
* Adds test todos * Can't seem to change locales * WIP playwright test refactoring * jest-playwright cleanup * Test fixes * Test fixes * More test fixes * WIP: Testing fixes * More test fixes * Removes unused files * Installs missing browsers for e2e * ts-node fixes * ts-check fixes * Type fixes * Fixes e2e * FFS * Renamex webhook snapshot * Fixes webhook cross-platform * Renamed webhook snapshot * Apply suggestions from code review Co-authored-by: Max Schmitt <max@schmitt.mx> * Removes kont dependency * Cleanup playwright options * Next.js cache optimizations on CI * Uses cache on e2e as well * Fixme is introducing side-effects Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: Bailey Pumfleet <pumfleet@hey.com> Co-authored-by: Max Schmitt <max@schmitt.mx>
37 lines
1.4 KiB
TypeScript
37 lines
1.4 KiB
TypeScript
import { Browser, chromium } from "@playwright/test";
|
|
|
|
async function loginAsUser(username: string, browser: Browser) {
|
|
const page = await browser.newPage();
|
|
await page.goto("http://localhost:3000/auth/login");
|
|
// Click input[name="email"]
|
|
await page.click('input[name="email"]');
|
|
// Fill input[name="email"]
|
|
await page.fill('input[name="email"]', `${username}@example.com`);
|
|
// Press Tab
|
|
await page.press('input[name="email"]', "Tab");
|
|
// Fill input[name="password"]
|
|
await page.fill('input[name="password"]', username);
|
|
// Press Enter
|
|
await page.press('input[name="password"]', "Enter");
|
|
await page.waitForSelector(
|
|
username === "onboarding" ? "[data-testid=onboarding]" : "[data-testid=dashboard-shell]"
|
|
);
|
|
// Save signed-in state to '${username}StorageState.json'.
|
|
await page.context().storageState({ path: `playwright/artifacts/${username}StorageState.json` });
|
|
await page.context().close();
|
|
}
|
|
|
|
async function globalSetup(/* config: FullConfig */) {
|
|
const browser = await chromium.launch();
|
|
await loginAsUser("onboarding", browser);
|
|
// await loginAsUser("free-first-hidden", browser);
|
|
await loginAsUser("pro", browser);
|
|
// await loginAsUser("trial", browser);
|
|
await loginAsUser("free", browser);
|
|
// await loginAsUser("usa", browser);
|
|
// await loginAsUser("teamfree", browser);
|
|
// await loginAsUser("teampro", browser);
|
|
await browser.close();
|
|
}
|
|
|
|
export default globalSetup;
|