Remove EdgeGatewayManager and related assets:
- Deleted `EdgeGatewayManager.vue` alongside its components, templates, styles, and functionality. - Added tests for `fetchDepartmentOrderBookingCount`. - Introduced `adminBookingCount.js` for department booking count logic.
This commit is contained in:
@@ -1341,8 +1341,66 @@ test.describe("Admin POS Orders - desktop settings", () => {
|
||||
await expect(dropdownContent).toHaveCSS("border-top-style", "solid");
|
||||
await expect(attachmentItems.nth(0)).toContainText(/vaskecertifikat|wash certificate/i);
|
||||
await expect(attachmentItems.nth(1)).toContainText(/upload/i);
|
||||
});
|
||||
});
|
||||
|
||||
test("shows only the draft export and receipt actions in the order rail for standard invoicing", async ({
|
||||
page,
|
||||
}, testInfo) => {
|
||||
test.skip(!testInfo.project.name.includes("desktop"), "Desktop-only order rail coverage");
|
||||
|
||||
await mockApi(page, {
|
||||
authenticated: true,
|
||||
permissions: POS_PERMISSIONS,
|
||||
edgeGateways: false,
|
||||
pos: createPosFixture(),
|
||||
});
|
||||
await primeOperatorSession(page, "pos-orders-order-rail-token");
|
||||
|
||||
await openOrderDetail(page);
|
||||
|
||||
const draftExportFlow = page.getByTestId("economic-draft-export-flow");
|
||||
const draftExportButton = page.getByTestId("economic-draft-export-submit");
|
||||
const invoiceExportFlow = page.getByTestId("economic-invoice-export-flow");
|
||||
const receiptButton = page.getByTestId("pos-order-print-receipt");
|
||||
|
||||
await expect(draftExportFlow).toBeVisible();
|
||||
await expect(invoiceExportFlow).toHaveCount(0);
|
||||
await expect(receiptButton).toBeVisible();
|
||||
await expect(receiptButton).toContainText("Kvittering");
|
||||
|
||||
const [draftExportWidth, receiptButtonWidth] = await Promise.all([
|
||||
draftExportButton.evaluate((element) => element.getBoundingClientRect().width),
|
||||
receiptButton.evaluate((element) => element.getBoundingClientRect().width),
|
||||
]);
|
||||
|
||||
expect(Math.abs(draftExportWidth - receiptButtonWidth)).toBeLessThanOrEqual(2);
|
||||
|
||||
await page.evaluate(() => {
|
||||
const receiptWindowState = window as Window & { __receiptOpenings?: string[] };
|
||||
receiptWindowState.__receiptOpenings = [];
|
||||
window.open = ((url?: string | URL) => {
|
||||
receiptWindowState.__receiptOpenings?.push(String(url ?? ""));
|
||||
return {
|
||||
onload: null,
|
||||
document: { title: "" },
|
||||
focus() {},
|
||||
print() {},
|
||||
close() {},
|
||||
} as unknown as Window;
|
||||
}) as typeof window.open;
|
||||
});
|
||||
|
||||
await receiptButton.click();
|
||||
|
||||
const openedReceiptUrls = await page.evaluate(() => {
|
||||
const receiptWindowState = window as Window & { __receiptOpenings?: string[] };
|
||||
return receiptWindowState.__receiptOpenings || [];
|
||||
});
|
||||
|
||||
expect(openedReceiptUrls).toHaveLength(1);
|
||||
expect(openedReceiptUrls[0]).toContain("/admin/12/modules/pos/orders/54518?print_receipt=true");
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Admin POS Orders - draft transaction customer", () => {
|
||||
test.beforeEach(async ({ page }, testInfo) => {
|
||||
@@ -1380,27 +1438,51 @@ test.describe("Admin POS Orders - draft transaction customer", () => {
|
||||
);
|
||||
});
|
||||
|
||||
test("blocks economic export for draft-backed orders and restores export actions after selecting a real customer", async ({
|
||||
test("opens the draft customer assignment modal from the blocked warnings and restores export actions after selecting a real customer", async ({
|
||||
page,
|
||||
}) => {
|
||||
await openOrderDetail(page);
|
||||
const warningAction = page.getByTestId("pos-order-economic-export-blocked-action");
|
||||
const railWarningAction = page.getByTestId("pos-order-economic-export-blocked-rail-action");
|
||||
|
||||
await expect(page.getByTestId("pos-order-draft-transaction-badge")).toBeVisible();
|
||||
await expect(page.getByText(/Gemt til fakturering/i)).toHaveCount(0);
|
||||
await expect(page.getByTestId("pos-order-economic-export-blocked")).toBeVisible();
|
||||
await expect(page.getByTestId("pos-order-economic-export-blocked-rail")).toBeVisible();
|
||||
await expect(warningAction).toBeVisible();
|
||||
await expect(railWarningAction).toBeVisible();
|
||||
await expect(warningAction).toHaveClass(/is-light/);
|
||||
await expect(warningAction).toHaveClass(/is-warning/);
|
||||
await expect(railWarningAction).toHaveClass(/is-light/);
|
||||
await expect(railWarningAction).toHaveClass(/is-warning/);
|
||||
await expect(page.getByTestId("economic-draft-export-flow")).toHaveCount(0);
|
||||
await expect(page.getByTestId("economic-invoice-export-flow")).toHaveCount(0);
|
||||
|
||||
await clickVisibleTestId(page, "pos-order-tab-settings");
|
||||
await expect(page.getByTestId("pos-order-panel-settings")).toBeVisible();
|
||||
const modal = page.getByTestId("draft-order-assign-customer-modal");
|
||||
await railWarningAction.click();
|
||||
await expect(modal).toBeVisible();
|
||||
await modal.locator(".delete").click();
|
||||
await expect(modal).toHaveCount(0);
|
||||
|
||||
await changeOrderCustomer(page, "12345679", "2026-05-02");
|
||||
await openOrderDetailsTab(page);
|
||||
await warningAction.click();
|
||||
await expect(modal).toBeVisible();
|
||||
await expect(page.getByTestId("draft-order-recalculate-prices")).toBeChecked();
|
||||
|
||||
await page.getByTestId("draft-order-assign-customer-search").fill("12345679");
|
||||
await page.getByTestId("draft-order-customer-option-12345679").click();
|
||||
await expect(page.getByTestId("draft-order-invoice-collection-option-101")).toBeVisible();
|
||||
await page.getByTestId("draft-order-invoice-collection-option-101").click();
|
||||
await page.getByTestId("draft-order-assign-submit").click();
|
||||
await expect(modal).toHaveCount(0);
|
||||
|
||||
await expect(page.getByTestId("pos-order-draft-transaction-badge")).toHaveCount(0);
|
||||
await expect(page.getByTestId("pos-order-economic-export-blocked")).toHaveCount(0);
|
||||
await expect(page.getByTestId("pos-order-economic-export-blocked-rail")).toHaveCount(0);
|
||||
await expect(page.getByTestId("pos-order-economic-export-blocked-action")).toHaveCount(0);
|
||||
await expect(page.getByTestId("pos-order-economic-export-blocked-rail-action")).toHaveCount(0);
|
||||
await expect(page.getByTestId("economic-draft-export-flow")).toBeVisible();
|
||||
await expect(page.getByTestId("economic-invoice-export-flow")).toBeVisible();
|
||||
await expect(page.getByTestId("economic-invoice-export-flow")).toHaveCount(0);
|
||||
await expect(page.getByTestId("pos-order-print-receipt")).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user