Skip to content

Commit fa41ebd

Browse files
committed
test(platform): type the connected member's seed parameters and find a seeded chat past See more
jsonb_build_object takes any type and a bare parameter beside || has none, so Postgres refused the seed before the disconnect check ran. The chats other live checks start sort above Vendor renewals, so the rail pages until the seeded chat shows.
1 parent 5f462da commit fa41ebd

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

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

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,15 @@ test.describe('Home for the seeded administrator', () => {
165165
await expect(
166166
page.getByRole('region', { name: 'Needs your attention', exact: true })
167167
).toHaveCount(0)
168-
await page
169-
.getByRole('region', { name: 'Chats', exact: true })
170-
.getByRole('link', { name: 'Vendor renewals' })
171-
.click()
168+
const chats = page.getByRole('region', { name: 'Chats', exact: true })
169+
const vendorRenewals = chats.getByRole('link', { name: 'Vendor renewals' })
170+
// Chats the other live checks start sort above the seeded one, a page or more down the rail.
171+
await expect(async () => {
172+
if ((await vendorRenewals.count()) === 0)
173+
await chats.getByRole('button', { name: 'See more', exact: true }).click()
174+
await expect(vendorRenewals).toBeVisible({ timeout: 1_000 })
175+
}).toPass()
176+
await vendorRenewals.click()
172177
await expect(page).toHaveURL(liveRoutePattern('/search/chat/22222222-'))
173178
await expect(page.getByText('Here is what I found about Vendor renewals.')).toBeVisible()
174179
})
@@ -340,21 +345,21 @@ test.describe('Home with connected accounts', () => {
340345
await withLiveDatabase((sql) =>
341346
sql.begin(async (tx) => {
342347
await tx`insert into permissions (id, user_id, entity_type, entity_id, permission_type)
343-
select ${person.id} || '-' || entity_id, ${person.id}, entity_type, entity_id, permission_type
348+
select ${person.id}::text || '-' || entity_id, ${person.id}, entity_type, entity_id, permission_type
344349
from permissions
345350
where user_id = (select id from "user" where email = ${connectedEmail()})
346351
and entity_type = 'workspace'`
347352
await tx`insert into credential_group_enrollment
348353
select (jsonb_populate_record(null::credential_group_enrollment, to_jsonb(e) || jsonb_build_object(
349-
'id', ${`${person.id}-enrollment`}, 'user_id', ${person.id}, 'email', ${person.email},
350-
'invitation_token_hash', ${`${person.id}-token`}))).*
354+
'id', ${`${person.id}-enrollment`}::text, 'user_id', ${person.id}::text,
355+
'email', ${person.email}::text, 'invitation_token_hash', ${`${person.id}-token`}::text))).*
351356
from credential_group_enrollment e where e.id = 'platform-live-enrollment'`
352357
for (const grant of [GRANT, CALENDAR_GRANT]) {
353358
await tx`insert into credential
354359
select (jsonb_populate_record(null::credential, to_jsonb(c) || jsonb_build_object(
355-
'id', ${`${person.id}-${grant}`}, 'created_by', ${person.id},
356-
'credential_group_enrollment_id', ${`${person.id}-enrollment`},
357-
'display_name', ${person.email}))).*
360+
'id', ${`${person.id}-${grant}`}::text, 'created_by', ${person.id}::text,
361+
'credential_group_enrollment_id', ${`${person.id}-enrollment`}::text,
362+
'display_name', ${person.email}::text))).*
358363
from credential c where c.id = ${grant}`
359364
}
360365
})

0 commit comments

Comments
 (0)