|
|
|
@@ -43,7 +43,7 @@ test.describe('US1: Cancel RSVP from Event Detail View', () => {
|
|
|
|
await expect(statusBar).toBeVisible()
|
|
|
|
await expect(statusBar).toBeVisible()
|
|
|
|
|
|
|
|
|
|
|
|
// Cancel button hidden initially
|
|
|
|
// Cancel button hidden initially
|
|
|
|
await expect(page.getByRole('button', { name: 'Cancel attendance' })).not.toBeVisible()
|
|
|
|
await expect(page.getByRole('button', { name: 'Cancel RSVP' })).not.toBeVisible()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
test('tapping status bar reveals cancel button', async ({ page, network }) => {
|
|
|
|
test('tapping status bar reveals cancel button', async ({ page, network }) => {
|
|
|
|
@@ -57,7 +57,7 @@ test.describe('US1: Cancel RSVP from Event Detail View', () => {
|
|
|
|
await page.getByRole('button', { name: /You're attending/ }).click()
|
|
|
|
await page.getByRole('button', { name: /You're attending/ }).click()
|
|
|
|
|
|
|
|
|
|
|
|
// Cancel button appears
|
|
|
|
// Cancel button appears
|
|
|
|
await expect(page.getByRole('button', { name: 'Cancel attendance' })).toBeVisible()
|
|
|
|
await expect(page.getByRole('button', { name: 'Cancel RSVP' })).toBeVisible()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
test('confirm cancellation → localStorage cleared, count decremented, bar reset', async ({ page, network }) => {
|
|
|
|
test('confirm cancellation → localStorage cleared, count decremented, bar reset', async ({ page, network }) => {
|
|
|
|
@@ -70,13 +70,13 @@ test.describe('US1: Cancel RSVP from Event Detail View', () => {
|
|
|
|
await page.addInitScript(seedEvents([rsvpSeed()]))
|
|
|
|
await page.addInitScript(seedEvents([rsvpSeed()]))
|
|
|
|
await page.goto(`/events/${fullEvent.eventToken}`)
|
|
|
|
await page.goto(`/events/${fullEvent.eventToken}`)
|
|
|
|
|
|
|
|
|
|
|
|
// Expand → Cancel attendance → Confirm in dialog
|
|
|
|
// Expand → Cancel RSVP → Confirm in dialog
|
|
|
|
await page.getByRole('button', { name: /You're attending/ }).click()
|
|
|
|
await page.getByRole('button', { name: /You're attending/ }).click()
|
|
|
|
await page.locator('.rsvp-bar__cancel').click()
|
|
|
|
await page.locator('.rsvp-bar__cancel').click()
|
|
|
|
|
|
|
|
|
|
|
|
// Confirm dialog
|
|
|
|
// Confirm dialog
|
|
|
|
await expect(page.getByText('Your attendance will be permanently cancelled.')).toBeVisible()
|
|
|
|
await expect(page.getByText('The organizer will no longer see you as attending.')).toBeVisible()
|
|
|
|
await page.getByRole('alertdialog').getByRole('button', { name: 'Cancel attendance' }).click()
|
|
|
|
await page.getByRole('alertdialog').getByRole('button', { name: 'Cancel RSVP' }).click()
|
|
|
|
|
|
|
|
|
|
|
|
// Bar resets to CTA state
|
|
|
|
// Bar resets to CTA state
|
|
|
|
await expect(page.getByRole('button', { name: "I'm attending" })).toBeVisible()
|
|
|
|
await expect(page.getByRole('button', { name: "I'm attending" })).toBeVisible()
|
|
|
|
@@ -108,7 +108,7 @@ test.describe('US1: Cancel RSVP from Event Detail View', () => {
|
|
|
|
// Expand → Cancel → Confirm in dialog
|
|
|
|
// Expand → Cancel → Confirm in dialog
|
|
|
|
await page.getByRole('button', { name: /You're attending/ }).click()
|
|
|
|
await page.getByRole('button', { name: /You're attending/ }).click()
|
|
|
|
await page.locator('.rsvp-bar__cancel').click()
|
|
|
|
await page.locator('.rsvp-bar__cancel').click()
|
|
|
|
await page.getByRole('alertdialog').getByRole('button', { name: 'Cancel attendance' }).click()
|
|
|
|
await page.getByRole('alertdialog').getByRole('button', { name: 'Cancel RSVP' }).click()
|
|
|
|
|
|
|
|
|
|
|
|
// Error message
|
|
|
|
// Error message
|
|
|
|
await expect(page.getByText('Could not cancel RSVP. Please try again.')).toBeVisible()
|
|
|
|
await expect(page.getByText('Could not cancel RSVP. Please try again.')).toBeVisible()
|
|
|
|
@@ -136,7 +136,7 @@ test.describe('US1: Cancel RSVP from Event Detail View', () => {
|
|
|
|
// Cancel first
|
|
|
|
// Cancel first
|
|
|
|
await page.getByRole('button', { name: /You're attending/ }).click()
|
|
|
|
await page.getByRole('button', { name: /You're attending/ }).click()
|
|
|
|
await page.locator('.rsvp-bar__cancel').click()
|
|
|
|
await page.locator('.rsvp-bar__cancel').click()
|
|
|
|
await page.getByRole('alertdialog').getByRole('button', { name: 'Cancel attendance' }).click()
|
|
|
|
await page.getByRole('alertdialog').getByRole('button', { name: 'Cancel RSVP' }).click()
|
|
|
|
|
|
|
|
|
|
|
|
// CTA should be back
|
|
|
|
// CTA should be back
|
|
|
|
await expect(page.getByRole('button', { name: "I'm attending" })).toBeVisible()
|
|
|
|
await expect(page.getByRole('button', { name: "I'm attending" })).toBeVisible()
|
|
|
|
@@ -244,7 +244,7 @@ test.describe('US3: Cancel RSVP with Stale/Invalid Token', () => {
|
|
|
|
// Cancel flow
|
|
|
|
// Cancel flow
|
|
|
|
await page.getByRole('button', { name: /You're attending/ }).click()
|
|
|
|
await page.getByRole('button', { name: /You're attending/ }).click()
|
|
|
|
await page.locator('.rsvp-bar__cancel').click()
|
|
|
|
await page.locator('.rsvp-bar__cancel').click()
|
|
|
|
await page.getByRole('alertdialog').getByRole('button', { name: 'Cancel attendance' }).click()
|
|
|
|
await page.getByRole('alertdialog').getByRole('button', { name: 'Cancel RSVP' }).click()
|
|
|
|
|
|
|
|
|
|
|
|
// Treated as success — CTA returns
|
|
|
|
// Treated as success — CTA returns
|
|
|
|
await expect(page.getByRole('button', { name: "I'm attending" })).toBeVisible()
|
|
|
|
await expect(page.getByRole('button', { name: "I'm attending" })).toBeVisible()
|
|
|
|
|