Add Fingerbank e2e coverage; fix two test races found along the way
- deep-check.spec.ts: new test asserting a Fingerbank ID + confidence label appears (targets the Nintendo device specifically, skips if it's not currently on the network -- not something the test suite controls). First run false-skipped because it checked row.count() before waiting for the device table to actually render. - device-ratio.spec.ts: badge counts and displayed text were read as two separate one-shot queries (.count()/.textContent() don't auto-retry like expect() matchers), which raced a background poll once and failed. Wrapped the whole comparison in expect().toPass() so it retries atomically instead. Confirmed fixed: 4/4 clean runs with retries disabled. 15/15 e2e tests green across 8 spec files. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -12,12 +12,17 @@ test("known/unknown ratio matches the actual badge counts", async ({ page }) =>
|
||||
await page.getByRole("button", { name: "Sign in" }).click();
|
||||
await expect(page.locator(".device-table tbody tr").first()).toBeVisible({ timeout: 15_000 });
|
||||
|
||||
const knownCount = await page.locator(".device-badge.known").count();
|
||||
const unknownCount = await page.locator(".device-badge.unknown").count();
|
||||
|
||||
const ratioText = await page.locator(".device-ratio").textContent();
|
||||
expect(ratioText).toBe(`${knownCount} known / ${unknownCount} unknown`);
|
||||
|
||||
const countText = await page.locator(".device-count").textContent();
|
||||
expect(countText).toBe(`(${knownCount + unknownCount})`);
|
||||
// Re-reads badge counts and the displayed text together, retrying the
|
||||
// whole comparison if they're ever caught mid-render (e.g. a background
|
||||
// poll landing between the two reads) instead of a one-shot comparison —
|
||||
// .count() and .textContent() don't auto-wait/retry the way expect()
|
||||
// matchers do, so a bare single read raced a poll and failed once already.
|
||||
await expect(async () => {
|
||||
const knownCount = await page.locator(".device-badge.known").count();
|
||||
const unknownCount = await page.locator(".device-badge.unknown").count();
|
||||
const ratioText = await page.locator(".device-ratio").textContent();
|
||||
const countText = await page.locator(".device-count").textContent();
|
||||
expect(ratioText).toBe(`${knownCount} known / ${unknownCount} unknown`);
|
||||
expect(countText).toBe(`(${knownCount + unknownCount})`);
|
||||
}).toPass({ timeout: 10_000 });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user