Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion e2e/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ export const fillDatePicker = async (page: Page, name: string, value: string) =>
// Wait for the field to be interactive before typing to avoid lost keystrokes
await expect(date).toBeEditable();
// Add delay between keystrokes as workaround for React Aria Components JS interop issues
return date.pressSequentially(value, { delay: 100 });
await date.pressSequentially(value, { delay: 100 });
// Verify the year was fully processed by React before returning
const year = value.split("/")[2];
if (year) {
await expect(page.getByRole("spinbutton", { name }).last()).toContainText(year);
}
};

export const findRichTextEditor = (page: Locator | Page, name: string) =>
Expand Down
29 changes: 16 additions & 13 deletions e2e/tests/company/invoices/complete-flow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ test.describe("Invoice submission, approval and rejection", () => {
await expect(page.getByText("$683", { exact: true })).toBeVisible();
await page.getByRole("button", { name: "Send invoice" }).click();

await expect(page.getByRole("cell", { name: "CUSTOM-1" })).toBeVisible();
await expect(page.locator("tbody")).toContainText("Nov 1, 2024");
await expect(page.locator("tbody")).toContainText("$683");
await expect(page.locator("tbody")).toContainText("Awaiting approval");
const custom1Row = page.locator("tbody tr").filter({ hasText: "CUSTOM-1" });
await expect(custom1Row).toBeVisible();
await expect(custom1Row).toContainText("Nov 1, 2024");
await expect(custom1Row).toContainText("$683");
await expect(custom1Row).toContainText("Awaiting approval");

await page.locator("header").getByRole("link", { name: "New invoice" }).click();
await page.getByPlaceholder("Description").fill("woops too little time");
Expand All @@ -61,10 +62,11 @@ test.describe("Invoice submission, approval and rejection", () => {
await fillDatePicker(page, "Date", "12/01/2024");
await page.getByRole("button", { name: "Send invoice" }).click();

await expect(page.getByRole("cell", { name: "CUSTOM-2" })).toBeVisible();
await expect(page.locator("tbody")).toContainText("Dec 1, 2024");
await expect(page.locator("tbody")).toContainText("$23");
await expect(page.locator("tbody")).toContainText("Awaiting approval");
const custom2Row = page.locator("tbody tr").filter({ hasText: "CUSTOM-2" });
await expect(custom2Row).toBeVisible();
await expect(custom2Row).toContainText("Dec 1, 2024");
await expect(custom2Row).toContainText("$23");
await expect(custom2Row).toContainText("Awaiting approval");

await page.getByRole("cell", { name: "CUSTOM-1" }).click();
await page.getByRole("link", { name: "Edit invoice" }).click();
Expand All @@ -84,12 +86,13 @@ test.describe("Invoice submission, approval and rejection", () => {
await fillDatePicker(page, "Date", "12/01/2024");
await page.getByRole("button", { name: "Send invoice" }).click();

await expect(page.getByRole("cell", { name: "CUSTOM-3" })).toBeVisible();
await expect(page.locator("tbody")).toContainText("Dec 1, 2024");
await expect(page.locator("tbody")).toContainText("$33");
await expect(page.locator("tbody")).toContainText("Awaiting approval");
const custom3Row = page.locator("tbody tr").filter({ hasText: "CUSTOM-3" });
await expect(custom3Row).toBeVisible();
await expect(custom3Row).toContainText("Dec 1, 2024");
await expect(custom3Row).toContainText("$33");
await expect(custom3Row).toContainText("Awaiting approval");

await page.getByRole("cell", { name: "CUSTOM-3" }).click({ button: "right" });
await custom3Row.click({ button: "right" });
await page.getByRole("menuitem", { name: "Delete" }).click();
await withinModal(
async (modal) => {
Expand Down