From c75a99ef55c0bfd1ec6b5bbf33f137e092aab6f1 Mon Sep 17 00:00:00 2001 From: Kaan Karaca Date: Mon, 20 Apr 2026 11:55:57 +0300 Subject: [PATCH] fix(e2e): align calendar + tags tests with M7 redesign MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The full e2e suite surfaced 8 latent failures the PR-only-changed-tests strategy had been hiding: - Calendar editor labels drifted after the M7 popover redesign (heading "New Event" → "Create calendar event", button "Create Event" → "Create", "Save Changes" → "Save", title input lost its aria-label). Switched to the existing data-testid pattern (event-edit-popover, event-edit-save) that calendar-promote-external.e2e.ts already uses. - Centralized popover() and titleInput() helpers in CalendarPO so future label changes are one-line fixes. - Day-view chips overlap visually; even { force: true } routes the OS click to the overlay. Used dispatchEvent('click') in the rename test to send the click straight to the target chip. - Tag drilldown's "Go back" button collided with the disabled titlebar history nav (same aria-label). Filtered with :not([disabled]). Test-only changes; no source touched. All 15 specs in the touched files pass locally (48s). --- .../tests/e2e/calendar-comprehensive.e2e.ts | 44 ++++++++++++------- apps/desktop/tests/e2e/calendar.e2e.ts | 13 +++--- .../tests/e2e/tags-rename-delete.e2e.ts | 7 ++- 3 files changed, 42 insertions(+), 22 deletions(-) diff --git a/apps/desktop/tests/e2e/calendar-comprehensive.e2e.ts b/apps/desktop/tests/e2e/calendar-comprehensive.e2e.ts index ef005c9a5..d2178a976 100644 --- a/apps/desktop/tests/e2e/calendar-comprehensive.e2e.ts +++ b/apps/desktop/tests/e2e/calendar-comprehensive.e2e.ts @@ -61,9 +61,17 @@ class CalendarPO { await this.root().getByRole('button', { name: 'Today', exact: true }).click() } + popover() { + return this.page.getByTestId('event-edit-popover') + } + + titleInput() { + return this.popover().getByPlaceholder('New Event') + } + async openCreateDrawer() { await this.root().getByRole('button', { name: 'Create event' }).click() - await expect(this.page.getByRole('heading', { name: 'New Event' })).toBeVisible() + await expect(this.popover()).toBeVisible() } async openFilters() { @@ -77,11 +85,13 @@ class CalendarPO { allDay?: boolean }) { await this.openCreateDrawer() - await this.page.getByLabel('Title').fill(opts.title) - if (opts.description) await this.page.getByLabel('Description').fill(opts.description) - if (opts.location) await this.page.getByLabel('Location').fill(opts.location) - if (opts.allDay) await this.page.getByLabel('All day').check() - await this.page.getByRole('button', { name: 'Create Event' }).click() + await this.titleInput().fill(opts.title) + if (opts.description) + await this.popover().getByPlaceholder('Add notes or URL').fill(opts.description) + if (opts.location) await this.popover().getByPlaceholder('Add location').fill(opts.location) + if (opts.allDay) await this.popover().getByLabel('All day').check() + await this.popover().getByTestId('event-edit-save').click() + await expect(this.popover()).toBeHidden() } eventChip(title: string | RegExp) { @@ -215,10 +225,10 @@ test.describe('Calendar — comprehensive coverage', () => { await cal.open() await cal.openCreateDrawer() - await page.getByLabel('Title').fill(title) + await cal.titleInput().fill(title) await page.keyboard.press('Escape') - await expect(page.getByRole('heading', { name: 'New Event' })).toHaveCount(0) + await expect(cal.popover()).toHaveCount(0) await expect(cal.eventChip(title)).toHaveCount(0) }) @@ -227,10 +237,10 @@ test.describe('Calendar — comprehensive coverage', () => { await cal.open() await cal.openCreateDrawer() - await expect(page.getByRole('button', { name: 'Create Event' })).toBeDisabled() + await expect(cal.popover().getByTestId('event-edit-save')).toBeDisabled() - await page.getByLabel('Title').fill('Now valid') - await expect(page.getByRole('button', { name: 'Create Event' })).toBeEnabled() + await cal.titleInput().fill('Now valid') + await expect(cal.popover().getByTestId('event-edit-save')).toBeEnabled() }) }) @@ -251,11 +261,15 @@ test.describe('Calendar — comprehensive coverage', () => { await cal.switchView('Day') await cal.createEvent({ title: original }) - await cal.eventChip(original).first().click() - await expect(page.getByRole('heading', { name: 'Edit Event' })).toBeVisible() + // Day view stacks seeded + new chips at overlapping times; an external_event + // chip sits on top of ours at the same pixel. Even { force: true } would + // route the OS-level click to the overlay, so dispatch the event directly + // on our chip's DOM node. + await cal.eventChip(original).first().dispatchEvent('click') + await expect(cal.popover()).toHaveAttribute('aria-label', 'Edit calendar event') - await page.getByLabel('Title').fill(renamed) - await page.getByRole('button', { name: 'Save Changes' }).click() + await cal.titleInput().fill(renamed) + await cal.popover().getByTestId('event-edit-save').click() await expect(cal.eventChip(renamed).first()).toBeVisible() await expect(cal.eventChip(original)).toHaveCount(0) diff --git a/apps/desktop/tests/e2e/calendar.e2e.ts b/apps/desktop/tests/e2e/calendar.e2e.ts index 245916ed2..2f3b7c8ab 100644 --- a/apps/desktop/tests/e2e/calendar.e2e.ts +++ b/apps/desktop/tests/e2e/calendar.e2e.ts @@ -95,10 +95,11 @@ test.describe('Calendar milestone e2e', () => { await calendarPage.getByRole('button', { name: 'Day', exact: true }).click() await calendarPage.getByRole('button', { name: /Create event|New Event/i }).click() - await expect(page.getByRole('heading', { name: 'New Event' })).toBeVisible() + const popover = page.getByTestId('event-edit-popover') + await expect(popover).toBeVisible() - await page.getByLabel('Title').fill(eventTitle) - await page.getByRole('button', { name: 'Create Event' }).click() + await popover.getByPlaceholder('New Event').fill(eventTitle) + await popover.getByTestId('event-edit-save').click() await expect( calendarPage.getByRole('button', { name: new RegExp(eventTitle) }).first() ).toBeVisible() @@ -107,9 +108,9 @@ test.describe('Calendar milestone e2e', () => { .getByRole('button', { name: new RegExp(eventTitle) }) .first() .click() - await expect(page.getByRole('heading', { name: 'Edit Event' })).toBeVisible() - await page.getByLabel('Title').fill(renamedEventTitle) - await page.getByRole('button', { name: 'Save Changes' }).click() + await expect(popover).toHaveAttribute('aria-label', 'Edit calendar event') + await popover.getByPlaceholder('New Event').fill(renamedEventTitle) + await popover.getByTestId('event-edit-save').click() await expect( calendarPage.getByRole('button', { name: new RegExp(renamedEventTitle) }).first() ).toBeVisible() diff --git a/apps/desktop/tests/e2e/tags-rename-delete.e2e.ts b/apps/desktop/tests/e2e/tags-rename-delete.e2e.ts index 9f4bdd877..746e0a2ca 100644 --- a/apps/desktop/tests/e2e/tags-rename-delete.e2e.ts +++ b/apps/desktop/tests/e2e/tags-rename-delete.e2e.ts @@ -48,7 +48,12 @@ async function openTagDrilldown(page, tag: string): Promise { const tagTrigger = page.getByRole('button', { name: tag, exact: true }).first() await tagTrigger.waitFor({ state: 'visible', timeout: 15000 }) await tagTrigger.click() - await page.locator('button[aria-label="Go back"]').waitFor({ state: 'visible', timeout: 10000 }) + // The window-controls titlebar also has aria-label="Go back" but is permanently + // disabled. Filter to the enabled drilldown back button to avoid strict-mode + // violations. + await page + .locator('button[aria-label="Go back"]:not([disabled])') + .waitFor({ state: 'visible', timeout: 10000 }) } test.describe('Tag rename + delete (§5.2)', () => {