* feat(marketplace): pass from_instance origin when opening marketplace
BrowseLink in PluginsTab now appends ?from_instance=<origin> so the
marketplace can silently capture the instance URL into localStorage,
skipping the manual InstanceConfig modal for users arriving from the app.
* test(e2e): add marketplace instance auto-discovery E2E tests
- playwright.marketplace.config.ts: standalone config that starts only
the marketplace on port 3002, no Docker/Postgres required
- tests/marketplace-from-instance.spec.ts: 4 marketplace-side tests
(capture valid URL, reject javascript: protocol, reject self-origin,
skip when no param) + 1 full-flow test (worldwideview -> marketplace,
auto-skipped when running under marketplace-only config)
- NEXT_PUBLIC_MARKETPLACE_URL env var in BrowseLink lets tests point
to localhost:3002 instead of the production marketplace
- data-testid="browse-plugins-btn" for stable Playwright selector
- playwright.config.ts updated with both webServers for full E2E
Run marketplace tests (no Docker): pnpm exec playwright test --config=playwright.marketplace.config.ts
Run full E2E (Docker required): pnpm test:e2e
* feat: implement Phase 2 install auth gate (ADR-003 closeout)
Closes the three foundational auth gaps that blocked a proper install gate:
2A - SSR session persistence:
- Add @supabase/ssr; create src/lib/supabase/{cookieOptions,server,client}.ts
mirroring the marketplace recipe so both repos issue the same cookie type
- Migrate login/actions.ts from @supabase/supabase-js to createServerClient
(previously the Supabase session was discarded; no cookie was ever set)
- Fix getSafeRedirect to allow trusted subdomain callbacks via
NEXT_PUBLIC_WWV_COOKIE_DOMAIN so marketplace ?callbackUrl= round-trips work
- Add NEXT_PUBLIC_WWV_COOKIE_DOMAIN and NEXT_PUBLIC_AUTH_HOST_URL to .env.example
2B - Signup route at auth host:
- Add /signup page and server action (supabase.auth.signUp with emailRedirectTo)
- Add /auth/callback route to handle Supabase PKCE email verification exchange
- Add "Sign up" link to login page preserving ?callbackUrl=
2C - Install auth gate:
- Swap NextAuth auth() for Supabase getSupabaseUser() in install-redirect route
(local/demo edition still uses NextAuth)
2D - Sweep:
- httpOnly: true added to buildCookieOptions()
- cloud-auth-architecture.md superseded section collapsed to forward-pointer
- ADR-003 status updated to Accepted with implementation notes
* chore: exclude .planning from git (moved to private repo)
* chore(05-01): add Playwright config and E2E specs for worldwideview-web auth UI
- playwright.web.config.ts: targets https://wwv.local:3001 with ignoreHTTPSErrors
- tests/web-auth.spec.ts: 4 describe groups covering reset-password form, /accounts redirect, /auth/verify no-code error, /auth/reset-password/confirm no-hash timeout
- bump version 2.20.0 -> 2.20.1
* fix(gc): narrow mdc-ref detector to eliminate false positives
Pattern now requires a quoted string context (['\"].*\.mdc['\"]) and
only scans .ts/.tsx files, excluding scripts/. Prevents the scanner
from flagging its own source code and rule documentation that explain
the anti-pattern rather than violating it.
73 lines
3.6 KiB
TypeScript
73 lines
3.6 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
|
|
// baseURL is set to https://wwv.local:3001 in playwright.web.config.ts.
|
|
// All page.goto() calls use relative paths.
|
|
|
|
// ─── /auth/reset-password ────────────────────────────────────────────────────
|
|
|
|
test.describe('/auth/reset-password', () => {
|
|
|
|
test('page renders the request form', async ({ page }) => {
|
|
await page.goto('/auth/reset-password');
|
|
await expect(page.getByRole('heading', { name: 'Reset Password' })).toBeVisible();
|
|
await expect(page.getByRole('textbox', { name: /email/i })).toBeVisible();
|
|
await expect(page.getByRole('button', { name: 'Send Reset Link' })).toBeVisible();
|
|
});
|
|
|
|
test('submit transitions to inline success state on same page', async ({ page }) => {
|
|
await page.goto('/auth/reset-password');
|
|
await page.getByRole('textbox', { name: /email/i }).fill('[email protected]');
|
|
await page.getByRole('button', { name: 'Send Reset Link' }).click();
|
|
// The server action calls Supabase resetPasswordForEmail; this will likely error in
|
|
// the test environment (no real Supabase creds). Handle both outcomes:
|
|
// - If success: heading changes to "Check Your Email"
|
|
// - If error: inline error message appears (not a crash / blank page)
|
|
const successHeading = page.getByRole('heading', { name: 'Check Your Email' });
|
|
const errorText = page.locator('[role="alert"]');
|
|
await expect(successHeading.or(errorText)).toBeVisible({ timeout: 10000 });
|
|
});
|
|
|
|
});
|
|
|
|
// ─── /accounts unauthenticated redirect ──────────────────────────────────────
|
|
|
|
test.describe('/accounts', () => {
|
|
|
|
test('unauthenticated visit redirects to /login', async ({ page }) => {
|
|
// Navigate to /accounts with no session cookie.
|
|
// The page.tsx server component calls getClaims() and redirects if no session.
|
|
await page.goto('/accounts');
|
|
// Wait for navigation to settle; allow up to 10 seconds for the redirect chain.
|
|
await page.waitForURL('**/login**', { timeout: 10000 });
|
|
expect(page.url()).toContain('/login');
|
|
});
|
|
|
|
});
|
|
|
|
// ─── /auth/verify without a code ─────────────────────────────────────────────
|
|
|
|
test.describe('/auth/verify', () => {
|
|
|
|
test('visiting without a code param shows Verification Failed state', async ({ page }) => {
|
|
await page.goto('/auth/verify');
|
|
// The VerifyContent useEffect checks for searchParams.get('code').
|
|
// With no code, it immediately sets status to 'error'.
|
|
await expect(page.getByRole('heading', { name: 'Verification Failed' })).toBeVisible({ timeout: 10000 });
|
|
});
|
|
|
|
});
|
|
|
|
// ─── /auth/reset-password/confirm without a hash ─────────────────────────────
|
|
|
|
test.describe('/auth/reset-password/confirm', () => {
|
|
|
|
test('visiting without a recovery hash shows Link Expired after timeout', async ({ page }) => {
|
|
await page.goto('/auth/reset-password/confirm');
|
|
// The page waits up to 3 seconds for onAuthStateChange PASSWORD_RECOVERY.
|
|
// With no hash, the event never fires, so the 3s timer triggers setLinkError(true).
|
|
// Allow up to 8 seconds total (3s timer + render time + margin).
|
|
await expect(page.getByRole('heading', { name: 'Link Expired' })).toBeVisible({ timeout: 8000 });
|
|
});
|
|
|
|
});
|