Skip to content

Commit ba718d8

Browse files
committed
Merge branch 'wip/fx16-http' into wip/platform-org-wiring
2 parents 85e7430 + c85d67e commit ba718d8

3 files changed

Lines changed: 32 additions & 14 deletions

File tree

‎apps/sim/scripts/test-assistant-actions-e2e.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -843,8 +843,9 @@ try {
843843
await expect(
844844
page.getByRole('region', { name: 'Connected credentials', exact: true }).getByRole('link')
845845
).toHaveCount(0)
846-
// With no connectable option left the page offers no connection at all.
847-
await expect(connectIntegration).toHaveCount(0)
846+
// No member method is left and this deployment configures no Salesforce client for the
847+
// workspace, so the page keeps Connect integration only as a disabled control naming why.
848+
await expect(connectIntegration).toBeDisabled()
848849
await capture('integration-disabled-app-empty')
849850
} finally {
850851
await sql`update credential set managed_oauth_status = 'active' where id = ${nativeCredentialId}`

‎apps/sim/scripts/test-browser-extension-e2e.ts‎

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2266,8 +2266,9 @@ try {
22662266
async () => {
22672267
assert(userId)
22682268
const viewer = userId
2269-
// A workspace of its own, owned by someone else and shared with the viewer, so revoking the
2270-
// share leaves the viewer no other way in.
2269+
// A workspace of the viewer's organization, owned by someone else and shared with the viewer.
2270+
// Organization owners inherit admin on its workspaces, so access is gone only once the share
2271+
// is revoked and the viewer is demoted to a plain member.
22712272
const scopedWorkspaceId = generateId()
22722273
const scopedChatId = generateId()
22732274
await sql.begin(async (tx) => {
@@ -2288,10 +2289,13 @@ try {
22882289
response.request().method() === 'POST' &&
22892290
new URL(response.url()).pathname === '/api/mothership/chat'
22902291
)
2291-
const runs = () =>
2292-
sql<{ workspaceId: string | null; organizationId: string | null }[]>`
2293-
select workspace_id as "workspaceId", organization_id as "organizationId"
2294-
from copilot_runs where chat_id = ${scopedChatId}`
2292+
const runs = async () =>
2293+
(
2294+
await sql<{ workspaceId: string | null; organizationId: string | null }[]>`
2295+
select workspace_id as "workspaceId", organization_id as "organizationId"
2296+
from copilot_runs where chat_id = ${scopedChatId}`
2297+
).map(({ workspaceId, organizationId }) => ({ workspaceId, organizationId }))
2298+
let demoted = false
22952299
try {
22962300
await navigate(`${base.origin}/extension/o/${organizationId}?chat=${scopedChatId}`)
22972301
await expect(frame().getByText('QA scoped response.', { exact: true })).toBeVisible()
@@ -2321,19 +2325,29 @@ try {
23212325
.toMatch(/^(?!active$)\w+$/)
23222326
assert.deepEqual(await runs(), [{ workspaceId: scopedWorkspaceId, organizationId: null }])
23232327

2324-
await sql`delete from permissions where entity_type = 'workspace' and entity_id = ${scopedWorkspaceId} and user_id = ${viewer}`
2328+
await sql.begin(async (tx) => {
2329+
await tx`delete from permissions where entity_type = 'workspace' and entity_id = ${scopedWorkspaceId} and user_id = ${viewer}`
2330+
await tx`update member set role = 'member' where organization_id = ${organizationId} and user_id = ${viewer}`
2331+
})
2332+
demoted = true
23252333
const followUp = chatPost()
23262334
await composer.fill('QA scoped follow-up')
23272335
await composer.press('Enter')
23282336
const refusal = (await followUp).status()
2329-
assert(refusal === 403 || refusal === 404, `The follow-up was answered ${refusal}`)
2337+
// The chat route answers a workspace the sender cannot reach with 400, before any run.
2338+
assert(
2339+
refusal === 400 || refusal === 403 || refusal === 404,
2340+
`The follow-up was answered ${refusal}`
2341+
)
23302342
// Refused, not re-scoped: no run under the organization, and the chat keeps its workspace.
23312343
assert.deepEqual(await runs(), [{ workspaceId: scopedWorkspaceId, organizationId: null }])
23322344
const [chat] = await sql<{ workspaceId: string | null; organizationId: string | null }[]>`
23332345
select workspace_id as "workspaceId", organization_id as "organizationId"
23342346
from copilot_chats where id = ${scopedChatId}`
23352347
assert.deepEqual(chat, { workspaceId: scopedWorkspaceId, organizationId: null })
23362348
} finally {
2349+
if (demoted)
2350+
await sql`update member set role = 'owner' where organization_id = ${organizationId} and user_id = ${viewer}`
23372351
await sql`delete from permissions where entity_type = 'workspace' and entity_id = ${scopedWorkspaceId}`
23382352
await sql`delete from workspace where id = ${scopedWorkspaceId}`
23392353
}

‎apps/sim/scripts/test-file-list-realtime-e2e.ts‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,11 +347,14 @@ try {
347347
revision = required(json(await request(`${prefix()}/${fileId}/versions`)).revision)
348348
})
349349
)
350-
assert.equal(
351-
toRecord(json(await request(`${prefix()}/${fileId}`, 'GET', undefined, readerCookie)).file)
352-
.id,
353-
fileId
350+
const readable = await request(
351+
`${prefix()}/${fileId}/content`,
352+
'GET',
353+
undefined,
354+
readerCookie
354355
)
356+
assert.equal(readable.status, 200, 'Unexpected HTTP status; inspect private app logs')
357+
assert.equal(readable.text, 'first version')
355358
assert.equal(retainedMembership.projectId, fixture.projectId)
356359
assert.equal(workspaceEvents.length, 0)
357360
}

0 commit comments

Comments
 (0)