Skip to content

Commit 1039d61

Browse files
committed
test(platform): follow members onto Home and stop waiting on a composer focus that was reverted
Members now chat and land on Home, which reads their accounts itself, so the Integrations hover warm starts from Search and first proves Search read none. A member's Search URL for an agent chat hands back to the chat (the legacy gate), not a not-found. e6ae142 dropped the composer's focus on mount, which both Mod+B checks used as their hydration signal. They now press the shortcut again only while the sidebar has not moved, so a press before hydration cannot pass or toggle back.
1 parent 4a88ee7 commit 1039d61

3 files changed

Lines changed: 23 additions & 17 deletions

File tree

‎apps/sim/platform/checks/live/flows.spec.ts‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,13 @@ test('Mod+B collapses the sidebar, the choice survives a reload, and Expand rest
6666
await signInAsAdmin(page, liveRoute('/home'))
6767
const sidebar = page.getByRole('complementary', { name: 'Platform sidebar' })
6868
await expect(sidebar).toBeVisible()
69-
// Home's composer takes focus as it mounts and Mod+B leaves a focused field alone, as legacy did.
70-
await expect(page.getByRole('textbox', { name: /Ask about your business/ })).toBeFocused()
69+
// Mod+B leaves a focused field alone, as legacy did, so the press starts off any field. The
70+
// server paints the sidebar before the shortcut listens: press again only while it is showing.
7171
await page.locator('body').click({ position: { x: 700, y: 20 } })
72-
await pressShortcut(page, 'ControlOrMeta+b')
73-
await expect(sidebar).toBeHidden()
72+
await expect(async () => {
73+
if (await sidebar.isVisible()) await pressShortcut(page, 'ControlOrMeta+b')
74+
await expect(sidebar).toBeHidden({ timeout: 1_000 })
75+
}).toPass()
7476
await page.reload()
7577
await expect(sidebar).toBeHidden()
7678
await page.getByRole('button', { name: 'Expand sidebar' }).click()

‎apps/sim/scripts/org-redesign-e2e/checks/landing.ts‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,26 +73,23 @@ export async function landingChecks() {
7373
})
7474
})
7575
await check(
76-
"a member's agent chat opens as a chat, is absent under Search, and lists in the rail",
76+
"a member's agent chat opens as a chat, Search hands it back to the chat, and it lists in the rail",
7777
async () => {
7878
await withSession(MEMBER, async (session) => {
7979
const { page } = session
8080
const transcript = page.getByText(`Here is what I found about ${MEMBER_CHATS.agent.title}.`)
8181
await page.goto(url(org.chat(MEMBER_CHATS.agent.id)))
8282
await expect(page).toHaveURL(url(org.chat(MEMBER_CHATS.agent.id)))
8383
await expect(transcript).toBeVisible()
84-
// Search only opens assistant chats, so an agent chat there is absent, as in legacy.
84+
// Search opens only assistant chats; a Search URL for an agent chat returns to the chat.
8585
await page.goto(url(org.searchChat(MEMBER_CHATS.agent.id)))
86-
await expectPageNotFound(page)
87-
await expect(transcript).toHaveCount(0)
86+
await expect(page).toHaveURL(url(org.chat(MEMBER_CHATS.agent.id)))
87+
await expect(transcript).toBeVisible()
88+
await expect(searchField(page)).toHaveCount(0)
8889
await page.goto(url(org.home))
8990
await session.settle()
9091
await expect(railLink(page, MEMBER_CHATS.agent.title)).toBeVisible()
9192
})
92-
},
93-
{
94-
// The member's own agent chat, which Search does not open.
95-
allow: [refused(404, 'GET', org.searchChat(MEMBER_CHATS.agent.id))],
9693
}
9794
)
9895
await check(

‎apps/sim/scripts/org-redesign-e2e/checks/sidebar.ts‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,13 @@ export async function sidebarChecks() {
100100
await check('hover warms Integrations through its own reads', async () => {
101101
await withSession(MEMBER, async (session) => {
102102
const { page } = session
103-
await page.goto(url(org.home))
103+
// Home reads the member's accounts itself, so the hover starts from Search, which does not.
104+
await page.goto(url(org.search))
104105
await session.settle()
106+
assert(
107+
!session.requests.some(({ path }) => path.includes('/connected-accounts')),
108+
'Search must not read the accounts the hover is meant to warm'
109+
)
105110
session.requests.length = 0
106111
await mainNav(page).getByRole('link', { name: 'Integrations', exact: true }).hover()
107112
await expect
@@ -134,11 +139,13 @@ export async function sidebarChecks() {
134139
await page.reload()
135140
await expect(rail).toBeHidden()
136141
await expect(opener).toBeVisible()
137-
// The server renders the attribute, so only this says the shortcut is listening.
138-
await expect(composer(page)).toBeFocused()
142+
// The server renders the collapsed rail before the shortcut listens, so a press before
143+
// hydration does nothing: press again only while the rail is still hidden.
139144
await page.locator('body').click({ position: { x: 700, y: 20 } })
140-
await page.keyboard.press('Control+b')
141-
await expect(rail).toBeVisible()
145+
await expect(async () => {
146+
if (await rail.isHidden()) await page.keyboard.press('Control+b')
147+
await expect(rail).toBeVisible({ timeout: 1_000 })
148+
}).toPass()
142149
await composer(page).click()
143150
await page.keyboard.press('Control+b')
144151
await expect(rail).toBeVisible()

0 commit comments

Comments
 (0)