fix: feat: E2E quality gate — mobile viewports + cross-browser matrix (#1099)
Add Playwright projects for Chromium, Firefox, WebKit, iPhone 14, and
Pixel 7 viewports. Chromium runs all specs (01-07); other projects run
read-only specs (03, 06, 07) after Chromium finishes, using project
dependencies to ensure chain state exists.
Coverage audit:
- Tests 01/02 already cover /app/get-krk, /app/cheats as part of flows
- Test 03 verifies GraphQL endpoints
- Test 06 covers wallet + position dashboards
- New test 07 adds landing page and docs smoke coverage
Changes:
- playwright.config.ts: 5 projects (3 desktop browsers + 2 mobile)
- wallet-provider.ts: accept optional viewport/screen for mobile contexts
- 03, 06 specs: pass project viewport to wallet context
- 07-landing-pages.spec.ts: new spec for landing homepage + docs
- e2e.yml: timeout 600→900s for cross-browser matrix, updated comments
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 10:55:01 +00:00
|
|
|
import { test, expect } from '@playwright/test';
|
|
|
|
|
import { getStackConfig, validateStackHealthy } from '../setup/stack';
|
|
|
|
|
|
|
|
|
|
const STACK_CONFIG = getStackConfig();
|
|
|
|
|
const STACK_BASE_URL = process.env.STACK_BASE_URL ?? 'http://localhost:8081';
|
|
|
|
|
|
|
|
|
|
test.describe('Landing Pages', () => {
|
|
|
|
|
test.beforeAll(async () => {
|
|
|
|
|
await validateStackHealthy(STACK_CONFIG);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('landing homepage loads without errors', async ({ page }) => {
|
|
|
|
|
await page.goto(`${STACK_BASE_URL}/`, { waitUntil: 'domcontentloaded' });
|
|
|
|
|
|
2026-03-23 12:03:25 +00:00
|
|
|
// Landing page always has a call-to-action button ("Get $KRK", "Get Your Edge", etc.)
|
2026-03-25 00:10:57 +00:00
|
|
|
// Use the .header-cta container to find the primary CTA button unambiguously.
|
|
|
|
|
const cta = page.locator('.header-cta button').first();
|
fix: feat: E2E quality gate — mobile viewports + cross-browser matrix (#1099)
Add Playwright projects for Chromium, Firefox, WebKit, iPhone 14, and
Pixel 7 viewports. Chromium runs all specs (01-07); other projects run
read-only specs (03, 06, 07) after Chromium finishes, using project
dependencies to ensure chain state exists.
Coverage audit:
- Tests 01/02 already cover /app/get-krk, /app/cheats as part of flows
- Test 03 verifies GraphQL endpoints
- Test 06 covers wallet + position dashboards
- New test 07 adds landing page and docs smoke coverage
Changes:
- playwright.config.ts: 5 projects (3 desktop browsers + 2 mobile)
- wallet-provider.ts: accept optional viewport/screen for mobile contexts
- 03, 06 specs: pass project viewport to wallet context
- 07-landing-pages.spec.ts: new spec for landing homepage + docs
- e2e.yml: timeout 600→900s for cross-browser matrix, updated comments
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 10:55:01 +00:00
|
|
|
await expect(cta).toBeVisible({ timeout: 15_000 });
|
|
|
|
|
|
|
|
|
|
await page.screenshot({ path: 'test-results/landing-homepage.png', fullPage: true });
|
|
|
|
|
|
|
|
|
|
console.log('[TEST] ✅ Landing homepage renders correctly');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('docs introduction page loads', async ({ page }) => {
|
|
|
|
|
await page.goto(`${STACK_BASE_URL}/docs/introduction`, { waitUntil: 'domcontentloaded' });
|
|
|
|
|
|
2026-03-25 00:10:57 +00:00
|
|
|
// Docs page should have a heading
|
fix: feat: E2E quality gate — mobile viewports + cross-browser matrix (#1099)
Add Playwright projects for Chromium, Firefox, WebKit, iPhone 14, and
Pixel 7 viewports. Chromium runs all specs (01-07); other projects run
read-only specs (03, 06, 07) after Chromium finishes, using project
dependencies to ensure chain state exists.
Coverage audit:
- Tests 01/02 already cover /app/get-krk, /app/cheats as part of flows
- Test 03 verifies GraphQL endpoints
- Test 06 covers wallet + position dashboards
- New test 07 adds landing page and docs smoke coverage
Changes:
- playwright.config.ts: 5 projects (3 desktop browsers + 2 mobile)
- wallet-provider.ts: accept optional viewport/screen for mobile contexts
- 03, 06 specs: pass project viewport to wallet context
- 07-landing-pages.spec.ts: new spec for landing homepage + docs
- e2e.yml: timeout 600→900s for cross-browser matrix, updated comments
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 10:55:01 +00:00
|
|
|
const heading = page.locator('h1, h2').first();
|
|
|
|
|
await expect(heading).toBeVisible({ timeout: 15_000 });
|
|
|
|
|
|
|
|
|
|
console.log('[TEST] ✅ Docs introduction page renders correctly');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('docs navigation works across pages', async ({ page }) => {
|
|
|
|
|
await page.goto(`${STACK_BASE_URL}/docs/introduction`, { waitUntil: 'domcontentloaded' });
|
2026-03-25 00:10:57 +00:00
|
|
|
|
|
|
|
|
// Wait for nav links to render before checking
|
|
|
|
|
const heading = page.locator('h1, h2').first();
|
|
|
|
|
await expect(heading).toBeVisible({ timeout: 15_000 });
|
fix: feat: E2E quality gate — mobile viewports + cross-browser matrix (#1099)
Add Playwright projects for Chromium, Firefox, WebKit, iPhone 14, and
Pixel 7 viewports. Chromium runs all specs (01-07); other projects run
read-only specs (03, 06, 07) after Chromium finishes, using project
dependencies to ensure chain state exists.
Coverage audit:
- Tests 01/02 already cover /app/get-krk, /app/cheats as part of flows
- Test 03 verifies GraphQL endpoints
- Test 06 covers wallet + position dashboards
- New test 07 adds landing page and docs smoke coverage
Changes:
- playwright.config.ts: 5 projects (3 desktop browsers + 2 mobile)
- wallet-provider.ts: accept optional viewport/screen for mobile contexts
- 03, 06 specs: pass project viewport to wallet context
- 07-landing-pages.spec.ts: new spec for landing homepage + docs
- e2e.yml: timeout 600→900s for cross-browser matrix, updated comments
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 10:55:01 +00:00
|
|
|
|
|
|
|
|
// Find a docs nav link to another page
|
|
|
|
|
const navLink = page.locator('a[href*="/docs/"]').filter({ hasNotText: /introduction/i }).first();
|
|
|
|
|
if (await navLink.isVisible({ timeout: 5_000 })) {
|
|
|
|
|
const href = await navLink.getAttribute('href');
|
|
|
|
|
console.log(`[TEST] Clicking docs nav link: ${href}`);
|
2026-03-25 00:10:57 +00:00
|
|
|
// Use waitForURL to detect SPA navigation instead of a fixed delay
|
|
|
|
|
await Promise.all([
|
|
|
|
|
page.waitForURL(`**${href}`, { timeout: 10_000 }),
|
|
|
|
|
navLink.click(),
|
|
|
|
|
]);
|
fix: feat: E2E quality gate — mobile viewports + cross-browser matrix (#1099)
Add Playwright projects for Chromium, Firefox, WebKit, iPhone 14, and
Pixel 7 viewports. Chromium runs all specs (01-07); other projects run
read-only specs (03, 06, 07) after Chromium finishes, using project
dependencies to ensure chain state exists.
Coverage audit:
- Tests 01/02 already cover /app/get-krk, /app/cheats as part of flows
- Test 03 verifies GraphQL endpoints
- Test 06 covers wallet + position dashboards
- New test 07 adds landing page and docs smoke coverage
Changes:
- playwright.config.ts: 5 projects (3 desktop browsers + 2 mobile)
- wallet-provider.ts: accept optional viewport/screen for mobile contexts
- 03, 06 specs: pass project viewport to wallet context
- 07-landing-pages.spec.ts: new spec for landing homepage + docs
- e2e.yml: timeout 600→900s for cross-browser matrix, updated comments
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 10:55:01 +00:00
|
|
|
|
|
|
|
|
// Should navigate without crashing
|
|
|
|
|
const body = await page.textContent('body');
|
|
|
|
|
expect(body).toBeTruthy();
|
|
|
|
|
console.log('[TEST] ✅ Docs navigation works');
|
|
|
|
|
} else {
|
|
|
|
|
console.log('[TEST] ⚠️ No docs nav links found — skipping navigation test');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|