17266: Avoids reloading the app on cypress tests by using search.
[arvados-workbench2.git] / cypress / support / commands.js
index c2b222a74e15734d60e24edb2f9114040672cd06..bba04ba85977bf9a95d34e9792a3fcb435902f5a 100644 (file)
@@ -116,6 +116,16 @@ Cypress.Commands.add(
     }
 )
 
+
+Cypress.Commands.add(
+    "createWorkflow", (token, data) => {
+        return cy.createResource(token, 'workflows', {
+            workflow: JSON.stringify(data),
+            ensure_unique_name: true
+        })
+    }
+)
+
 Cypress.Commands.add(
     "createCollection", (token, data) => {
         return cy.createResource(token, 'collections', {
@@ -166,10 +176,14 @@ Cypress.Commands.add(
 Cypress.Commands.add(
     "loginAs", (user) => {
         cy.visit(`/token/?api_token=${user.token}`);
-        cy.get('[data-cy=loading-spinner]').should('exist');
-        cy.get('[data-cy=loading-spinner]').should('not.exist');
         cy.url().should('contain', '/projects/');
         cy.get('div#root').should('contain', 'Arvados Workbench (zzzzz)');
         cy.get('div#root').should('not.contain', 'Your account is inactive');
     }
 )
+
+Cypress.Commands.add(
+    "doSearch", (searchTerm) => {
+        cy.get('[data-cy=searchbar-input-field]').type(`{selectall}${searchTerm}{enter}`);
+    }
+)
\ No newline at end of file