Stabilize invoicing period E2E scenarios
This commit is contained in:
@@ -1273,7 +1273,9 @@ test.describe("Invoicing period tab", () => {
|
||||
await expect(page.getByTestId("date-period-start")).toHaveCount(0);
|
||||
expect(selectedPeriodRequests).toHaveLength(0);
|
||||
|
||||
await monthSelector.locator(".datepicker-months .datepicker-cell").nth(6).click();
|
||||
const julyOption = monthSelector.locator(".datepicker-months .datepicker-cell").filter({ hasText: /jul/i });
|
||||
await expect(julyOption).toHaveCount(1);
|
||||
await julyOption.click();
|
||||
|
||||
await expect
|
||||
.poll(() => selectedPeriodRequests.at(-1))
|
||||
@@ -1627,15 +1629,12 @@ test.describe("Invoicing period tab", () => {
|
||||
|
||||
const priceField = page.getByTestId("invoice-period-tree-field-order_item:7701-price");
|
||||
const priceFlagButton = priceField.getByTestId("invoice-period-flag-badge").locator("button").first();
|
||||
expect(
|
||||
await priceFlagButton.evaluate((button) => {
|
||||
const actions = button
|
||||
.closest(".invoice-period-tree-node__row")
|
||||
?.querySelector(".invoice-period-tree-node__actions")
|
||||
?.getBoundingClientRect();
|
||||
return actions ? button.getBoundingClientRect().right <= actions.left : false;
|
||||
})
|
||||
).toBe(true);
|
||||
const priceActionWheel = page.getByTestId("invoice-period-tree-action-wheel-order_item:7701");
|
||||
const [priceFlagBox, priceActionBox] = await Promise.all([
|
||||
getBoundingBox(priceFlagButton, "price flag button"),
|
||||
getBoundingBox(priceActionWheel, "price action wheel"),
|
||||
]);
|
||||
expect(boxesOverlap(priceFlagBox, priceActionBox), "price flag overlaps its row action wheel").toBe(false);
|
||||
await priceFlagButton.click();
|
||||
await expect(priceFlagButton).toHaveAttribute("aria-expanded", "true");
|
||||
const automaticFlag = page.getByTestId("invoice-period-flag-auto-price-1");
|
||||
@@ -1922,20 +1921,24 @@ test.describe("Invoicing period tab", () => {
|
||||
await expect(duplicateSelector).toContainText(/Mulige|Possible/i);
|
||||
await expect(duplicateSelector).toContainText("(0/1)");
|
||||
|
||||
const duplicateGroup = page.getByTestId("invoicing-period-duplicate-group-EC21233-2026-05-11");
|
||||
const duplicateGroup = page.getByTestId(/^invoicing-period-duplicate-group-EC21233-\d{4}-\d{2}-\d{2}$/);
|
||||
await expect(duplicateGroup).toBeVisible();
|
||||
const duplicateGroupTestId = await duplicateGroup.getAttribute("data-testid");
|
||||
const duplicateGroupKey = duplicateGroupTestId?.replace("invoicing-period-duplicate-group-", "");
|
||||
expect(duplicateGroupKey).toMatch(/^EC21233-\d{4}-\d{2}-\d{2}$/);
|
||||
const duplicateDate = duplicateGroupKey?.replace("EC21233-", "");
|
||||
await expect(page.getByTestId("invoicing-period-customer-7201")).toHaveCount(0);
|
||||
await expect(page.getByTestId("invoicing-period-customer-7202")).toHaveCount(0);
|
||||
await expect(duplicateGroup).toContainText("EC21233");
|
||||
await expect(duplicateGroup).toContainText("2 kunder");
|
||||
await expect(duplicateGroup).toContainText("2 vaskelog");
|
||||
await expect(duplicateGroup).not.toContainText("EC21233 - 11/05/2026");
|
||||
await expect(duplicateGroup.getByText(/^EC21233\s+-\s+/)).toHaveCount(0);
|
||||
await expect(duplicateGroup).toContainText("Pleno Vognmandsforretning #7201");
|
||||
await expect(duplicateGroup).toContainText("Estland Alle ApS #7202");
|
||||
await expect(page.getByTestId("invoicing-period-duplicate-group-SINGLE1-2026-05-11")).toHaveCount(0);
|
||||
await expect(page.getByTestId(`invoicing-period-duplicate-group-SINGLE1-${duplicateDate}`)).toHaveCount(0);
|
||||
|
||||
const plateTag = page.getByTestId("invoicing-period-duplicate-plate-tag-EC21233-2026-05-11");
|
||||
const dateTag = page.getByTestId("invoicing-period-duplicate-date-tag-EC21233-2026-05-11");
|
||||
const plateTag = page.getByTestId(`invoicing-period-duplicate-plate-tag-${duplicateGroupKey}`);
|
||||
const dateTag = page.getByTestId(`invoicing-period-duplicate-date-tag-${duplicateGroupKey}`);
|
||||
const plateBox = await plateTag.boundingBox();
|
||||
const dateBox = await dateTag.boundingBox();
|
||||
expect(plateBox).not.toBeNull();
|
||||
@@ -1944,12 +1947,12 @@ test.describe("Invoicing period tab", () => {
|
||||
expect(dateBox?.y ?? 0).toBeGreaterThan(plateBox?.y ?? 0);
|
||||
|
||||
await duplicateGroup.click();
|
||||
const expandedGroup = page.getByTestId("invoicing-period-duplicate-group-expanded-EC21233-2026-05-11");
|
||||
const expandedGroup = page.getByTestId(`invoicing-period-duplicate-group-expanded-${duplicateGroupKey}`);
|
||||
await expect(expandedGroup.locator("[data-testid='pagination-search-input']")).toHaveCount(0);
|
||||
await expect(expandedGroup.locator("[data-testid='pagination-reload-actions']")).toHaveCount(0);
|
||||
await expect(expandedGroup.locator("nav.pagination")).toHaveCount(0);
|
||||
await expect(expandedGroup.getByText(/Side\s+\d+\s+af/i)).toHaveCount(0);
|
||||
const comparison = page.getByTestId("invoicing-period-duplicate-comparison-EC21233-2026-05-11");
|
||||
const comparison = page.getByTestId(`invoicing-period-duplicate-comparison-${duplicateGroupKey}`);
|
||||
await expect(comparison).toBeVisible();
|
||||
await expect(comparison.getByTestId("invoicing-period-duplicate-comparison-row-9701")).toContainText(
|
||||
"Pleno Vognmandsforretning #7201"
|
||||
@@ -2641,8 +2644,6 @@ test.describe("Invoicing period tab", () => {
|
||||
|
||||
const { periodRequests } = await openPeriodView(page);
|
||||
|
||||
await expect(page.getByTestId("invoicing-period-reload-button")).toBeVisible();
|
||||
await page.getByTestId("invoicing-period-view-selector-all").click();
|
||||
await expect(page.getByTestId("invoicing-period-page-reload-button")).toBeVisible();
|
||||
await expect(page.getByTestId("invoicing-period-reload-button")).toHaveCount(0);
|
||||
const initialRequestCount = periodRequests.length;
|
||||
|
||||
Reference in New Issue
Block a user