From cc4c910effedd4bda433a4bea5a39f07973ab24c Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Tue, 21 Jan 2025 17:52:59 +0200 Subject: [PATCH] Slightly cleaned up cypress tests (#8975) --- .../e2e/actions_projects_models/markdown_base_pipeline.js | 3 +-- tests/cypress/e2e/features/skeletons_pipeline.js | 2 +- .../cypress/e2e/remove_users_tasks_projects_organizations.js | 5 +---- tests/cypress/support/commands.js | 5 ++--- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/tests/cypress/e2e/actions_projects_models/markdown_base_pipeline.js b/tests/cypress/e2e/actions_projects_models/markdown_base_pipeline.js index 13da4896fad0..bbe3603f2a17 100644 --- a/tests/cypress/e2e/actions_projects_models/markdown_base_pipeline.js +++ b/tests/cypress/e2e/actions_projects_models/markdown_base_pipeline.js @@ -42,10 +42,9 @@ context('Basic markdown pipeline', () => { cy.visit('/'); cy.get('.cvat-login-form-wrapper').should('exist').and('be.visible'); - cy.clearCookies(); for (const user of Object.values(additionalUsers)) { cy.headlessCreateUser(user); - cy.clearCookies(); + cy.headlessLogout(); } cy.login(); diff --git a/tests/cypress/e2e/features/skeletons_pipeline.js b/tests/cypress/e2e/features/skeletons_pipeline.js index 0592158558fa..e3b686697875 100644 --- a/tests/cypress/e2e/features/skeletons_pipeline.js +++ b/tests/cypress/e2e/features/skeletons_pipeline.js @@ -54,7 +54,7 @@ context('Manipulations with skeletons', { scrollBehavior: false }, () => { }); after(() => { - cy.clearAllCookies(); + cy.headlessLogout(); if (taskID !== null) { cy.getAuthKey().then((response) => { const authKey = response.body.key; diff --git a/tests/cypress/e2e/remove_users_tasks_projects_organizations.js b/tests/cypress/e2e/remove_users_tasks_projects_organizations.js index 624cc2831958..d3f2890bedbc 100644 --- a/tests/cypress/e2e/remove_users_tasks_projects_organizations.js +++ b/tests/cypress/e2e/remove_users_tasks_projects_organizations.js @@ -1,4 +1,5 @@ // Copyright (C) 2020-2022 Intel Corporation +// Copyright (C) CVAT.ai Corporation // // SPDX-License-Identifier: MIT @@ -6,10 +7,6 @@ let authKey = ''; -before(() => { - cy.clearAllCookies(); -}); - describe('Delete users, tasks, projects, organizations created during the tests run.', () => { it('Get token', () => { cy.request({ diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index 792a873ceef0..7dac05153f44 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -36,7 +36,7 @@ Cypress.Commands.add('logout', () => { cy.get('.cvat-header-menu-user-dropdown-user').click(); cy.get('span[aria-label="logout"]').click(); cy.url().should('include', '/auth/login'); - cy.clearAllCookies(); + cy.clearCookies(); cy.visit('/auth/login'); cy.url().should('not.include', '?next='); cy.contains('Sign in').should('exist'); @@ -369,8 +369,7 @@ Cypress.Commands.add('headlessCreateUser', (userSpec) => { }); Cypress.Commands.add('headlessLogout', () => { - cy.clearAllCookies(); - cy.clearAllLocalStorage(); + cy.clearCookies(); }); Cypress.Commands.add('headlessCreateJob', (jobSpec) => {