Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 29 additions & 15 deletions apps/desktop/tests/e2e/calendar-comprehensive.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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) {
Expand Down Expand Up @@ -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)
})

Expand All @@ -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()
})
})

Expand All @@ -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)
Expand Down
13 changes: 7 additions & 6 deletions apps/desktop/tests/e2e/calendar.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand Down
7 changes: 6 additions & 1 deletion apps/desktop/tests/e2e/tags-rename-delete.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ async function openTagDrilldown(page, tag: string): Promise<void> {
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)', () => {
Expand Down
Loading