import { test as setup, expect } from '@playwright/test'; import { loadFixture, probeReadiness, readinessMessage, STORAGE_STATE_PATH } from './helpers'; import { ensureLoggedIn } from './flow'; declare const require: (id: string) => any; setup('authenticate once for the negative suite', async ({ page }) => { const readiness = await probeReadiness(); expect(readiness.ok, readinessMessage(readiness)).toBe(true); let fixture; try { fixture = loadFixture(); } catch (err) { setup.skip(true, `run provision first: cargo run -p provision -- bootstrap --password-file (${(err as Error).message})`); throw new Error('unreachable'); } const { authenticator } = require('otplib'); await ensureLoggedIn(page, fixture, (secret: string) => authenticator.generate(secret)); const fs = require('node:fs'); const path = require('node:path'); fs.mkdirSync(path.dirname(STORAGE_STATE_PATH), { recursive: true }); await page.context().storageState({ path: STORAGE_STATE_PATH }); });