fix(e2e): dismiss Welcome intro dialog before Shepherd tour

The E2E tests were failing because dismissTourIfVisible only handled
the Shepherd tour steps, not the Welcome intro mat-dialog that appears
first. This dialog blocks UI interactions causing test timeouts.

Updated tour-helpers.ts to:
- Add dismissWelcomeDialog() for the intro dialog
- Add dismissShepherdTour() for the tour steps
- Update dismissTourIfVisible() to handle both in sequence
This commit is contained in:
Johannes Millan 2026-01-09 18:28:18 +01:00
parent cabe73177a
commit 42b0d65352
2 changed files with 48 additions and 4 deletions

View file

@ -6,11 +6,11 @@ import {
} from '@playwright/test';
import { expect } from '@playwright/test';
import { waitForAppReady } from './waits';
import { dismissTourIfVisible } from './tour-helpers';
import { dismissTourIfVisible, dismissWelcomeDialog } from './tour-helpers';
import type { SyncPage } from '../pages/sync.page';
// Re-export tour helper for convenience
export { dismissTourIfVisible };
// Re-export tour helpers for convenience
export { dismissTourIfVisible, dismissWelcomeDialog };
/**
* WebDAV configuration interface

View file

@ -1,10 +1,38 @@
import type { Page } from '@playwright/test';
/**
* Dismisses the Welcome intro dialog if present.
* This is the mat-dialog that appears before the Shepherd tour,
* asking "Do you want a quick tour of the most important features?"
*/
export const dismissWelcomeDialog = async (page: Page): Promise<void> => {
try {
// Look for the "No thanks" button or "Close Tour" button in the welcome dialog
const closeBtn = page.locator('button:has-text("No thanks")').first();
const closeTourBtn = page.locator('button:has-text("Close Tour")').first();
// Check if either button is visible (with short timeout)
const noThanksVisible = await closeBtn.isVisible().catch(() => false);
const closeTourVisible = await closeTourBtn.isVisible().catch(() => false);
if (noThanksVisible) {
await closeBtn.click();
// Wait for dialog to close
await page.waitForTimeout(300);
} else if (closeTourVisible) {
await closeTourBtn.click();
await page.waitForTimeout(300);
}
} catch {
// Dialog not present, ignore
}
};
/**
* Dismisses the Shepherd tour if it appears on the page.
* Silently ignores if tour doesn't appear.
*/
export const dismissTourIfVisible = async (page: Page): Promise<void> => {
export const dismissShepherdTour = async (page: Page): Promise<void> => {
try {
const tourElement = page.locator('.shepherd-element').first();
await tourElement.waitFor({ state: 'visible', timeout: 4000 });
@ -21,3 +49,19 @@ export const dismissTourIfVisible = async (page: Page): Promise<void> => {
// Tour didn't appear or wasn't dismissable, ignore
}
};
/**
* Dismisses both the Welcome intro dialog and the Shepherd tour if they appear.
* This handles the full tour dismissal flow:
* 1. First, dismiss the "Welcome to Super Productivity!" mat-dialog (if present)
* 2. Then, dismiss any Shepherd tour steps (if present)
*
* Silently ignores if neither appears.
*/
export const dismissTourIfVisible = async (page: Page): Promise<void> => {
// First, dismiss the welcome intro dialog if present
await dismissWelcomeDialog(page);
// Then, dismiss the Shepherd tour if it appears
await dismissShepherdTour(page);
};