From ec4f255e077630131159f49239f9fcf3c3dc3196 Mon Sep 17 00:00:00 2001 From: Jacob Pihl Date: Thu, 24 Oct 2024 13:22:48 +0200 Subject: [PATCH 1/5] Upgrade Cypress to version 10 IntegrationFolder is now deprecated and the config file should instead rely on Testing Type-Specific Options https://docs.cypress.io/app/references/configuration#Testing-Type-Specific-Options --- cypress.config.js | 4 ++-- package.json | 2 +- src/components/campaign/campaign.test.ts | 2 +- yarn.lock | 18 +++++++++--------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cypress.config.js b/cypress.config.js index 6863a713a8..5b0f7ea29f 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -6,13 +6,13 @@ module.exports = defineConfig({ defaultCommandTimeout: 10000, pageLoadTimeout: 10000, requestTimeout: 30000, - testFiles: "@(apps|components)/**/*.test.@(ts|tsx)", - integrationFolder: "./src", retries: { runMode: 3, openMode: 0 }, e2e: { + supportFile: "cypress/support/index.ts", + specPattern: "./src/@(apps|components)/**/*.test.@(ts|tsx)", baseUrl: "http://localhost:57021" } }); diff --git a/package.json b/package.json index 25c840fcb9..f78961da5e 100644 --- a/package.json +++ b/package.json @@ -94,7 +94,7 @@ "core-js": "^3.38.1", "css-loader": "^7.1.2", "cssnano": "^7.0.6", - "cypress": "^9.6.1", + "cypress": "^10.0.0", "dotenv": "^16.4.5", "eslint": "^8.57.0", "eslint-config-airbnb": "^19.0.4", diff --git a/src/components/campaign/campaign.test.ts b/src/components/campaign/campaign.test.ts index 24ff0c0497..bc0c61db47 100644 --- a/src/components/campaign/campaign.test.ts +++ b/src/components/campaign/campaign.test.ts @@ -1,6 +1,6 @@ const coverUrlPattern = /^https:\/\/res\.cloudinary\.com\/.*\.(jpg|jpeg|png)$/; -export function isImageLoaded(cy: Cypress.cy & EventEmitter) { +export function isImageLoaded(cy: Cypress.cy) { cy.getBySel("campaign-image") .should("be.visible") .and("have.prop", "naturalWidth") diff --git a/yarn.lock b/yarn.lock index ba7a6d3102..4002068b87 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5956,10 +5956,10 @@ csstype@^3.0.2, csstype@^3.1.2: resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.2.tgz#1d4bf9d572f11c14031f0436e1c10bc1f571f50b" integrity sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ== -cypress@^9.6.1: - version "9.6.1" - resolved "https://registry.npmjs.org/cypress/-/cypress-9.6.1.tgz" - integrity sha512-ECzmV7pJSkk+NuAhEw6C3D+RIRATkSb2VAHXDY6qGZbca/F9mv5pPsj2LO6Ty6oIFVBTrwCyL9agl28MtJMe2g== +cypress@^10.0.0: + version "10.11.0" + resolved "https://registry.yarnpkg.com/cypress/-/cypress-10.11.0.tgz#e9fbdd7638bae3d8fb7619fd75a6330d11ebb4e8" + integrity sha512-lsaE7dprw5DoXM00skni6W5ElVVLGAdRUUdZjX2dYsGjbY/QnpzWZ95Zom1mkGg0hAaO/QVTZoFVS7Jgr/GUPA== dependencies: "@cypress/request" "^2.88.10" "@cypress/xvfb" "^1.2.4" @@ -5980,7 +5980,7 @@ cypress@^9.6.1: dayjs "^1.10.4" debug "^4.3.2" enquirer "^2.3.6" - eventemitter2 "^6.4.3" + eventemitter2 "6.4.7" execa "4.1.0" executable "^4.1.1" extract-zip "2.0.1" @@ -7213,10 +7213,10 @@ event-target-shim@^5.0.0: resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== -eventemitter2@^6.4.3: - version "6.4.5" - resolved "https://registry.npmjs.org/eventemitter2/-/eventemitter2-6.4.5.tgz" - integrity sha512-bXE7Dyc1i6oQElDG0jMRZJrRAn9QR2xyyFGmBdZleNmyQX0FqGYmhZIrIrpPfm/w//LTo4tVQGOGQcGCb5q9uw== +eventemitter2@6.4.7: + version "6.4.7" + resolved "https://registry.yarnpkg.com/eventemitter2/-/eventemitter2-6.4.7.tgz#a7f6c4d7abf28a14c1ef3442f21cb306a054271d" + integrity sha512-tYUSVOGeQPKt/eC1ABfhHy5Xd96N3oIijJvN3O9+TsC28T5V9yX9oEfEK5faP0EFSNVOG97qtAS68GBrQB2hDg== events@^2.0.0: version "2.1.0" From 436d030ab889fbdbf5d5a6c3114a6acbd65eed57 Mon Sep 17 00:00:00 2001 From: Jacob Pihl Date: Thu, 24 Oct 2024 14:00:23 +0200 Subject: [PATCH 2/5] Upgraded Cypress to version 13 --- package.json | 2 +- yarn.lock | 153 ++++++++++++++++++++++++++++----------------------- 2 files changed, 84 insertions(+), 71 deletions(-) diff --git a/package.json b/package.json index f78961da5e..d25e2b4aa4 100644 --- a/package.json +++ b/package.json @@ -94,7 +94,7 @@ "core-js": "^3.38.1", "css-loader": "^7.1.2", "cssnano": "^7.0.6", - "cypress": "^10.0.0", + "cypress": "^13.0.0", "dotenv": "^16.4.5", "eslint": "^8.57.0", "eslint-config-airbnb": "^19.0.4", diff --git a/yarn.lock b/yarn.lock index 4002068b87..51f190b499 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1238,10 +1238,10 @@ js-yaml "4.1.0" nyc "15.1.0" -"@cypress/request@^2.88.10": - version "2.88.10" - resolved "https://registry.npmjs.org/@cypress/request/-/request-2.88.10.tgz" - integrity sha512-Zp7F+R93N0yZyG34GutyTNr+okam7s/Fzc1+i3kcqOP8vk6OuajuE9qZJ6Rs+10/1JFtXFYMdyarnU1rZuJesg== +"@cypress/request@^3.0.4": + version "3.0.5" + resolved "https://registry.yarnpkg.com/@cypress/request/-/request-3.0.5.tgz#d893a6e68ce2636c085fcd8d7283c3186499ba63" + integrity sha512-v+XHd9XmWbufxF1/bTaVm2yhbxY+TB4YtWRqF2zaXBlDNMkls34KiATz0AVDLavL3iB6bQk9/7n3oY1EoLSWGA== dependencies: aws-sign2 "~0.7.0" aws4 "^1.8.0" @@ -1249,16 +1249,16 @@ 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 "~4.0.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.5.2" + qs "6.13.0" safe-buffer "^5.1.2" - tough-cookie "~2.5.0" + tough-cookie "^4.1.3" tunnel-agent "^0.6.0" uuid "^8.3.2" @@ -3442,11 +3442,6 @@ dependencies: undici-types "~6.19.2" -"@types/node@^14.14.31": - version "14.18.16" - resolved "https://registry.npmjs.org/@types/node/-/node-14.18.16.tgz" - integrity sha512-X3bUMdK/VmvrWdoTkz+VCn6nwKwrKCFTHtqwBIaQJNx4RUIBBUFXM00bqPz/DsDd+Icjmzm6/tyYZzeGVqb6/Q== - "@types/node@^20.16.5": version "20.16.5" resolved "https://registry.yarnpkg.com/@types/node/-/node-20.16.5.tgz#d43c7f973b32ffdf9aa7bd4f80e1072310fd7a53" @@ -4963,7 +4958,7 @@ buffer-xor@^1.0.3: resolved "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz" integrity sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk= -buffer@^5.5.0, buffer@^5.6.0, buffer@^5.7.0: +buffer@^5.5.0, buffer@^5.7.0, buffer@^5.7.1: version "5.7.1" resolved "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz" integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== @@ -5473,7 +5468,7 @@ combine-source-map@^0.8.0, combine-source-map@~0.8.0: lodash.memoize "~3.0.3" source-map "~0.5.3" -combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6: +combined-stream@^1.0.8, combined-stream@~1.0.6: version "1.0.8" resolved "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz" integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== @@ -5490,10 +5485,10 @@ commander@^2.20.0: resolved "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== -commander@^5.1.0: - version "5.1.0" - resolved "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz" - integrity sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg== +commander@^6.2.1: + version "6.2.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.1.tgz#0792eb682dfbc325999bb2b84fddddba110ac73c" + integrity sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA== commander@^7.2.0: version "7.2.0" @@ -5956,29 +5951,28 @@ csstype@^3.0.2, csstype@^3.1.2: resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.2.tgz#1d4bf9d572f11c14031f0436e1c10bc1f571f50b" integrity sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ== -cypress@^10.0.0: - version "10.11.0" - resolved "https://registry.yarnpkg.com/cypress/-/cypress-10.11.0.tgz#e9fbdd7638bae3d8fb7619fd75a6330d11ebb4e8" - integrity sha512-lsaE7dprw5DoXM00skni6W5ElVVLGAdRUUdZjX2dYsGjbY/QnpzWZ95Zom1mkGg0hAaO/QVTZoFVS7Jgr/GUPA== +cypress@^13.0.0: + version "13.15.0" + resolved "https://registry.yarnpkg.com/cypress/-/cypress-13.15.0.tgz#5eca5387ef34b2e611cfa291967c69c2cd39381d" + integrity sha512-53aO7PwOfi604qzOkCSzNlWquCynLlKE/rmmpSPcziRH6LNfaDUAklQT6WJIsD8ywxlIy+uVZsnTMCCQVd2kTw== dependencies: - "@cypress/request" "^2.88.10" + "@cypress/request" "^3.0.4" "@cypress/xvfb" "^1.2.4" - "@types/node" "^14.14.31" "@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" cli-cursor "^3.1.0" cli-table3 "~0.6.1" - commander "^5.1.0" + commander "^6.2.1" common-tags "^1.8.0" dayjs "^1.10.4" - debug "^4.3.2" + debug "^4.3.4" enquirer "^2.3.6" eventemitter2 "6.4.7" execa "4.1.0" @@ -5987,20 +5981,21 @@ cypress@^10.0.0: 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" lodash "^4.17.21" log-symbols "^4.0.0" - minimist "^1.2.6" + minimist "^1.2.8" ospath "^1.2.2" pretty-bytes "^5.6.0" + process "^0.11.10" proxy-from-env "1.0.0" request-progress "^3.0.0" - semver "^7.3.2" + 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" @@ -7702,13 +7697,13 @@ form-data@^3.0.0: combined-stream "^1.0.8" mime-types "^2.1.12" -form-data@~2.3.2: - version "2.3.3" - resolved "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz" - integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== +form-data@~4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.1.tgz#ba1076daaaa5bfd7e99c1a6cb02aa0a5cff90d48" + integrity sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw== dependencies: asynckit "^0.4.0" - combined-stream "^1.0.6" + combined-stream "^1.0.8" mime-types "^2.1.12" formdata-node@^4.3.1: @@ -8399,14 +8394,14 @@ http-proxy-agent@^5.0.0: agent-base "6" debug "4" -http-signature@~1.3.6: - version "1.3.6" - resolved "https://registry.npmjs.org/http-signature/-/http-signature-1.3.6.tgz" - integrity sha512-3adrsD6zqo4GsTqtO7FyrejHNv+NgiIfAfv68+jVlFmSr9OGy7zrxONceFRLKvnnZA5jbxQBX1u9PpB6Wi32Gw== +http-signature@~1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.4.0.tgz#dee5a9ba2bf49416abc544abd6d967f6a94c8c3f" + integrity sha512-G5akfn7eKbpDN+8nPS/cb57YeA1jLTVxjpCj7tmm3QKPdyDy7T+qSC40e9ptydSWvkwjSXw1VbkpyEm39ukeAg== dependencies: assert-plus "^1.0.0" jsprim "^2.0.2" - sshpk "^1.14.1" + sshpk "^1.18.0" http2-client@^1.2.5: version "1.3.5" @@ -8756,9 +8751,9 @@ is-callable@^1.2.4: resolved "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz" integrity sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w== -is-ci@^3.0.0: +is-ci@^3.0.1: version "3.0.1" - resolved "https://registry.npmjs.org/is-ci/-/is-ci-3.0.1.tgz" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-3.0.1.tgz#db6ecbed1bd659c43dac0f45661e7674103d1867" integrity sha512-ZYvCgrefwqoQ6yTyYUbQu64HsITZ3NfKX1lzaEYdkTDcfKzzCI/wthRRYKkdjHKFVgNiXKAKm65Zo1pk2as/QQ== dependencies: ci-info "^3.2.0" @@ -10242,7 +10237,7 @@ minimist-options@4.1.0: is-plain-obj "^1.1.0" kind-of "^6.0.3" -minimist@^1.1.0, minimist@^1.1.1, minimist@^1.2.0, minimist@^1.2.6: +minimist@^1.1.0, minimist@^1.1.1, minimist@^1.2.0, minimist@^1.2.6, minimist@^1.2.8: version "1.2.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== @@ -11637,10 +11632,10 @@ proxy-from-env@1.0.0: resolved "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.0.0.tgz" integrity sha1-M8UDmPcOp+uW0h97gXYwpVeRx+4= -psl@^1.1.28: - version "1.8.0" - resolved "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz" - integrity sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ== +psl@^1.1.33: + version "1.9.0" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7" + integrity sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag== public-encrypt@^4.0.0: version "4.0.3" @@ -11689,11 +11684,6 @@ qs@6.13.0: dependencies: side-channel "^1.0.6" -qs@~6.5.2: - version "6.5.2" - resolved "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz" - integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== - querystring-es3@~0.2.0: version "0.2.1" resolved "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz" @@ -11704,6 +11694,11 @@ querystring@0.2.0, querystring@^0.2.0: resolved "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz" integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= +querystringify@^2.1.1: + version "2.2.0" + resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" + integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== + queue-microtask@^1.2.2: version "1.2.3" resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" @@ -12347,6 +12342,11 @@ require-package-name@^2.0.1: resolved "https://registry.yarnpkg.com/require-package-name/-/require-package-name-2.0.1.tgz#c11e97276b65b8e2923f75dabf5fb2ef0c3841b9" integrity sha512-uuoJ1hU/k6M0779t3VMVIYpb2VMJk05cehCaABFhXaibcbvfgR8wKiozLjVFSzJPmQMRqIcO0HMyTFqfV09V6Q== +requires-port@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" + integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== + reselect@^4.1.8: version "4.1.8" resolved "https://registry.yarnpkg.com/reselect/-/reselect-4.1.8.tgz#3f5dc671ea168dccdeb3e141236f69f02eaec524" @@ -12589,7 +12589,7 @@ semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0, semve resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.5.3, semver@^7.5.4, semver@^7.6.0, semver@^7.6.2: +semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.5.3, semver@^7.5.4, semver@^7.6.0, semver@^7.6.2: version "7.6.3" resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== @@ -12968,10 +12968,10 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== -sshpk@^1.14.1: - version "1.17.0" - resolved "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz" - integrity sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ== +sshpk@^1.18.0: + version "1.18.0" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.18.0.tgz#1663e55cddf4d688b86a46b77f0d5fe363aba028" + integrity sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ== dependencies: asn1 "~0.2.3" assert-plus "^1.0.0" @@ -13746,12 +13746,10 @@ tmp@^0.0.33: dependencies: os-tmpdir "~1.0.2" -tmp@~0.2.1: - version "0.2.1" - resolved "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz" - integrity sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ== - dependencies: - rimraf "^3.0.0" +tmp@~0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.2.3.tgz#eb783cc22bc1e8bebd0671476d46ea4eb32a79ae" + integrity sha512-nZD7m9iCPC5g0pYmcaxogYKggSfLsdxl8of3Q/oIbqCqLLIO9IAF0GWjX1z9NZRHPiXv8Wex4yDCaZsgEw0Y8w== to-readable-stream@^1.0.0: version "1.0.0" @@ -13775,13 +13773,15 @@ toidentifier@1.0.1: resolved "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz" integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== -tough-cookie@~2.5.0: - version "2.5.0" - resolved "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz" - integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== +tough-cookie@^4.1.3: + version "4.1.4" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.4.tgz#945f1461b45b5a8c76821c33ea49c3ac192c1b36" + integrity sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag== dependencies: - psl "^1.1.28" + psl "^1.1.33" punycode "^2.1.1" + universalify "^0.2.0" + url-parse "^1.5.3" tr46@^1.0.1: version "1.0.1" @@ -14165,6 +14165,11 @@ universalify@^0.1.0: resolved "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz" integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== +universalify@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0" + integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg== + universalify@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.1.tgz#168efc2180964e6386d061e094df61afe239b18d" @@ -14244,6 +14249,14 @@ url-parse-lax@^3.0.0: dependencies: prepend-http "^2.0.0" +url-parse@^1.5.3: + version "1.5.10" + resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1" + integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ== + dependencies: + querystringify "^2.1.1" + requires-port "^1.0.0" + url@^0.11.0, url@~0.11.0: version "0.11.0" resolved "https://registry.npmjs.org/url/-/url-0.11.0.tgz" From 85d9012b4b5ac0721f0312bde672aaa114593f03 Mon Sep 17 00:00:00 2001 From: Jacob Pihl Date: Thu, 24 Oct 2024 14:59:09 +0200 Subject: [PATCH 3/5] Disable Test Isolation By default test isolation will be enabled in Cypress 12 and up, but out tests are not ready to run isolated yet. This should be prioritized in another task. --- cypress.config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cypress.config.js b/cypress.config.js index 5b0f7ea29f..8a0875b6e8 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -13,6 +13,7 @@ module.exports = defineConfig({ e2e: { supportFile: "cypress/support/index.ts", specPattern: "./src/@(apps|components)/**/*.test.@(ts|tsx)", - baseUrl: "http://localhost:57021" + baseUrl: "http://localhost:57021", + testIsolation: false } }); From 02f998d622b881956ffaecc7ef722d61e74355b8 Mon Sep 17 00:00:00 2001 From: Jacob Pihl Date: Thu, 24 Oct 2024 15:20:38 +0200 Subject: [PATCH 4/5] Use first() as within() can only be called on a single element --- src/apps/material/material.test.ts | 336 +++++++++++++++-------------- 1 file changed, 171 insertions(+), 165 deletions(-) diff --git a/src/apps/material/material.test.ts b/src/apps/material/material.test.ts index 3a0e8ed067..99fd8d5a21 100644 --- a/src/apps/material/material.test.ts +++ b/src/apps/material/material.test.ts @@ -133,138 +133,142 @@ describe("Material", () => { cy.scrollTo("bottom"); cy.getBySel("material-details-disclosure").click(); - cy.get('[data-cy="list-description"]').within(() => { - // Verify "Language" field and its value - cy.get(".list-description__item") - .contains("Language") - .next() - .should("contain.text", "dansk"); - - // Verify "Edition" field and its value - cy.get(".list-description__item") - .contains("Edition") - .next() - .should("contain.text", "1. udgave, 2016"); - - // Verify "Genre" field and its value - cy.get(".list-description__item") - .contains("Genre") - .next() - .should("contain.text", "roman / slægtsromaner"); - - // Verify "Original title" field and its value - cy.get(".list-description__item") - .contains("Original title") - .next() - .should("contain.text", "The seven sisters"); - - // Verify "Publisher" field and its value - cy.get(".list-description__item") - .contains("Publisher") - .next() - .should("contain.text", "Cicero"); - - // Verify "Type" field and its value - cy.get(".list-description__item") - .contains("Type") - .next() - .should("contain.text", "bog"); - - // Verify "Contributors" field and its value - cy.get(".list-description__item") - .contains("Contributors") - .next() - .should("contain.text", "Ulla Lauridsen (oversætter)"); - - // Verify "Scope" field and its value - cy.get(".list-description__item") - .contains("Scope") - .next() - .should("contain.text", "523"); - - // Verify "Dimensions" field and its value - cy.get(".list-description__item") - .contains("Dimensions") - .next() - .should("contain.text", "523 sider"); - }); + cy.get('[data-cy="list-description"]') + .first() + .within(() => { + // Verify "Language" field and its value + cy.get(".list-description__item") + .contains("Language") + .next() + .should("contain.text", "dansk"); + + // Verify "Edition" field and its value + cy.get(".list-description__item") + .contains("Edition") + .next() + .should("contain.text", "1. udgave, 2016"); + + // Verify "Genre" field and its value + cy.get(".list-description__item") + .contains("Genre") + .next() + .should("contain.text", "roman / slægtsromaner"); + + // Verify "Original title" field and its value + cy.get(".list-description__item") + .contains("Original title") + .next() + .should("contain.text", "The seven sisters"); + + // Verify "Publisher" field and its value + cy.get(".list-description__item") + .contains("Publisher") + .next() + .should("contain.text", "Cicero"); + + // Verify "Type" field and its value + cy.get(".list-description__item") + .contains("Type") + .next() + .should("contain.text", "bog"); + + // Verify "Contributors" field and its value + cy.get(".list-description__item") + .contains("Contributors") + .next() + .should("contain.text", "Ulla Lauridsen (oversætter)"); + + // Verify "Scope" field and its value + cy.get(".list-description__item") + .contains("Scope") + .next() + .should("contain.text", "523"); + + // Verify "Dimensions" field and its value + cy.get(".list-description__item") + .contains("Dimensions") + .next() + .should("contain.text", "523 sider"); + }); cy.getBySel("material-editions-disclosure").click(); cy.get(".material-manifestation-item__details").first().click(); - cy.get('[data-cy="list-description"]').within(() => { - // Verify "Type" field and its value - cy.get(".list-description__item") - .contains("Type") - .next() - .should("contain.text", "bog"); - - // Verify "Language" field and its value - cy.get(".list-description__item") - .contains("Language") - .next() - .should("contain.text", "dansk"); - - // Verify "Genre" field and its value - cy.get(".list-description__item") - .contains("Genre") - .next() - .should("contain.text", "roman / slægtsromaner"); - - // Verify "Contributors" field and its value - cy.get(".list-description__item") - .contains("Contributors") - .next() - .should("contain.text", "Ulla Lauridsen (oversætter)"); - - // Verify "Original title" field and its value - cy.get(".list-description__item") - .contains("Original title") - .next() - .should("contain.text", "The seven sisters"); - - // Verify "ISBN" field and its value - cy.get(".list-description__item") - .contains("ISBN") - .next() - .should("contain.text", "9788763844116"); - - // Verify "Edition" field and its value - cy.get(".list-description__item") - .contains("Edition") - .next() - .should("contain.text", "1. udgave, 2016"); - - // Verify "Scope" field and its value - cy.get(".list-description__item") - .contains("Scope") - .next() - .should("contain.text", "523"); - - // Verify "Publisher" field and its value - cy.get(".list-description__item") - .contains("Publisher") - .next() - .should("contain.text", "Cicero"); - - // Verify "Authors" field and its value - cy.get(".list-description__item") - .contains("Authors") - .next() - .should("contain.text", "Lucinda Riley"); - - // Verify "Dimensions" field and its value - cy.get(".list-description__item") - .contains("Dimensions") - .next() - .should("contain.text", "523 sider"); - - // Verify "Source" field and its value - cy.get(".list-description__item") - .contains("Source") - .next() - .should("contain.text", "Bibliotekskatalog"); - }); + cy.get('[data-cy="list-description"]') + .first() + .within(() => { + // Verify "Type" field and its value + cy.get(".list-description__item") + .contains("Type") + .next() + .should("contain.text", "bog"); + + // Verify "Language" field and its value + cy.get(".list-description__item") + .contains("Language") + .next() + .should("contain.text", "dansk"); + + // Verify "Genre" field and its value + cy.get(".list-description__item") + .contains("Genre") + .next() + .should("contain.text", "roman / slægtsromaner"); + + // Verify "Contributors" field and its value + cy.get(".list-description__item") + .contains("Contributors") + .next() + .should("contain.text", "Ulla Lauridsen (oversætter)"); + + // Verify "Original title" field and its value + cy.get(".list-description__item") + .contains("Original title") + .next() + .should("contain.text", "The seven sisters"); + + // Verify "ISBN" field and its value + cy.get(".list-description__item") + .contains("ISBN") + .next() + .should("contain.text", "9788763844116"); + + // Verify "Edition" field and its value + cy.get(".list-description__item") + .contains("Edition") + .next() + .should("contain.text", "1. udgave, 2016"); + + // Verify "Scope" field and its value + cy.get(".list-description__item") + .contains("Scope") + .next() + .should("contain.text", "523"); + + // Verify "Publisher" field and its value + cy.get(".list-description__item") + .contains("Publisher") + .next() + .should("contain.text", "Cicero"); + + // Verify "Authors" field and its value + cy.get(".list-description__item") + .contains("Authors") + .next() + .should("contain.text", "Lucinda Riley"); + + // Verify "Dimensions" field and its value + cy.get(".list-description__item") + .contains("Dimensions") + .next() + .should("contain.text", "523 sider"); + + // Verify "Source" field and its value + cy.get(".list-description__item") + .contains("Source") + .next() + .should("contain.text", "Bibliotekskatalog"); + }); }); it("Renders the correct details for infomedia", () => { @@ -281,43 +285,45 @@ describe("Material", () => { cy.scrollTo("bottom"); cy.getBySel("material-details-disclosure").click(); - cy.get('[data-cy="list-description"]').within(() => { - // Verify "Language" field and its value - cy.get(".list-description__item") - .contains("Language") - .next() - .should("contain.text", "dansk"); - - // Verify "Edition" field and its value - cy.get(".list-description__item") - .contains("Edition") - .next() - .should("contain.text", "2013"); - - // Verify "Type" field and its value - cy.get(".list-description__item") - .contains("Type") - .next() - .should("contain.text", "artikel"); - - // Verify "Scope" field and its value - cy.get(".list-description__item") - .contains("Scope") - .next() - .should("contain.text", "2"); - - // Verify "Dimensions" field and its value - cy.get(".list-description__item") - .contains("Dimensions") - .next() - .should("contain.text", "Sektion 3, s. 6-7: ill."); - - // Verify "Host Publication" field and its value - cy.get(".list-description__item") - .contains("Host Publication") - .next() - .should("contain.text", "Politiken, 2013-09-19"); - }); + cy.get('[data-cy="list-description"]') + .first() + .within(() => { + // Verify "Language" field and its value + cy.get(".list-description__item") + .contains("Language") + .next() + .should("contain.text", "dansk"); + + // Verify "Edition" field and its value + cy.get(".list-description__item") + .contains("Edition") + .next() + .should("contain.text", "2013"); + + // Verify "Type" field and its value + cy.get(".list-description__item") + .contains("Type") + .next() + .should("contain.text", "artikel"); + + // Verify "Scope" field and its value + cy.get(".list-description__item") + .contains("Scope") + .next() + .should("contain.text", "2"); + + // Verify "Dimensions" field and its value + cy.get(".list-description__item") + .contains("Dimensions") + .next() + .should("contain.text", "Sektion 3, s. 6-7: ill."); + + // Verify "Host Publication" field and its value + cy.get(".list-description__item") + .contains("Host Publication") + .next() + .should("contain.text", "Politiken, 2013-09-19"); + }); }); it("Renders the correct details for music", () => { From dacb795d336f939a02c17c461255fb137ea8b0d2 Mon Sep 17 00:00:00 2001 From: Jacob Pihl Date: Mon, 28 Oct 2024 12:50:46 +0100 Subject: [PATCH 5/5] Import cypress plugins As Cypress 10 depricates the use of a native separate plugins file, we need to import it into the config --- cypress.config.js | 6 +++++- cypress/plugins/index.js | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cypress.config.js b/cypress.config.js index 8a0875b6e8..6100b0e39c 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -1,5 +1,6 @@ // eslint-disable-next-line import/no-extraneous-dependencies const { defineConfig } = require("cypress"); +const plugins = require("./cypress/plugins"); module.exports = defineConfig({ projectId: "4trcdv", @@ -14,6 +15,9 @@ module.exports = defineConfig({ supportFile: "cypress/support/index.ts", specPattern: "./src/@(apps|components)/**/*.test.@(ts|tsx)", baseUrl: "http://localhost:57021", - testIsolation: false + testIsolation: false, + setupNodeEvents(on, config) { + return plugins(on, config); + } } }); diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js index 639737b39f..a85458412e 100644 --- a/cypress/plugins/index.js +++ b/cypress/plugins/index.js @@ -1,3 +1,6 @@ +// Cypress no longer natively supports plugins file, but we keep it for better code abstraction +// https://docs.cypress.io/app/references/migration-guide#Plugins-File-Removed + const task = require("@cypress/code-coverage/task"); const browserify = require("@cypress/browserify-preprocessor");