mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-13 23:53:05 +00:00
fix(e2e): OPS83 — polish after review: rename expectSectionCount, toBeOK, settle helper reuse
This commit is contained in:
parent
e4cb8d1006
commit
10e0c17078
2 changed files with 13 additions and 12 deletions
|
|
@ -719,9 +719,10 @@ test.describe('Municípios — jornadas por papel', () => {
|
|||
// leadership-list chunk can land after `goto` settles, so let the stream
|
||||
// commit before asserting the leadership link (same class as the `:115`
|
||||
// editar checkbox and the C142 FAB). The generic `S:` gate alone is not
|
||||
// enough (observed in the OPS83 verify run #15): poll the DOM for the
|
||||
// specific link instead of `.first()` on the nondeterministic stream.
|
||||
await page.waitForFunction(() => document.querySelectorAll('div[id^="S:"]').length === 0)
|
||||
// enough (observed in the OPS83 verify run #15): poll until the specific
|
||||
// link lands in the DOM, then assert visibility (`.first()` only disambiguates
|
||||
// if a duplicate ever appears — the count poll is the real gate).
|
||||
await settleMunicipalityStream(page)
|
||||
const leadershipLink = page.getByRole('link', { name: contact.name })
|
||||
await expect.poll(() => leadershipLink.count(), { timeout: 15_000 }).toBeGreaterThan(0)
|
||||
await expect(leadershipLink.first()).toBeVisible()
|
||||
|
|
|
|||
|
|
@ -699,7 +699,7 @@ test.describe('Campaign home content section', () => {
|
|||
* link). This is the source that observes the actual payload — pair it with
|
||||
* `gotoHomeFresh` so the navigation itself misses the cache.
|
||||
*/
|
||||
const expectSectionCardCount = (locator: Locator, expected: number, timeout = 15_000) =>
|
||||
const expectSectionCount = (locator: Locator, expected: number, timeout = 15_000) =>
|
||||
expect
|
||||
.poll(async () => locator.count(), { timeout, message: 'contents section card count' })
|
||||
.toBe(expected)
|
||||
|
|
@ -803,13 +803,13 @@ test.describe('Campaign home content section', () => {
|
|||
const revalidate = await request.post(`${baseURL}/api/revalidate?tag=posts`, {
|
||||
headers: { 'x-revalidate-secret': revalidateSecret },
|
||||
})
|
||||
expect(revalidate.ok()).toBeTruthy()
|
||||
expect(revalidate).toBeOK()
|
||||
await waitForHomeSectionState(request, 'absent', 30)
|
||||
|
||||
// Plain URL on purpose: the test also pins the canonical home URL.
|
||||
await page.goto('/')
|
||||
await expect(page).toHaveURL(/\/$/)
|
||||
await expectSectionCardCount(page.locator('[data-home-section="contents"]'), 0)
|
||||
await expectSectionCount(page.locator('[data-home-section="contents"]'), 0)
|
||||
await expect(page.getByText('A caminhada, em tempo real')).toHaveCount(0)
|
||||
|
||||
const proof = await page.locator('[data-home-section="proof"]').boundingBox()
|
||||
|
|
@ -1350,8 +1350,8 @@ test.describe('Campaign home content section', () => {
|
|||
await expect(section.getByRole('link', { name: /E2e Artigo fallback IG/ })).toBeVisible()
|
||||
// Same rendered-DOM class as the kill-switch test (OPS83 run #15): the
|
||||
// server poll converged but the page served a stale body — poll the DOM.
|
||||
await expectSectionCardCount(section.getByText('E2e Post do muro'), 0)
|
||||
await expectSectionCardCount(section.getByRole('link', { name: /Seguir no Instagram/ }), 0)
|
||||
await expectSectionCount(section.getByText('E2e Post do muro'), 0)
|
||||
await expectSectionCount(section.getByRole('link', { name: /Seguir no Instagram/ }), 0)
|
||||
|
||||
await page.goto('about:blank')
|
||||
await expect(page).toHaveURL(/about:blank/)
|
||||
|
|
@ -1482,10 +1482,10 @@ test.describe('Campaign home content section', () => {
|
|||
const section = page.locator('[data-home-section="contents"]')
|
||||
await expect(section).toBeVisible()
|
||||
await expect(section.getByRole('link', { name: /E2e Artigo kill switch/ })).toBeVisible()
|
||||
await expectSectionCardCount(section.getByText('E2e Vídeo em destaque'), 0)
|
||||
await expectSectionCardCount(section.getByRole('link', { name: /YouTube →/ }), 0)
|
||||
await expectSectionCardCount(section.getByText('E2e Post do muro'), 0)
|
||||
await expectSectionCardCount(section.getByRole('link', { name: /Seguir no Instagram/ }), 0)
|
||||
await expectSectionCount(section.getByText('E2e Vídeo em destaque'), 0)
|
||||
await expectSectionCount(section.getByRole('link', { name: /YouTube →/ }), 0)
|
||||
await expectSectionCount(section.getByText('E2e Post do muro'), 0)
|
||||
await expectSectionCount(section.getByRole('link', { name: /Seguir no Instagram/ }), 0)
|
||||
|
||||
await page.goto('about:blank')
|
||||
await expect(page).toHaveURL(/about:blank/)
|
||||
|
|
|
|||
Loading…
Reference in a new issue