mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-12 22:13:05 +00:00
B203 — fix e2e: abertura explícita no AiLinks; split open/send no Context (drawer mobile)
This commit is contained in:
parent
a84c0183b1
commit
d5c6c285b7
2 changed files with 22 additions and 11 deletions
|
|
@ -20,6 +20,13 @@ const ASSISTANT_LINKS =
|
|||
'Confira [o portal da saúde](https://www.saude.ba.gov.br/) e [o município de Ilhéus](/campanha/municipios/ilheus).'
|
||||
|
||||
const openChatAndSend = async (page: Page) => {
|
||||
// B203 — fresh desktop sessions start closed (this spec is desktop-only);
|
||||
// open explicitly via the header button.
|
||||
await waitForRouterSettled(page)
|
||||
await page
|
||||
.getByRole('button', { name: 'Sollinha — Assistente virtual' })
|
||||
.filter({ visible: true })
|
||||
.click()
|
||||
await expect(page.getByText('Olá! Eu sou o Sollinha')).toBeVisible({ timeout: 20_000 })
|
||||
// OPS42 — dev-only settle before interacting (see `waitForRouterSettled`).
|
||||
await waitForRouterSettled(page)
|
||||
|
|
|
|||
|
|
@ -51,18 +51,10 @@ const gatedMockAiChat = (page: Page) => {
|
|||
const MESSAGE = 'Mensagem que sobrevive ao reload'
|
||||
const SECOND_MESSAGE = 'Segunda pergunta'
|
||||
|
||||
const openDesktopChat = async (page: Page) => {
|
||||
// B203 — fresh desktop sessions start closed; open explicitly via the header button.
|
||||
await waitForRouterSettled(page)
|
||||
await page
|
||||
.getByRole('button', { name: 'Sollinha — Assistente virtual' })
|
||||
.filter({ visible: true })
|
||||
.click()
|
||||
await expect(page.getByText('Olá! Eu sou o Sollinha')).toBeVisible({ timeout: 20_000 })
|
||||
}
|
||||
|
||||
const openChatAndSend = async (page: Page) => {
|
||||
await openDesktopChat(page)
|
||||
// The chat must already be open (desktop: via the header button — B203;
|
||||
// mobile: via the drawer) — this helper only sends.
|
||||
await expect(page.getByText('Olá! Eu sou o Sollinha')).toBeVisible({ timeout: 20_000 })
|
||||
// OPS42 — dev-only settle before interacting (see `waitForRouterSettled`).
|
||||
await waitForRouterSettled(page)
|
||||
const input = page.getByRole('textbox', { name: 'Pergunte para o Sollinha...' })
|
||||
|
|
@ -71,6 +63,16 @@ const openChatAndSend = async (page: Page) => {
|
|||
await expect(page.getByText(MESSAGE)).toBeVisible({ timeout: 20_000 })
|
||||
}
|
||||
|
||||
/** B203 — desktop-only: fresh sessions start closed; open via the header button. */
|
||||
const openDesktopChat = async (page: Page) => {
|
||||
await waitForRouterSettled(page)
|
||||
await page
|
||||
.getByRole('button', { name: 'Sollinha — Assistente virtual' })
|
||||
.filter({ visible: true })
|
||||
.click()
|
||||
await expect(page.getByText('Olá! Eu sou o Sollinha')).toBeVisible({ timeout: 20_000 })
|
||||
}
|
||||
|
||||
/** The chat has settled once the mic button re-enables (busy → ready). */
|
||||
const waitForChatSettled = async (page: Page) => {
|
||||
await expect(
|
||||
|
|
@ -111,6 +113,7 @@ test.describe('B188 — contexto da conversa persiste na sessão da janela/tab',
|
|||
await page.setViewportSize({ width: 1280, height: 800 })
|
||||
await page.goto('/campanha')
|
||||
|
||||
await openDesktopChat(page)
|
||||
await openChatAndSend(page)
|
||||
await waitForChatSettled(page)
|
||||
// Deterministic gate: the persist effect must have landed before reload.
|
||||
|
|
@ -130,6 +133,7 @@ test.describe('B188 — contexto da conversa persiste na sessão da janela/tab',
|
|||
await page.setViewportSize({ width: 1280, height: 800 })
|
||||
await page.goto('/campanha')
|
||||
|
||||
await openDesktopChat(page)
|
||||
await openChatAndSend(page)
|
||||
await waitForChatSettled(page)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue