Skip to content

Commit

Permalink
test(demo-playwright): tests for addon-mobile (#5697)
Browse files Browse the repository at this point in the history
Co-authored-by: Vidhi Rambhia <[email protected]>
Co-authored-by: Nikita Barsukov <[email protected]>
Co-authored-by: VidhiRambhia <[email protected]>
Co-authored-by: Maksim Ivanov <[email protected]>
  • Loading branch information
5 people authored Oct 20, 2023
1 parent 408947e commit 1ecdd83
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 29 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import {TuiDocumentationPagePO, tuiGoto} from '@demo-playwright/utils';
import {expect, test} from '@playwright/test';

test.describe(`MobileCalendar`, () => {
test.use({viewport: {width: 400, height: 812}});

test(`works`, async ({page}) => {
await tuiGoto(page, `components/mobile-calendar`);
const example = new TuiDocumentationPagePO(page).getExample(`#dropdown`);
const chooseDateButton = example
.locator(`tui-mobile-calendar-example-1 button`)
.first();

await chooseDateButton.click();
await expect(example).toHaveScreenshot(`01-mobile-calendar.png`);
});

test(`check disabled state`, async ({page}) => {
await tuiGoto(page, `components/mobile-calendar/API?tuiMode=null&max$=1`);
const {apiPageExample} = new TuiDocumentationPagePO(page);

await apiPageExample.scrollIntoViewIfNeeded();
await expect(page).toHaveScreenshot(`01-mobile-calendar-disabled.png`, {
mask: [page.locator(`tui-mobile-calendar`)],
});
});

test(`check enabled state`, async ({page}) => {
await tuiGoto(page, `components/mobile-calendar/API?tuiMode=null&max$=0`);
const {apiPageExample} = new TuiDocumentationPagePO(page);

await apiPageExample.scrollIntoViewIfNeeded();
await expect(page).toHaveScreenshot(`01-mobile-calendar-enabled.png`, {
mask: [page.locator(`tui-mobile-calendar`)],
});
});
});

0 comments on commit 1ecdd83

Please sign in to comment.