Files
DIYgod 93e4a3b48f feat: add cross-platform e2e coverage (#4901)
* feat: add cross-platform e2e coverage

* fix: stabilize desktop e2e navigation

* fix: harden desktop e2e read flow

* fix: harden desktop e2e auth and follow flows

* fix: stabilize desktop e2e discover entry flows

* fix: run android e2e in a single shell

* fix: speed up mobile e2e builds in ci

* fix: build android e2e app from mobile workspace

* fix: invoke android gradle build from repo root

* fix: use absolute path for android ci build

* fix: restore android eas build in ci

* fix: target iOS simulator by udid in ci

* fix: align desktop e2e with discover card flow

* fix: reorder web e2e after relogin

* fix: navigate web e2e via real hash url

* fix: close stale settings modal before reopening

* fix: track android maestro flows

* fix: wait for settings router in web e2e

* fix: wait for web settings sync propagation

* fix: stabilize desktop e2e settings flows

* fix: harden desktop e2e regressions

* fix: stabilize desktop e2e selectors

* fix: read desktop entry state from locators

* fix: relax desktop e2e entry assertions

* fix: avoid waiting on missing desktop feed ids
2026-03-10 11:32:00 +08:00

45 lines
1.1 KiB
TypeScript

import type { Page } from "@playwright/test"
import type { DesktopE2EEnv } from "./env"
export interface TestAccount {
email: string
password: string
}
export const createTestAccount = (name: string): TestAccount => {
const suffix = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`
return {
email: `folo-e2e-${name}-${suffix}@example.com`,
password: process.env.FOLO_E2E_PASSWORD ?? "Password123!",
}
}
export const tryDeleteCurrentUser = async (page: Page, env: DesktopE2EEnv) => {
return page.evaluate(async ({ apiURL }) => {
try {
const response = await fetch(`${apiURL}/better-auth/delete-user-custom`, {
method: "POST",
credentials: "include",
headers: {
"content-type": "application/json",
},
body: JSON.stringify({}),
})
return {
ok: response.ok,
status: response.status,
text: await response.text(),
}
} catch (error) {
return {
ok: false,
status: -1,
text: error instanceof Error ? error.message : String(error),
}
}
}, env)
}