Skip to content

Commit

Permalink
chore: test
Browse files Browse the repository at this point in the history
  • Loading branch information
eirikhaugstulen committed Oct 20, 2023
1 parent 99313fd commit 8503cdb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
6 changes: 4 additions & 2 deletions cypress/e2e/sharedSteps.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/tagUtils/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { filterInstanceVersion } from './filterInstanceVersion';
export { shouldLogin } from './shouldLogin';
export { shouldClearCookies } from './shouldClearCookies';
10 changes: 10 additions & 0 deletions cypress/support/tagUtils/shouldClearCookies.js
Original file line number Diff line number Diff line change
@@ -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');
};
10 changes: 0 additions & 10 deletions cypress/support/tagUtils/shouldLogin.js

This file was deleted.

0 comments on commit 8503cdb

Please sign in to comment.