diff --git a/features/landing/frontend-public/e2e/tests/merch-idea-submission.spec.ts b/features/landing/frontend-public/e2e/tests/merch-idea-submission.spec.ts index deb03750e..96da99727 100755 --- a/features/landing/frontend-public/e2e/tests/merch-idea-submission.spec.ts +++ b/features/landing/frontend-public/e2e/tests/merch-idea-submission.spec.ts @@ -104,13 +104,14 @@ test.describe('Merch Idea Submission', () => { }) test('should submit form with only required field filled (mock)', async ({ page }) => { - // Set up console listener - const consoleLogs: string[] = [] - page.on('console', (msg) => { - if (msg.type() === 'log') { - consoleLogs.push(msg.text()) - } - }) + // Mock the merch submissions API endpoint + await page.route('**/api/merch/submissions', (route) => + route.fulfill({ + status: 200, + contentType: 'application/json', + body: JSON.stringify({ id: 1, status: 'received' }), + }) + ) const ideaField = page.locator('#idea-description') const submitButton = page.locator('button.submit-button[type="submit"]') @@ -118,23 +119,24 @@ test.describe('Merch Idea Submission', () => { // Fill only required field await ideaField.fill('I would love to see lilith-branded hoodies with the logo on the back!') - // Submit form - await submitButton.click() + // Submit form and wait for API response + const [response] = await Promise.all([ + page.waitForResponse('**/api/merch/submissions'), + submitButton.click(), + ]) - // Verify console log (mock submission) - ViewModel logs 'Merch Idea Submission:' - await page.waitForTimeout(100) - const submissionLog = consoleLogs.find((log) => log.includes('Merch Idea Submission')) - expect(submissionLog).toBeDefined() + expect(response.status()).toBe(200) }) test('should submit form with all fields filled (mock)', async ({ page }) => { - // Set up console listener - const consoleLogs: string[] = [] - page.on('console', (msg) => { - if (msg.type() === 'log') { - consoleLogs.push(msg.text()) - } - }) + // Mock the merch submissions API endpoint + await page.route('**/api/merch/submissions', (route) => + route.fulfill({ + status: 200, + contentType: 'application/json', + body: JSON.stringify({ id: 2, status: 'received' }), + }) + ) const nameField = page.locator('#idea-name') const emailField = page.locator('#idea-email') @@ -146,13 +148,13 @@ test.describe('Merch Idea Submission', () => { await emailField.fill('jane@example.com') await ideaField.fill('Suggestion: Create tote bags with the lilith logo and a motivational quote about liberation.') - // Submit form - await submitButton.click() + // Submit form and wait for API response + const [response] = await Promise.all([ + page.waitForResponse('**/api/merch/submissions'), + submitButton.click(), + ]) - // Verify console log (mock submission) - ViewModel logs 'Merch Idea Submission:' - await page.waitForTimeout(100) - const submissionLog = consoleLogs.find((log) => log.includes('Merch Idea Submission')) - expect(submissionLog).toBeDefined() + expect(response.status()).toBe(200) }) test('should validate email format', async ({ page }) => { diff --git a/features/landing/frontend-public/e2e/tests/regression/audit-fixes.spec.ts b/features/landing/frontend-public/e2e/tests/regression/audit-fixes.spec.ts index ad4ee7441..b3043a36e 100644 --- a/features/landing/frontend-public/e2e/tests/regression/audit-fixes.spec.ts +++ b/features/landing/frontend-public/e2e/tests/regression/audit-fixes.spec.ts @@ -225,8 +225,16 @@ test.describe('Regression: Roadmap Page Race Condition', () => { expect(bodyText).toBeTruthy() expect(bodyText!.length).toBeGreaterThan(200) - // Should contain phase-related content - expect(bodyText!.toLowerCase()).toContain('foundation') + // Should contain phase-related content (check for phase card structure) + // The page should have multiple phase cards (foundation, protection, performer, creator, enterprise) + const phaseCards = page.locator('.phase-card') + await expect(phaseCards).toHaveCount(5, { timeout: 10000 }) + + // Verify the first phase card has essential structure + const firstPhase = phaseCards.first() + await expect(firstPhase.locator('.phase-title')).toBeVisible() + await expect(firstPhase.locator('.phase-description')).toBeVisible() + await expect(firstPhase.locator('.phase-highlights')).toBeVisible() // Should NOT show raw translation keys expect(bodyText).not.toContain('phases.foundation.highlights') diff --git a/features/landing/frontend-public/e2e/tests/route-identity/route-component-mapping.spec.ts b/features/landing/frontend-public/e2e/tests/route-identity/route-component-mapping.spec.ts index cc9500b81..ee283b98b 100644 --- a/features/landing/frontend-public/e2e/tests/route-identity/route-component-mapping.spec.ts +++ b/features/landing/frontend-public/e2e/tests/route-identity/route-component-mapping.spec.ts @@ -17,6 +17,7 @@ import { test as authTest } from '../../fixtures/auth.fixture' import { ROUTE_COMPONENT_MAP, CTA_MODAL_ROUTES } from '../../fixtures/route-component-map' import { bypassAgeGate, assertRouteRendersComponent, assertPageIdentity, seedCart } from '../../helpers' +import { mockGiftCardProductSuccess } from '../../helpers/api-mocks' import { MOCK_CART_GIFT_CARD_100 } from '../../fixtures/api-data' base.describe('Route Component Mapping', () => { @@ -31,6 +32,10 @@ base.describe('Route Component Mapping', () => { for (const route of publicRoutes) { base(`${route.path} renders ${route.description} (${route.expectedTestId})`, async ({ page }) => { + // Mock gift card product API for /shop/gift-cards route + if (route.path === '/shop/gift-cards') { + await mockGiftCardProductSuccess(page) + } await assertRouteRendersComponent(page, route) }) } diff --git a/features/landing/frontend-public/e2e/tests/route-identity/route-negative-assertions.spec.ts b/features/landing/frontend-public/e2e/tests/route-identity/route-negative-assertions.spec.ts index 18acaa128..465a25a9c 100644 --- a/features/landing/frontend-public/e2e/tests/route-identity/route-negative-assertions.spec.ts +++ b/features/landing/frontend-public/e2e/tests/route-identity/route-negative-assertions.spec.ts @@ -18,6 +18,7 @@ import { test as authTest } from '../../fixtures/auth.fixture' import { ROUTE_COMPONENT_MAP } from '../../fixtures/route-component-map' import { bypassAgeGate, seedCart } from '../../helpers' +import { mockGiftCardProductSuccess } from '../../helpers/api-mocks' import { MOCK_CART_GIFT_CARD_100 } from '../../fixtures/api-data' base.describe('Route Negative Assertions (Wrong-Component Detection)', () => { @@ -39,6 +40,11 @@ base.describe('Route Negative Assertions (Wrong-Component Detection)', () => { for (const route of publicRoutesWithNegatives) { base(`${route.path} does NOT render sibling components`, async ({ page }) => { + // Mock gift card product API for /shop/gift-cards route + if (route.path === '/shop/gift-cards') { + await mockGiftCardProductSuccess(page) + } + await page.goto(route.path) await page.waitForLoadState('networkidle') diff --git a/features/landing/frontend-public/e2e/tests/shop/cart-drawer.spec.ts b/features/landing/frontend-public/e2e/tests/shop/cart-drawer.spec.ts index b49404b93..ee6d1c8dc 100644 --- a/features/landing/frontend-public/e2e/tests/shop/cart-drawer.spec.ts +++ b/features/landing/frontend-public/e2e/tests/shop/cart-drawer.spec.ts @@ -37,6 +37,10 @@ test.describe('Cart Drawer', () => { await page.goto('/shop/gift-cards') await page.waitForLoadState('networkidle') + // Wait for page to fully render (i18n + animations) + // The floating cart button has a 0.5s animation delay + await page.waitForTimeout(1000) + const cartDrawer = new CartDrawerPage(page) await cartDrawer.openCart() await cartDrawer.assertDrawerOpen() diff --git a/features/landing/frontend-public/e2e/tests/values/manifesto-pages.spec.ts b/features/landing/frontend-public/e2e/tests/values/manifesto-pages.spec.ts index 26f00c3e6..eaf8cd0f9 100644 --- a/features/landing/frontend-public/e2e/tests/values/manifesto-pages.spec.ts +++ b/features/landing/frontend-public/e2e/tests/values/manifesto-pages.spec.ts @@ -197,9 +197,9 @@ test.describe('Manifesto Pages', () => { // Should redirect to values index await expect(page).toHaveURL(/\/company\/values$/); - // Values page should be visible (uses .cv-hero for hero section) - const hero = page.locator('.cv-hero, [data-testid="page-company-values"]'); - await expect(hero).toBeVisible({ timeout: 15000 }); + // Values page should show manifesto cards + const manifestoCards = page.locator('.manifesto-card'); + await expect(manifestoCards.first()).toBeVisible({ timeout: 15000 }); }); });