Skip to content

Commit

Permalink
test(e2e): update about modals e2e tests implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
DenysKarmazynDFINITY committed Aug 22, 2024
1 parent 54a57f3 commit 20bf618
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions e2e/about-how-modal.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions e2e/about-what-modal.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions e2e/utils/pages/homepage.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -20,7 +21,7 @@ type WaitForModalParams = {
modalTestId: string;
};

type TakeModalSnapshotParams = {
type TestModalSnapshotParams = {
viewportSize?: ViewportSize;
} & WaitForModalParams;

Expand Down Expand Up @@ -66,12 +67,12 @@ abstract class Homepage {
await this.#page.getByTestId(TOKENS_SKELETONS_INITIALIZED).waitFor();
}

async takeModalSnapshot({
async testModalSnapshot({
viewportSize,
modalOpenButtonTestId,
modalTestId
}: TakeModalSnapshotParams): Promise<void> {
if (viewportSize) {
}: TestModalSnapshotParams): Promise<void> {
if (nonNullish(viewportSize)) {
await this.setViewportSize(viewportSize);
}

Expand Down

0 comments on commit 20bf618

Please sign in to comment.