[ARVADOS-WORKBENCH2] updated: 2.1.0-313-gab8763f9

Git user git at public.arvados.org
Tue Apr 20 19:22:58 UTC 2021


Summary of changes:
 cypress/support/commands.js | 40 +++++++++++++++++++++++++---------------
 1 file changed, 25 insertions(+), 15 deletions(-)

       via  ab8763f927c1f831353d40dfdc66f754e78a6030 (commit)
       via  4043ab4e285f08e9d56ffd8f8a401b68816fc841 (commit)
      from  75022caec274dcdb1d7983b66c783e96584b5a10 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit ab8763f927c1f831353d40dfdc66f754e78a6030
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Tue Apr 20 16:07:06 2021 -0300

    17500: Avoids session data leaking within one test.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/cypress/support/commands.js b/cypress/support/commands.js
index 36358991..dbb9cd0b 100644
--- a/cypress/support/commands.js
+++ b/cypress/support/commands.js
@@ -183,6 +183,8 @@ Cypress.Commands.add(
 
 Cypress.Commands.add(
     "loginAs", (user) => {
+        cy.clearCookies()
+        cy.clearLocalStorage()
         cy.visit(`/token/?api_token=${user.token}`);
         cy.url({timeout: 10000}).should('contain', '/projects/');
         cy.get('div#root').should('contain', 'Arvados Workbench (zzzzz)');

commit 4043ab4e285f08e9d56ffd8f8a401b68816fc841
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Tue Apr 20 15:26:51 2021 -0300

    17500: Cleans up previously created objects before running each test.
    
    This is intended to avoid making wb2 tests increasingly slow by objects
    accumulation after every test. Also may avoid hard to debug issues making
    tests see UI elements they shouldn't be there.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/cypress/support/commands.js b/cypress/support/commands.js
index 929ffb83..36358991 100644
--- a/cypress/support/commands.js
+++ b/cypress/support/commands.js
@@ -30,28 +30,35 @@
 
 const controllerURL = Cypress.env('controller_url');
 const systemToken = Cypress.env('system_token');
+let createdResources = [];
+
+// Clean up on a 'before' hook to allow post-mortem analysis on individual tests.
+beforeEach(function () {
+    if (createdResources.length === 0) {
+        return;
+    }
+    cy.log(`Cleaning ${createdResources.length} previously created resource(s)`);
+    createdResources.forEach(function({suffix, uuid}) {
+        // Don't fail when a resource isn't already there, some objects may have
+        // been removed, directly or indirectly, from the test that created them.
+        cy.deleteResource(systemToken, suffix, uuid, false);
+    });
+    createdResources = [];
+});
 
 Cypress.Commands.add(
     "doRequest", (method = 'GET', path = '', data = null, qs = null,
-        token = systemToken, auth = false, followRedirect = true) => {
+        token = systemToken, auth = false, followRedirect = true, failOnStatusCode = true) => {
     return cy.request({
         method: method,
         url: `${controllerURL.replace(/\/+$/, '')}/${path.replace(/^\/+/, '')}`,
         body: data,
         qs: auth ? qs : Object.assign({ api_token: token }, qs),
         auth: auth ? { bearer: `${token}` } : undefined,
-        followRedirect: followRedirect
-    })
-}
-)
-
-// This resets the DB removing all content and seeding it with the fixtures.
-// TODO: Maybe we can add an optional param to avoid the loading part?
-Cypress.Commands.add(
-    "resetDB", () => {
-        cy.request('POST', `${controllerURL}/database/reset?api_token=${systemToken}`);
-    }
-)
+        followRedirect: followRedirect,
+        failOnStatusCode: failOnStatusCode
+    });
+});
 
 Cypress.Commands.add(
     "getUser", (username, first_name = '', last_name = '', is_admin = false, is_active = true) => {
@@ -148,14 +155,15 @@ Cypress.Commands.add(
         return cy.doRequest('POST', '/arvados/v1/' + suffix, data, null, token, true)
             .its('body').as('resource')
             .then(function () {
+                createdResources.push({suffix, uuid: this.resource.uuid});
                 return this.resource;
             })
     }
 )
 
 Cypress.Commands.add(
-    "deleteResource", (token, suffix, uuid) => {
-        return cy.doRequest('DELETE', '/arvados/v1/' + suffix + '/' + uuid)
+    "deleteResource", (token, suffix, uuid, failOnStatusCode = true) => {
+        return cy.doRequest('DELETE', '/arvados/v1/' + suffix + '/' + uuid, null, null, token, false, true, failOnStatusCode)
             .its('body').as('resource')
             .then(function () {
                 return this.resource;

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list