Skip to content

Commit 9536a21

Browse files
committed
test(org): prove the rename saved and walk Generic Secrets in both modes
1 parent 5172e29 commit 9536a21

2 files changed

Lines changed: 52 additions & 8 deletions

File tree

‎apps/sim/scripts/org-redesign-seed.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
organization,
1111
organizationSearchHistory,
1212
organizationSearchIntegration,
13+
organizationSecretSource,
1314
permissionGroup,
1415
permissionGroupMember,
1516
permissions,
@@ -350,6 +351,11 @@ await db.transaction(async (tx) => {
350351
)
351352

352353
await tx.insert(simLink).values(syntheticLinks())
354+
await tx.insert(organizationSecretSource).values({
355+
id: 'org-redesign-secret-source',
356+
organizationId: ORGANIZATION_ID,
357+
mode: 'member',
358+
})
353359

354360
const policies = Object.fromEntries(
355361
await Promise.all(

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

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,12 @@ async function sidebarChecks() {
825825
const restore = await startRename()
826826
await restore.fill(ORGANIZATION_NAME)
827827
await restore.press('Enter')
828+
await expect
829+
.poll(
830+
async () =>
831+
(await sql`select name from organization where id = ${ORGANIZATION_ID}`)[0]?.name
832+
)
833+
.toBe(ORGANIZATION_NAME)
828834
await expect(chip).toContainText(ORGANIZATION_NAME)
829835
})
830836
}
@@ -2141,17 +2147,49 @@ async function integrationChecks() {
21412147
})
21422148

21432149
section('3 Generic Secrets')
2144-
await check('the Generic Secrets page opens in member mode with a way back', async () => {
2150+
await check('member mode opens the personal editor and keeps q on the way back', async () => {
21452151
await withSession(MEMBER, async ({ page }) => {
2146-
await page.goto(url(`${root}/integrations/secrets?q=sec`))
2147-
await expect(
2148-
page
2149-
.getByRole('link', { name: /Integrations/ })
2150-
.or(page.getByRole('button', { name: /Back|Integrations/ }))
2151-
.first()
2152-
).toBeVisible()
2152+
await page.goto(url(`${root}/integrations?q=secret`))
2153+
const row = page
2154+
.getByRole('main')
2155+
.getByRole('link')
2156+
.filter({ hasText: /Secrets/ })
2157+
await expect(row).toContainText('Personal secrets')
2158+
await row.click()
2159+
await expect(page).toHaveURL(
2160+
(address) =>
2161+
address.pathname === `${root}/integrations/secrets` &&
2162+
address.searchParams.get('q') === 'secret'
2163+
)
2164+
await page
2165+
.getByRole('link', { name: /Integrations/ })
2166+
.first()
2167+
.click()
2168+
await expect(page).toHaveURL(
2169+
(address) =>
2170+
address.pathname === `${root}/integrations` && address.searchParams.get('q') === 'secret'
2171+
)
21532172
})
21542173
})
2174+
await check('organization mode lists a read-only view under the organization', async () => {
2175+
await sql`update organization_secret_source set mode = 'organization' where organization_id = ${ORGANIZATION_ID}`
2176+
await withSession(MEMBER, async ({ page }) => {
2177+
await page.goto(url(`${root}/integrations?q=secret`))
2178+
const row = page
2179+
.getByRole('region', { name: 'Managed by your organization' })
2180+
.getByRole('link')
2181+
.filter({ hasText: /Secrets/ })
2182+
await expect(row).toContainText('Organization managed')
2183+
await row.click()
2184+
await expect(page).toHaveURL(
2185+
(address) => address.pathname === `${root}/integrations/generic-secrets`
2186+
)
2187+
await expect(page.getByRole('heading', { level: 1 })).toContainText('Secrets')
2188+
}).finally(
2189+
() =>
2190+
sql`update organization_secret_source set mode = 'member' where organization_id = ${ORGANIZATION_ID}`
2191+
)
2192+
})
21552193
notProvable(
21562194
'Slack onboarding ?slack= actions',
21572195
'A valid token needs a Slack workspace install; invalid tokens are asserted as not found'

0 commit comments

Comments
 (0)