test(playwright): update pager/markup selectors to M10 component hooks (INT)
This commit is contained in:
+12
-15
@@ -546,36 +546,33 @@ public class SiteCallsPageTests
|
||||
await SetSearchKeywordAsync(page, sharedTarget);
|
||||
await page.ClickAsync("[data-test='site-calls-query']");
|
||||
|
||||
// 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");
|
||||
// The M10 KeysetPager summary span (`Page {N} · {rows} rows`), exposed
|
||||
// via its stable data-test hook so a future markup tweak can't make this
|
||||
// match ambiguous under strict mode.
|
||||
var pageIndicator = page.Locator("[data-test='keyset-summary']");
|
||||
|
||||
// ── Page 1: full page (50 rows). Assert COUNT first (waits for the
|
||||
// fetch), then the indicator and the button states. ──
|
||||
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();
|
||||
await Assertions.Expect(page.Locator("[data-test='site-calls-next']")).ToBeEnabledAsync();
|
||||
await Assertions.Expect(page.Locator("[data-test='keyset-prev']")).ToBeDisabledAsync();
|
||||
await Assertions.Expect(page.Locator("[data-test='keyset-next']")).ToBeEnabledAsync();
|
||||
|
||||
// ── Next → Page 2: short page (1 row). Last page, so Next disables. ──
|
||||
await page.ClickAsync("[data-test='site-calls-next']");
|
||||
await page.ClickAsync("[data-test='keyset-next']");
|
||||
await Assertions.Expect(page.Locator("tbody tr")).ToHaveCountAsync(1);
|
||||
await Assertions.Expect(pageIndicator).ToContainTextAsync("Page 2");
|
||||
await Assertions.Expect(page.Locator("[data-test='site-calls-prev']")).ToBeEnabledAsync();
|
||||
await Assertions.Expect(page.Locator("[data-test='site-calls-next']")).ToBeDisabledAsync();
|
||||
await Assertions.Expect(page.Locator("[data-test='keyset-prev']")).ToBeEnabledAsync();
|
||||
await Assertions.Expect(page.Locator("[data-test='keyset-next']")).ToBeDisabledAsync();
|
||||
|
||||
// ── Previous → back on Page 1: full page again, Prev disables. ──
|
||||
await page.ClickAsync("[data-test='site-calls-prev']");
|
||||
await page.ClickAsync("[data-test='keyset-prev']");
|
||||
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();
|
||||
await Assertions.Expect(page.Locator("[data-test='keyset-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();
|
||||
await Assertions.Expect(page.Locator("[data-test='keyset-next']")).ToBeEnabledAsync();
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user