Skip to content

Commit

Permalink
oct-2136: e2e 3 groups
Browse files Browse the repository at this point in the history
  • Loading branch information
jmikolajczyk committed Jan 17, 2025
1 parent bb1a619 commit 71faa75
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 47 deletions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,53 @@ Object.values(viewports).forEach(
});
});

it('"Always show onboarding" option toggle works', () => {
connectWallet({ isPatronModeEnabled: false });
cy.wait(2500);

if (isLargeDesktop || isDesktop) {
cy.get('[data-test=LayoutTopBar__settingsButton]').click({ force: true });
}

cy.get('[data-test=SettingsShowOnboardingBox__InputToggle]').check({ force: true });
cy.get('[data-test=SettingsShowOnboardingBox__InputToggle]').should('be.checked');
cy.getAllLocalStorage().then(() => {
expect(localStorage.getItem(IS_ONBOARDING_ALWAYS_VISIBLE)).eq('true');
});
cy.reload();
cy.wait(500);
cy.get('[data-test=ModalOnboarding]').should('be.visible');
cy.get('[data-test=ModalOnboarding__Button]').click();

if (isLargeDesktop || isDesktop) {
cy.get('[data-test=LayoutTopBar__settingsButton]').click();
} else {
cy.get(`[data-test=LayoutNavbar__Button--settings]`).click();
}

cy.get('[data-test=SettingsShowOnboardingBox__InputToggle]').click({ force: true });
cy.get('[data-test=SettingsShowOnboardingBox__InputToggle]').should('not.be.checked');
cy.getAllLocalStorage().then(() => {
expect(localStorage.getItem(IS_ONBOARDING_ALWAYS_VISIBLE)).eq('false');
});
cy.reload();
cy.get('[data-test=ModalOnboarding]').should('not.exist');

if (isLargeDesktop || isDesktop) {
cy.get('[data-test=LayoutTopBar__settingsButton]').click();
} else {
cy.get(`[data-test=LayoutNavbar__Button--settings]`).click();
}

cy.get('[data-test=SettingsShowOnboardingBox__InputToggle]').click({ force: true });
cy.get('[data-test=SettingsShowOnboardingBox__InputToggle]').should('be.checked');
cy.getAllLocalStorage().then(() => {
expect(localStorage.getItem(IS_ONBOARDING_ALWAYS_VISIBLE)).eq('true');
});

cy.disconnectMetamaskWalletFromAllDapps();
});

it('"Choose a display currency" option works', () => {
for (let i = 0; i < DISPLAY_CURRENCIES.length - 1; i++) {
const displayCurrency = DISPLAY_CURRENCIES[i];
Expand Down Expand Up @@ -256,51 +303,6 @@ Object.values(viewports).forEach(
cy.get('[data-test=HomeGridVideoBar]').should('be.visible');
}
});

it('"Always show onboarding" option toggle works', () => {
connectWallet({ isPatronModeEnabled: false });

if (isLargeDesktop || isDesktop) {
cy.get('[data-test=LayoutTopBar__settingsButton]').click({ force: true });
}

cy.get('[data-test=SettingsShowOnboardingBox__InputToggle]').check({ force: true });
cy.get('[data-test=SettingsShowOnboardingBox__InputToggle]').should('be.checked');
cy.getAllLocalStorage().then(() => {
expect(localStorage.getItem(IS_ONBOARDING_ALWAYS_VISIBLE)).eq('true');
});
cy.reload();
cy.get('[data-test=ModalOnboarding]').should('be.visible');
cy.get('[data-test=ModalOnboarding__Button]').click();

if (isLargeDesktop || isDesktop) {
cy.get('[data-test=LayoutTopBar__settingsButton]').click();
} else {
cy.get(`[data-test=LayoutNavbar__Button--settings]`).click();
}

cy.get('[data-test=SettingsShowOnboardingBox__InputToggle]').click({ force: true });
cy.get('[data-test=SettingsShowOnboardingBox__InputToggle]').should('not.be.checked');
cy.getAllLocalStorage().then(() => {
expect(localStorage.getItem(IS_ONBOARDING_ALWAYS_VISIBLE)).eq('false');
});
cy.reload();
cy.get('[data-test=ModalOnboarding]').should('not.exist');

if (isLargeDesktop || isDesktop) {
cy.get('[data-test=LayoutTopBar__settingsButton]').click();
} else {
cy.get(`[data-test=LayoutNavbar__Button--settings]`).click();
}

cy.get('[data-test=SettingsShowOnboardingBox__InputToggle]').click({ force: true });
cy.get('[data-test=SettingsShowOnboardingBox__InputToggle]').should('be.checked');
cy.getAllLocalStorage().then(() => {
expect(localStorage.getItem(IS_ONBOARDING_ALWAYS_VISIBLE)).eq('true');
});

cy.disconnectMetamaskWalletFromAllDapps();
});
});
},
);
8 changes: 8 additions & 0 deletions client/cypress/e2e/group3/_01metamaskWorkaround.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Cypress tests based on framer pass only in case when test tab is active (chrome doesn't block animations).
// On first test, active tab is MetaMask and on each next active tab is test tab - due to that we had to add this workaround.
// Only for `synpress run` command
describe('Workaround for first test (active tab is MetaMask instead of Cypress tab)', () => {
it('true', () => {
expect(true).to.be.true;
});
});
5 changes: 3 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@
"type-check": "tsc --noEmit true",
"sourcemaps:remove": "rimraf dist/**/*.map",
"synpress:open": "TZ=Europe/Warsaw synpress open --configFile synpress.config.ts",
"synpress:run": "yarn synpress:run:group-1 && yarn synpress:run:group-2",
"synpress:run": "yarn synpress:run:group-1 && yarn synpress:run:group-2 && yarn synpress:run:group-3",
"synpress:run:group-1": "TZ=Europe/Warsaw synpress run --configFile synpress.config.ts --spec '**/group1/*.cy.ts'",
"synpress:run:group-2": "TZ=Europe/Warsaw synpress run --configFile synpress.config.ts --spec '**/group2/*.cy.ts'"
"synpress:run:group-2": "TZ=Europe/Warsaw synpress run --configFile synpress.config.ts --spec '**/group2/*.cy.ts'",
"synpress:run:group-3": "TZ=Europe/Warsaw synpress run --configFile synpress.config.ts --spec '**/group3/*.cy.ts'"
},
"dependencies": {
"@ethersproject/constants": "^5.7.0",
Expand Down

0 comments on commit 71faa75

Please sign in to comment.