test(e2e): fix failing tests by suppressing onboarding and example tasks

Set localStorage flags (onboarding preset, hints, tour, example tasks)
via addInitScript before app boots, preventing onboarding overlays and
example tasks from interfering with e2e tests. Also switch archive
import/subtask specs to use the shared test fixture for proper isolation.
This commit is contained in:
Johannes Millan 2026-03-22 21:20:09 +01:00
parent ab10637e7d
commit 1cf7cffa8e
4 changed files with 19 additions and 5 deletions

View file

@ -50,6 +50,15 @@ export const test = base.extend<TestFixtures>({
page: async ({ isolatedContext }, use) => {
const page = await isolatedContext.newPage();
// Skip onboarding, hints, and example tasks before the app boots.
// This runs before any page JavaScript, so Angular sees the flags immediately.
await page.addInitScript(() => {
localStorage.setItem('SUP_ONBOARDING_PRESET_DONE', 'true');
localStorage.setItem('SUP_ONBOARDING_HINTS_DONE', 'true');
localStorage.setItem('SUP_IS_SHOW_TOUR', 'true');
localStorage.setItem('SUP_EXAMPLE_TASKS_CREATED', 'true');
});
try {
// Always log uncaught page errors — they are almost always test-relevant
page.on('pageerror', (error) => {

View file

@ -1,4 +1,5 @@
import { test, expect, type Page, type Download } from '@playwright/test';
import { test, expect } from '../../fixtures/test.fixture';
import { type Page, type Download } from '@playwright/test';
import { ImportPage } from '../../pages/import.page';
import * as fs from 'fs';

View file

@ -1,4 +1,5 @@
import { test, expect, type Page, type Download } from '@playwright/test';
import { test, expect } from '../../fixtures/test.fixture';
import { type Page, type Download } from '@playwright/test';
import { ImportPage } from '../../pages/import.page';
import * as fs from 'fs';

View file

@ -66,9 +66,12 @@ const dismissOnboardingPresets = async (page: Page): Promise<void> => {
.then(() => true)
.catch(() => false);
if (isVisible) {
await page.evaluate(() =>
localStorage.setItem('SUP_ONBOARDING_PRESET_DONE', 'true'),
);
await page.evaluate(() => {
localStorage.setItem('SUP_ONBOARDING_PRESET_DONE', 'true');
localStorage.setItem('SUP_ONBOARDING_HINTS_DONE', 'true');
localStorage.setItem('SUP_IS_SHOW_TOUR', 'true');
localStorage.setItem('SUP_EXAMPLE_TASKS_CREATED', 'true');
});
await page.reload({ waitUntil: 'domcontentloaded' });
await page.waitForTimeout(500);
}