teqo-backup/tests/e2e/campaignOpsEstimateOutbox.e2e.spec.ts
Cursor Agent 9b56b641a6
OH14 — remove OPS_HYBRID flag; sync always on for staff
Decision: remove compile-time OPS_HYBRID after OH11/OH13 green in CI/staging.
Staff hybrid sync is gated only by isStaffCampaignRole in the app layout;
OfflineBoundary swaps to Local when the browser is offline.

- Delete opsHybridFlag.ts and legacy formAction branches in staff controls
- E2e offline specs run in CI without OPS_HYBRID env
- Update ops-hibrido spec to implementado + offline write recipe

Closes #175

Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
2026-08-02 03:47:04 +00:00

52 lines
1.8 KiB
TypeScript

import { expect, test } from './fixtures/campaignE2EFixtures.js'
/** OH6 — flaky-network outbox for estimateVotes. */
test.describe('OH6 estimate outbox', () => {
test('offline edit stays queued across reload and flushes when online', async ({
campaign,
page,
}) => {
const { fixtures } = campaign
const municipality = await fixtures.claimMunicipality()
const advisor = await fixtures.createCampaignUser('advisor', {
name: fixtures.value('Assessor Outbox'),
})
await campaign.payload.update({
collection: 'municipality',
id: municipality.id,
data: { advisors: [advisor.id] },
depth: 0,
})
fixtures.touchMunicipality(municipality.id)
const { leadershipId } = await fixtures.createStaffLeadership({
namePrefix: 'Liderança Outbox',
municipalities: [municipality],
supportStatus: 'engajado',
})
await campaign.payload.create({
collection: 'votePledge',
data: {
leadership: leadershipId,
municipality: municipality.id,
declaredVotes: 120,
},
depth: 0,
})
await campaign.login(page, advisor.email!, advisor.password)
await page.goto(`${campaign.baseURL}/campanha/municipios/${municipality.slug}`)
await page.context().setOffline(true)
await page.getByLabel('Média', { exact: true }).fill('55')
await page.getByLabel('Justificativa').fill('Editado na estrada.')
await page.getByRole('button', { name: 'Salvar estimativa' }).click()
await expect(page.getByText('Pendente', { exact: true })).toBeVisible()
await page.reload()
await expect(page.getByText('Pendente', { exact: true })).toBeVisible()
await page.context().setOffline(false)
await expect(page.getByText('Média: 55')).toBeVisible({ timeout: 30_000 })
})
})