-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(demo-playwright): test for navigation (#6144)
Co-authored-by: Nikita Barsukov <[email protected]> Co-authored-by: Atharv Chandratre <[email protected]>
- Loading branch information
1 parent
aa77105
commit 61f84b7
Showing
3 changed files
with
74 additions
and
43 deletions.
There are no files selected for viewing
43 changes: 0 additions & 43 deletions
43
projects/demo-cypress/cypress/tests/addon-doc/navigation.cy.ts
This file was deleted.
Oops, something went wrong.
53 changes: 53 additions & 0 deletions
53
projects/demo-playwright/tests/addon-doc/navigation.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,53 @@ | ||
import {tuiGoto} from '@demo-playwright/utils'; | ||
import {expect, test} from '@playwright/test'; | ||
|
||
test.describe(`Navigation`, () => { | ||
test.use({viewport: {width: 1080, height: 600}}); | ||
test(`getting started / [light mode]`, async ({page}) => { | ||
await tuiGoto(page, `/getting-started`, { | ||
hideHeader: false, | ||
hideLanguageSwitcher: true, | ||
hideVersionManager: true, | ||
}); | ||
const sideNavigation = page.locator(`tui-doc-navigation`); | ||
|
||
await sideNavigation.isVisible(); | ||
await expect(sideNavigation).toHaveScreenshot( | ||
`01-tui-doc-navigation-light-mode.png`, | ||
); | ||
}); | ||
|
||
test(`getting started / [night mode]`, async ({page}) => { | ||
await tuiGoto(page, `/getting-started`, { | ||
hideHeader: false, | ||
enableNightMode: true, | ||
hideLanguageSwitcher: true, | ||
hideVersionManager: true, | ||
}); | ||
const sideNavigation = page.locator(`tui-doc-navigation`); | ||
|
||
await sideNavigation.isVisible(); | ||
await expect(sideNavigation).toHaveScreenshot( | ||
`02-tui-doc-navigation-night-mode.png`, | ||
); | ||
}); | ||
|
||
test.describe(`anchor links navigation works`, () => { | ||
test(`scroll to "tui-doc-example"`, async ({page}) => { | ||
await tuiGoto(page, `/components/input#table`); | ||
await expect(page.locator(`#table`)).toBeInViewport(); | ||
}); | ||
|
||
test(`scroll to "tui-doc-code"`, async ({page}) => { | ||
await tuiGoto(page, `/getting-started#icons`); | ||
await expect(page.locator(`#icons`)).toBeVisible(); | ||
await expect(page.locator(`#icons`)).toBeInViewport(); | ||
}); | ||
|
||
test(`scroll after click on link with anchor`, async ({page}) => { | ||
await tuiGoto(page, `/getting-started`); | ||
await page.locator(`a[fragment="root"]`).click(); | ||
await expect(page.locator(`#root`)).toBeInViewport(); | ||
}); | ||
}); | ||
}); |
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