Skip to content

Commit 0486275

Browse files
committed
fix(tests): wait for Search URL persistence before reload
1 parent 2d25022 commit 0486275

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

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

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,23 @@ async function verifyLegacyDraft(
9090
const draftKey = `${prefix}${destination === 'assistant' ? 'search-assistant' : 'home'}`
9191
const attachment = {
9292
id: 'legacy-upload',
93-
key: 'legacy-note.png',
94-
filename: 'legacy-note.png',
95-
media_type: 'image/png',
93+
key: `copilot/${userId}/legacy-note.txt`,
94+
filename: 'legacy-note.txt',
95+
media_type: 'text/plain',
9696
size: 68,
97-
path: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+jFmcAAAAASUVORK5CYII=',
97+
path: `/api/files/serve/copilot/${userId}/legacy-note.txt`,
9898
}
9999
const expectedDraft = {
100100
text: existingDraft ? 'A newer destination draft' : 'An unsent question from before the move',
101101
fileAttachments: [
102102
existingDraft
103-
? { ...attachment, id: 'new-upload', key: 'new-note.png', filename: 'new-note.png' }
103+
? {
104+
...attachment,
105+
id: 'new-upload',
106+
key: `copilot/${userId}/new-note.txt`,
107+
filename: 'new-note.txt',
108+
path: `/api/files/serve/copilot/${userId}/new-note.txt`,
109+
}
104110
: attachment,
105111
],
106112
}
@@ -231,6 +237,9 @@ try {
231237
await expect(searchInput).toHaveValue('Launch notes')
232238
await page.getByRole('radio', { name: 'Assistant', exact: true }).click()
233239
await expect(assistantInput).toHaveValue('Summarize launch readiness')
240+
await expect(page).toHaveURL(
241+
(url) => url.pathname === `${root}/search` && url.searchParams.get('mode') === 'assistant'
242+
)
234243
await page.reload()
235244
await expect(page.getByRole('radio', { name: 'Assistant', exact: true })).toBeChecked()
236245
await expect(assistantInput).toHaveValue('Summarize launch readiness')

0 commit comments

Comments
 (0)