This commit is contained in:
@@ -3,7 +3,7 @@ import { createRequire } from 'node:module';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { dirname, resolve, join } from 'node:path';
|
||||
import { mkdirSync, writeFileSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { openSpaceTab } from '../e2e/helpers/spaceTabs';
|
||||
|
||||
// ── Local-auth SHARING-SCOPE E2E ──────────────────────────────────────────────
|
||||
//
|
||||
@@ -43,7 +43,8 @@ const require = createRequire(import.meta.url);
|
||||
const repoRoot = resolve(__dirname, '..', '..');
|
||||
|
||||
// Same deterministic DB + worktree dir the webServer opens (playwright.auth.config.ts).
|
||||
const e2eTmp = join(tmpdir(), 'maestro-e2e-auth');
|
||||
const e2eTmp = process.env.E2E_AUTH_TMP;
|
||||
if (!e2eTmp) throw new Error('E2E_AUTH_TMP must be set by playwright.auth.config.ts');
|
||||
const DB_PATH = join(e2eTmp, 'e2e-auth.db');
|
||||
const WORKTREE_DIR = join(e2eTmp, 'workspaces');
|
||||
|
||||
@@ -68,7 +69,6 @@ const BENIGN_PATHS = new Set([
|
||||
const BENIGN_ASSET = /\.(ico|png|svg|map|webmanifest|json)$/i;
|
||||
const BENIGN_PATH_RE =
|
||||
/\/api\/local\/tasks\/\d+\/console\/status$|\/api\/local\/browser\/sessions\/task-session\/\d+$/;
|
||||
const SPACE_MEMBERS_RE = /\/api\/local\/spaces\/[^/]+\/members$/;
|
||||
|
||||
function trackFatalErrors(page: Page): string[] {
|
||||
const fatalErrors: string[] = [];
|
||||
@@ -76,12 +76,10 @@ function trackFatalErrors(page: Page): string[] {
|
||||
page.on('response', (res) => {
|
||||
if (res.status() >= 400) {
|
||||
const { pathname } = new URL(res.url());
|
||||
const transientMembers401 = res.status() === 401 && SPACE_MEMBERS_RE.test(pathname);
|
||||
if (
|
||||
!BENIGN_ASSET.test(pathname) &&
|
||||
!BENIGN_PATHS.has(pathname) &&
|
||||
!BENIGN_PATH_RE.test(pathname) &&
|
||||
!transientMembers401
|
||||
!BENIGN_PATH_RE.test(pathname)
|
||||
) {
|
||||
fatalErrors.push(`HTTP ${res.status()} ${res.url()}`);
|
||||
}
|
||||
@@ -101,10 +99,6 @@ async function login(page: Page, email: string, password: string) {
|
||||
expect(page.url(), 'login should not bounce back to /auth/login').not.toContain('/auth/login');
|
||||
}
|
||||
|
||||
async function logout(page: Page) {
|
||||
await page.goto('/auth/logout');
|
||||
}
|
||||
|
||||
/** Open Spaces and select the seeded shared space; returns the detail locator. */
|
||||
async function openSharedSpace(page: Page) {
|
||||
await page.goto('/ui');
|
||||
@@ -163,7 +157,7 @@ async function createAndOpenCaseSpace(page: Page, label: string) {
|
||||
}
|
||||
|
||||
async function openMembersPanel(page: Page) {
|
||||
await page.getByTestId('space-tab-settings').click();
|
||||
await openSpaceTab(page, 'settings');
|
||||
await page.getByTestId('space-settings-nav-members').click();
|
||||
const panel = page.getByTestId('space-members-panel');
|
||||
await expect(panel).toBeVisible({ timeout: 15_000 });
|
||||
|
||||
Reference in New Issue
Block a user