Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions playwright/e2e/onboarding-setup.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,18 @@ test.describe('Dashboard exploration and returning to v3 setup', () => {
const appId = 'com.example.onboarding-preview'
const setup = `${fixture}?view=navigation&resume=${appId}&step=setup`

test('routes legacy saved setup through channel creation when the channel treatment is enabled', async ({ page }) => {
await page.goto(`${setup}&legacyChannel=1&channelTreatment=1`)
await expect(page.locator('[data-test="channel-default-routing-animation"]')).toBeVisible()
await expect(page.locator('[data-test="onboarding-setup-cli"]')).toHaveCount(0)
})

test('lets the new todo list override the channel treatment for legacy saved setup', async ({ page }) => {
await page.goto(`${setup}&legacyChannel=1&channelTreatment=1&todoListTreatment=1`)
await expect(page.locator('[data-test="onboarding-setup-cli"]')).toBeVisible()
await expect(page.locator('[data-test="channel-default-routing-animation"]')).toHaveCount(0)
})

test('lands on the app dashboard, prompts on refresh, and returns to fullscreen setup', async ({ page }) => {
await page.goto(setup)
await expect(page.locator('[data-test="onboarding-setup-cli"]')).toBeVisible()
Expand Down
17 changes: 15 additions & 2 deletions playwright/fixtures/onboarding-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@ const state = {
const events: string[] = []
const channelEvents: Array<{ event: OnboardingChannelEvent, properties: OnboardingChannelEventProperties }> = []
const preview = { state, events, channelEvents, appId: ref(previewAppId), command: ref('npx @capgo/cli@latest i [API_KEY]'), hiding: ref(false), selectedOrgId: ref('') }
const previewUserOnboarding = {
abtests: {
...(params.get('channelTreatment') === '1' ? { new_channel: { assigned_at: '2026-09-25T00:00:00.000Z', branch: 'A' } } : {}),
...(params.get('todoListTreatment') === '1' ? { ota_todo_list_v3: { assigned_at: '2026-09-25T00:00:00.000Z', branch: 'A' } } : {}),
},
intent: assignment ? 'builder' : 'ota',
status: 'in_progress',
step: 'setup',
flow: 'existing_org',
setup_stage: 'cli',
app_id: previewAppId,
...(params.get('legacyChannel') === '1' ? {} : { final_step: 'setup' }),
}
Object.assign(window, { onboardingSetupPreview: preview })

function previewOnboarding() {
Expand Down Expand Up @@ -140,7 +153,7 @@ window.fetch = async (input, init) => {
}
if (params.get('view') === 'flow' || navigationView) {
const app = { id: '00000000-0000-4000-8000-000000000003', app_id: previewAppId, name: 'My Capacitor app', icon_url: '', owner_org: '00000000-0000-4000-8000-000000000002', need_onboarding: true, onboarding: previewOnboarding() }
const user = { id: '00000000-0000-4000-8000-000000000001', email: 'preview@example.com', onboarding: { intent: assignment ? 'builder' : 'ota', status: 'in_progress', step: 'setup', flow: 'app', setup_stage: 'cli', app_id: previewAppId } }
const user = { id: '00000000-0000-4000-8000-000000000001', email: 'preview@example.com', onboarding: previewUserOnboarding }
const rows = url.pathname.endsWith('/apps') ? (!url.searchParams.get('owner_org') || url.searchParams.get('owner_org') === `eq.${app.owner_org}` ? [app] : []) : url.pathname.endsWith('/users') ? [user] : url.pathname.endsWith('/apikeys') ? [{ key: '00000000-0000-4000-8000-000000000004', rbac_id: '00000000-0000-4000-8000-000000000005', expires_at: null }] : url.pathname.endsWith('/role_bindings') ? [{ principal_id: '00000000-0000-4000-8000-000000000005', scope_type: 'org', roles: { name: 'org_super_admin' } }] : []
const single = new Headers(init?.headers).get('Accept')?.includes('object')
return new Response(JSON.stringify(single ? rows[0] ?? {} : rows), { headers: { 'Content-Type': 'application/json' } })
Expand Down Expand Up @@ -210,7 +223,7 @@ const app = createApp(defineComponent({
const pinia = createPinia()
app.use(pinia)
// Supply identity to the real channel form without starting dashboard store watchers.
Object.defineProperty(useMainStore(pinia), 'user', { value: { id: '00000000-0000-4000-8000-000000000001', email: 'preview@example.com', onboarding: { intent: assignment ? 'builder' : 'ota', status: 'in_progress', step: 'setup', flow: 'app', setup_stage: 'cli', app_id: previewAppId } } })
Object.defineProperty(useMainStore(pinia), 'user', { value: { id: '00000000-0000-4000-8000-000000000001', email: 'preview@example.com', onboarding: previewUserOnboarding } })
Object.defineProperty(useMainStore(pinia), 'auth', { value: { id: '00000000-0000-4000-8000-000000000001' } })
useMainStore(pinia).awaitInitialLoad = async () => true
const organization = useOrganizationStore(pinia)
Expand Down
Loading
Loading