Skip to content

Commit b60ee08

Browse files
committed
Fix Recent billing events nav target and update e2e tests for back-office UI drift
1 parent c402487 commit b60ee08

3 files changed

Lines changed: 27 additions & 34 deletions

File tree

application/account/BackOffice/routes/-components/DashboardRecentStripeEventsCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function DashboardRecentStripeEventsCard() {
3030
const handleActivate = useCallback(
3131
(key: RowKey) => {
3232
const tenantId = String(key).split("|")[0];
33-
navigate({ to: "/accounts/$tenantId", params: { tenantId }, search: { tab: "invoices" } });
33+
navigate({ to: "/accounts/$tenantId", params: { tenantId }, search: { tab: "billing-events" } });
3434
},
3535
[navigate]
3636
);

application/account/WebApp/tests/e2e/back-office-flows.spec.ts

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ test.describe("@smoke", () => {
191191

192192
const main = page.getByRole("main");
193193

194-
await expect(page.getByRole("button", { name: "Back to accounts" })).toBeVisible();
195194
await expect(main.getByText("MRR")).toBeVisible();
196195
await expect(main.getByText("Lifetime value")).toBeVisible();
197196
await expect(main.getByRole("tab", { name: "Users" })).toBeVisible();
@@ -279,32 +278,23 @@ test.describe("@smoke", () => {
279278
await expect(page.getByRole("searchbox", { name: "Search" })).toBeVisible();
280279
})();
281280

282-
await step("Search for e2e owner first name & verify results table with at least one row")(async () => {
281+
await step("Search for e2e owner first name & verify URL filters to TestOwner row")(async () => {
283282
await page.getByRole("searchbox", { name: "Search" }).fill("testowner");
284283

284+
await expect(page).toHaveURL(`${BACK_OFFICE_BASE_URL}/users?search=testowner`);
285285
await expect(page.getByRole("table", { name: "Users" })).toBeVisible();
286286
await expect(page.getByRole("columnheader", { name: "User" })).toBeVisible();
287-
await expect(page.getByRole("row").nth(1)).toBeVisible();
287+
await expect(page.getByRole("row").filter({ hasText: "TestOwner" }).first()).toBeVisible();
288288
})();
289289

290-
await step("Click first user row & verify navigation to user detail page with display name and KPI cards")(
291-
async () => {
292-
await page.getByRole("row").nth(1).click();
293-
294-
await expect(page.getByRole("heading", { level: 1 })).toContainText("TestOwner");
295-
await expect(page.getByText("Last log-in")).toBeVisible();
296-
await expect(page.getByRole("heading", { name: "Accounts" })).toBeVisible();
297-
await expect(page.getByRole("heading", { name: "Sessions" })).toBeVisible();
298-
await expect(page.getByRole("heading", { name: "Login history" })).toBeVisible();
299-
}
300-
)();
301-
302-
await step("Click Page views tab & verify telemetry section renders all three tabs")(async () => {
303-
await page.getByRole("tab", { name: "Page views" }).click();
290+
await step("Click TestOwner row & verify navigation to user detail page with display name and tabs")(async () => {
291+
await page.getByRole("row").filter({ hasText: "TestOwner" }).first().click();
304292

305-
await expect(page.getByRole("tab", { name: "Exceptions" })).toBeVisible();
306-
await expect(page.getByRole("tab", { name: "Page views" })).toBeVisible();
307-
await expect(page.getByRole("tab", { name: "Custom events" })).toBeVisible();
293+
await expect(page.getByRole("heading", { level: 1 })).toContainText("TestOwner");
294+
await expect(page.getByText("Last log-in")).toBeVisible();
295+
await expect(page.getByRole("tab", { name: "Accounts" })).toBeVisible();
296+
await expect(page.getByRole("tab", { name: "Logins" })).toBeVisible();
297+
await expect(page.getByRole("tab", { name: "Sessions" })).toBeVisible();
308298
})();
309299

310300
await backOfficeContext.close();

application/account/WebApp/tests/e2e/billing-events-flows.spec.ts

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,27 @@ test.describe("@smoke", () => {
5353

5454
// === FILTERS ===
5555

56-
await step("Apply Subscribed event-type filter & verify chip becomes pressed and table stays visible")(async () => {
57-
const subscribedChip = page.getByRole("button", { name: "Subscribed" });
58-
await subscribedChip.click();
59-
60-
await expect(subscribedChip).toHaveAttribute("aria-pressed", "true");
61-
await expect(page.getByRole("table", { name: "Billing events" })).toBeVisible();
62-
})();
63-
64-
await step("Clear event-type filter & verify chip is unpressed and URL returns to base /billing-events")(
56+
await step("Apply Subscribed event-type filter & verify URL reflects selection and table stays visible")(
6557
async () => {
66-
const subscribedChip = page.getByRole("button", { name: "Subscribed" });
67-
await subscribedChip.click();
58+
await page.getByRole("combobox", { name: "All event types" }).click();
59+
await page.getByRole("option", { name: "Subscribed" }).click();
60+
await page.keyboard.press("Escape");
6861

69-
await expect(subscribedChip).toHaveAttribute("aria-pressed", "false");
70-
await expect(page).toHaveURL(`${BACK_OFFICE_BASE_URL}/billing-events`);
62+
await expect(page).toHaveURL(
63+
`${BACK_OFFICE_BASE_URL}/billing-events?eventTypes=%5B%22SubscriptionCreated%22%5D`
64+
);
65+
await expect(page.getByRole("table", { name: "Billing events" })).toBeVisible();
7166
}
7267
)();
7368

69+
await step("Clear Subscribed event-type filter & verify URL returns to base /billing-events")(async () => {
70+
await page.getByRole("combobox", { name: "All event types" }).click();
71+
await page.getByRole("option", { name: "Subscribed" }).click();
72+
await page.keyboard.press("Escape");
73+
74+
await expect(page).toHaveURL(`${BACK_OFFICE_BASE_URL}/billing-events`);
75+
})();
76+
7477
await step(
7578
"Type a deliberately non-matching tenant search & verify URL reflects search query and empty state appears"
7679
)(async () => {

0 commit comments

Comments
 (0)