diff --git a/e2e/tests/waitlist/waitlist-journey.spec.ts b/e2e/tests/waitlist/waitlist-journey.spec.ts index 91942556fd..0c3e3a69d7 100644 --- a/e2e/tests/waitlist/waitlist-journey.spec.ts +++ b/e2e/tests/waitlist/waitlist-journey.spec.ts @@ -3,6 +3,7 @@ import { test, expect } from '../../fixtures'; import { PublicEventPage } from '../../pages/public-event.page'; import { createSoldOutEvent } from '../../api/factory'; import { uniqueEmail } from '../../utils/unique'; +import { cookieDomain } from '../../utils/env'; const fillIfNeeded = async (locator: Locator, value: string): Promise => { if ((await locator.isEditable()) && (await locator.inputValue()) === '') { @@ -27,6 +28,26 @@ const fillCheckoutContacts = async (page: Page, details: { firstName: string; em }; test.describe('waitlist journey', () => { + test('a waitlist confirmation uses the selected language', async ({ page, api, account, publicApi, mailpit }) => { + const event = await createSoldOutEvent(api, publicApi, account.organizerId, { waitlist: true }); + const email = uniqueEmail('waitlister-pl'); + await page.context().addCookies([{ name: 'locale', value: 'pl', domain: cookieDomain(), path: '/' }]); + + const publicPage = new PublicEventPage(page); + await publicPage.goto(event.eventId, event.slug); + await publicPage.joinWaitlistButton().click(); + const dialog = page.getByRole('dialog'); + await dialog.getByLabel(/^Imię/).fill('Wanda'); + await dialog.getByLabel(/^E-mail/).fill(email); + await dialog.getByLabel(/Zgadzam się na otrzymywanie powiadomień e-mail/).check(); + const request = page.waitForRequest((req) => req.method() === 'POST' && /\/waitlist$/.test(new URL(req.url()).pathname)); + await dialog.getByRole('button', { name: 'Dołącz do listy oczekujących' }).click(); + + expect((await request).postDataJSON()).toMatchObject({ locale: 'pl', email }); + await expect(page.getByText('Jesteś na liście oczekujących!')).toBeVisible(); + await mailpit.waitForMessage(email, { subjectContains: 'Jesteś na liście oczekujących!' }); + }); + test('a waitlisted buyer is offered a freed spot and completes the purchase', async ({ page, api, diff --git a/frontend/src/components/modals/JoinWaitlistModal/index.tsx b/frontend/src/components/modals/JoinWaitlistModal/index.tsx index c66c1e4b55..30a8c3e789 100644 --- a/frontend/src/components/modals/JoinWaitlistModal/index.tsx +++ b/frontend/src/components/modals/JoinWaitlistModal/index.tsx @@ -65,6 +65,7 @@ export const JoinWaitlistModal = ({onClose, product, event, productPriceId, even eventId: event.id, data: { ...values, + locale: getClientLocale(), product_price_id: Number(productPriceId), event_occurrence_id: eventOccurrenceId ? Number(eventOccurrenceId) : undefined, promo_code: new URLSearchParams(window.location.search).get('promo_code') || undefined,