Files
marketplaces/e2e/smoke.spec.ts
sdarbinyan c2a56571af
Some checks failed
Architecture Governance / architecture (push) Has been cancelled
Deploy Frontend / deploy (push) Has been cancelled
feat(bootstrap): fall back to built-in placeholder when marketplace unpublished
Adds published: boolean to the bootstrap wire contract. ConfigService
swaps to a new DEFAULT_BOOTSTRAP constant (all feature flags on, generic
branding/theme/pages) whenever the backend reports published: false, so
an unpublished marketplace renders a working demo instead of a blank or
broken page. Missing published field stays backward compatible (treated
as true). Documents the brand bootstrap wire shape for backend/ops use.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-22 22:02:42 +04:00

54 lines
2.2 KiB
TypeScript

import { expect, test } from '@playwright/test';
/** First E2E test in this repo. If this fails, nothing else in the suite matters. */
test.describe('smoke', () => {
test('storefront boots with no console errors', async ({ page }) => {
const errors: string[] = [];
// pageerror catches uncaught exceptions - always a real bug, always kept.
page.on('pageerror', err => errors.push(err.message));
page.on('console', msg => {
if (msg.type() !== 'error') {
return;
}
// "Failed to load resource" is Chrome's own message for a failed
// network request (404/502/etc), not application code. With
// environment.useMockData: false and no live backend behind this dev
// server (docs/backend/BACKEND-HANDOFF.md), every /api/ call 404s by
// design - that is a backend-availability fact, not something this
// smoke test exists to catch. A real app-level console.error still
// fails this test.
if (/^Failed to load resource/.test(msg.text())) {
return;
}
errors.push(msg.text());
});
await page.goto('/');
await expect(page.locator('body')).toBeVisible();
// Give the bootstrap fetch + first render cycle time to settle before
// asserting on the error list, or this is a race against app.config.ts.
await page.waitForLoadState('networkidle');
expect(errors, `console errors on first paint: ${errors.join('\n')}`).toEqual([]);
});
test('renders the placeholder home page when the marketplace is unpublished', async ({ page }) => {
// This suite runs against the mock-data build (see comment at the top of
// playwright.config.ts), so MockBootstrapProvider fetches this static
// asset rather than a live /bootstrap endpoint - that's the URL to
// intercept here, not the real API path.
await page.route('**/assets/mock/bootstrap/bootstrap.json', route =>
route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({ schemaVersion: '1.0.0', generatedAt: new Date().toISOString(), published: false }),
})
);
await page.goto('/');
await expect(page.getByText('Welcome to Marketplace')).toBeVisible();
});
});