Skip to content

Commit

Permalink
oct-2097: onboarding e2e update
Browse files Browse the repository at this point in the history
  • Loading branch information
jmikolajczyk committed Jan 13, 2025
1 parent 05f9b42 commit 5f4154f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
6 changes: 3 additions & 3 deletions client/cypress/e2e/_07onboardingTOSNotAccepted.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
chai.use(chaiColors);

Object.values(viewports).forEach(
({ device, viewportWidth, viewportHeight, isMobile }, index, arr) => {
({ device, viewportWidth, viewportHeight, isMobile, isTablet }, index, arr) => {
describe(
`[AW IS CLOSED] Onboarding (TOS not accepted): ${device}`,
{ viewportHeight, viewportWidth },
Expand Down Expand Up @@ -77,11 +77,11 @@ Object.values(viewports).forEach(
});

it('user cannot change steps by clicking the edge of the screen (up to 25px from each edge)', () => {
checkChangeStepsByClickingEdgeOfTheScreenUpTo25px(false, isMobile);
checkChangeStepsByClickingEdgeOfTheScreenUpTo25px(false, isMobile || isTablet);
});

it('user cannot change steps by clicking the edge of the screen (more than 25px from each edge)', () => {
checkChangeStepsByClickingEdgeOfTheScreenMoreThan25px(false, isMobile);
checkChangeStepsByClickingEdgeOfTheScreenMoreThan25px(false, isMobile || isTablet);
});

it('user cannot change steps by swiping on screen (difference more than or equal 5px)', () => {
Expand Down
8 changes: 3 additions & 5 deletions client/cypress/e2e/_08onboardingTOSAccepted.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
chai.use(chaiColors);

Object.values(viewports).forEach(
({ device, viewportWidth, viewportHeight, isMobile, isDesktop, isLargeDesktop }) => {
({ device, viewportWidth, viewportHeight, isMobile, isTablet, isDesktop, isLargeDesktop }) => {
describe(
`[AW IS CLOSED] onboarding (TOS accepted): ${device}`,
{ viewportHeight, viewportWidth },
Expand Down Expand Up @@ -104,13 +104,11 @@ Object.values(viewports).forEach(
});

it('user can change steps by clicking the edge of the screen (up to 25px from each edge)', () => {
checkChangeStepsByClickingEdgeOfTheScreenUpTo25px(true, isMobile);
checkChangeStepsByClickingEdgeOfTheScreenUpTo25px(true, isMobile || isTablet);
});

// TODO will be unskipped in https://github.com/golemfoundation/octant/pull/624.
// eslint-disable-next-line
it('user cannot change steps by clicking the edge of the screen (more than 25px from each edge)', () => {
checkChangeStepsByClickingEdgeOfTheScreenMoreThan25px(true, isMobile);
checkChangeStepsByClickingEdgeOfTheScreenMoreThan25px(true, isMobile || isTablet);
});

it('user can change steps by swiping on screen (difference more than or equal 5px)', () => {
Expand Down
8 changes: 4 additions & 4 deletions client/cypress/utils/onboarding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const checkChangeStepsWithArrowKeys = (isTOSAccepted: boolean): void => {

export const checkChangeStepsByClickingEdgeOfTheScreenUpTo25px = (
isTOSAccepted: boolean,
isMobile = false,
isMobileOrTablet = false,
): void => {
checkCurrentElement(0, true);

Expand All @@ -93,7 +93,7 @@ export const checkChangeStepsByClickingEdgeOfTheScreenUpTo25px = (
{ clientX: leftEdgeX, el: 0 },
].forEach(({ clientX, el }) => {
cy.get('[data-test=ModalOnboarding]').click(clientX, element.height()! / 2, {
force: isMobile,
force: isMobileOrTablet,
});
checkCurrentElement(el, isTOSAccepted || el === 0);

Expand All @@ -106,7 +106,7 @@ export const checkChangeStepsByClickingEdgeOfTheScreenUpTo25px = (

export const checkChangeStepsByClickingEdgeOfTheScreenMoreThan25px = (
isTOSAccepted: boolean,
isMobile = false,
isMobileOrTablet = false,
): void => {
checkCurrentElement(0, true);

Expand All @@ -121,7 +121,7 @@ export const checkChangeStepsByClickingEdgeOfTheScreenMoreThan25px = (
{ clientX: leftEdgeX + 25, el: 0 },
].forEach(({ clientX, el }) => {
cy.get('[data-test=ModalOnboarding]').click(clientX, element.height()! / 2, {
force: isMobile,
force: isMobileOrTablet,
});
checkCurrentElement(el, isTOSAccepted || el === 0);

Expand Down

0 comments on commit 5f4154f

Please sign in to comment.