diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml
index 43fdfbbe6..e8cf878e1 100644
--- a/.github/workflows/lint.yaml
+++ b/.github/workflows/lint.yaml
@@ -20,3 +20,7 @@ jobs:
- run: just web install
- run: just web lint
- run: just web check-format
+
+ - run: just test/cy install
+ - run: just test/cy lint
+ - run: just test/cy check-format
diff --git a/test/cy/.eslintrc.cjs b/test/cy/.eslintrc.cjs
index 6e27995f3..4ac87d8f5 100644
--- a/test/cy/.eslintrc.cjs
+++ b/test/cy/.eslintrc.cjs
@@ -1,7 +1,7 @@
module.exports = {
- extends: ['plugin:cypress/recommended'],
- plugins: ['cypress'],
- env: {
- 'cypress/globals': true,
- }
- };
+ extends: ["plugin:cypress/recommended", "prettier"],
+ plugins: ["cypress"],
+ env: {
+ "cypress/globals": true,
+ },
+};
diff --git a/test/cy/.prettierrc b/test/cy/.prettierrc
new file mode 100644
index 000000000..0967ef424
--- /dev/null
+++ b/test/cy/.prettierrc
@@ -0,0 +1 @@
+{}
diff --git a/test/cy/cypress.config.js b/test/cy/cypress.config.js
index 32bcd3fff..73c888b9b 100644
--- a/test/cy/cypress.config.js
+++ b/test/cy/cypress.config.js
@@ -8,6 +8,6 @@ module.exports = defineConfig({
},
viewportHeight: 1080,
viewportWidth: 1920,
- video: true
+ video: true,
},
});
diff --git a/test/cy/cypress/e2e/contract/deploy.cy.js b/test/cy/cypress/e2e/contract/deploy.cy.js
index b328ca475..a02f0d622 100644
--- a/test/cy/cypress/e2e/contract/deploy.cy.js
+++ b/test/cy/cypress/e2e/contract/deploy.cy.js
@@ -1,50 +1,55 @@
-describe('Publish', () => {
- it('publish content and check app type', () => {
+describe("Publish", () => {
+ it("publish content and check app type", () => {
cy.visit({
- url: '/',
- qs: { token: Cypress.env('token') }
+ url: "/",
+ qs: { token: Cypress.env("token") },
});
// Add a New Deployment button
- cy.get('div[data-automation="add-new-deployment"]')
- .click();
+ cy.get('div[data-automation="add-new-deployment"]').click();
// Continue to Deploy
// ensure accounts are loaded to stall before clicking
- cy.get('label[data-automation="account"]')
- .should('exist');
- cy.get('button[data-automation="continue-deployment"]')
- .click();
+ cy.get('label[data-automation="account"]').should("exist");
+ cy.get('button[data-automation="continue-deployment"]').click();
// Deploy
- cy.get('button[data-automation="deploy"]')
- .click();
+ cy.get('button[data-automation="deploy"]').click();
// Wait for Deployment Success message
- cy.get('div[data-automation="deploy-message"]', { timeout: 30000 })
- .contains("Deploy was successful!");
+ cy.get('div[data-automation="deploy-message"]', {
+ timeout: 30000,
+ }).contains("Deploy was successful!");
// Get the link from the deployment logs
- cy.get('a[href="#/progress')
- .click();
+ cy.get('a[href="#/progress').click();
cy.get('div[class="space-between-sm"]')
- .find('p').last().invoke('text').then((guid) => {
- Cypress.env('DEPLOYED_APP_URL', '/__api__/v1/content/' + guid);
- cy.log("MY GUID " + Cypress.env('DEPLOYED_APP_URL'));
- cy.log("MY URL " + Cypress.env('CYPRESS_CONNECT_ADDRESS') + Cypress.env('DEPLOYED_APP_URL'))
+ .find("p")
+ .last()
+ .invoke("text")
+ .then((guid) => {
+ Cypress.env("DEPLOYED_APP_URL", "/__api__/v1/content/" + guid);
+ cy.log("MY GUID " + Cypress.env("DEPLOYED_APP_URL"));
+ cy.log(
+ "MY URL " +
+ Cypress.env("CYPRESS_CONNECT_ADDRESS") +
+ Cypress.env("DEPLOYED_APP_URL"),
+ );
// Use API to check the content on Connect
cy.request({
- method: 'GET',
- url: Cypress.env('CYPRESS_CONNECT_ADDRESS') + Cypress.env('DEPLOYED_APP_URL'),
- 'auth': {
- 'bearer': Cypress.env('CONNECT_API_KEY')
- },
- }).then((response) => {
- expect(response.status).to.equal(200);
- // app mode should be correct
- expect(response.body).to.have.property('app_mode', 'python-fastapi')
+ method: "GET",
+ url:
+ Cypress.env("CYPRESS_CONNECT_ADDRESS") +
+ Cypress.env("DEPLOYED_APP_URL"),
+ auth: {
+ bearer: Cypress.env("CONNECT_API_KEY"),
+ },
+ }).then((response) => {
+ expect(response.status).to.equal(200);
+ // app mode should be correct
+ expect(response.body).to.have.property("app_mode", "python-fastapi");
+ });
});
- });
});
});
diff --git a/test/cy/cypress/e2e/ui/home.cy.js b/test/cy/cypress/e2e/ui/home.cy.js
index e191d1aed..92f6dfc93 100644
--- a/test/cy/cypress/e2e/ui/home.cy.js
+++ b/test/cy/cypress/e2e/ui/home.cy.js
@@ -1,43 +1,40 @@
-describe('Landing', () => {
+describe("Landing", () => {
beforeEach(() => {
cy.visit({
- url: '/',
+ url: "/",
});
});
- it('.should() - assert that
is correct', () => {
- cy.title().should('include', 'Posit Publisher');
+ it(".should() - assert that is correct", () => {
+ cy.title().should("include", "Posit Publisher");
});
-
- it('dark mode works', () => {
+
+ it("dark mode works", () => {
// expand dark mode menu
cy.expandDarkMenu();
- cy.get('body').should('have.css', 'background-color', 'rgb(250, 250, 250)');
+ cy.get("body").should("have.css", "background-color", "rgb(250, 250, 250)");
// set dark mode on
- cy.get('div[data-automation="dark-on"]')
- .click();
- cy.get('body').should('have.css', 'background-color', 'rgb(18, 18, 18)');
+ cy.get('div[data-automation="dark-on"]').click();
+ cy.get("body").should("have.css", "background-color", "rgb(18, 18, 18)");
cy.expandDarkMenu();
// set dark mode off
- cy.get('div[data-automation="dark-off"]')
- .click();
- cy.get('body').should('have.css', 'background-color', 'rgb(250, 250, 250)');
+ cy.get('div[data-automation="dark-off"]').click();
+ cy.get("body").should("have.css", "background-color", "rgb(250, 250, 250)");
cy.expandDarkMenu();
// set dark mode auto
- cy.get('div[data-automation="dark-auto"]')
- .click();
- cy.get('body').should('have.css', 'background-color', 'rgb(250, 250, 250)');
+ cy.get('div[data-automation="dark-auto"]').click();
+ cy.get("body").should("have.css", "background-color", "rgb(250, 250, 250)");
});
-// disabling configuration file test temporarily
- // it('configuration file is displayed', () => {
- // cy.get('div[data-automation="config-card"]')
- // .find('h3[class="card-title truncate"]')
- // .contains("default");
- // });
-
+ // disabling configuration file test temporarily
+ // it('configuration file is displayed', () => {
+ // cy.get('div[data-automation="config-card"]')
+ // .find('h3[class="card-title truncate"]')
+ // .contains("default");
+ // });
+
// cy.get('div[data-automation="config-card"]')
// .find('p')
// .should('contain', '.posit')
@@ -45,10 +42,10 @@ describe('Landing', () => {
// .and('contain', 'default.toml');
// });
-it('files are displayed', () => {
- cy.get('div[data-automation="file-tree"]')
- .should('contain', 'fastapi-simple')
- .and('contain', 'requirements.txt')
- .and('contain', 'simple.py');
+ it("files are displayed", () => {
+ cy.get('div[data-automation="file-tree"]')
+ .should("contain", "fastapi-simple")
+ .and("contain", "requirements.txt")
+ .and("contain", "simple.py");
});
-});
\ No newline at end of file
+});
diff --git a/test/cy/cypress/support/commands.js b/test/cy/cypress/support/commands.js
index 4f82c58e7..e9ad10644 100644
--- a/test/cy/cypress/support/commands.js
+++ b/test/cy/cypress/support/commands.js
@@ -24,11 +24,8 @@
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
-Cypress.Commands.add('expandDarkMenu', () => {
- cy.get('button[data-automation="menu-button"]')
- .click();
- cy.get('div[data-automation="dark-mode-submenu"]')
- .click();
- cy.get('div[data-automation="dark-on"]')
- .should('be.visible');
-});
\ No newline at end of file
+Cypress.Commands.add("expandDarkMenu", () => {
+ cy.get('button[data-automation="menu-button"]').click();
+ cy.get('div[data-automation="dark-mode-submenu"]').click();
+ cy.get('div[data-automation="dark-on"]').should("be.visible");
+});
diff --git a/test/cy/cypress/support/e2e.js b/test/cy/cypress/support/e2e.js
index 0e7290a13..3a2522438 100644
--- a/test/cy/cypress/support/e2e.js
+++ b/test/cy/cypress/support/e2e.js
@@ -14,7 +14,7 @@
// ***********************************************************
// Import commands.js using ES2015 syntax:
-import './commands'
+import "./commands";
// Alternatively you can use CommonJS syntax:
-// require('./commands')
\ No newline at end of file
+// require('./commands')
diff --git a/test/cy/justfile b/test/cy/justfile
index b269eadb5..948216cdf 100644
--- a/test/cy/justfile
+++ b/test/cy/justfile
@@ -46,6 +46,20 @@ lint:
npm run lint
+format:
+ #!/usr/bin/env bash
+ set -eou pipefail
+ {{ _with_debug }}
+
+ npm run format
+
+check-format:
+ #!/usr/bin/env bash
+ set -eou pipefail
+ {{ _with_debug }}
+
+ npm run check-format
+
# Install dependencies
install:
#!/usr/bin/env bash
diff --git a/test/cy/package-lock.json b/test/cy/package-lock.json
index e9efa1fca..ffa87a51e 100644
--- a/test/cy/package-lock.json
+++ b/test/cy/package-lock.json
@@ -7,7 +7,9 @@
"devDependencies": {
"cypress": "^13.3.0",
"eslint": "^8.51.0",
+ "eslint-config-prettier": "^9.1.0",
"eslint-plugin-cypress": "^2.15.1",
+ "prettier": "3.2.5",
"start-server-and-test": "^2.0.3"
}
},
@@ -1028,6 +1030,18 @@
"url": "https://opencollective.com/eslint"
}
},
+ "node_modules/eslint-config-prettier": {
+ "version": "9.1.0",
+ "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz",
+ "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==",
+ "dev": true,
+ "bin": {
+ "eslint-config-prettier": "bin/cli.js"
+ },
+ "peerDependencies": {
+ "eslint": ">=7.0.0"
+ }
+ },
"node_modules/eslint-plugin-cypress": {
"version": "2.15.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-cypress/-/eslint-plugin-cypress-2.15.1.tgz",
@@ -2326,6 +2340,21 @@
"node": ">= 0.8.0"
}
},
+ "node_modules/prettier": {
+ "version": "3.2.5",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz",
+ "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==",
+ "dev": true,
+ "bin": {
+ "prettier": "bin/prettier.cjs"
+ },
+ "engines": {
+ "node": ">=14"
+ },
+ "funding": {
+ "url": "https://github.com/prettier/prettier?sponsor=1"
+ }
+ },
"node_modules/pretty-bytes": {
"version": "5.6.0",
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz",
diff --git a/test/cy/package.json b/test/cy/package.json
index a06d65b08..f60e6850e 100644
--- a/test/cy/package.json
+++ b/test/cy/package.json
@@ -3,6 +3,8 @@
"scripts": {
"lint": "eslint --ext .js,.ts,.cjs .",
"fix": "eslint --ext .js,.ts,.cjs . --fix",
+ "format": "prettier . --write",
+ "check-format": "prettier . --check",
"init": "just ../../run init ./test/sample-content/fastapi-simple",
"start": "just ../../run ui --listen 127.0.0.1:9000 ./test/sample-content/fastapi-simple",
"test": "start-server-and-test --expect 200 start http-get://127.0.0.1:9000 run",
@@ -18,7 +20,9 @@
"devDependencies": {
"cypress": "^13.3.0",
"eslint": "^8.51.0",
+ "eslint-config-prettier": "^9.1.0",
"eslint-plugin-cypress": "^2.15.1",
+ "prettier": "3.2.5",
"start-server-and-test": "^2.0.3"
}
}