From: Lucas Di Pentima Date: Fri, 23 Feb 2024 20:59:25 +0000 (-0300) Subject: 21461: Removes unnecessary session clearing code. Cypress already does it. X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/65e6fa3de6c5e921e30044c66ed494456d965c59 21461: Removes unnecessary session clearing code. Cypress already does it. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- diff --git a/services/workbench2/cypress/e2e/banner-tooltip.cy.js b/services/workbench2/cypress/e2e/banner-tooltip.cy.js index 3fbaba9e38..0a434ec9e8 100644 --- a/services/workbench2/cypress/e2e/banner-tooltip.cy.js +++ b/services/workbench2/cypress/e2e/banner-tooltip.cy.js @@ -23,9 +23,6 @@ describe('Banner / tooltip tests', function () { }); beforeEach(function () { - cy.clearCookies(); - cy.clearLocalStorage(); - cy.on('uncaught:exception', (err, runnable, promise) => { Cypress.log({ message: `Application Error: ${err}`}); if (promise) { diff --git a/services/workbench2/cypress/e2e/collection.cy.js b/services/workbench2/cypress/e2e/collection.cy.js index f4ffaebf5e..c5edf0e4f2 100644 --- a/services/workbench2/cypress/e2e/collection.cy.js +++ b/services/workbench2/cypress/e2e/collection.cy.js @@ -27,11 +27,6 @@ describe("Collection panel tests", function () { downloadsFolder = Cypress.config("downloadsFolder"); }); - beforeEach(function () { - cy.clearCookies(); - cy.clearLocalStorage(); - }); - it('shows the appropriate buttons in the toolbar', () => { const msButtonTooltips = [ diff --git a/services/workbench2/cypress/e2e/create-workflow.cy.js b/services/workbench2/cypress/e2e/create-workflow.cy.js index e646903934..c8acc67348 100644 --- a/services/workbench2/cypress/e2e/create-workflow.cy.js +++ b/services/workbench2/cypress/e2e/create-workflow.cy.js @@ -19,11 +19,6 @@ describe('Create workflow tests', function () { ); }); - beforeEach(function () { - cy.clearCookies(); - cy.clearLocalStorage(); - }); - it('can create project with nested data', function () { cy.createGroup(adminUser.token, { group_class: "project", diff --git a/services/workbench2/cypress/e2e/delete-multiple-files.cy.js b/services/workbench2/cypress/e2e/delete-multiple-files.cy.js index b506fb3d68..8086dd125d 100644 --- a/services/workbench2/cypress/e2e/delete-multiple-files.cy.js +++ b/services/workbench2/cypress/e2e/delete-multiple-files.cy.js @@ -19,11 +19,6 @@ describe('Multi-file deletion tests', function () { ); }); - beforeEach(function () { - cy.clearCookies(); - cy.clearLocalStorage(); - }); - it('deletes all files from root dir', function () { cy.createCollection(adminUser.token, { name: `Test collection ${Math.floor(Math.random() * 999999)}`, diff --git a/services/workbench2/cypress/e2e/favorites.cy.js b/services/workbench2/cypress/e2e/favorites.cy.js index db9a0d5f39..2898c22cba 100644 --- a/services/workbench2/cypress/e2e/favorites.cy.js +++ b/services/workbench2/cypress/e2e/favorites.cy.js @@ -21,11 +21,6 @@ describe('Favorites tests', function () { }); }); - beforeEach(function () { - cy.clearCookies() - cy.clearLocalStorage() - }); - it('creates and removes a public favorite', function () { cy.loginAs(adminUser); diff --git a/services/workbench2/cypress/e2e/login.cy.js b/services/workbench2/cypress/e2e/login.cy.js index 79f73670a3..6f2c91c37e 100644 --- a/services/workbench2/cypress/e2e/login.cy.js +++ b/services/workbench2/cypress/e2e/login.cy.js @@ -33,11 +33,6 @@ describe('Login tests', function() { randomUser.password = 'topsecret'; }) - beforeEach(function() { - cy.clearCookies() - cy.clearLocalStorage() - }) - it('shows login page on first visit', function() { cy.visit('/') cy.get('div#root').should('contain', 'Please log in') diff --git a/services/workbench2/cypress/e2e/multiselect-toolbar.cy.js b/services/workbench2/cypress/e2e/multiselect-toolbar.cy.js index ef503f7ef6..ce3551bbd1 100644 --- a/services/workbench2/cypress/e2e/multiselect-toolbar.cy.js +++ b/services/workbench2/cypress/e2e/multiselect-toolbar.cy.js @@ -23,11 +23,6 @@ describe('Multiselect Toolbar Tests', () => { }); }); - beforeEach(function () { - cy.clearCookies(); - cy.clearLocalStorage(); - }); - it('exists in DOM in neutral state', () => { cy.loginAs(activeUser); cy.get('[data-cy=multiselect-toolbar]').should('exist'); diff --git a/services/workbench2/cypress/e2e/page-not-found.cy.js b/services/workbench2/cypress/e2e/page-not-found.cy.js index 6eab27c827..e147d740d3 100644 --- a/services/workbench2/cypress/e2e/page-not-found.cy.js +++ b/services/workbench2/cypress/e2e/page-not-found.cy.js @@ -13,11 +13,6 @@ describe('Page not found tests', function() { ); }); - beforeEach(function() { - cy.clearCookies() - cy.clearLocalStorage() - }); - it('shows not found page', function() { // when cy.loginAs(adminUser); diff --git a/services/workbench2/cypress/e2e/process.cy.js b/services/workbench2/cypress/e2e/process.cy.js index 4687a2577e..ca13e9f9e0 100644 --- a/services/workbench2/cypress/e2e/process.cy.js +++ b/services/workbench2/cypress/e2e/process.cy.js @@ -25,11 +25,6 @@ describe("Process tests", function () { }); }); - beforeEach(function () { - cy.clearCookies(); - cy.clearLocalStorage(); - }); - function setupDockerImage(image_name) { // Create a collection that will be used as a docker image for the tests. cy.createCollection(adminUser.token, { diff --git a/services/workbench2/cypress/e2e/project.cy.js b/services/workbench2/cypress/e2e/project.cy.js index c03aa8dcd5..a7e7002759 100644 --- a/services/workbench2/cypress/e2e/project.cy.js +++ b/services/workbench2/cypress/e2e/project.cy.js @@ -23,11 +23,6 @@ describe("Project tests", function () { }); }); - beforeEach(function () { - cy.clearCookies(); - cy.clearLocalStorage(); - }); - it("creates a new project with multiple properties", function () { const projName = `Test project (${Math.floor(999999 * Math.random())})`; cy.loginAs(activeUser); diff --git a/services/workbench2/cypress/e2e/search.cy.js b/services/workbench2/cypress/e2e/search.cy.js index d8aa35d3d2..4411c9ffb4 100644 --- a/services/workbench2/cypress/e2e/search.cy.js +++ b/services/workbench2/cypress/e2e/search.cy.js @@ -23,11 +23,6 @@ describe("Search tests", function () { }); }); - beforeEach(function () { - cy.clearCookies(); - cy.clearLocalStorage(); - }); - it("can search for old collection versions", function () { const colName = `Versioned Collection ${Math.floor(Math.random() * Math.floor(999999))}`; let colUuid = ""; diff --git a/services/workbench2/cypress/e2e/sharing.cy.js b/services/workbench2/cypress/e2e/sharing.cy.js index f742d09062..05a7d470bf 100644 --- a/services/workbench2/cypress/e2e/sharing.cy.js +++ b/services/workbench2/cypress/e2e/sharing.cy.js @@ -21,11 +21,6 @@ describe('Sharing tests', function () { }); }) - beforeEach(function () { - cy.clearCookies() - cy.clearLocalStorage() - }); - it('can create and delete sharing URLs on collections', () => { const collName = 'shared-collection ' + new Date().getTime(); cy.createCollection(adminUser.token, { diff --git a/services/workbench2/cypress/e2e/side-panel.cy.js b/services/workbench2/cypress/e2e/side-panel.cy.js index d6ac754d0a..6d6b19bfab 100644 --- a/services/workbench2/cypress/e2e/side-panel.cy.js +++ b/services/workbench2/cypress/e2e/side-panel.cy.js @@ -23,11 +23,6 @@ describe('Side panel tests', function() { ); }) - beforeEach(function() { - cy.clearCookies() - cy.clearLocalStorage() - }) - it('enables the +NEW side panel button on users home project', function() { cy.loginAs(activeUser); cy.get('[data-cy=side-panel-button]') diff --git a/services/workbench2/cypress/support/commands.js b/services/workbench2/cypress/support/commands.js index 8fe0b06aaf..da7300a430 100644 --- a/services/workbench2/cypress/support/commands.js +++ b/services/workbench2/cypress/support/commands.js @@ -350,8 +350,11 @@ Cypress.Commands.add("updateResource", (token, suffix, uuid, data) => { }); Cypress.Commands.add("loginAs", user => { + // This shouldn't be necessary unless we need to call loginAs multiple times + // in the same test. cy.clearCookies(); - cy.clearLocalStorage(); + cy.clearAllLocalStorage(); + cy.clearAllSessionStorage(); cy.visit(`/token/?api_token=${user.token}`); // Use waitUntil to avoid permafail race conditions with window.location being undefined cy.waitUntil(() => cy.window().then(win =>