21461: Updates arvados-server install to support other archs. Upgrades Cypress.
[arvados.git] / services / workbench2 / cypress / support / commands.js
index e5a56e9de0042c8e6f9392428e73a9d46210ed7a..8fe0b06aafebb6adb3aca33f94e701b3b515213c 100644 (file)
@@ -353,9 +353,13 @@ Cypress.Commands.add("loginAs", user => {
     cy.clearCookies();
     cy.clearLocalStorage();
     cy.visit(`/token/?api_token=${user.token}`);
-    // Wait for window.location to not be undefined
-    cy.waitUntil(() => cy.window().then(win => win?.location?.href));
-    cy.url({ timeout: 15000 }).should("contain", "/projects/");
+    // Use waitUntil to avoid permafail race conditions with window.location being undefined
+    cy.waitUntil(() => cy.window().then(win =>
+        win?.location?.href &&
+        win.location.href.includes("/projects/")
+    ), { timeout: 15000 });
+    // Wait for page to settle before getting elements
+    cy.waitForDom();
     cy.get("div#root").should("contain", "Arvados Workbench (zzzzz)");
     cy.get("div#root").should("not.contain", "Your account is inactive");
 });