From 42b0d65352df9b0102e1dc400a133b16e040319d Mon Sep 17 00:00:00 2001 From: Johannes Millan Date: Fri, 9 Jan 2026 18:28:18 +0100 Subject: [PATCH] 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 --- e2e/utils/sync-helpers.ts | 6 ++--- e2e/utils/tour-helpers.ts | 46 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/e2e/utils/sync-helpers.ts b/e2e/utils/sync-helpers.ts index 721ebc3a9..461393789 100644 --- a/e2e/utils/sync-helpers.ts +++ b/e2e/utils/sync-helpers.ts @@ -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 diff --git a/e2e/utils/tour-helpers.ts b/e2e/utils/tour-helpers.ts index 58a114a68..3d2c4b99f 100644 --- a/e2e/utils/tour-helpers.ts +++ b/e2e/utils/tour-helpers.ts @@ -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 => { + 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 => { +export const dismissShepherdTour = async (page: Page): Promise => { 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 => { // 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 => { + // First, dismiss the welcome intro dialog if present + await dismissWelcomeDialog(page); + + // Then, dismiss the Shepherd tour if it appears + await dismissShepherdTour(page); +};