diff --git a/cypress/e2e/sharedSteps.js b/cypress/e2e/sharedSteps.js index 9dbd8ffab1..16967a0c21 100644 --- a/cypress/e2e/sharedSteps.js +++ b/cypress/e2e/sharedSteps.js @@ -4,11 +4,13 @@ import { Then, defineStep as And, Before, } from '@badeball/cypress-cucumber-preprocessor'; -import { filterInstanceVersion, shouldLogin } from '../support/tagUtils'; +import { filterInstanceVersion, shouldClearCookies } from '../support/tagUtils'; Before(function callback() { filterInstanceVersion(() => this.skip()); - !shouldLogin() && cy.clearAllCookies(); + if (shouldClearCookies()) { + cy.clearAllCookies(); + } }); Given('you are in the main page with no selections made', () => { diff --git a/cypress/support/tagUtils/index.js b/cypress/support/tagUtils/index.js index e2c3a66227..7471fd0a2f 100644 --- a/cypress/support/tagUtils/index.js +++ b/cypress/support/tagUtils/index.js @@ -1,2 +1,2 @@ export { filterInstanceVersion } from './filterInstanceVersion'; -export { shouldLogin } from './shouldLogin'; +export { shouldClearCookies } from './shouldClearCookies'; diff --git a/cypress/support/tagUtils/shouldClearCookies.js b/cypress/support/tagUtils/shouldClearCookies.js new file mode 100644 index 0000000000..7f93259919 --- /dev/null +++ b/cypress/support/tagUtils/shouldClearCookies.js @@ -0,0 +1,10 @@ +export const shouldClearCookies = () => { + const { tags } = window.testState.pickle; + + if (!tags || !tags.length) { + return false; + } + + return tags + .any(({ name }) => name === '@skip-login'); +}; diff --git a/cypress/support/tagUtils/shouldLogin.js b/cypress/support/tagUtils/shouldLogin.js deleted file mode 100644 index 9adbebc459..0000000000 --- a/cypress/support/tagUtils/shouldLogin.js +++ /dev/null @@ -1,10 +0,0 @@ -export const shouldLogin = () => { - const { tags } = window.testState.pickle; - - if (!tags || !tags.length) { - return true; - } - - return tags - .every(({ name }) => name !== '@skip-login'); -};