-
Notifications
You must be signed in to change notification settings - Fork 475
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(demo-playwright): tests for addon-mobile (#5697)
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
1 parent
408947e
commit 1ecdd83
Showing
2 changed files
with
37 additions
and
29 deletions.
There are no files selected for viewing
29 changes: 0 additions & 29 deletions
29
projects/demo-cypress/cypress/tests/addon-mobile/mobile-calendar/mobile-calendar.cy.ts
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
projects/demo-playwright/tests/addon-mobile/mobile-calendar/mobile-calendar.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`)], | ||
}); | ||
}); | ||
}); |