test(playwright): SiteCalls hygiene — site-a seeds where grid-visible, scoped pager locator, next-enabled re-assert

This commit is contained in:
Joseph Doherty
2026-06-07 10:20:33 -04:00
parent f78086334f
commit d3adf8c2e4
@@ -122,11 +122,11 @@ public class SiteCallsPageTests
// One ApiOutbound row, one DbOutbound row — distinct Targets.
await SiteCallDataSeeder.InsertSiteCallAsync(
trackedOperationId: apiId, channel: "ApiOutbound", target: targetPrefix + "api",
sourceSite: "plant-a", status: "Delivered", retryCount: 0,
sourceSite: "site-a", status: "Delivered", retryCount: 0,
createdAtUtc: now, updatedAtUtc: now, httpStatus: 200, terminalAtUtc: now);
await SiteCallDataSeeder.InsertSiteCallAsync(
trackedOperationId: dbId, channel: "DbOutbound", target: targetPrefix + "db",
sourceSite: "plant-a", status: "Delivered", retryCount: 0,
sourceSite: "site-a", status: "Delivered", retryCount: 0,
createdAtUtc: now, updatedAtUtc: now, terminalAtUtc: now);
var page = await _fixture.NewAuthenticatedPageAsync();
@@ -176,7 +176,7 @@ public class SiteCallsPageTests
{
await SiteCallDataSeeder.InsertSiteCallAsync(
trackedOperationId: trackedId, channel: "ApiOutbound", target: targetPrefix + "endpoint",
sourceSite: "plant-a", status: "Delivered", retryCount: 0,
sourceSite: "site-a", status: "Delivered", retryCount: 0,
createdAtUtc: now, updatedAtUtc: now, httpStatus: 200, terminalAtUtc: now);
var page = await _fixture.NewAuthenticatedPageAsync();
@@ -226,12 +226,12 @@ public class SiteCallsPageTests
// actionable from central).
await SiteCallDataSeeder.InsertSiteCallAsync(
trackedOperationId: parkedId, channel: "ApiOutbound", target: targetPrefix + "parked",
sourceSite: "plant-a", status: "Parked", retryCount: 3,
sourceSite: "site-a", status: "Parked", retryCount: 3,
lastError: "HTTP 503 from ERP", httpStatus: 503,
createdAtUtc: now, updatedAtUtc: now);
await SiteCallDataSeeder.InsertSiteCallAsync(
trackedOperationId: failedId, channel: "DbOutbound", target: targetPrefix + "failed",
sourceSite: "plant-a", status: "Failed", retryCount: 1,
sourceSite: "site-a", status: "Failed", retryCount: 1,
lastError: "constraint violation",
createdAtUtc: now, updatedAtUtc: now, terminalAtUtc: now);
@@ -546,10 +546,13 @@ public class SiteCallsPageTests
await SetSearchKeywordAsync(page, sharedTarget);
await page.ClickAsync("[data-test='site-calls-query']");
// The pager indicator span (`Page {N} · {rows} rows`). It is the only
// text-muted small span in the table footer, so a scoped GetByText
// regex is unambiguous.
var pageIndicator = page.Locator("span.text-muted.small");
// The pager indicator span (`Page {N} · {rows} rows`). Scope the
// locator to the pager wrapper div
// (`.d-flex.justify-content-between.align-items-center`) so a future
// second `span.text-muted.small` elsewhere on the page can't make
// this match ambiguous under strict mode.
var pageIndicator = page.Locator(
".d-flex.justify-content-between.align-items-center span.text-muted.small");
// ── Page 1: full page (50 rows). Assert COUNT first (waits for the
// fetch), then the indicator and the button states. ──
@@ -570,6 +573,9 @@ public class SiteCallsPageTests
await Assertions.Expect(page.Locator("tbody tr")).ToHaveCountAsync(50);
await Assertions.Expect(pageIndicator).ToContainTextAsync("Page 1");
await Assertions.Expect(page.Locator("[data-test='site-calls-prev']")).ToBeDisabledAsync();
// Page 1 is full again on the back-leg, so Next must re-enable —
// catches a regression that left Next disabled after a page-back.
await Assertions.Expect(page.Locator("[data-test='site-calls-next']")).ToBeEnabledAsync();
}
finally
{