Skip to content

Commit

Permalink
chore: update @taiga-ui/* deps to v0.235.3
Browse files Browse the repository at this point in the history
  • Loading branch information
taiga-family-bot authored and splincode committed Dec 16, 2024
1 parent 9ba8fb1 commit 449d697
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ test.describe('DropdownSelection', () => {
const example = api.getExample('#textarea');

await example.scrollIntoViewIfNeeded();
await api.waitStableState();
await page.waitForTimeout(500); // flaky in Safari

await example.locator('textarea').focus();
await page.keyboard.press('Control+ArrowLeft');
await api.waitStableState();
await page.waitForTimeout(300); // flaky in Safari

await expect(page).toHaveScreenshot('01-dropdown-selection.png');

Expand All @@ -25,14 +26,12 @@ test.describe('DropdownSelection', () => {
await page.keyboard.press('ArrowRight');
await page.keyboard.press('ArrowRight');
await api.waitStableState();
await page.waitForTimeout(300); // flaky in Safari

await expect(page).toHaveScreenshot('02-dropdown-selection.png');

await example.locator('textarea').fill('');
await example.locator('textarea').fill('@');
await api.waitStableState();
await page.waitForTimeout(300); // flaky in Safari

await expect(page).toHaveScreenshot('03-dropdown-selection.png');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,12 @@ test.describe('ComboBox', () => {
test(`search shouldn't be reset if an exact match is entered when strict is ${strict}`, async ({
page,
}) => {
const {apiPageExample} = new TuiDocumentationPagePO(page);
const documentationPagePO = new TuiDocumentationPagePO(page);

const comboBoxPO = new TuiComboBoxPO(apiPageExample);
const comboBoxPO = new TuiComboBoxPO(documentationPagePO.apiPageExample);
const textfield = comboBoxPO.textfield.first();

await tuiGoto(
page,
`components/combo-box/API?strict=${strict}&sandboxExpanded=true`,
);
await documentationPagePO.waitTuiIcons();

await expect(page).toHaveScreenshot(
`search-should-not-be-reset-strict-${strict}.png`,
Expand Down
16 changes: 13 additions & 3 deletions projects/demo-playwright/tests/legacy/select/select.pw.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DemoRoute} from '@demo/routes';
import {TuiDocumentationPagePO, tuiGoto} from '@demo-playwright/utils';
import {TuiDocumentationPagePO, tuiGoto, waitIcons} from '@demo-playwright/utils';
import {expect, test} from '@playwright/test';

import {TuiSelectPO} from '../../../utils/page-objects/select.po';
Expand All @@ -14,25 +14,35 @@ test.describe('Select', () => {
documentationPage = new TuiDocumentationPagePO(page);
});

test('checkmark size', async () => {
test('checkmark size', async ({page}) => {
const example = documentationPage.getExample('#template');
const select = new TuiSelectPO(example.locator('tui-select').first());

await select.textfield.click();

await expect(select.dropdown).toBeVisible();

await waitIcons({
page,
icons: await example.locator('tui-icon >> visible=true').all(),
});

await expect(example).toHaveScreenshot('01-checkmark-size.png');
});

test('opens dropdown by click on icon', async () => {
test('opens dropdown by click on icon', async ({page}) => {
const example = documentationPage.getExample('#base');
const select = new TuiSelectPO(example.locator('tui-select').last());

await select.textfield.click({position: {x: 200, y: 30}});

await expect(select.dropdown).toBeVisible();

await waitIcons({
page,
icons: await example.locator('tui-icon >> visible=true').all(),
});

await expect(select.dropdown).toHaveScreenshot('01-click-arrow.png');
});
});
Expand Down
8 changes: 8 additions & 0 deletions projects/demo-playwright/utils/goto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {expect} from '@playwright/test';
import {tuiRemoveElement} from './hide-element';
import {tuiMockDate} from './mock-date';
import {tuiWaitForFonts} from './wait-for-fonts';
import {waitIcons} from './wait-icons';
import {waitStableState} from './wait-stable-state';

interface TuiGotoOptions extends NonNullable<Parameters<Page['goto']>[1]> {
Expand Down Expand Up @@ -62,6 +63,13 @@ export async function tuiGoto(
await page.waitForLoadState('domcontentloaded');
await page.waitForLoadState('load');
await expect(app).toHaveClass(/_loaded/, {timeout: 30_000});

await waitIcons({
page,
timeout: 100,
icons: await page.locator('tui-icon >> visible=true').all(),
});

await tuiWaitForFonts(page);
await waitStableState(app);

Expand Down
1 change: 1 addition & 0 deletions projects/demo-playwright/utils/is-flaky-examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const FLAKY_EXAMPLES = new Map<
[DemoRoute.IconsCustomization, [{exampleIndex: 0}]], // TODO: investigate flaky test
[DemoRoute.LegendItem, [{exampleIndex: 0, browserName: 'webkit'}]], // Flaky in safari, need to investigate a problem
[DemoRoute.MultiSelect, [{exampleIndex: 3}]], // Imitating server response (timer(5000))
[DemoRoute.Navigation, [{exampleIndex: 1, browserName: 'webkit'}]],
[
DemoRoute.RingChart,
[
Expand Down
5 changes: 3 additions & 2 deletions projects/demo-playwright/utils/wait-icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ interface Options {
page: Page;
icons: Locator[];
cache?: Set<string>;
timeout?: number;
}

export async function waitIcons(options: Options): Promise<void> {
const {page, icons, cache = new Set()} = options;
const {page, icons, cache = new Set(), timeout = 300} = options;

// eslint-disable-next-line @taiga-ui/experience/no-simple-for-of
for (const icon of icons) {
Expand All @@ -28,7 +29,7 @@ export async function waitIcons(options: Options): Promise<void> {

if (url.endsWith('.svg') && !cache.has(url)) {
try {
const response = await page.waitForResponse(url, {timeout: 500});
const response = await page.waitForResponse(url, {timeout});

await response.finished();
} catch {
Expand Down

0 comments on commit 449d697

Please sign in to comment.