📝 CodeRabbit Chat: Simplify code

This commit is contained in:
coderabbitai[bot]
2026-06-20 04:35:03 +00:00
committed by GitHub
parent 0d10a1dc1e
commit d55fdb85bf
4 changed files with 8 additions and 14 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ export async function loginViaUi(page: Page, account: E2EAccount) {
export async function logoutViaUi(page: Page, account: E2EAccount) {
await page.getByText(account.email).click();
await page.getByRole("menuitem", { name: "Logout" }).click();
await page.goto("/auth/login");
await page.waitForURL(/\/auth\/login/);
}
async function registerViaApi(request: APIRequestContext, account: E2EAccount, baseURL: string) {
+2 -6
View File
@@ -1,15 +1,11 @@
import type { E2EAccount } from "./data";
import { Pool } from "pg";
function getDatabaseUrl() {
export async function deleteE2EUser(account: E2EAccount) {
const databaseUrl = process.env.DATABASE_URL;
if (!databaseUrl) throw new Error("DATABASE_URL is required for E2E cleanup.");
return databaseUrl;
}
export async function deleteE2EUser(account: E2EAccount) {
const pool = new Pool({ connectionString: getDatabaseUrl() });
const pool = new Pool({ connectionString: databaseUrl });
try {
await pool.query('delete from "user" where email = $1 or username = $2', [account.email, account.username]);
+1 -1
View File
@@ -15,7 +15,7 @@ export async function createSampleResumeFromDashboard(page: Page, testInfo: Test
await createGroup.getByRole("button").nth(1).click();
await page.getByRole("menuitem", { name: "Create a Sample Resume" }).click();
const resumeLink = page.getByRole("link", { name: new RegExp(resumeName) });
const resumeLink = page.getByRole("link", { name: resumeName, exact: true });
await expect(resumeLink).toBeVisible();
await resumeLink.click();
await page.waitForURL(/\/builder\/.+/);
+4 -6
View File
@@ -12,8 +12,7 @@ type Fixtures = {
};
export const test = base.extend<Fixtures>({
account: async ({ baseURL }, use, testInfo) => {
void baseURL;
account: async ({}, use, testInfo) => {
const account = createAccount(testInfo);
try {
@@ -22,13 +21,12 @@ export const test = base.extend<Fixtures>({
await deleteE2EUser(account);
}
},
authContext: async ({ browser, request, account }, use, testInfo) => {
const baseURL = String(testInfo.project.use.baseURL ?? "http://localhost:3000");
const context = await createAuthenticatedContext(browser, request, account, baseURL);
authContext: async ({ browser, request, account, baseURL }, use) => {
const context = await createAuthenticatedContext(browser, request, account, baseURL ?? "http://localhost:3000");
try {
await use(context);
} finally {
await context.close();
}
},