15814: Add cypress fail fast and tweak some process tests
authorPeter Amstutz <peter.amstutz@curii.com>
Wed, 19 Jun 2024 19:51:09 +0000 (15:51 -0400)
committerPeter Amstutz <peter.amstutz@curii.com>
Mon, 24 Jun 2024 18:17:03 +0000 (14:17 -0400)
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>

build/run-tests.sh
services/workbench2/Makefile
services/workbench2/cypress.config.ts
services/workbench2/cypress/e2e/process.cy.js
services/workbench2/cypress/support/e2e.js
services/workbench2/package.json
services/workbench2/yarn.lock

index 0eb421454e80dca7914b04c67266d563af957853..1088070b7f5c120d49be5713e0a8b9f43e514e12 100755 (executable)
@@ -993,7 +993,11 @@ test_services/workbench2_units() {
 }
 
 test_services/workbench2_integration() {
-    cd "$WORKSPACE/services/workbench2" && make integration-tests ARVADOS_DIRECTORY="${WORKSPACE}" WORKSPACE="$(pwd)" ${testargs[services/workbench2]}
+    if [[ -n ${interactive} ]]; then
+       INTERACTIVE=-i
+    fi
+    echo make integration-tests ARVADOS_DIRECTORY="${WORKSPACE}" WORKSPACE="$(pwd)" INTERACTIVE=$INTERACTIVE ${testargs[services/workbench2]}
+    cd "$WORKSPACE/services/workbench2" && make integration-tests ARVADOS_DIRECTORY="${WORKSPACE}" WORKSPACE="$(pwd)" INTERACTIVE=$INTERACTIVE ${testargs[services/workbench2]}
 }
 
 install_deps() {
index 72235b96f7eb38ce827b0162a989d01b78043742..4b917cd227cf8ea9092a43975d23427f777067cb 100644 (file)
@@ -91,10 +91,11 @@ unit-tests: yarn-install
 
 integration-tests: yarn-install check-arvados-directory
        yarn run cypress install
+       echo $(INTERACTIVE)
 ifeq ($(SPECFILE), ALL)
-       $(WORKSPACE)/tools/run-integration-tests.sh -a $(ARVADOS_DIRECTORY)
+       $(WORKSPACE)/tools/run-integration-tests.sh $(INTERACTIVE) -a $(ARVADOS_DIRECTORY)
 else
-       $(WORKSPACE)/tools/run-integration-tests.sh -a $(ARVADOS_DIRECTORY) -- --spec $(SPECFILE)
+       $(WORKSPACE)/tools/run-integration-tests.sh $(INTERACTIVE) -a $(ARVADOS_DIRECTORY) -- --spec $(SPECFILE)
 endif
 
 integration-tests-in-docker: workbench2-build-image check-arvados-directory
index d5698b0bfb70e3f49fd8e92578686ad6f29fce30..1a3b1ec56e9b43706a91a74403a80c67aa148ae4 100644 (file)
@@ -13,13 +13,15 @@ export default defineConfig({
   e2e: {
     // We've imported your old cypress plugins here.
     // You may want to clean this up later by importing these.
-    setupNodeEvents(on, config) {
-      return require('./cypress/plugins/index.js')(on, config)
-    },
-    baseUrl: 'https://localhost:3000/',
-    experimentalRunAllSpecs: true,
-    // The 2 options below make Electron crash a lot less and Firefox behave better
-    experimentalMemoryManagement: true,
-    numTestsKeptInMemory: 0,
+      setupNodeEvents(on, config) {
+         require("cypress-fail-fast/plugin")(on, config);
+         require('./cypress/plugins/index.js')(on, config)
+         return config;
+      },
+      baseUrl: 'https://localhost:3000/',
+      experimentalRunAllSpecs: true,
+      // The 2 options below make Electron crash a lot less and Firefox behave better
+      experimentalMemoryManagement: true,
+      numTestsKeptInMemory: 2,
   },
 })
index 412576c05e96d63b333908ba1f528a1eba15cd33..ea4da31b2bf3aa36587b43575e8fa99a1eb24a23 100644 (file)
@@ -145,7 +145,19 @@ describe("Process tests", function () {
                 cy.get("[data-cy=process-details-attributes-runtime-user]").should("not.exist");
             });
 
-            // Fake submitted by another user
+            // Fake submitted by another user to test "runtime user" field.
+           //
+           // Need to override both group contents and direct get,
+           // because it displays the the cached value from
+           // 'contents' for a few moments while requesting the full
+           // object.
+            cy.intercept({ method: "GET", url: "**/arvados/v1/groups/*/contents?*" }, req => {
+                req.on('response', res => {
+                   res.body.items.forEach(item => {
+                       item.modified_by_user_uuid = "zzzzz-tpzed-000000000000000";
+                   });
+                });
+            });
             cy.intercept({ method: "GET", url: "**/arvados/v1/container_requests/*" }, req => {
                 req.on('response', res => {
                     res.body.modified_by_user_uuid = "zzzzz-tpzed-000000000000000";
@@ -223,16 +235,18 @@ describe("Process tests", function () {
                 });
             });
 
-            cy.getAll("@containerRequest").then(function ([containerRequest]) {
-                cy.goToPath(`/processes/${containerRequest.uuid}`);
-                cy.get("[data-cy=process-runtime-status-retry-warning]", { timeout: 7000 }).should("contain", "Process retried 1 time");
-            });
-
-            cy.getAll("@containerRequest").then(function ([containerRequest]) {
-                containerCount = 3;
-                cy.goToPath(`/processes/${containerRequest.uuid}`);
-                cy.get("[data-cy=process-runtime-status-retry-warning]", { timeout: 7000 }).should("contain", "Process retried 2 times");
-            });
+            cy.getAll("@containerRequest", "@runningContainer").then(function ([containerRequest]) {
+               cy.goToPath(`/processes/${containerRequest.uuid}`);
+               cy.reload();
+               cy.get("[data-cy=process-runtime-status-retry-warning]", { timeout: 7000 }).should("contain", "Process retried 1 time")
+           }).as("retry1");
+
+            cy.getAll("@containerRequest", "@runningContainer", "@retry1").then(function ([containerRequest]) {
+               containerCount = 3;
+               cy.goToPath(`/processes/${containerRequest.uuid}`);
+               cy.reload();
+               cy.get("[data-cy=process-runtime-status-retry-warning]", { timeout: 7000 }).should("contain", "Process retried 2 times");
+           });
         });
 
         it("allows copying processes", function () {
index 0a89cb5bafc7005ed1a0a14f08c4a7aab4df7eb0..e8b030a32e278f091d6fed97377329ff0a2fdc94 100644 (file)
@@ -19,6 +19,7 @@
 
 // Import commands.js using ES2015 syntax:
 import './commands'
+import "cypress-fail-fast";
 
 // Alternatively you can use CommonJS syntax:
 // require('./commands')
index d69185d6144f549dc5801d42ecfa2baf4068e8eb..0d35c675ef5ec1e9a702ee99ff6b18541a7760d3 100644 (file)
@@ -45,6 +45,7 @@
     "css-loader": "^6.5.1",
     "css-minimizer-webpack-plugin": "^3.2.0",
     "cwlts": "1.15.29",
+    "cypress-fail-fast": "^7.1.0",
     "date-fns": "^2.28.0",
     "debounce": "1.2.0",
     "dompurify": "^3.0.6",
index dbe764e56725da49456f0b5fa20a39ca43b59def..cedbcde1855e48fc5e1005a663bc68eed8e9318f 100644 (file)
@@ -5321,6 +5321,7 @@ __metadata:
     css-minimizer-webpack-plugin: ^3.2.0
     cwlts: 1.15.29
     cypress: ^13.6.6
+    cypress-fail-fast: ^7.1.0
     cypress-wait-until: ^3.0.1
     date-fns: ^2.28.0
     debounce: 1.2.0
@@ -6243,6 +6244,16 @@ __metadata:
   languageName: node
   linkType: hard
 
+"chalk@npm:4.1.2, chalk@npm:^4.0.0, chalk@npm:^4.0.2, chalk@npm:^4.1.0, chalk@npm:^4.1.2":
+  version: 4.1.2
+  resolution: "chalk@npm:4.1.2"
+  dependencies:
+    ansi-styles: ^4.1.0
+    supports-color: ^7.1.0
+  checksum: fe75c9d5c76a7a98d45495b91b2172fa3b7a09e0cc9370e5c8feb1c567b85c4288e2b3fded7cfdd7359ac28d6b3844feb8b82b8686842e93d23c827c417e83fc
+  languageName: node
+  linkType: hard
+
 "chalk@npm:^2.0.0, chalk@npm:^2.3.0, chalk@npm:^2.4.1, chalk@npm:^2.4.2":
   version: 2.4.2
   resolution: "chalk@npm:2.4.2"
@@ -6254,16 +6265,6 @@ __metadata:
   languageName: node
   linkType: hard
 
-"chalk@npm:^4.0.0, chalk@npm:^4.0.2, chalk@npm:^4.1.0, chalk@npm:^4.1.2":
-  version: 4.1.2
-  resolution: "chalk@npm:4.1.2"
-  dependencies:
-    ansi-styles: ^4.1.0
-    supports-color: ^7.1.0
-  checksum: fe75c9d5c76a7a98d45495b91b2172fa3b7a09e0cc9370e5c8feb1c567b85c4288e2b3fded7cfdd7359ac28d6b3844feb8b82b8686842e93d23c827c417e83fc
-  languageName: node
-  linkType: hard
-
 "change-emitter@npm:^0.1.2":
   version: 0.1.6
   resolution: "change-emitter@npm:0.1.6"
@@ -7163,6 +7164,17 @@ __metadata:
   languageName: node
   linkType: hard
 
+"cypress-fail-fast@npm:^7.1.0":
+  version: 7.1.0
+  resolution: "cypress-fail-fast@npm:7.1.0"
+  dependencies:
+    chalk: 4.1.2
+  peerDependencies:
+    cypress: ">=8.0.0"
+  checksum: 0666d283fc61e015eb99b04047dc9ec796963f50e21acee8e6c0a5ff24fd79cfa54068361ffb05a8c576e71b646b0f86ab4793f91909fcc4ae19a772f113d397
+  languageName: node
+  linkType: hard
+
 "cypress-wait-until@npm:^3.0.1":
   version: 3.0.1
   resolution: "cypress-wait-until@npm:3.0.1"