Skip to content

Commit c43a2b4

Browse files
committed
fix(ci): bound organization search failure diagnostics
1 parent 1d8a527 commit c43a2b4

1 file changed

Lines changed: 34 additions & 23 deletions

File tree

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

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,12 @@ async function check(name: string, run: () => Promise<void>) {
219219
}
220220
}
221221

222-
async function capture(name: string) {
223-
await page.evaluate(() => document.fonts.ready)
224-
await page.addStyleTag({ content: 'nextjs-portal { display: none; }' })
225-
await page.screenshot({ path: resolve(artifactDirectory, `${name}.png`) })
222+
async function capture(name: string, timeout = 10_000) {
223+
await page.screenshot({
224+
path: resolve(artifactDirectory, `${name}.png`),
225+
style: 'nextjs-portal { display: none; }',
226+
timeout,
227+
})
226228
}
227229

228230
async function verifyLegacyDraft(
@@ -1012,28 +1014,37 @@ try {
10121014
})
10131015
} catch (error) {
10141016
logger.error('Organization Search E2E failed', { error: getErrorMessage(error) })
1015-
await capture('failure').catch(() => {})
10161017
process.exitCode = 1
1018+
await capture('failure', 5000).catch(() => {})
10171019
} finally {
10181020
currentCheck = 'Teardown'
1019-
await browser.close()
1020-
try {
1021-
await sql.begin(async (tx) => {
1022-
await tx`delete from workspace where owner_id = ${userId}`
1023-
await tx`delete from project where owner_id = ${userId}`
1024-
await tx`delete from organization where id in (${organizationId}, ${otherOrganizationId})`
1025-
await tx`delete from "user" where id = ${userId}`
1026-
})
1027-
} catch (error) {
1028-
checks.push({
1029-
name: 'Fixture cleanup',
1030-
status: 'failed',
1031-
durationMs: 0,
1032-
error: getErrorMessage(error),
1033-
})
1034-
process.exitCode = 1
1035-
} finally {
1036-
await sql.end()
1021+
for (const [name, cleanup] of [
1022+
['Browser cleanup', () => browser.close()],
1023+
[
1024+
'Fixture cleanup',
1025+
async () => {
1026+
await sql.begin(async (tx) => {
1027+
await tx`delete from workspace where owner_id = ${userId}`
1028+
await tx`delete from project where owner_id = ${userId}`
1029+
await tx`delete from organization where id in (${organizationId}, ${otherOrganizationId})`
1030+
await tx`delete from "user" where id = ${userId}`
1031+
})
1032+
},
1033+
],
1034+
['Database connection cleanup', () => sql.end({ timeout: 5 })],
1035+
] as const) {
1036+
const started = performance.now()
1037+
try {
1038+
await cleanup()
1039+
} catch (error) {
1040+
checks.push({
1041+
name,
1042+
status: 'failed',
1043+
durationMs: Math.round(performance.now() - started),
1044+
error: getErrorMessage(error),
1045+
})
1046+
process.exitCode = 1
1047+
}
10371048
}
10381049
await mkdir(dirname(reportPath), { recursive: true })
10391050
await writeFile(

0 commit comments

Comments
 (0)