Skip to content
Open
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
21 changes: 21 additions & 0 deletions e2e/tests/waitlist/waitlist-journey.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> => {
if ((await locator.isEditable()) && (await locator.inputValue()) === '') {
Expand All @@ -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,
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/modals/JoinWaitlistModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down