Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

fix failing tests

Khuram Niaz03903d11e397
diff --git a/e2e/add-job.spec.ts b/e2e/add-job.spec.ts
index fd94f00..4b4684a 100644
--- a/e2e/add-job.spec.ts
+++ b/e2e/add-job.spec.ts
@@ -26,37 +26,52 @@ async function createNewJob(page: Page, jobText: string) {
await page.getByLabel("Job Title").click();
await page.getByPlaceholder("Create or Search title").click();
await page.getByPlaceholder("Create or Search title").fill(jobText);
- await page.waitForTimeout(500); // Wait for debounce and list to stabilize
- const jobTitle = page.getByRole("option", {
+ await page.waitForTimeout(500); // Wait for debounce
+ // Check if item exists in list or needs to be created
+ const existingOption = page.getByRole("option", {
name: jobText,
exact: true,
});
- await jobTitle.waitFor({ state: "visible", timeout: 5000 });
- await jobTitle.click({ force: true });
+ const createOption = page.getByText(`Create: ${jobText}`);
+ if (await existingOption.isVisible()) {
+ await existingOption.click();
+ } else if (await createOption.isVisible()) {
+ await createOption.click();
+ }
await expect(page.getByLabel("Job Title")).toContainText(jobText);
await page.getByLabel("Company").click();
await page.getByPlaceholder("Create or Search company").click();
const companyText = "company test";
await page.getByPlaceholder("Create or Search company").fill(companyText);
- await page.waitForTimeout(500); // Wait for debounce and list to stabilize
- const companyTitle = page.getByRole("option", {
+ await page.waitForTimeout(500); // Wait for debounce
+ // Check if item exists in list or needs to be created
+ const existingCompany = page.getByRole("option", {
name: companyText,
exact: true,
});
- await companyTitle.waitFor({ state: "visible", timeout: 5000 });
- await companyTitle.click({ force: true });
+ const createCompany = page.getByText(`Create: ${companyText}`);
+ if (await existingCompany.isVisible()) {
+ await existingCompany.click();
+ } else if (await createCompany.isVisible()) {
+ await createCompany.click();
+ }
await expect(page.getByLabel("Company")).toContainText(companyText);
await page.getByLabel("Job Location").click();
await page.getByPlaceholder("Create or Search location").click();
const locationText = "location test";
await page.getByPlaceholder("Create or Search location").fill(locationText);
- await page.waitForTimeout(500); // Wait for debounce and list to stabilize
- const locationTitle = page.getByRole("option", {
+ await page.waitForTimeout(500); // Wait for debounce
+ // Check if item exists in list or needs to be created
+ const existingLocation = page.getByRole("option", {
name: locationText,
exact: true,
});
- await locationTitle.waitFor({ state: "visible", timeout: 5000 });
- await locationTitle.click({ force: true });
+ const createLocation = page.getByText(`Create: ${locationText}`);
+ if (await existingLocation.isVisible()) {
+ await existingLocation.click();
+ } else if (await createLocation.isVisible()) {
+ await createLocation.click();
+ }
await expect(page.getByLabel("Job Location")).toContainText(locationText);
await page.getByText("Part-time").click();
await page.getByLabel("Job Source").click();
diff --git a/e2e/profile.spec.ts b/e2e/profile.spec.ts
index c14b03f..6be3436 100644
--- a/e2e/profile.spec.ts
+++ b/e2e/profile.spec.ts
@@ -184,20 +184,31 @@ test.describe("Profile page", () => {
await expect(page.getByRole("heading", { name: "Resume" })).toBeVisible();
await page.getByRole("button", { name: "Add Section" }).click();
await page.getByRole("menuitem", { name: "Add Education" }).click();
- await page.getByPlaceholder("Ex: Education").fill("Education");
+ // Wait for the dialog to open
+ await page.waitForTimeout(500);
+ // Only fill section title if it's visible (when creating new section)
+ const sectionTitleField = page.getByPlaceholder("Ex: Education");
+ if (await sectionTitleField.isVisible()) {
+ await sectionTitleField.fill("Education");
+ }
await page.getByPlaceholder("Ex: Stanford").click();
await page.getByPlaceholder("Ex: Stanford").fill("test school");
await page.getByLabel("Location").click();
await page.getByPlaceholder("Create or Search location").click();
const locationText = "location test";
await page.getByPlaceholder("Create or Search location").fill(locationText);
- await page.waitForTimeout(500); // Wait for debounce and list to stabilize
- const locationTitle = page.getByRole("option", {
+ await page.waitForTimeout(500); // Wait for debounce
+ // Check if item exists in list or needs to be created
+ const existingLocation = page.getByRole("option", {
name: locationText,
exact: true,
});
- await locationTitle.waitFor({ state: "visible", timeout: 5000 });
- await locationTitle.click({ force: true });
+ const createLocation = page.getByText(`Create: ${locationText}`);
+ if (await existingLocation.isVisible()) {
+ await existingLocation.click();
+ } else if (await createLocation.isVisible()) {
+ await createLocation.click();
+ }
await expect(page.getByLabel("Location")).toContainText(locationText);
await page.getByPlaceholder("Ex: Bachelor's").click();
await page.getByPlaceholder("Ex: Bachelor's").fill("degree text");
@@ -206,21 +217,19 @@ test.describe("Profile page", () => {
.getByPlaceholder("Ex: Computer Science")
.fill("computer science");
await page.getByLabel("Start Date").click();
- // Wait for popover to be visible and calendar to render
- await page.getByRole("grid").waitFor({ state: "visible", timeout: 5000 });
- await page.waitForTimeout(500); // Additional wait for calendar to stabilize
- await page
- .getByRole("gridcell", { name: "2", exact: true })
- .first()
- .click();
+ // Wait for calendar popover to open
+ await page.waitForTimeout(1000);
+ // Click on any available date in the calendar
+ const startDateCell = page.getByRole("gridcell", { name: "15" }).first();
+ await startDateCell.waitFor({ state: "visible", timeout: 5000 });
+ await startDateCell.click();
await page.getByLabel("End Date").click();
- // Wait for popover to be visible and calendar to render
- await page.getByRole("grid").waitFor({ state: "visible", timeout: 5000 });
- await page.waitForTimeout(500); // Additional wait for calendar to stabilize
- await page
- .getByRole("gridcell", { name: "3", exact: true })
- .first()
- .click();
+ // Wait for calendar popover to open
+ await page.waitForTimeout(1000);
+ // Click on any available date in the calendar
+ const endDateCell = page.getByRole("gridcell", { name: "20" }).first();
+ await endDateCell.waitFor({ state: "visible", timeout: 5000 });
+ await endDateCell.click();
await page.locator("div:nth-child(2) > .tiptap").click();
await page.locator("div:nth-child(2) > .tiptap").fill("test description");
await page.getByRole("button", { name: "Save" }).click();
@@ -247,48 +256,71 @@ async function addExperience(page: Page, resumeTitle: string, jobText: string) {
await expect(page.getByRole("heading", { name: "Resume" })).toBeVisible();
await page.getByRole("button", { name: "Add Section" }).click();
await page.getByRole("menuitem", { name: "Add Experience" }).click();
- await page.getByPlaceholder("Ex: Experience").fill("Experience");
- await page.getByPlaceholder("Ex: Experience").press("Tab");
+ // Wait for the dialog to open
+ await page.waitForTimeout(500);
+ // Only fill section title if it's visible (when creating new section)
+ const sectionTitleField = page.getByPlaceholder("Ex: Experience");
+ if (await sectionTitleField.isVisible()) {
+ await sectionTitleField.fill("Experience");
+ await sectionTitleField.press("Tab");
+ }
await page.getByLabel("Job Title").click();
await page.getByPlaceholder("Create or Search title").click();
await page.getByPlaceholder("Create or Search title").fill(jobText);
- await page.waitForTimeout(500); // Wait for debounce and list to stabilize
- const jobTitle = page.getByRole("option", {
+ await page.waitForTimeout(500); // Wait for debounce
+ // Check if item exists in list or needs to be created
+ const existingTitle = page.getByRole("option", {
name: jobText,
exact: true,
});
- await jobTitle.waitFor({ state: "visible", timeout: 5000 });
- await jobTitle.click({ force: true });
+ const createTitle = page.getByText(`Create: ${jobText}`);
+ if (await existingTitle.isVisible()) {
+ await existingTitle.click();
+ } else if (await createTitle.isVisible()) {
+ await createTitle.click();
+ }
await expect(page.getByLabel("Job Title")).toContainText(jobText);
await page.getByLabel("Company").click();
await page.getByPlaceholder("Create or Search company").click();
const companyText = "company test";
await page.getByPlaceholder("Create or Search company").fill(companyText);
- await page.waitForTimeout(500); // Wait for debounce and list to stabilize
- const companyTitle = page.getByRole("option", {
+ await page.waitForTimeout(500); // Wait for debounce
+ // Check if item exists in list or needs to be created
+ const existingCompany = page.getByRole("option", {
name: companyText,
exact: true,
});
- await companyTitle.waitFor({ state: "visible", timeout: 5000 });
- await companyTitle.click({ force: true });
+ const createCompany = page.getByText(`Create: ${companyText}`);
+ if (await existingCompany.isVisible()) {
+ await existingCompany.click();
+ } else if (await createCompany.isVisible()) {
+ await createCompany.click();
+ }
await expect(page.getByLabel("Company")).toContainText(companyText);
await page.getByLabel("Job Location").click();
await page.getByPlaceholder("Create or Search location").click();
const locationText = "location test";
await page.getByPlaceholder("Create or Search location").fill(locationText);
- await page.waitForTimeout(500); // Wait for debounce and list to stabilize
- const locationTitle = page.getByRole("option", {
+ await page.waitForTimeout(500); // Wait for debounce
+ // Check if item exists in list or needs to be created
+ const existingLocation = page.getByRole("option", {
name: locationText,
exact: true,
});
- await locationTitle.waitFor({ state: "visible", timeout: 5000 });
- await locationTitle.click({ force: true });
+ const createLocation = page.getByText(`Create: ${locationText}`);
+ if (await existingLocation.isVisible()) {
+ await existingLocation.click();
+ } else if (await createLocation.isVisible()) {
+ await createLocation.click();
+ }
await expect(page.getByLabel("Job Location")).toContainText(locationText);
await page.getByLabel("Start Date").click();
- // Wait for popover to be visible and calendar to render
- await page.getByRole("grid").waitFor({ state: "visible", timeout: 5000 });
- await page.waitForTimeout(500); // Additional wait for calendar to stabilize
- await page.getByRole("gridcell", { name: "2", exact: true }).first().click();
+ // Wait for calendar popover to open
+ await page.waitForTimeout(1000);
+ // Click on any available date in the calendar
+ const dateCell = page.getByRole("gridcell", { name: "15" }).first();
+ await dateCell.waitFor({ state: "visible", timeout: 5000 });
+ await dateCell.click();
await page.locator("div:nth-child(2) > .tiptap").click();
await page.locator("div:nth-child(2) > .tiptap").fill("test description");
await page.getByRole("button", { name: "Save" }).click();