Skip to content

Commit 209656d

Browse files
committed
test(org): a member's agent chat is not found, as it is today
1 parent 66388d4 commit 209656d

2 files changed

Lines changed: 36 additions & 21 deletions

File tree

‎apps/sim/scripts/test-org-redesign-e2e.ts‎

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -430,21 +430,32 @@ async function landingChecks() {
430430
).toBeVisible()
431431
})
432432
})
433-
await check('an agent chat redirects a member to Search and renders for an admin', async () => {
434-
await withSession(MEMBER, async ({ page }) => {
435-
await page.goto(url(`${root}/chat/${MEMBER_CHATS.agent.id}`))
436-
await expect(page).toHaveURL((address) => address.pathname === `${root}/search`)
437-
await page.goto(url(`${root}/search/chat/${MEMBER_CHATS.agent.id}`))
438-
await expect(page).toHaveURL((address) => address.pathname === `${root}/search`)
439-
})
440-
await withSession(ADMIN, async ({ page }) => {
441-
await page.goto(url(`${root}/search/chat/${ADMIN_CHATS.agent.id}`))
442-
await expect(page).toHaveURL(url(`${root}/chat/${ADMIN_CHATS.agent.id}`))
443-
await expect(
444-
page.getByText(`Here is what I found about ${ADMIN_CHATS.agent.title}.`)
445-
).toBeVisible()
446-
})
447-
})
433+
await check(
434+
'an agent chat is not found for a member, stays out of their rail, and renders for an admin',
435+
async () => {
436+
await withSession(MEMBER, async ({ page }) => {
437+
await page.goto(url(`${root}/chat/${MEMBER_CHATS.agent.id}`))
438+
await expectPageNotFound(page)
439+
await page.goto(url(`${root}/search/chat/${MEMBER_CHATS.agent.id}`))
440+
await expectPageNotFound(page)
441+
await page.goto(url(`${root}/home`))
442+
await expect(
443+
sidebar(page).getByRole('link', { name: MEMBER_CHATS.unread.title })
444+
).toBeVisible()
445+
await expect(
446+
sidebar(page).getByRole('link', { name: MEMBER_CHATS.agent.title })
447+
).toHaveCount(0)
448+
})
449+
await withSession(ADMIN, async ({ page }) => {
450+
await page.goto(url(`${root}/search/chat/${ADMIN_CHATS.agent.id}`))
451+
await expect(page).toHaveURL(url(`${root}/chat/${ADMIN_CHATS.agent.id}`))
452+
await expect(
453+
page.getByText(`Here is what I found about ${ADMIN_CHATS.agent.title}.`)
454+
).toBeVisible()
455+
})
456+
},
457+
{ allow: [/404/] }
458+
)
448459
await check(
449460
'a chat that is not theirs, or in another organization, is not found',
450461
async () => {

‎apps/sim/scripts/test-organization-search-e2e.ts‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,8 @@ try {
10301030
await expect(page).toHaveURL((url) => url.pathname === `${root}/home`)
10311031
await expect(page.getByRole('textbox', { name: 'Ask Sim' })).toBeVisible()
10321032
await page.goto(`${baseUrl.origin}${root}/chat/${agentId}`)
1033-
await expect(page).toHaveURL((url) => url.pathname === `${root}/search`)
1033+
await expect(page.getByRole('heading', { name: 'Page not found' })).toBeVisible()
1034+
await expect(page.getByRole('textbox', { name: 'Ask Sim' })).toHaveCount(0)
10341035
await page.goto(`${baseUrl.origin}${root}/search/chat/${assistantId}`)
10351036
await expect(page.getByText(answer, { exact: true })).toBeVisible()
10361037
}
@@ -1054,11 +1055,14 @@ try {
10541055
const deniedRecoveries = browserErrorEvents.filter(
10551056
(event) =>
10561057
event.digest === 'NEXT_HTTP_ERROR_FALLBACK;404' &&
1057-
event.url === `${baseUrl.origin}${root}/search/chat/${deniedChatId}` &&
1058-
[
1059-
'Assistant history rejects a chat from another organization',
1060-
'A streamed denied chat remains navigable after hydration',
1061-
].includes(event.stage)
1058+
((event.url === `${baseUrl.origin}${root}/search/chat/${deniedChatId}` &&
1059+
[
1060+
'Assistant history rejects a chat from another organization',
1061+
'A streamed denied chat remains navigable after hydration',
1062+
].includes(event.stage)) ||
1063+
(event.url === `${baseUrl.origin}${root}/chat/${agentId}` &&
1064+
event.stage ===
1065+
'Search-only members have Home with the Assistant and their history, but no agent chat'))
10621066
)
10631067
const recoveryCount = deniedRecoveries.reduce((total, event) => total + event.count, 0)
10641068
assert.equal(

0 commit comments

Comments
 (0)