Skip to content

Commit

Permalink
chore(deps): update dependency @taiga-ui/eslint-plugin-experience to …
Browse files Browse the repository at this point in the history
…v0.45.0 (#6346)

Co-authored-by: splincode <[email protected]>
  • Loading branch information
taiga-family-bot and splincode authored Dec 27, 2023
1 parent cfbb5f8 commit 8d8695e
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 29 deletions.
3 changes: 2 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"retrowave",
"replicants",
"tuiiconbutton",
"hitbox"
"hitbox",
"domcontentloaded"
],
"ignoreRegExpList": ["\\(https?://.*?\\)", "\\/{1}.+\\/{1}", "\\%2F.+", "\\%2C.+", "\\ɵ.+", "\\ыва.+"],
"overrides": [
Expand Down
8 changes: 4 additions & 4 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 @@ -133,7 +133,7 @@
"@taiga-ui/browserslist-config": "0.4.0",
"@taiga-ui/commitlint-config": "0.5.0",
"@taiga-ui/cspell-config": "0.25.0",
"@taiga-ui/eslint-plugin-experience": "0.44.4",
"@taiga-ui/eslint-plugin-experience": "0.45.0",
"@taiga-ui/prettier-config": "0.7.0",
"@taiga-ui/stylelint-config": "0.12.4",
"@taiga-ui/tsconfig": "0.12.0",
Expand Down
2 changes: 1 addition & 1 deletion projects/demo-playwright/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default defineConfig({
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? '100%' : '50%',
use: {
baseURL: `http://localhost:${process.env.NG_SERVER_PORT || 3333}`,
Expand Down
49 changes: 27 additions & 22 deletions projects/demo-playwright/tests/deep/deep.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,48 +26,53 @@ test.describe('Deep', () => {
await tuiMockImages(page);
await tuiGoto(page, `${path}/API?sandboxWidth=320`);

const controls = await page.locator('.t-table .t-cell_value').all();
const rows = await page.locator('.t-table .t-row:not(.t-row_header)').all();

for (const [index, control] of controls.entries()) {
await control.scrollIntoViewIfNeeded();
for (const row of rows) {
const select = ((await row.locator('.t-cell_value tui-select').all()) ??
[])?.[0];
const toggle = ((await row.locator('.t-cell_value tui-toggles').all()) ??
[])?.[0];

const selects = (await control.locator('tui-select').all()) ?? [];
const name =
(await row.locator('.t-property code').textContent())?.trim() ?? '';

for (const [selectIndex, select] of selects.entries()) {
if (select) {
await select.scrollIntoViewIfNeeded();
await select.click();

const options = await page.locator('[tuiOption]').all();
const options = await page
.locator('[automation-id="tui-data-list-wrapper__option"]')
.all();
const defaultOptionIndex =
await getDefaultOptionOnApiControl(options);

for (const [optionIndex, option] of options.entries()) {
for (const [index, option] of options.entries()) {
await option.click();

await expect(page.locator('#demo-content')).toHaveScreenshot(
`deep-${path}-${index}-select-${selectIndex}-option-${optionIndex}.png`,
`deep-${path}__${name}-select-option-${index}.png`,
);

await select.click();
}

if (defaultOptionIndex !== null) {
await page.locator('[tuiOption]').nth(defaultOptionIndex).click();
const cleaner = ((await select
.locator('[automation-id="tui-primitive-textfield__cleaner"]')
.all()) ?? [])?.[0];

if (cleaner) {
await cleaner.click();
} else {
await select
.locator('[automation-id=tui-primitive-textfield__cleaner]')
.click();
await select.click();
await options[defaultOptionIndex]?.click();
}
}

await page.waitForTimeout(100); // flaky free

const toggles = (await control.locator('tui-toggle').all()) ?? [];

for (const [toggleIndex, toggle] of toggles.entries()) {
if (toggle) {
await toggle.scrollIntoViewIfNeeded();
await toggle.click();
await expect(page.locator('#demo-content')).toHaveScreenshot(
`deep-${path}-${index}-toggles-${toggleIndex}.png`,
`deep-${path}__${name}-toggled.png`,
);
await toggle.click();
}
Expand All @@ -76,7 +81,7 @@ test.describe('Deep', () => {
});
});

async function getDefaultOptionOnApiControl(options: Locator[]): Promise<number | null> {
async function getDefaultOptionOnApiControl(options: Locator[]): Promise<number> {
for (const [index, option] of options.entries()) {
const hasMark = await option
.locator('[automation-id=tui-select-option__checkmark]')
Expand All @@ -87,5 +92,5 @@ async function getDefaultOptionOnApiControl(options: Locator[]): Promise<number
}
}

return null;
return 0;
}
7 changes: 7 additions & 0 deletions projects/demo-playwright/utils/goto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ export async function tuiGoto(

const response = await page.goto(url, playwrightGotoOptions);

await page.waitForLoadState('domcontentloaded');
await page.waitForLoadState('load');

await expect(page.locator('app')).toHaveClass(/_loaded/, {timeout: 15_000});
await tuiWaitForFonts(page);

Expand All @@ -55,5 +58,9 @@ export async function tuiGoto(
await page.locator('tui-language-switcher').evaluate(el => el.remove());
}

expect(
await page.evaluate("matchMedia('(prefers-reduced-motion)').matches"),
).toBeTruthy();

return response;
}

0 comments on commit 8d8695e

Please sign in to comment.