Update Playwright staging flows and Paddle sandbox checkout
This commit is contained in:
@@ -1,59 +1,37 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { test, expectFixture as expect } from '../helpers/test-fixtures';
|
||||
|
||||
test.describe('Package Flow in Admin PWA', () => {
|
||||
test('Create event with package and verify limits', async ({ page }) => {
|
||||
// Assume logged in as tenant admin, navigate to events page
|
||||
await page.goto('/event-admin/events');
|
||||
test('Create event in admin PWA and verify it appears in the list', async ({ tenantAdminCredentials, signInTenantAdmin, page }) => {
|
||||
test.skip(
|
||||
!tenantAdminCredentials,
|
||||
'Provide E2E_TENANT_EMAIL and E2E_TENANT_PASSWORD to run admin package flow tests.'
|
||||
);
|
||||
|
||||
// Click create event button
|
||||
await page.click('[data-testid="create-event"]');
|
||||
await expect(page).toHaveURL(/\/event-admin\/events\/create/);
|
||||
await signInTenantAdmin();
|
||||
|
||||
// Fill form
|
||||
await page.fill('[name="name"]', 'Test Package Event');
|
||||
await page.fill('[name="slug"]', 'test-package-event');
|
||||
await page.fill('[name="date"]', '2025-10-01');
|
||||
await page.goto('/event-admin/mobile/events/new');
|
||||
|
||||
// Select package from dropdown
|
||||
await page.selectOption('[name="package_id"]', '1'); // Assume ID 1 is Starter package
|
||||
await expect(page.locator('[name="package_id"]')).toHaveValue('1');
|
||||
const eventName = `Package Flow ${Date.now()}`;
|
||||
const date = new Date(Date.now() + 14 * 86400000).toISOString().slice(0, 10);
|
||||
|
||||
// Submit
|
||||
await page.click('[type="submit"]');
|
||||
await expect(page).toHaveURL(/\/event-admin\/events/);
|
||||
await page.getByPlaceholder(/Sommerfest|Summer Party/i).fill(eventName);
|
||||
await page.locator('input[type="datetime-local"]').fill(`${date}T12:00`);
|
||||
|
||||
// Verify event created and package assigned
|
||||
await expect(page.locator('text=Test Package Event')).toBeVisible();
|
||||
await expect(page.locator('text=Starter')).toBeVisible(); // Package name in table
|
||||
await page.locator('select').first().selectOption({ index: 1 });
|
||||
|
||||
// Check dashboard limits
|
||||
await page.goto('/event-admin/events');
|
||||
await expect(page.locator('text=Remaining Photos')).toContainText('300'); // Starter limit
|
||||
await page.getByRole('button', { name: /Event erstellen|Create event/i }).click();
|
||||
await expect(page).toHaveURL(/\/event-admin\/mobile\/events\/[a-z0-9-]+$/, { timeout: 20_000 });
|
||||
|
||||
// Try to create another event to test reseller limit if applicable
|
||||
// (Skip for endcustomer; assume tenant has reseller package with limit 1)
|
||||
await page.goto('/event-admin/events');
|
||||
await page.click('[data-testid="create-event"]');
|
||||
await page.fill('[name="name"]', 'Second Event');
|
||||
await page.fill('[name="slug"]', 'second-event');
|
||||
await page.fill('[name="date"]', '2025-10-02');
|
||||
await page.selectOption('[name="package_id"]', '1');
|
||||
await page.click('[type="submit"]');
|
||||
|
||||
// If limit reached, expect error
|
||||
await expect(page.locator('text=No available package')).toBeVisible();
|
||||
await page.goto('/event-admin/mobile/events');
|
||||
await expect(page.getByText(eventName, { exact: false })).toBeVisible();
|
||||
});
|
||||
|
||||
test('Upload blocked when package limit reached in Guest PWA', async ({ page }) => {
|
||||
// Assume event with package limit 0 created
|
||||
await page.goto('/e/test-limited-event'); // Slug of event with max_photos = 0
|
||||
const eventToken = process.env.E2E_GUEST_LIMIT_EVENT_TOKEN;
|
||||
test.skip(!eventToken, 'Set E2E_GUEST_LIMIT_EVENT_TOKEN to a guest join token with exhausted limits.');
|
||||
|
||||
// Navigate to upload
|
||||
await page.click('text=Upload');
|
||||
await expect(page).toHaveURL(/\/upload/);
|
||||
await page.goto(`/e/${eventToken}/upload`);
|
||||
|
||||
// Expect upload disabled and error message
|
||||
await expect(page.locator('button:disabled')).toBeVisible(); // Upload button disabled
|
||||
await expect(page.locator('text=Upload-Limit erreicht')).toBeVisible();
|
||||
await expect(page.getByText(/Upload-Limit erreicht/i)).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user