Something went wrong. Try again.
A free, open-source, self-hosted place to write a novel.
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031import { expect, test as setup } from '@playwright/test';import { EMAIL, PASSWORD, WRITER_NAME, spendWritingTour } from './session.ts';
/** * Claims the shared E2E instance once per database reset before authenticated * specs run. Individual specs then sign in explicitly and never race to claim * `/signup` first. */setup('claim or verify the shared test instance', async ({ page }) => { await page.goto('/signup');
const claim = page.getByRole('button', { name: /claim this instance/i });
if ((await claim.count()) > 0) { await page.getByLabel('Name').fill(WRITER_NAME); await page.getByLabel('Email').fill(EMAIL); await page.getByLabel('Password', { exact: true }).fill(PASSWORD); await page.getByLabel('Repeat the password').fill(PASSWORD); await claim.click(); await expect(page).toHaveURL(/\/library$/); } else { await page.goto('/signin'); await page.getByLabel('Email').fill(EMAIL); await page.getByLabel('Password', { exact: true }).fill(PASSWORD); await page.getByRole('button', { name: /^sign in$/i }).click(); await expect(page).toHaveURL(/\/library$/); }
await spendWritingTour(page);});