Skip to content

Commit

Permalink
[STYLE] Cypress utils unification (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
aziolek authored Mar 12, 2024
1 parent f13778d commit bd2443a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions client/cypress/e2e/layout.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { navigateWithCheck, mockCoinPricesServer } from 'cypress/utils/e2e';
import viewports from 'cypress/utils/viewports';
import { IS_ONBOARDING_ALWAYS_VISIBLE, IS_ONBOARDING_DONE } from 'src/constants/localStorageKeys';
import { navigationTabs } from 'src/constants/navigationTabs/navigationTabs';
import { ROOT } from 'src/routes/RootRoutes/routes';
import { ROOT, ROOT_ROUTES } from 'src/routes/RootRoutes/routes';

Object.values(viewports).forEach(({ device, viewportWidth, viewportHeight }) => {
describe(`layout: ${device}`, { viewportHeight, viewportWidth }, () => {
Expand Down Expand Up @@ -34,15 +34,15 @@ Object.values(viewports).forEach(({ device, viewportWidth, viewportHeight }) =>
});

it('Clicking on Octant logo redirects to projects view (outside projects view)', () => {
cy.get('[data-test=Navbar__Button--Settings]').click();
navigateWithCheck(ROOT_ROUTES.settings.absolute);
cy.get('[data-test=SettingsView]').should('be.visible');
cy.get('[data-test=MainLayout__Logo]').click();
cy.get('[data-test=ProposalsView]').should('be.visible');
});

it('Clicking on Octant logo redirects to projects view (outside projects view) with memorized scrollY', () => {
cy.scrollTo(0, 500);
cy.get('[data-test=Navbar__Button--Settings]').click();
navigateWithCheck(ROOT_ROUTES.settings.absolute);
cy.get('[data-test=SettingsView]').should('be.visible');
cy.get('[data-test=MainLayout__Logo]').click();
cy.get('[data-test=ProposalsView]').should('be.visible');
Expand Down
5 changes: 3 additions & 2 deletions client/cypress/utils/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ export const loadersShouldNotExist = (): Chainable<any> => {
};

export const checkLocationWithLoader = (url: string): Chainable<any> => {
cy.location('pathname').should('eq', url);
return loadersShouldNotExist();
// First loaders, since user can be moved between the routes before they disappear.
loadersShouldNotExist();
return cy.location('pathname').should('eq', url);
};

export const visitWithLoader = (urlEnter: string, urlEnd?: string): Chainable<any> => {
Expand Down

0 comments on commit bd2443a

Please sign in to comment.