Skip to content

Commit a86095a

Browse files
committed
test(platform): assert where saved upgrade, request and outside-organization links really land
- A saved upgrade link keeps its query on the first hop to Plans; the seeded Enterprise organization then exits to Billing, as legacy did. - A legacy access-requests link names view=requests, as the existing access-requests navigation always has. - A non-member organization is the access denial the shell gate draws, which the org-redesign suite already asserts. - Self-hosted Plans goes to the hosted app's upgrade page with its reason, per resolvePlansEntry; Billing stays not found.
1 parent fa41ebd commit a86095a

2 files changed

Lines changed: 24 additions & 13 deletions

File tree

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

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,8 @@ const REDIRECTS: readonly (readonly [string, string])[] = [
2424
[liveRoute('/links?search=hand'), liveRoute('/settings/links?search=hand')],
2525
[`${WORKSPACE}/w`, `${WORKSPACE}/workflows`],
2626
[`${WORKSPACE}/home`, liveRoute('/home')],
27-
// The upgrade prompt carries why it was shown and nothing else.
28-
[
29-
`${WORKSPACE}/upgrade?reason=credits&ref=x`,
30-
liveRoute('/settings/billing/plans?reason=credits'),
31-
],
27+
// The seeded organization is on Enterprise, whose plans page exits to Billing, as legacy's did.
28+
[`${WORKSPACE}/upgrade?reason=credits&ref=x`, liveRoute('/settings/billing')],
3229
]
3330

3431
for (const [from, to] of REDIRECTS) {
@@ -62,7 +59,11 @@ const QUERY_REDIRECTS: readonly (readonly [string, string])[] = [
6259
[`${WORKSPACE}/settings/apikeys?from=mail`, `${WORKSPACE}/settings/api-keys?from=mail`],
6360
[
6461
`${WORKSPACE}/access-requests?requestId=req-1`,
65-
`${WORKSPACE}/settings/requests?requestId=req-1`,
62+
`${WORKSPACE}/settings/requests?view=requests&requestId=req-1`,
63+
],
64+
[
65+
`${WORKSPACE}/upgrade?reason=credits&ref=x`,
66+
liveRoute('/settings/billing/plans?reason=credits&ref=x'),
6667
],
6768
]
6869

@@ -112,14 +113,19 @@ test('every legacy sub-path of a workspace the viewer cannot open is a branded n
112113
}
113114
})
114115

115-
test('an organization the viewer does not belong to is the branded not-found, not a failed read', async ({
116+
test('an organization the viewer does not belong to is the access denial, not a failed read', async ({
116117
page,
117118
}) => {
118119
await signInAsAdmin(page, liveRoute('/home'))
119120
const outside = `/o/${organizationId()}-outside`
120121
for (const route of ['/home', '/settings/members']) {
121122
await page.goto(`${outside}${route}`)
122-
await expect(page.getByRole('heading', { name: 'Page not found' }), route).toBeVisible()
123+
await expect(
124+
page.getByRole('heading', { name: 'Organization access denied' }),
125+
route
126+
).toBeVisible()
127+
await expect(page.getByRole('button', { name: 'View your workspaces' }), route).toBeVisible()
128+
await expect(page.getByRole('heading', { name: 'Something went wrong' }), route).toHaveCount(0)
123129
}
124130
})
125131

‎apps/sim/platform/checks/live/self-hosted/surfaces.spec.ts‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { expect } from '@playwright/test'
2+
import { SIM_SITE_URL } from '@sim/utils/site'
23
import { signInAsAdmin } from '@/platform/checks/live/session'
34
import { firstHopFrom } from '@/platform/checks/live/support/navigation'
45
import { liveRoute, liveRoutePattern } from '@/platform/checks/routes'
@@ -30,15 +31,19 @@ test('a self-hosted shell renders every section a member uses', async ({ page })
3031
}
3132
})
3233

33-
test('self-hosted settings offer no billing section, and a saved billing link is not found', async ({
34+
test('self-hosted settings offer no billing section, a saved billing link is not found, and plans go to the hosted app', async ({
3435
page,
3536
}) => {
3637
await signInAsAdmin(page, liveRoute('/settings'))
3738
await expect(page.getByRole('link', { name: 'Billing', exact: true })).toHaveCount(0)
38-
for (const route of ['/settings/billing', '/settings/billing/plans']) {
39-
await page.goto(liveRoute(route))
40-
await expect(page.getByRole('heading', { name: 'Page not found' }), route).toBeVisible()
41-
}
39+
await page.goto(liveRoute('/settings/billing'))
40+
await expect(page.getByRole('heading', { name: 'Page not found' })).toBeVisible()
41+
// A self-hosted deployment buys its plan on the hosted app, as the legacy upgrade page sent it.
42+
await page.route(`${SIM_SITE_URL}/**`, (route) =>
43+
route.fulfill({ status: 200, contentType: 'text/html', body: 'Hosted upgrade stand-in' })
44+
)
45+
await page.goto(liveRoute('/settings/billing/plans?reason=credits'))
46+
await expect(page).toHaveURL(`${SIM_SITE_URL}/upgrade?reason=credits`)
4247
})
4348

4449
for (const [from, to] of [

0 commit comments

Comments
 (0)