Compare commits

..

1 Commits

Author SHA1 Message Date
peptiderepo
4a7fec7b74 Fix setup project: override testDir to repo root so global.setup.ts is found
The top-level testDir is './tests', which scopes Playwright's file discovery.
global.setup.ts lives at repo root, so the setup project's testMatch regex
never got a chance to match — Playwright silently ran 0 setup tests, the
storage-state file at playwright/.auth/admin.json was never written, and
every dependent test failed on storageState load with ENOENT.

Adding 'testDir: \".\"' on the setup project lets Playwright scan repo root
for files matching the testMatch regex without affecting the chromium
project, which still uses the top-level './tests' testDir.

Bug present since the initial smoke suite (d46a1e4). Has been blocking
PRAutoBlogger workflow-driven prod deploys since the smoke gate was added
on 2026-04-26 (prautoblogger 96f0248d). v0.14.0 and v0.15.0 reached prod
via manual SSH rsync outside the workflow.

Agent-Session: cto peptide-e2e-setup-project-fix
2026-05-14 17:30:35 +08:00
4 changed files with 5 additions and 15 deletions

View File

@@ -33,18 +33,8 @@ setup('authenticate as WP admin', async ({ page }) => {
await page.fill('#user_pass', password);
await page.click('#wp-submit');
// Wait for any post-login navigation. The site may redirect successful logins
// to the homepage (via a login_redirect filter) rather than to wp-admin —
// staging does this. So we don't assert the post-submit URL; instead, we
// verify we're no longer ON wp-login.php (which would indicate a credential
// rejection or 2FA prompt) and then navigate explicitly to wp-admin.
await page.waitForURL((url) => !url.pathname.includes('/wp-login.php'), {
timeout: 20_000,
});
// Navigate explicitly into wp-admin to capture the authenticated admin session.
await page.goto('/wp-admin/');
await expect(page).toHaveURL(/\/wp-admin\//, { timeout: 20_000 });
// Wait for successful redirect to wp-admin dashboard
await expect(page).toHaveURL(/wp-admin/, { timeout: 20_000 });
await expect(page.locator('#wpadminbar')).toBeVisible();
// Persist session cookies + localStorage to disk

View File

@@ -29,7 +29,7 @@ test.describe('Homepage', () => {
test('renders site name in page title', async ({ page }) => {
await page.goto('/');
await expect(page).toHaveTitle(/peptide ?repo/i);
await expect(page).toHaveTitle(/peptiderepo/i);
});
test('wp-admin bar present (logged-in session)', async ({ page }) => {

View File

@@ -14,7 +14,7 @@
import { test, expect } from '@playwright/test';
const CALC_PATH = process.env.CALC_PAGE_PATH ?? '/calculator/';
const CALC_PATH = process.env.CALC_PAGE_PATH ?? '/reconstitution-calculator/';
test.describe('Reconstitution Calculator', () => {
test.beforeEach(async ({ page }) => {

View File

@@ -25,7 +25,7 @@ const REQUIRED_PLUGINS = [
'peptide-search-ai',
'peptide-repo-core',
'peptide-reconstitution-calculator',
'prautoblogger',
'pr-autoblogger',
'peptide-starter-theme', // theme, shown differently — checked separately
];