test(desktop): re-select the room before reading room content in group specs

A bot created moments before the room runs its canonical-chat intro turn in
the background (create-dialog.tsx createCanonicalChat kickoff); when it
lands, the roster fronts that bot's chat tab and yanks the center away from
the room, so a room-content assertion sees the reply as hidden or the
Activity button as missing and fails on an unrelated visibility check. Both
specs now re-select the room tab inside the wait, like the approval spec.
This commit is contained in:
teknium1
2026-09-16 14:45:49 -07:00
committed by Teknium
parent 84b79b3787
commit abbcdc0104
2 changed files with 30 additions and 3 deletions

View File

@@ -69,6 +69,17 @@ async function createRoom(page: MockBackendFixture['page']) {
return groupComposer
}
/** A bot created moments ago runs its intro turn in the background; when it
* lands, the roster fronts that bot's chat tab and yanks the center away from
* the room. Re-select the room before reading room content. */
async function showRoom(page: MockBackendFixture['page']) {
const groupTab = page.getByRole('tab', { name: new RegExp(`${ROOM} Close`) })
if ((await groupTab.getAttribute('aria-selected')) !== 'true') {
await groupTab.click()
}
}
test.beforeEach(async () => {
fixture = await setupMockBackend({ mockServer: {
holdFirstCompletionContaining: 'LANE_H_FIRST',
@@ -94,7 +105,10 @@ test('a distant German filler word does not hold the mentioned bot (#103893)', a
await expect.poll(() => fixture!.mock.receivedPrompts.some(p => p.includes('LANE_H_GERMAN')), { timeout: 60_000 }).toBe(true)
// ... and the persisted room record must not carry a hold for it.
expect(await roomHolds(page)).toEqual([])
await expect(page.getByText(MOCK_REPLY, { exact: true }).first()).toBeVisible({ timeout: 60_000 })
await expect(async () => {
await showRoom(page)
await expect(page.getByText(MOCK_REPLY, { exact: true }).first()).toBeVisible({ timeout: 5_000 })
}).toPass({ timeout: 60_000 })
await expect(page.locator('[data-slot="group-hold-status"]')).toHaveCount(0)
console.log('GERMAN FILLER: prompt delivered, holds =', JSON.stringify(await roomHolds(page)))
await page.screenshot({ path: test.info().outputPath('german-filler-after.png') })
@@ -123,8 +137,11 @@ test('@all with a task re-engages a room the user stopped (#97740)', async () =>
await groupComposer.press('Enter')
await expect.poll(() => fixture!.mock.receivedPrompts.filter(p => p.includes('LANE_H_ALLTASK')).length, { timeout: 90_000 }).toBeGreaterThanOrEqual(2)
expect(await roomHolds(page)).toEqual([])
await expect(async () => {
await showRoom(page)
await expect(page.getByText(MOCK_REPLY, { exact: true }).first()).toBeVisible({ timeout: 5_000 })
}).toPass({ timeout: 60_000 })
await expect(page.locator('[data-slot="group-hold-status"]')).toHaveCount(0)
await expect(page.getByText(MOCK_REPLY, { exact: true }).first()).toBeVisible({ timeout: 60_000 })
console.log('@all TASK: prompts delivered to', fixture!.mock.receivedPrompts.filter(p => p.includes('LANE_H_ALLTASK')).length, 'members; holds =', JSON.stringify(await roomHolds(page)))
await page.screenshot({ path: test.info().outputPath('all-task-after.png') })
})

View File

@@ -81,7 +81,17 @@ test('a member whose backend fails the turn is reported at once, not read as bus
// The gateway has failed the turn; the room must say so within the base
// turn timeout instead of extending the deadline on the retained snapshot.
const activity = page.getByRole('button', { name: /^Activity/ })
await expect(activity).toContainText('Programmer hit an error', { timeout: 120_000 })
const groupTab = page.getByRole('tab', { name: new RegExp(`${ROOM} Close`) })
await expect(async () => {
// A just-created bot's background intro turn can front that bot's chat
// tab and yank the center away from the room; re-select the room first.
if ((await groupTab.getAttribute('aria-selected')) !== 'true') {
await groupTab.click()
}
await expect(activity).toContainText('Programmer hit an error', { timeout: 5_000 })
}).toPass({ timeout: 120_000 })
await expect(page.getByRole('button', { name: 'Stop', exact: true })).toHaveCount(0, { timeout: 30_000 })
const room = await page.evaluate(name => {