Add .prettierrc.json and refactor test files for improved formatting consistency:
- Introduced `.prettierrc.json` to enforce consistent code formatting across the project. - Updated unit and e2e test files to address formatting issues, improve readability, and ensure alignment with the new Prettier configuration.
This commit is contained in:
@@ -28,7 +28,8 @@ async function suppressVueDevtoolsOverlay(page) {
|
||||
if (!document.getElementById(STYLE_ID)) {
|
||||
const style = document.createElement("style");
|
||||
style.id = STYLE_ID;
|
||||
style.textContent = "#__vue-devtools-container__, .vue-devtools__anchor-btn, .vue-devtools__panel-content { display: none !important; visibility: hidden !important; pointer-events: none !important; }";
|
||||
style.textContent =
|
||||
"#__vue-devtools-container__, .vue-devtools__anchor-btn, .vue-devtools__panel-content { display: none !important; visibility: hidden !important; pointer-events: none !important; }";
|
||||
(document.head || document.documentElement).appendChild(style);
|
||||
}
|
||||
|
||||
@@ -65,16 +66,21 @@ test.describe("Economic queue async export workflow", () => {
|
||||
return;
|
||||
}
|
||||
|
||||
await route.fulfill(json({
|
||||
data: {
|
||||
job: {
|
||||
id: 1101,
|
||||
status: "QUEUED",
|
||||
progress_percent: 0,
|
||||
progress_message: "Queued export",
|
||||
await route.fulfill(
|
||||
json(
|
||||
{
|
||||
data: {
|
||||
job: {
|
||||
id: 1101,
|
||||
status: "QUEUED",
|
||||
progress_percent: 0,
|
||||
progress_message: "Queued export",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}, 202));
|
||||
202
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
await page.route("**/economic/invoice/export/status**", async (route) => {
|
||||
@@ -85,28 +91,32 @@ test.describe("Economic queue async export workflow", () => {
|
||||
|
||||
statusCalls += 1;
|
||||
if (statusCalls === 1) {
|
||||
await route.fulfill(json({
|
||||
data: {
|
||||
id: 1101,
|
||||
status: "PROCESSING",
|
||||
progress_percent: 40,
|
||||
progress_message: "Preparing invoice payload",
|
||||
},
|
||||
}));
|
||||
await route.fulfill(
|
||||
json({
|
||||
data: {
|
||||
id: 1101,
|
||||
status: "PROCESSING",
|
||||
progress_percent: 40,
|
||||
progress_message: "Preparing invoice payload",
|
||||
},
|
||||
})
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
await route.fulfill(json({
|
||||
data: {
|
||||
id: 1101,
|
||||
status: "COMPLETED",
|
||||
progress_percent: 100,
|
||||
progress_message: "Completed",
|
||||
result: {
|
||||
message: "Invoice export completed by queue worker.",
|
||||
await route.fulfill(
|
||||
json({
|
||||
data: {
|
||||
id: 1101,
|
||||
status: "COMPLETED",
|
||||
progress_percent: 100,
|
||||
progress_message: "Completed",
|
||||
result: {
|
||||
message: "Invoice export completed by queue worker.",
|
||||
},
|
||||
},
|
||||
},
|
||||
}));
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
await openHarness(page);
|
||||
@@ -116,7 +126,9 @@ test.describe("Economic queue async export workflow", () => {
|
||||
await expect(submitButton).toBeDisabled();
|
||||
await expect(page.getByTestId("economic-invoice-export-progress")).toContainText("Preparing invoice payload");
|
||||
|
||||
await expect(page.getByTestId("economic-invoice-export-completed")).toContainText("Invoice export completed by queue worker.");
|
||||
await expect(page.getByTestId("economic-invoice-export-completed")).toContainText(
|
||||
"Invoice export completed by queue worker."
|
||||
);
|
||||
await expect(page.getByTestId("economic-invoice-export-completed")).toBeVisible();
|
||||
|
||||
const terminalCallCount = statusCalls;
|
||||
@@ -134,16 +146,21 @@ test.describe("Economic queue async export workflow", () => {
|
||||
return;
|
||||
}
|
||||
|
||||
await route.fulfill(json({
|
||||
data: {
|
||||
job: {
|
||||
id: 1201,
|
||||
status: "QUEUED",
|
||||
progress_percent: 0,
|
||||
progress_message: "Queued export",
|
||||
await route.fulfill(
|
||||
json(
|
||||
{
|
||||
data: {
|
||||
job: {
|
||||
id: 1201,
|
||||
status: "QUEUED",
|
||||
progress_percent: 0,
|
||||
progress_message: "Queued export",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}, 202));
|
||||
202
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
await page.route("**/economic/invoice/export/retry", async (route) => {
|
||||
@@ -153,16 +170,21 @@ test.describe("Economic queue async export workflow", () => {
|
||||
}
|
||||
|
||||
phase = "retry";
|
||||
await route.fulfill(json({
|
||||
data: {
|
||||
job: {
|
||||
id: 1201,
|
||||
status: "QUEUED",
|
||||
progress_percent: 0,
|
||||
progress_message: "Retry queued",
|
||||
await route.fulfill(
|
||||
json(
|
||||
{
|
||||
data: {
|
||||
job: {
|
||||
id: 1201,
|
||||
status: "QUEUED",
|
||||
progress_percent: 0,
|
||||
progress_message: "Retry queued",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}, 200));
|
||||
200
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
await page.route("**/economic/invoice/export/status**", async (route) => {
|
||||
@@ -172,52 +194,62 @@ test.describe("Economic queue async export workflow", () => {
|
||||
}
|
||||
|
||||
if (phase === "initial") {
|
||||
await route.fulfill(json({
|
||||
data: {
|
||||
id: 1201,
|
||||
status: "FAILED",
|
||||
progress_percent: 10,
|
||||
progress_message: "Failed",
|
||||
error_message: "no billable order items after zero-price/zero-quantity skips",
|
||||
},
|
||||
}));
|
||||
await route.fulfill(
|
||||
json({
|
||||
data: {
|
||||
id: 1201,
|
||||
status: "FAILED",
|
||||
progress_percent: 10,
|
||||
progress_message: "Failed",
|
||||
error_message: "no billable order items after zero-price/zero-quantity skips",
|
||||
},
|
||||
})
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
retryStatusCalls += 1;
|
||||
if (retryStatusCalls === 1) {
|
||||
await route.fulfill(json({
|
||||
data: {
|
||||
id: 1201,
|
||||
status: "PROCESSING",
|
||||
progress_percent: 70,
|
||||
progress_message: "Retry processing",
|
||||
},
|
||||
}));
|
||||
await route.fulfill(
|
||||
json({
|
||||
data: {
|
||||
id: 1201,
|
||||
status: "PROCESSING",
|
||||
progress_percent: 70,
|
||||
progress_message: "Retry processing",
|
||||
},
|
||||
})
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
await route.fulfill(json({
|
||||
data: {
|
||||
id: 1201,
|
||||
status: "COMPLETED",
|
||||
progress_percent: 100,
|
||||
progress_message: "Retry completed",
|
||||
result: {
|
||||
message: "Invoice export completed after retry.",
|
||||
await route.fulfill(
|
||||
json({
|
||||
data: {
|
||||
id: 1201,
|
||||
status: "COMPLETED",
|
||||
progress_percent: 100,
|
||||
progress_message: "Retry completed",
|
||||
result: {
|
||||
message: "Invoice export completed after retry.",
|
||||
},
|
||||
},
|
||||
},
|
||||
}));
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
await openHarness(page);
|
||||
|
||||
await page.getByTestId("economic-invoice-export-submit").click();
|
||||
await expect(page.getByTestId("economic-invoice-export-failed")).toContainText("no billable order items after zero-price/zero-quantity skips");
|
||||
await expect(page.getByTestId("economic-invoice-export-failed")).toContainText(
|
||||
"no billable order items after zero-price/zero-quantity skips"
|
||||
);
|
||||
|
||||
await page.getByTestId("economic-invoice-export-retry").click();
|
||||
await expect(page.getByTestId("economic-invoice-export-progress")).toContainText("Retry processing");
|
||||
await expect(page.getByTestId("economic-invoice-export-completed")).toContainText("Invoice export completed after retry.");
|
||||
await expect(page.getByTestId("economic-invoice-export-completed")).toContainText(
|
||||
"Invoice export completed after retry."
|
||||
);
|
||||
});
|
||||
|
||||
test("draft export surfaces API transport errors separately from queue failure state", async ({ page }) => {
|
||||
@@ -252,16 +284,21 @@ test.describe("Economic queue async export workflow", () => {
|
||||
send_as_is: false,
|
||||
});
|
||||
|
||||
await route.fulfill(json({
|
||||
data: {
|
||||
job: {
|
||||
id: 1301,
|
||||
status: "QUEUED",
|
||||
progress_percent: 0,
|
||||
progress_message: "Collected invoice queued",
|
||||
await route.fulfill(
|
||||
json(
|
||||
{
|
||||
data: {
|
||||
job: {
|
||||
id: 1301,
|
||||
status: "QUEUED",
|
||||
progress_percent: 0,
|
||||
progress_message: "Collected invoice queued",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}, 202));
|
||||
202
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
await page.route("**/collected-invoices/economic/queue/status**", async (route) => {
|
||||
@@ -272,28 +309,32 @@ test.describe("Economic queue async export workflow", () => {
|
||||
|
||||
statusCalls += 1;
|
||||
if (statusCalls === 1) {
|
||||
await route.fulfill(json({
|
||||
data: {
|
||||
id: 1301,
|
||||
status: "PROCESSING",
|
||||
progress_percent: 55,
|
||||
progress_message: "Building e-conomic payload",
|
||||
},
|
||||
}));
|
||||
await route.fulfill(
|
||||
json({
|
||||
data: {
|
||||
id: 1301,
|
||||
status: "PROCESSING",
|
||||
progress_percent: 55,
|
||||
progress_message: "Building e-conomic payload",
|
||||
},
|
||||
})
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
await route.fulfill(json({
|
||||
data: {
|
||||
id: 1301,
|
||||
status: "COMPLETED",
|
||||
progress_percent: 100,
|
||||
progress_message: "Completed",
|
||||
result: {
|
||||
message: "Collected invoice exported.",
|
||||
await route.fulfill(
|
||||
json({
|
||||
data: {
|
||||
id: 1301,
|
||||
status: "COMPLETED",
|
||||
progress_percent: 100,
|
||||
progress_message: "Completed",
|
||||
result: {
|
||||
message: "Collected invoice exported.",
|
||||
},
|
||||
},
|
||||
},
|
||||
}));
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
await openHarness(page);
|
||||
@@ -312,17 +353,22 @@ test.describe("Economic queue async export workflow", () => {
|
||||
return;
|
||||
}
|
||||
|
||||
await route.fulfill(json({
|
||||
data: {
|
||||
message: "Queued collected invoice export",
|
||||
job_id: 1302,
|
||||
job: {
|
||||
status: "QUEUED",
|
||||
progress_percent: 0,
|
||||
progress_message: "Collected invoice queued",
|
||||
await route.fulfill(
|
||||
json(
|
||||
{
|
||||
data: {
|
||||
message: "Queued collected invoice export",
|
||||
job_id: 1302,
|
||||
job: {
|
||||
status: "QUEUED",
|
||||
progress_percent: 0,
|
||||
progress_message: "Collected invoice queued",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}, 202));
|
||||
202
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
await page.route("**/collected-invoices/economic/queue/status**", async (route) => {
|
||||
@@ -333,35 +379,41 @@ test.describe("Economic queue async export workflow", () => {
|
||||
|
||||
statusCalls += 1;
|
||||
if (statusCalls === 1) {
|
||||
await route.fulfill(json({
|
||||
data: {
|
||||
id: 1302,
|
||||
status: "PROCESSING",
|
||||
progress_percent: 65,
|
||||
progress_message: "Creating draft invoice",
|
||||
},
|
||||
}));
|
||||
await route.fulfill(
|
||||
json({
|
||||
data: {
|
||||
id: 1302,
|
||||
status: "PROCESSING",
|
||||
progress_percent: 65,
|
||||
progress_message: "Creating draft invoice",
|
||||
},
|
||||
})
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
await route.fulfill(json({
|
||||
data: {
|
||||
id: 1302,
|
||||
status: "COMPLETED",
|
||||
progress_percent: 100,
|
||||
progress_message: "Completed",
|
||||
result: {
|
||||
message: "Collected invoice exported from alias response.",
|
||||
await route.fulfill(
|
||||
json({
|
||||
data: {
|
||||
id: 1302,
|
||||
status: "COMPLETED",
|
||||
progress_percent: 100,
|
||||
progress_message: "Completed",
|
||||
result: {
|
||||
message: "Collected invoice exported from alias response.",
|
||||
},
|
||||
},
|
||||
},
|
||||
}));
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
await openHarness(page);
|
||||
|
||||
await page.getByTestId("collected-economic-create-invoice").click();
|
||||
await expect(page.getByTestId("collected-economic-progress")).toContainText("Creating draft invoice");
|
||||
await expect(page.getByTestId("collected-economic-completed")).toContainText("Collected invoice exported from alias response.");
|
||||
await expect(page.getByTestId("collected-economic-completed")).toContainText(
|
||||
"Collected invoice exported from alias response."
|
||||
);
|
||||
});
|
||||
|
||||
test("invalid boolean send_as_is is blocked and shown as validation error", async ({ page }) => {
|
||||
@@ -380,7 +432,9 @@ test.describe("Economic queue async export workflow", () => {
|
||||
await openHarness(page);
|
||||
|
||||
await page.getByTestId("economic-queue-harness-invalid-boolean-trigger").click();
|
||||
await expect(page.getByTestId("economic-queue-harness-invalid-boolean-error")).toContainText("send_as_is must be a boolean.");
|
||||
await expect(page.getByTestId("economic-queue-harness-invalid-boolean-error")).toContainText(
|
||||
"send_as_is must be a boolean."
|
||||
);
|
||||
expect(enqueueCalls).toBe(0);
|
||||
});
|
||||
|
||||
@@ -393,16 +447,21 @@ test.describe("Economic queue async export workflow", () => {
|
||||
return;
|
||||
}
|
||||
|
||||
await route.fulfill(json({
|
||||
data: {
|
||||
job: {
|
||||
id: 1401,
|
||||
status: "QUEUED",
|
||||
progress_percent: 0,
|
||||
progress_message: "Queued export",
|
||||
await route.fulfill(
|
||||
json(
|
||||
{
|
||||
data: {
|
||||
job: {
|
||||
id: 1401,
|
||||
status: "QUEUED",
|
||||
progress_percent: 0,
|
||||
progress_message: "Queued export",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}, 202));
|
||||
202
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
await page.route("**/economic/invoice/export/status**", async (route) => {
|
||||
@@ -412,14 +471,16 @@ test.describe("Economic queue async export workflow", () => {
|
||||
}
|
||||
|
||||
statusCalls += 1;
|
||||
await route.fulfill(json({
|
||||
data: {
|
||||
id: 1401,
|
||||
status: "PROCESSING",
|
||||
progress_percent: 25,
|
||||
progress_message: "Still processing",
|
||||
},
|
||||
}));
|
||||
await route.fulfill(
|
||||
json({
|
||||
data: {
|
||||
id: 1401,
|
||||
status: "PROCESSING",
|
||||
progress_percent: 25,
|
||||
progress_message: "Still processing",
|
||||
},
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
await openHarness(page);
|
||||
|
||||
Reference in New Issue
Block a user