From 59ba031b1f733aa43576a042ad639f5ded6f7ca3 Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Fri, 6 Sep 2024 14:47:16 -0500 Subject: [PATCH 1/7] Upgrade to Cypress 13 --- package-lock.json | 74 ++++++++++++++++++++++++----------------------- package.json | 2 +- 2 files changed, 39 insertions(+), 37 deletions(-) diff --git a/package-lock.json b/package-lock.json index 75016e4b853..26724237a46 100644 --- a/package-lock.json +++ b/package-lock.json @@ -115,7 +115,7 @@ "compression-webpack-plugin": "^9.2.0", "copy-webpack-plugin": "^6.4.1", "cross-env": "^7.0.3", - "cypress": "12.17.4", + "cypress": "^13.14.2", "cypress-axe": "^1.4.0", "deep-freeze": "0.0.1", "eslint": "^8.39.0", @@ -3989,9 +3989,9 @@ } }, "node_modules/@cypress/request": { - "version": "2.88.12", - "resolved": "https://registry.npmjs.org/@cypress/request/-/request-2.88.12.tgz", - "integrity": "sha512-tOn+0mDZxASFM+cuAP9szGUGPI1HwWVSvdzm7V4cCsPdFTx6qMj29CwaQmRAMIEhORIUBFBsYROYJcveK4uOjA==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@cypress/request/-/request-3.0.4.tgz", + "integrity": "sha512-eqNHMsxEXuit0sRvvWoGG3/4+Q5qwqjKARWXKM/KoSsKvTNBwWt8pwspg5+TniP3POAZcPPx0O8CiEIQ4e6NWg==", "dev": true, "dependencies": { "aws-sign2": "~0.7.0", @@ -4000,14 +4000,14 @@ "combined-stream": "~1.0.6", "extend": "~3.0.2", "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "http-signature": "~1.3.6", + "form-data": "~2.5.0", + "http-signature": "~1.4.0", "is-typedarray": "~1.0.0", "isstream": "~0.1.2", "json-stringify-safe": "~5.0.1", "mime-types": "~2.1.19", "performance-now": "^2.1.0", - "qs": "~6.10.3", + "qs": "6.13.0", "safe-buffer": "^5.1.2", "tough-cookie": "^4.1.3", "tunnel-agent": "^0.6.0", @@ -4018,9 +4018,9 @@ } }, "node_modules/@cypress/request/node_modules/form-data": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", + "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", "dev": true, "dependencies": { "asynckit": "^0.4.0", @@ -8200,9 +8200,9 @@ } }, "node_modules/aws4": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.13.0.tgz", - "integrity": "sha512-3AungXC4I8kKsS9PuS4JH2nc+0bVY/mjgrephHTIi8fpEeGsTHBUJeosp0Wc1myYMElmD0B3Oc4XL/HVJ4PV2g==", + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.13.2.tgz", + "integrity": "sha512-lHe62zvbTB5eEABUVi/AwVh0ZKY9rMMDhmm+eeyuuUQbQ3+J+fONVQOZyj+DdrvD4BY33uYniyRJ4UJIaSKAfw==", "dev": true }, "node_modules/axe-core": { @@ -10075,21 +10075,20 @@ "dev": true }, "node_modules/cypress": { - "version": "12.17.4", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-12.17.4.tgz", - "integrity": "sha512-gAN8Pmns9MA5eCDFSDJXWKUpaL3IDd89N9TtIupjYnzLSmlpVr+ZR+vb4U/qaMp+lB6tBvAmt7504c3Z4RU5KQ==", + "version": "13.14.2", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.14.2.tgz", + "integrity": "sha512-lsiQrN17vHMB2fnvxIrKLAjOr9bPwsNbPZNrWf99s4u+DVmCY6U+w7O3GGG9FvP4EUVYaDu+guWeNLiUzBrqvA==", "dev": true, "hasInstallScript": true, "dependencies": { - "@cypress/request": "2.88.12", + "@cypress/request": "^3.0.1", "@cypress/xvfb": "^1.2.4", - "@types/node": "^16.18.39", "@types/sinonjs__fake-timers": "8.1.1", "@types/sizzle": "^2.3.2", "arch": "^2.2.0", "blob-util": "^2.0.2", "bluebird": "^3.7.2", - "buffer": "^5.6.0", + "buffer": "^5.7.1", "cachedir": "^2.3.0", "chalk": "^4.1.0", "check-more-types": "^2.24.0", @@ -10107,7 +10106,7 @@ "figures": "^3.2.0", "fs-extra": "^9.1.0", "getos": "^3.2.1", - "is-ci": "^3.0.0", + "is-ci": "^3.0.1", "is-installed-globally": "~0.4.0", "lazy-ass": "^1.6.0", "listr2": "^3.8.3", @@ -10121,7 +10120,7 @@ "request-progress": "^3.0.0", "semver": "^7.5.3", "supports-color": "^8.1.1", - "tmp": "~0.2.1", + "tmp": "~0.2.3", "untildify": "^4.0.0", "yauzl": "^2.10.0" }, @@ -10129,7 +10128,7 @@ "cypress": "bin/cypress" }, "engines": { - "node": "^14.0.0 || ^16.0.0 || >=18.0.0" + "node": "^16.0.0 || ^18.0.0 || >=20.0.0" } }, "node_modules/cypress-axe": { @@ -10145,12 +10144,6 @@ "cypress": "^10 || ^11 || ^12 || ^13" } }, - "node_modules/cypress/node_modules/@types/node": { - "version": "16.18.101", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.101.tgz", - "integrity": "sha512-AAsx9Rgz2IzG8KJ6tXd6ndNkVcu+GYB6U/SnFAaokSPNx2N7dcIIfnighYUNumvj6YS2q39Dejz5tT0NCV7CWA==", - "dev": true - }, "node_modules/cypress/node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -10269,6 +10262,15 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, + "node_modules/cypress/node_modules/tmp": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.3.tgz", + "integrity": "sha512-nZD7m9iCPC5g0pYmcaxogYKggSfLsdxl8of3Q/oIbqCqLLIO9IAF0GWjX1z9NZRHPiXv8Wex4yDCaZsgEw0Y8w==", + "dev": true, + "engines": { + "node": ">=14.14" + } + }, "node_modules/cypress/node_modules/universalify": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", @@ -13632,14 +13634,14 @@ } }, "node_modules/http-signature": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.3.6.tgz", - "integrity": "sha512-3adrsD6zqo4GsTqtO7FyrejHNv+NgiIfAfv68+jVlFmSr9OGy7zrxONceFRLKvnnZA5jbxQBX1u9PpB6Wi32Gw==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.4.0.tgz", + "integrity": "sha512-G5akfn7eKbpDN+8nPS/cb57YeA1jLTVxjpCj7tmm3QKPdyDy7T+qSC40e9ptydSWvkwjSXw1VbkpyEm39ukeAg==", "dev": true, "dependencies": { "assert-plus": "^1.0.0", "jsprim": "^2.0.2", - "sshpk": "^1.14.1" + "sshpk": "^1.18.0" }, "engines": { "node": ">=0.10" @@ -19673,12 +19675,12 @@ } }, "node_modules/qs": { - "version": "6.10.4", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.4.tgz", - "integrity": "sha512-OQiU+C+Ds5qiH91qh/mg0w+8nwQuLjM4F4M/PbmhDOoYehPh+Fb0bDjtR1sOvy7YKxvj28Y/M0PhP5uVX0kB+g==", + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", "dev": true, "dependencies": { - "side-channel": "^1.0.4" + "side-channel": "^1.0.6" }, "engines": { "node": ">=0.6" diff --git a/package.json b/package.json index 9fdc97ff63d..037ab6ba13b 100644 --- a/package.json +++ b/package.json @@ -202,7 +202,7 @@ "compression-webpack-plugin": "^9.2.0", "copy-webpack-plugin": "^6.4.1", "cross-env": "^7.0.3", - "cypress": "12.17.4", + "cypress": "^13.14.2", "cypress-axe": "^1.4.0", "deep-freeze": "0.0.1", "eslint": "^8.39.0", From f9911ce5ba125e28e81cb5338dd887f6d892fe91 Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Fri, 6 Sep 2024 16:31:40 -0500 Subject: [PATCH 2/7] Ensure Cypress still creates videos in GitHub Actions --- cypress.config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/cypress.config.ts b/cypress.config.ts index 442dde3607c..36d8120342a 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -1,6 +1,7 @@ import { defineConfig } from 'cypress'; export default defineConfig({ + video: true, videosFolder: 'cypress/videos', screenshotsFolder: 'cypress/screenshots', fixturesFolder: 'cypress/fixtures', From 7aba69edd6c345ad48045748940390eb964a8961 Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Fri, 6 Sep 2024 16:32:10 -0500 Subject: [PATCH 3/7] Minor changes to login-modal.cy.ts to cleanup CSS selectors --- cypress/e2e/login-modal.cy.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cypress/e2e/login-modal.cy.ts b/cypress/e2e/login-modal.cy.ts index ec218e80afa..0eb6da8f0fc 100644 --- a/cypress/e2e/login-modal.cy.ts +++ b/cypress/e2e/login-modal.cy.ts @@ -3,31 +3,31 @@ import { testA11y } from 'cypress/support/utils'; const page = { openLoginMenu() { // Click the "Log In" dropdown menu in header - cy.get('ds-header [data-test="login-menu"]').click(); + cy.get('[data-test="login-menu"]').click(); }, openUserMenu() { // Once logged in, click the User menu in header - cy.get('ds-header [data-test="user-menu"]').click(); + cy.get('[data-test="user-menu"]').click(); }, submitLoginAndPasswordByPressingButton(email, password) { // Enter email - cy.get('ds-header [data-test="email"]').type(email); + cy.get('[data-test="email"]').type(email); // Enter password - cy.get('ds-header [data-test="password"]').type(password); + cy.get('[data-test="password"]').type(password); // Click login button - cy.get('ds-header [data-test="login-button"]').click(); + cy.get('[data-test="login-button"]').click(); }, submitLoginAndPasswordByPressingEnter(email, password) { // In opened Login modal, fill out email & password, then click Enter - cy.get('ds-header [data-test="email"]').type(email); - cy.get('ds-header [data-test="password"]').type(password); - cy.get('ds-header [data-test="password"]').type('{enter}'); + cy.get('[data-test="email"]').type(email); + cy.get('[data-test="password"]').type(password); + cy.get('[data-test="password"]').type('{enter}'); }, submitLogoutByPressingButton() { // This is the POST command that will actually log us out cy.intercept('POST', '/server/api/authn/logout').as('logout'); // Click logout button - cy.get('ds-header [data-test="logout-button"]').click(); + cy.get('[data-test="logout-button"]').click(); // Wait until above POST command responds before continuing // (This ensures next action waits until logout completes) cy.wait('@logout'); From 968c5bda7158e874bb248361e39d39f732996f7d Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Mon, 9 Sep 2024 16:21:03 -0500 Subject: [PATCH 4/7] Simplify login CSS selectors --- cypress/support/commands.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index b3e3b9630bb..8cc2c5c721b 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -101,11 +101,11 @@ Cypress.Commands.add('login', login); */ function loginViaForm(email: string, password: string): void { // Enter email - cy.get('ds-log-in [data-test="email"]').type(email); + cy.get('[data-test="email"]').type(email); // Enter password - cy.get('ds-log-in [data-test="password"]').type(password); + cy.get('[data-test="password"]').type(password); // Click login button - cy.get('ds-log-in [data-test="login-button"]').click(); + cy.get('[data-test="login-button"]').click(); } // Add as a Cypress command (i.e. assign to 'cy.loginViaForm') Cypress.Commands.add('loginViaForm', loginViaForm); From a012e4cea25423fed9bce67aafaa4e7432c58b41 Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Mon, 9 Sep 2024 16:21:24 -0500 Subject: [PATCH 5/7] Test stability fixes. Ensure Item Edit tests wait on tabs to load by testing if tab is active. Fix small bug in login-modal test. --- cypress/e2e/item-edit.cy.ts | 24 ++++++++++++++++++++++++ cypress/e2e/login-modal.cy.ts | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/cypress/e2e/item-edit.cy.ts b/cypress/e2e/item-edit.cy.ts index a0d49a76570..45131baace2 100644 --- a/cypress/e2e/item-edit.cy.ts +++ b/cypress/e2e/item-edit.cy.ts @@ -20,6 +20,9 @@ describe('Edit Item > Edit Metadata tab', () => { it('should pass accessibility tests', () => { cy.get('a[data-test="metadata"]').click(); + // Our selected tab should be active + cy.get('a[data-test="metadata"]').should('have.class', 'active'); + // tag must be loaded cy.get('ds-edit-item-page').should('be.visible'); @@ -38,6 +41,9 @@ describe('Edit Item > Status tab', () => { it('should pass accessibility tests', () => { cy.get('a[data-test="status"]').click(); + // Our selected tab should be active + cy.get('a[data-test="status"]').should('have.class', 'active'); + // tag must be loaded cy.get('ds-item-status').should('be.visible'); @@ -51,6 +57,9 @@ describe('Edit Item > Bitstreams tab', () => { it('should pass accessibility tests', () => { cy.get('a[data-test="bitstreams"]').click(); + // Our selected tab should be active + cy.get('a[data-test="bitstreams"]').should('have.class', 'active'); + // tag must be loaded cy.get('ds-item-bitstreams').should('be.visible'); @@ -75,6 +84,9 @@ describe('Edit Item > Curate tab', () => { it('should pass accessibility tests', () => { cy.get('a[data-test="curate"]').click(); + // Our selected tab should be active + cy.get('a[data-test="curate"]').should('have.class', 'active'); + // tag must be loaded cy.get('ds-item-curate').should('be.visible'); @@ -88,6 +100,9 @@ describe('Edit Item > Relationships tab', () => { it('should pass accessibility tests', () => { cy.get('a[data-test="relationships"]').click(); + // Our selected tab should be active + cy.get('a[data-test="relationships"]').should('have.class', 'active'); + // tag must be loaded cy.get('ds-item-relationships').should('be.visible'); @@ -101,6 +116,9 @@ describe('Edit Item > Version History tab', () => { it('should pass accessibility tests', () => { cy.get('a[data-test="versionhistory"]').click(); + // Our selected tab should be active + cy.get('a[data-test="versionhistory"]').should('have.class', 'active'); + // tag must be loaded cy.get('ds-item-version-history').should('be.visible'); @@ -114,6 +132,9 @@ describe('Edit Item > Access Control tab', () => { it('should pass accessibility tests', () => { cy.get('a[data-test="access-control"]').click(); + // Our selected tab should be active + cy.get('a[data-test="access-control"]').should('have.class', 'active'); + // tag must be loaded cy.get('ds-item-access-control').should('be.visible'); @@ -127,6 +148,9 @@ describe('Edit Item > Collection Mapper tab', () => { it('should pass accessibility tests', () => { cy.get('a[data-test="mapper"]').click(); + // Our selected tab should be active + cy.get('a[data-test="mapper"]').should('have.class', 'active'); + // tag must be loaded cy.get('ds-item-collection-mapper').should('be.visible'); diff --git a/cypress/e2e/login-modal.cy.ts b/cypress/e2e/login-modal.cy.ts index 0eb6da8f0fc..80d36a03099 100644 --- a/cypress/e2e/login-modal.cy.ts +++ b/cypress/e2e/login-modal.cy.ts @@ -67,7 +67,7 @@ describe('Login Modal', () => { // Login, and the tag should no longer exist page.submitLoginAndPasswordByPressingEnter(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD')); - cy.get('.form-login').should('not.exist'); + cy.get('ds-log-in').should('not.exist'); // Verify we are still on homepage cy.url().should('include', '/home'); From b543b32a373dcae05bfe529f6f8353b627aed15b Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Tue, 10 Sep 2024 14:18:30 -0500 Subject: [PATCH 6/7] Bump cypress-axe to 1.5.0 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 26724237a46..c2a146a40ed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -116,7 +116,7 @@ "copy-webpack-plugin": "^6.4.1", "cross-env": "^7.0.3", "cypress": "^13.14.2", - "cypress-axe": "^1.4.0", + "cypress-axe": "^1.5.0", "deep-freeze": "0.0.1", "eslint": "^8.39.0", "eslint-plugin-deprecation": "^1.4.1", diff --git a/package.json b/package.json index 037ab6ba13b..30386d02658 100644 --- a/package.json +++ b/package.json @@ -203,7 +203,7 @@ "copy-webpack-plugin": "^6.4.1", "cross-env": "^7.0.3", "cypress": "^13.14.2", - "cypress-axe": "^1.4.0", + "cypress-axe": "^1.5.0", "deep-freeze": "0.0.1", "eslint": "^8.39.0", "eslint-plugin-deprecation": "^1.4.1", From b4d932a91b07a781510d4cfa54aad30dfe218c5c Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Wed, 9 Oct 2024 10:24:42 -0500 Subject: [PATCH 7/7] Bump to Cypress 13.5.0 --- package-lock.json | 10 +++++----- package.json | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index c2a146a40ed..329fcbae33f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -115,7 +115,7 @@ "compression-webpack-plugin": "^9.2.0", "copy-webpack-plugin": "^6.4.1", "cross-env": "^7.0.3", - "cypress": "^13.14.2", + "cypress": "^13.15.0", "cypress-axe": "^1.5.0", "deep-freeze": "0.0.1", "eslint": "^8.39.0", @@ -10075,13 +10075,13 @@ "dev": true }, "node_modules/cypress": { - "version": "13.14.2", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.14.2.tgz", - "integrity": "sha512-lsiQrN17vHMB2fnvxIrKLAjOr9bPwsNbPZNrWf99s4u+DVmCY6U+w7O3GGG9FvP4EUVYaDu+guWeNLiUzBrqvA==", + "version": "13.15.0", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.15.0.tgz", + "integrity": "sha512-53aO7PwOfi604qzOkCSzNlWquCynLlKE/rmmpSPcziRH6LNfaDUAklQT6WJIsD8ywxlIy+uVZsnTMCCQVd2kTw==", "dev": true, "hasInstallScript": true, "dependencies": { - "@cypress/request": "^3.0.1", + "@cypress/request": "^3.0.4", "@cypress/xvfb": "^1.2.4", "@types/sinonjs__fake-timers": "8.1.1", "@types/sizzle": "^2.3.2", diff --git a/package.json b/package.json index 30386d02658..96c7ad68bd4 100644 --- a/package.json +++ b/package.json @@ -202,7 +202,7 @@ "compression-webpack-plugin": "^9.2.0", "copy-webpack-plugin": "^6.4.1", "cross-env": "^7.0.3", - "cypress": "^13.14.2", + "cypress": "^13.15.0", "cypress-axe": "^1.5.0", "deep-freeze": "0.0.1", "eslint": "^8.39.0",