Skip to content

Commit 1decafd

Browse files
committed
Split off dismissTour into a shared file
1 parent 9c0ce33 commit 1decafd

3 files changed

Lines changed: 11 additions & 21 deletions

File tree

console/integration-tests/support/login.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ declare global {
33
interface Chainable {
44
login(username?: string, password?: string): Chainable<Element>;
55
logout(): Chainable<Element>;
6+
dismissTour(): Chainable<Element>;
67
}
78
}
89
}
@@ -30,6 +31,14 @@ Cypress.Commands.add('login', (username: string, password: string) => {
3031
});
3132
});
3233

34+
Cypress.Commands.add('dismissTour', () => {
35+
cy.get('body').then(($body) => {
36+
if ($body.find('[data-test="tour-step-footer-secondary"]').length > 0) {
37+
cy.get('[data-test="tour-step-footer-secondary"]').contains('Skip tour').click();
38+
}
39+
});
40+
});
41+
3342
Cypress.Commands.add('logout', () => {
3443
// Check if auth is disabled (for a local development environment).
3544
cy.window().then((win) => {

console/integration-tests/tests/install-pattern-page.cy.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
const dismissTour = () => {
2-
cy.get('body').then(($body) => {
3-
if ($body.find('[data-test="tour-step-footer-secondary"]').length > 0) {
4-
cy.get('[data-test="tour-step-footer-secondary"]').contains('Skip tour').click();
5-
}
6-
});
7-
};
8-
91
const navigateToInstallPage = () => {
102
cy.visit('/patterns');
113
cy.get('.patterns-operator__card', { timeout: 60000 }).should('exist');
@@ -19,7 +11,7 @@ const navigateToInstallPage = () => {
1911
describe('Install Pattern Page', () => {
2012
before(function () {
2113
cy.login();
22-
dismissTour();
14+
cy.dismissTour();
2315

2416
// Check if Install is available; skip the entire suite if not
2517
cy.visit('/patterns');

console/integration-tests/tests/pattern-catalog-page.cy.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
const PLUGIN_NAME = 'patterns-operator-console-plugin';
2-
const isLocalDevEnvironment = Cypress.config('baseUrl').includes('localhost');
3-
4-
const dismissTour = () => {
5-
cy.get('body').then(($body) => {
6-
if ($body.find('[data-test="tour-step-footer-secondary"]').length > 0) {
7-
cy.get('[data-test="tour-step-footer-secondary"]').contains('Skip tour').click();
8-
}
9-
});
10-
};
11-
121
const visitCatalog = () => {
132
cy.visit('/patterns');
143
cy.get('.patterns-operator__card', { timeout: 60000 }).should('exist');
@@ -17,7 +6,7 @@ const visitCatalog = () => {
176
describe('Pattern Catalog Page', () => {
187
before(() => {
198
cy.login();
20-
dismissTour();
9+
cy.dismissTour();
2110
});
2211

2312
after(() => {

0 commit comments

Comments
 (0)