diff --git a/e2e/about-how-modal.spec.ts b/e2e/about-how-modal.spec.ts index 667974c80c..6119015c8f 100644 --- a/e2e/about-how-modal.spec.ts +++ b/e2e/about-how-modal.spec.ts @@ -6,12 +6,12 @@ import { import { ABOUT_MODALS_VIEWPORT_WIDTH } from './utils/constants/e2e.constants'; import { HomepageLoggedOut } from './utils/pages/homepage.page'; -export const ABOUT_HOW_MODAL_VIEWPORT_HEIGHT = 1600; +const ABOUT_HOW_MODAL_VIEWPORT_HEIGHT = 1600; test('should display about-how modal', async ({ page }) => { const homepageLoggedOut = new HomepageLoggedOut({ page }); - await homepageLoggedOut.takeModalSnapshot({ + await homepageLoggedOut.testModalSnapshot({ viewportSize: { width: ABOUT_MODALS_VIEWPORT_WIDTH, height: ABOUT_HOW_MODAL_VIEWPORT_HEIGHT diff --git a/e2e/about-what-modal.spec.ts b/e2e/about-what-modal.spec.ts index 81863c82a6..cab55b7040 100644 --- a/e2e/about-what-modal.spec.ts +++ b/e2e/about-what-modal.spec.ts @@ -3,12 +3,12 @@ import { test } from '@playwright/test'; import { ABOUT_MODALS_VIEWPORT_WIDTH } from './utils/constants/e2e.constants'; import { HomepageLoggedOut } from './utils/pages/homepage.page'; -export const ABOUT_WHAT_MODAL_VIEWPORT_HEIGHT = 930; +const ABOUT_WHAT_MODAL_VIEWPORT_HEIGHT = 930; test('should display about-what modal', async ({ page }) => { const homepageLoggedOut = new HomepageLoggedOut({ page }); - await homepageLoggedOut.takeModalSnapshot({ + await homepageLoggedOut.testModalSnapshot({ viewportSize: { width: ABOUT_MODALS_VIEWPORT_WIDTH, height: ABOUT_WHAT_MODAL_VIEWPORT_HEIGHT diff --git a/e2e/utils/pages/homepage.page.ts b/e2e/utils/pages/homepage.page.ts index 5dbaca26bb..0a47d30990 100644 --- a/e2e/utils/pages/homepage.page.ts +++ b/e2e/utils/pages/homepage.page.ts @@ -4,6 +4,7 @@ import { TOKENS_SKELETONS_INITIALIZED } from '$lib/constants/test-ids.constant'; import { type InternetIdentityPage } from '@dfinity/internet-identity-playwright'; +import { nonNullish } from '@dfinity/utils'; import { expect, type Locator, type Page, type ViewportSize } from '@playwright/test'; import { HOMEPAGE_URL, LOCAL_REPLICA_URL } from '../constants/e2e.constants'; @@ -20,7 +21,7 @@ type WaitForModalParams = { modalTestId: string; }; -type TakeModalSnapshotParams = { +type TestModalSnapshotParams = { viewportSize?: ViewportSize; } & WaitForModalParams; @@ -66,12 +67,12 @@ abstract class Homepage { await this.#page.getByTestId(TOKENS_SKELETONS_INITIALIZED).waitFor(); } - async takeModalSnapshot({ + async testModalSnapshot({ viewportSize, modalOpenButtonTestId, modalTestId - }: TakeModalSnapshotParams): Promise { - if (viewportSize) { + }: TestModalSnapshotParams): Promise { + if (nonNullish(viewportSize)) { await this.setViewportSize(viewportSize); }