From d0cd651c6f662ee697b6d7b6054d1e0898f493a6 Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Tue, 1 Aug 2023 11:53:27 +0100 Subject: [PATCH] Fix e2e tests and update cypress, browserlist --- webapp/cypress/e2e/batchSampleFeature.cy.js | 29 +++++---------- webapp/cypress/e2e/sampleTablePage.cy.js | 6 ++- webapp/package.json | 2 +- webapp/yarn.lock | 41 ++++++++++++--------- 4 files changed, 39 insertions(+), 39 deletions(-) diff --git a/webapp/cypress/e2e/batchSampleFeature.cy.js b/webapp/cypress/e2e/batchSampleFeature.cy.js index f977a3648..9f28fc2dc 100644 --- a/webapp/cypress/e2e/batchSampleFeature.cy.js +++ b/webapp/cypress/e2e/batchSampleFeature.cy.js @@ -53,10 +53,9 @@ function searchAndSelectItem(search_text, selector, delay = 100) { function deleteSample(sample_id, delay = 100) { cy.wait(delay).then(() => { cy.log("search for and delete: " + sample_id); - var matchingTds = []; - cy.findByText(sample_id, { - selector: "[data-testid=sample-table] tr > td:nth-of-type(1) > div > span", - }) + var matchingIds = []; + cy.get("[data-testid=sample-table]") + .contains(sample_id) .parents("tr") .within(() => { cy.get("button.close").click(); @@ -229,14 +228,12 @@ describe("Batch sample creation", () => { it("checks the copied samples", () => { // check the copied samples cy.contains("baseA_copy").click(); - cy.findByLabelText("Sample ID").should("have.value", "baseA_copy"); cy.findByLabelText("Name").should("have.value", "a copied sample"); cy.findByText("this is a description of baseA."); cy.findByText("a comment is added here."); cy.findByText("Home").click(); cy.contains(/^baseB_copy$/).click(); - cy.findByLabelText("Sample ID").should("have.value", "baseB_copy"); cy.findByText("this is a description of baseB."); cy.findByText("a comment is added here."); cy.findByText("a second comment is added here."); @@ -250,7 +247,6 @@ describe("Batch sample creation", () => { cy.findByText("Home").click(); cy.findByText("baseB_copy2").click(); - cy.findByLabelText("Sample ID").should("have.value", "baseB_copy2"); cy.findByText("this is a description of baseB."); cy.findByText("a comment is added here."); cy.findByText("a second comment is added here."); @@ -346,7 +342,6 @@ describe("Batch sample creation", () => { it("checks the created samples", () => { cy.contains("test101").click(); - cy.findByLabelText("Sample ID").should("have.value", "test101"); cy.findByLabelText("Name").should("have.value", "sample with two components"); cy.get("#synthesis-information table").contains("component1"); cy.get("#synthesis-information table").contains("component2"); @@ -355,7 +350,6 @@ describe("Batch sample creation", () => { cy.findByText("Home").click(); cy.contains("test102").click(); - cy.findByLabelText("Sample ID").should("have.value", "test102"); cy.findByLabelText("Name").should( "have.value", "sample with two components, copied from a sample with no components" @@ -369,7 +363,6 @@ describe("Batch sample creation", () => { cy.findByText("Home").click(); cy.contains("test103").click(); - cy.findByLabelText("Sample ID").should("have.value", "test103"); cy.findByLabelText("Name").should( "have.value", "sample with one component, copied from a sample with two components" @@ -403,7 +396,6 @@ describe("Batch sample creation", () => { cy.findByText("Home").click(); cy.contains("test104").click(); - cy.findByLabelText("Sample ID").should("have.value", "test104"); cy.findByLabelText("Name").should( "have.value", "sample with three components, copied from a sample with some of the same components" @@ -560,7 +552,6 @@ describe("Batch sample creation", () => { function checkCreatedSample(item_id) { cy.contains(item_id).click(); - cy.findByLabelText("Sample ID").should("have.value", item_id); cy.contains("this is a description of baseB."); cy.get("#synthesis-information table").contains("component3"); cy.get("#synthesis-information table").contains("component4"); @@ -679,7 +670,6 @@ describe("Batch sample creation", () => { function checkCreatedSample(item_id) { cy.contains(item_id).click(); - cy.findByLabelText("Sample ID").should("have.value", item_id); cy.contains("this is a description of baseB."); cy.get("#synthesis-information table").contains("component3"); cy.get("#synthesis-information table").contains("component4"); @@ -763,10 +753,13 @@ describe("Batch sample creation", () => { verifySample("test101_unique2"); }); + // as contains matches greedily, if any IDs have matching substrings they must be added in the appropriate order it("deletes the rest of the samples (cleanup)", () => { [ - "baseA", - "baseB", + "test101_unique", + "test102_unique", + "test103_unique", + "test101_unique2", "component1", "component2", "component3", @@ -781,10 +774,8 @@ describe("Batch sample creation", () => { "test_1", "test_2", "test_3", - "test101_unique", - "test102_unique", - "test103_unique", - "test101_unique2", + "baseA", + "baseB", ].forEach((item_id) => { deleteSample(item_id); }); diff --git a/webapp/cypress/e2e/sampleTablePage.cy.js b/webapp/cypress/e2e/sampleTablePage.cy.js index 8fe08d353..8fe7c6c9d 100644 --- a/webapp/cypress/e2e/sampleTablePage.cy.js +++ b/webapp/cypress/e2e/sampleTablePage.cy.js @@ -108,6 +108,7 @@ describe("Sample table page", () => { it("Checks the sample edit page", () => { cy.findByText("12345678910").click(); + cy.wait(1000); cy.go("back"); cy.findByText("12345678910"); cy.findByText("This is a sample name"); @@ -185,6 +186,7 @@ describe("Sample table page", () => { // check one of the pages to make sure it is generating properly cy.findByText("122.rwre").click(); + cy.wait(1000); cy.go("back"); more_ids.map((id) => verifySample(id)); @@ -332,14 +334,14 @@ describe("Advanced sample creation features", () => { it("deletes all samples", () => { [ - "testB", "testAcopy", "component1", "component2", "component3", "component4", - "testBcopy", "testBcopy_copy", + "testBcopy", + "testB", ].map((id) => { deleteSample(id); }); diff --git a/webapp/package.json b/webapp/package.json index 2aaedfca7..f4993cbf3 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -56,7 +56,7 @@ "babel-core": "7.0.0-bridge.0", "babel-eslint": "^10.1.0", "babel-plugin-transform-remove-console": "^6.9.4", - "cypress": "12.3.0", + "cypress": "12.17.2", "eslint": "^6.7.2", "eslint-plugin-prettier": "^3.3.1", "eslint-plugin-vue": "^7.0.0", diff --git a/webapp/yarn.lock b/webapp/yarn.lock index 09f6e03cf..2cbe506bc 100644 --- a/webapp/yarn.lock +++ b/webapp/yarn.lock @@ -975,7 +975,7 @@ resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ== -"@cypress/request@^2.88.10": +"@cypress/request@^2.88.11": version "2.88.11" resolved "https://registry.yarnpkg.com/@cypress/request/-/request-2.88.11.tgz#5a4c7399bc2d7e7ed56e92ce5acb620c8b187047" integrity sha512-M83/wfQ1EkspjkE2lNWNV5ui2Cv7UCv1swW1DqljahbzLVWltcsexQh8jYtuS/vzFXP+HySntGM83ZXA9fn17w== @@ -3326,10 +3326,10 @@ commander@^2.18.0, commander@^2.19.0, commander@^2.20.0: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== -commander@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae" - 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@~2.19.0: version "2.19.0" @@ -3785,12 +3785,12 @@ cyclist@^1.0.1: resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9" integrity sha512-NJGVKPS81XejHcLhaLJS7plab0fK3slPh11mESeeDq2W4ZI5kUKK/LRRdVDvjJseojbPB7ZwjnyOybg3Igea/A== -cypress@12.3.0: - version "12.3.0" - resolved "https://registry.yarnpkg.com/cypress/-/cypress-12.3.0.tgz#ae3fb0540aef4b5eab1ef2bcd0760caf2992b8bf" - integrity sha512-ZQNebibi6NBt51TRxRMYKeFvIiQZ01t50HSy7z/JMgRVqBUey3cdjog5MYEbzG6Ktti5ckDt1tfcC47lmFwXkw== +cypress@12.17.2: + version "12.17.2" + resolved "https://registry.yarnpkg.com/cypress/-/cypress-12.17.2.tgz#040ac55de1e811f6e037d231a2869d5ab8c29c85" + integrity sha512-hxWAaWbqQBzzMuadSGSuQg5PDvIGOovm6xm0hIfpCVcORsCAj/gF2p0EvfnJ4f+jK2PCiDgP6D2eeE9/FK4Mjg== dependencies: - "@cypress/request" "^2.88.10" + "@cypress/request" "^2.88.11" "@cypress/xvfb" "^1.2.4" "@types/node" "^14.14.31" "@types/sinonjs__fake-timers" "8.1.1" @@ -3804,10 +3804,10 @@ cypress@12.3.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" @@ -3822,12 +3822,12 @@ cypress@12.3.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" 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" untildify "^4.0.0" @@ -4202,7 +4202,7 @@ debug@^3.1.0, debug@^3.2.7: dependencies: ms "^2.1.1" -debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2: +debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -7285,7 +7285,7 @@ minimatch@^5.0.1: dependencies: brace-expansion "^2.0.1" -minimist@^1.2.0, minimist@^1.2.5, minimist@^1.2.6: +minimist@^1.2.0, minimist@^1.2.5, 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== @@ -9095,13 +9095,20 @@ semver@^6.0.0, semver@^6.1.0, semver@^6.1.1, semver@^6.1.2, semver@^6.3.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== -semver@^7.3.2, semver@^7.3.4: +semver@^7.3.4: version "7.5.0" resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.0.tgz#ed8c5dc8efb6c629c88b23d41dc9bf40c1d96cd0" integrity sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA== dependencies: lru-cache "^6.0.0" +semver@^7.5.3: + version "7.5.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" + integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== + dependencies: + lru-cache "^6.0.0" + send@0.18.0: version "0.18.0" resolved "https://registry.yarnpkg.com/send/-/send-0.18.0.tgz#670167cc654b05f5aa4a767f9113bb371bc706be"