Skip to content

Commit

Permalink
chore: update dependency lint-staged to v15.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
taiga-family-bot authored and splincode committed Jan 3, 2025
1 parent 5171c2e commit fc14465
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 47 deletions.
24 changes: 5 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
"@types/webpack-env": "1.18.5",
"cpy-cli": "5.0.0",
"husky": "9.1.7",
"lint-staged": "15.2.11",
"lint-staged": "15.3.0",
"ng-morph": "4.8.4",
"ng-packagr": "16.2.3",
"ngx-highlightjs": "10.0.0",
Expand Down
35 changes: 14 additions & 21 deletions projects/demo-playwright/tests/core/data-list/data-list.pw.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ import {DemoRoute} from '@demo/routes';
import {TuiDocumentationPagePO, tuiGoto} from '@demo-playwright/utils';
import {expect, test} from '@playwright/test';

import {scrollToExample} from '../../../utils/scroll-to-example';

test.describe('DataList', () => {
test('Custom list', async ({page}) => {
await tuiGoto(page, DemoRoute.DataList);

const documentationPagePO = new TuiDocumentationPagePO(page);
const example = documentationPagePO.getExample('#custom');

await example.scrollIntoViewIfNeeded();
await scrollToExample(page, example);
await example.locator('tui-select').click();
await page.locator('tui-dropdown [tuiOption]').nth(0).hover();

Expand All @@ -21,7 +23,7 @@ test.describe('DataList', () => {
const documentationPagePO = new TuiDocumentationPagePO(page);
const example = documentationPagePO.getExample('#links');

await example.scrollIntoViewIfNeeded();
await scrollToExample(page, example);
await example.locator('[tuiDropdownOpen]').click();
await page.locator('tui-dropdown [tuiOption]').nth(0).hover();
await page.waitForTimeout(300);
Expand All @@ -42,7 +44,7 @@ test.describe('DataList', () => {
const documentationPagePO = new TuiDocumentationPagePO(page);
const example = documentationPagePO.getExample('#submenu');

await example.scrollIntoViewIfNeeded();
await scrollToExample(page, example);
await documentationPagePO.prepareBeforeScreenshot();

await example.locator('button').click();
Expand Down Expand Up @@ -93,40 +95,29 @@ test.describe('DataList', () => {
await expect(page).toHaveScreenshot('03-8-data-list.png');
});

test('Form control', async ({page, browserName}) => {
test.skip(
browserName !== 'chromium',
// TODO: why does this test keep failing in safari
'This feature is only relevant in Chrome',
);

test('Form control', async ({page}) => {
await tuiGoto(page, DemoRoute.DataList);

const documentationPagePO = new TuiDocumentationPagePO(page);
const example = documentationPagePO.getExample('#control');

await example.scrollIntoViewIfNeeded();
await scrollToExample(page, example);
await example.locator('button').first().click();
await documentationPagePO.prepareBeforeScreenshot();

await expect(page.locator('tui-dropdown')).toHaveScreenshot('04-data-list.png');
});

test('Complex', async ({page, browserName}) => {
test.skip(
browserName !== 'chromium',
// TODO: check later
'This feature is only relevant in Chrome',
);

test('Complex', async ({page}) => {
await page.setViewportSize({width: 1400, height: 500});
await tuiGoto(page, DemoRoute.DataList);

const documentationPagePO = new TuiDocumentationPagePO(page);
const example = documentationPagePO.getExample('#complex');

await example.scrollIntoViewIfNeeded();
await scrollToExample(page, example);
await example.locator('button').click();

await documentationPagePO.hideContent();
await documentationPagePO.prepareBeforeScreenshot();

await expect(page).toHaveScreenshot('05-data-list.png');
Expand Down Expand Up @@ -181,8 +172,10 @@ test.describe('DataList', () => {
const documentationPagePO = new TuiDocumentationPagePO(page);
const example = documentationPagePO.getExample('#long-text-options');

await example.scrollIntoViewIfNeeded();
await scrollToExample(page, example);
await example.locator('button').click();

await documentationPagePO.hideContent();
await documentationPagePO.prepareBeforeScreenshot();

await expect(page).toHaveScreenshot('10-data-list.png');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DemoRoute} from '@demo/routes';
import {tuiGoto} from '@demo-playwright/utils';
import {TuiDocumentationApiPagePO, tuiGoto} from '@demo-playwright/utils';
import {expect, test} from '@playwright/test';

import {
Expand All @@ -19,18 +19,26 @@ test.describe('ActionBar', () => {

test('works', async ({page}) => {
await tuiGoto(page, DemoRoute.ActionBar);

const api = new TuiDocumentationApiPagePO(page);
const example = page.locator('#size--m');
const showActionBarButton = example.locator('label').first();

await showActionBarButton.click();
const actionBarExample = page.locator('tui-action-bar');

await api.hideContent();
await api.prepareBeforeScreenshot();

await expect(actionBarExample).toHaveScreenshot('01-actions-bar-mobile.png');

const more = actionBarExample.locator('button:has-text("More")');

await more.click();

await api.hideContent();
await api.prepareBeforeScreenshot();

await expect(actionBarExample).toHaveScreenshot(
'01-action-bar-mobile-expanded.png',
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DemoRoute} from '@demo/routes';
import {tuiGoto} from '@demo-playwright/utils';
import {TuiDocumentationApiPagePO, tuiGoto} from '@demo-playwright/utils';
import {expect, test} from '@playwright/test';

test.describe('ActionBar', () => {
Expand All @@ -9,23 +9,33 @@ test.describe('ActionBar', () => {

test('works', async ({page}) => {
await tuiGoto(page, DemoRoute.ActionBar);

const api = new TuiDocumentationApiPagePO(page);
const example = page.locator('#size--m');
const showActionBarButton = example.locator('label').first();

await showActionBarButton.click();
const actionBarExample = page.locator('tui-action-bar');

await api.hideContent();
await api.prepareBeforeScreenshot();

await expect(actionBarExample).toHaveScreenshot('01-actions-bar.png');
});

test('should show on top', async ({page}) => {
await tuiGoto(page, DemoRoute.ActionBar);

const api = new TuiDocumentationApiPagePO(page);
const example = page.locator('#top-position');
const showActionBarButton = example.getByTestId('open-table-bar-on-top').first();

await showActionBarButton.click();
const actionBarExample = page.locator('tui-action-bar');

await api.hideContent();
await api.prepareBeforeScreenshot();

await expect(actionBarExample).toHaveScreenshot('02-actions-bar.png');
});
});
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import {DemoRoute} from '@demo/routes';
import {TuiComboBoxPO, TuiDocumentationPagePO, tuiGoto} from '@demo-playwright/utils';
import {
TuiComboBoxPO,
TuiDocumentationPagePO,
tuiGoto,
waitIcons,
} from '@demo-playwright/utils';
import {expect, test} from '@playwright/test';

import {scrollToExample} from '../../../utils/scroll-to-example';

test.describe('ComboBox', () => {
test.use({viewport: {width: 500, height: 500}});

Expand All @@ -12,8 +19,7 @@ test.describe('ComboBox', () => {
const example = documentationPage.getExample('#ignore-disabled');
const input = example.locator('tui-combo-box input[tuiTextfieldLegacy]');

await example.scrollIntoViewIfNeeded();
await page.waitForTimeout(300); // safari flaky
await scrollToExample(page, example);
await input.click();

await expect(page).toHaveScreenshot('01-combobox-dont-allow-disabled-01.png');
Expand All @@ -23,6 +29,7 @@ test.describe('ComboBox', () => {
await expect(page).toHaveScreenshot('01-combobox-dont-allow-disabled-02.png');

await page.click('body');
await scrollToExample(page, example);

await expect(page).toHaveScreenshot('01-combobox-dont-allow-disabled-03.png');

Expand All @@ -46,7 +53,10 @@ test.describe('ComboBox', () => {
const comboBoxPO = new TuiComboBoxPO(apiPageExample);
const textfield = comboBoxPO.textfield.first();

await page.waitForTimeout(300); // safari flaky
await waitIcons({
page,
icons: await page.locator('tui-icon >> visible=true').all(),
});

await expect(page).toHaveScreenshot(
`search-should-not-be-reset-strict-${strict}.png`,
Expand Down
10 changes: 10 additions & 0 deletions projects/demo-playwright/utils/scroll-to-example.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type {Locator, Page} from '@playwright/test';

export async function scrollToExample(page: Page, example: Locator): Promise<void> {
await page.evaluate(
(view) => window.scrollTo({top: view?.y, behavior: 'auto'}),
await example.boundingBox(),
);

await page.waitForTimeout(500); // flaky
}

0 comments on commit fc14465

Please sign in to comment.