Skip to content

Commit

Permalink
chore: add e2e test for layout navigation (#8963)
Browse files Browse the repository at this point in the history
Co-authored-by: taiga-family-bot <[email protected]>
  • Loading branch information
splincode and taiga-family-bot authored Sep 11, 2024
1 parent 54d6363 commit caab33f
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
2 changes: 2 additions & 0 deletions projects/cdk/constants/used-icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export const TUI_USED_ICONS = [
'@tui.chevron-right',
'@tui.chevron-left',
'@tui.calendar',
'@tui.settings',
'@tui.heart',
'@tui.minus',
'@tui.file',
'@tui.trash',
Expand Down
2 changes: 1 addition & 1 deletion projects/demo-playwright/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"e2e-ui": {
"executor": "nx:run-commands",
"options": {
"command": "nx e2e {projectName} -- --ui --debug"
"command": "nx e2e {projectName} -- --ui --debug --update-snapshots"
}
}
}
Expand Down
50 changes: 50 additions & 0 deletions projects/demo-playwright/tests/layout/navigation.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import {DemoRoute} from '@demo/routes';
import {TuiDocumentationPagePO, tuiGoto} from '@demo-playwright/utils';
import {expect, test} from '@playwright/test';

test.describe('Navigation', () => {
test('Show settings in aside', async ({page}) => {
await tuiGoto(page, DemoRoute.Navigation);
const example = new TuiDocumentationPagePO(page).getExample('#full');

await example.scrollIntoViewIfNeeded();

await expect(example).toHaveScreenshot('01-navigation.png');

await example.locator('aside [iconStart="@tui.settings"]').hover();

await expect(example).toHaveScreenshot('02-navigation.png');
});

test('Show hint in aside', async ({page}) => {
await tuiGoto(page, DemoRoute.Navigation);
const example = new TuiDocumentationPagePO(page).getExample('#full');

await example.scrollIntoViewIfNeeded();

await example.locator('aside [iconStart="@tui.heart"]').hover();

await expect(example).toHaveScreenshot('03-navigation.png');
});

test('A12y', async ({page}) => {
await tuiGoto(page, DemoRoute.Navigation);
const example = new TuiDocumentationPagePO(page).getExample('#full');

await example.scrollIntoViewIfNeeded();
await example.locator('aside footer button').nth(1).click();

await expect(example).toHaveScreenshot('04-navigation.png');

await example.locator('aside [iconStart="@tui.settings"]').focus();
await page.keyboard.press('Enter');

await expect(example).toHaveScreenshot('05-navigation.png');

await example.locator('aside [iconStart="@tui.heart"]').focus();
await page.keyboard.press('Tab');
await page.keyboard.press('Space');

await expect(example).toHaveScreenshot('06-navigation.png');
});
});

0 comments on commit caab33f

Please sign in to comment.