test(playwright): SiteCalls hygiene — site-a seeds where grid-visible, scoped pager locator, next-enabled re-assert
This commit is contained in:
+15
-9
@@ -122,11 +122,11 @@ public class SiteCallsPageTests
|
|||||||
// One ApiOutbound row, one DbOutbound row — distinct Targets.
|
// One ApiOutbound row, one DbOutbound row — distinct Targets.
|
||||||
await SiteCallDataSeeder.InsertSiteCallAsync(
|
await SiteCallDataSeeder.InsertSiteCallAsync(
|
||||||
trackedOperationId: apiId, channel: "ApiOutbound", target: targetPrefix + "api",
|
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);
|
createdAtUtc: now, updatedAtUtc: now, httpStatus: 200, terminalAtUtc: now);
|
||||||
await SiteCallDataSeeder.InsertSiteCallAsync(
|
await SiteCallDataSeeder.InsertSiteCallAsync(
|
||||||
trackedOperationId: dbId, channel: "DbOutbound", target: targetPrefix + "db",
|
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);
|
createdAtUtc: now, updatedAtUtc: now, terminalAtUtc: now);
|
||||||
|
|
||||||
var page = await _fixture.NewAuthenticatedPageAsync();
|
var page = await _fixture.NewAuthenticatedPageAsync();
|
||||||
@@ -176,7 +176,7 @@ public class SiteCallsPageTests
|
|||||||
{
|
{
|
||||||
await SiteCallDataSeeder.InsertSiteCallAsync(
|
await SiteCallDataSeeder.InsertSiteCallAsync(
|
||||||
trackedOperationId: trackedId, channel: "ApiOutbound", target: targetPrefix + "endpoint",
|
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);
|
createdAtUtc: now, updatedAtUtc: now, httpStatus: 200, terminalAtUtc: now);
|
||||||
|
|
||||||
var page = await _fixture.NewAuthenticatedPageAsync();
|
var page = await _fixture.NewAuthenticatedPageAsync();
|
||||||
@@ -226,12 +226,12 @@ public class SiteCallsPageTests
|
|||||||
// actionable from central).
|
// actionable from central).
|
||||||
await SiteCallDataSeeder.InsertSiteCallAsync(
|
await SiteCallDataSeeder.InsertSiteCallAsync(
|
||||||
trackedOperationId: parkedId, channel: "ApiOutbound", target: targetPrefix + "parked",
|
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,
|
lastError: "HTTP 503 from ERP", httpStatus: 503,
|
||||||
createdAtUtc: now, updatedAtUtc: now);
|
createdAtUtc: now, updatedAtUtc: now);
|
||||||
await SiteCallDataSeeder.InsertSiteCallAsync(
|
await SiteCallDataSeeder.InsertSiteCallAsync(
|
||||||
trackedOperationId: failedId, channel: "DbOutbound", target: targetPrefix + "failed",
|
trackedOperationId: failedId, channel: "DbOutbound", target: targetPrefix + "failed",
|
||||||
sourceSite: "plant-a", status: "Failed", retryCount: 1,
|
sourceSite: "site-a", status: "Failed", retryCount: 1,
|
||||||
lastError: "constraint violation",
|
lastError: "constraint violation",
|
||||||
createdAtUtc: now, updatedAtUtc: now, terminalAtUtc: now);
|
createdAtUtc: now, updatedAtUtc: now, terminalAtUtc: now);
|
||||||
|
|
||||||
@@ -546,10 +546,13 @@ public class SiteCallsPageTests
|
|||||||
await SetSearchKeywordAsync(page, sharedTarget);
|
await SetSearchKeywordAsync(page, sharedTarget);
|
||||||
await page.ClickAsync("[data-test='site-calls-query']");
|
await page.ClickAsync("[data-test='site-calls-query']");
|
||||||
|
|
||||||
// The pager indicator span (`Page {N} · {rows} rows`). It is the only
|
// The pager indicator span (`Page {N} · {rows} rows`). Scope the
|
||||||
// text-muted small span in the table footer, so a scoped GetByText
|
// locator to the pager wrapper div
|
||||||
// regex is unambiguous.
|
// (`.d-flex.justify-content-between.align-items-center`) so a future
|
||||||
var pageIndicator = page.Locator("span.text-muted.small");
|
// 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
|
// ── Page 1: full page (50 rows). Assert COUNT first (waits for the
|
||||||
// fetch), then the indicator and the button states. ──
|
// 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(page.Locator("tbody tr")).ToHaveCountAsync(50);
|
||||||
await Assertions.Expect(pageIndicator).ToContainTextAsync("Page 1");
|
await Assertions.Expect(pageIndicator).ToContainTextAsync("Page 1");
|
||||||
await Assertions.Expect(page.Locator("[data-test='site-calls-prev']")).ToBeDisabledAsync();
|
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
|
finally
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user