Skip to content

Commit

Permalink
chore: slow operations on deep tests
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode committed Dec 13, 2024
1 parent 9ec1e7b commit ba6713a
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 21 deletions.
1 change: 0 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ jobs:
needs: [build-demo]
strategy:
fail-fast: false
max-parallel: 9
matrix:
shard: [
# Safari
Expand Down
4 changes: 0 additions & 4 deletions projects/demo-playwright/tests/deep/deep-select.pw.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ test.describe('Deep / Select', () => {
await expect(select).toBeVisible();

await select.click();
await api.waitTuiIcons();

const options = await api.getOptions();

Expand All @@ -47,14 +46,12 @@ test.describe('Deep / Select', () => {
await api.focusOnBody();
await api.hideNotifications();
await api.waitStableState();
await api.waitTuiIcons();

await expect(api.apiPageExample).toHaveScreenshot(
`deep-${path}-${name}-row—${rowIndex}-select-option-${index}.png`,
);

await select.click();
await api.waitTuiIcons();
}

const cleaner = await api.getCleaner(select);
Expand All @@ -69,7 +66,6 @@ test.describe('Deep / Select', () => {

await api.waitStableState();
await api.focusOnBody();
await api.waitTuiIcons();
}
}),
);
Expand Down
2 changes: 0 additions & 2 deletions projects/demo-playwright/tests/deep/deep-toggle.pw.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ test.describe('Deep / Toggle', () => {
await expect(toggle).toBeVisible();

await toggle.click();
await api.waitTuiIcons();
await api.hideNotifications();
await api.waitStableState();
await page.waitForTimeout(100);
Expand All @@ -41,7 +40,6 @@ test.describe('Deep / Toggle', () => {
);

await toggle.click();
await api.waitTuiIcons();
}
}),
);
Expand Down
4 changes: 2 additions & 2 deletions projects/demo-playwright/tests/demo/demo.pw.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ test.describe('Demo', () => {
const demoPaths: string[] = JSON.parse(process.env['DEMO_PATHS']!);

demoPaths.forEach((path) => {
test(`${path}`, async ({page}) => {
test(`${path}`, async ({page, browserName}) => {
const documentation = new TuiDocumentationPagePO(page);

await tuiMockImages(page);
Expand All @@ -29,7 +29,7 @@ test.describe('Demo', () => {

for (const [i, example] of examples.entries()) {
// eslint-disable-next-line playwright/no-conditional-in-test
if (tuiIsFlakyExample(path, i)) {
if (tuiIsFlakyExample(path, i, browserName)) {
continue;
}

Expand Down
39 changes: 27 additions & 12 deletions projects/demo-playwright/utils/is-flaky-examples.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@
import {DemoRoute} from '@demo/routes';

const FLAKY_EXAMPLES = new Map<string, number[]>([
const FLAKY_EXAMPLES = new Map<
string,
Array<{exampleIndex: number; browserName?: string}>
>([
[DemoRoute.AppBar, [{exampleIndex: 0, browserName: 'webkit'}]], // Flaky in safari, need to investigate a problem
[DemoRoute.Carousel, [{exampleIndex: 2, browserName: 'webkit'}]], // Flaky in safari, need to investigate a problem
[
DemoRoute.Carousel,
[
0, // [duration]="4000"
3, // just button (to open dialog)
{exampleIndex: 0}, // [duration]="4000"
{exampleIndex: 3}, // just button (to open dialog)
],
],
[DemoRoute.IconsCustomization, [0]], // TODO: investigate flaky test
[DemoRoute.MultiSelect, [3]], // Imitating server response (timer(5000))
[DemoRoute.Select, [4]], // Imitating server response (delay(3000))
[DemoRoute.Stepper, [2]], // TODO: flaky test for proprietary demo (autoscroll problems)
[DemoRoute.TabBar, [3]], // Imitating server response (timer(3000))
[DemoRoute.Table, [3, 4]], // Imitating server response (delay(3000)) and virtual scroll
[DemoRoute.Tiles, [0]], // YouTube iframe player
[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.RingChart, [{exampleIndex: 0, browserName: 'webkit'}]], // Flaky in safari, need to investigate a problem
[DemoRoute.Select, [{exampleIndex: 4}]], // Imitating server response (delay(3000))
[DemoRoute.Stepper, [{exampleIndex: 2}]], // TODO: flaky test for proprietary demo (autoscroll problems)
[DemoRoute.TabBar, [{exampleIndex: 3}]], // Imitating server response (timer(3000))
[DemoRoute.Table, [{exampleIndex: 3}, {exampleIndex: 4}]], // Imitating server response (delay(3000)) and virtual scroll
[DemoRoute.Tiles, [{exampleIndex: 0}]], // YouTube iframe player
]);

export function tuiIsFlakyExample(path: string, exampleIndex: number): boolean {
export function tuiIsFlakyExample(
path: string,
exampleIndex: number,
browserName: string,
): boolean {
const exclusions = FLAKY_EXAMPLES.get(path) ?? [];

const excluded = !!exclusions?.includes(exampleIndex);
const excluded = !!exclusions.find(
(exclusion) =>
exclusion.exampleIndex === exampleIndex &&
(exclusion.browserName ? exclusion.browserName === browserName : true),
);

if (excluded) {
console.info(`skip test for: ${path}[${exampleIndex}]`);
Expand Down

0 comments on commit ba6713a

Please sign in to comment.