11import { expect , test } from '@playwright/test'
22import { expectRedirectToLogin , loginViaProgrammaticPage , loginViaUi } from './helpers/auth'
33import { selectors } from './helpers/selectors'
4- import { createTeamFromSettings , getActiveTeamViaApi , switchTeamFromSidebar } from './helpers/teams'
4+ import { createTeamFromSettings , ensureTeamAndOrganizationContext , getActiveTeamViaApi , switchTeamFromSidebar } from './helpers/teams'
55
66const TEST_EMAIL = process . env . E2E_USER_EMAIL || 'test@preview.local'
77const TEST_PASSWORD = process . env . E2E_USER_PASSWORD || 'password123'
@@ -16,6 +16,48 @@ test('user can sign in through login form and land in dashboard', async ({ page
1616 await loginViaUi ( page , { email : TEST_EMAIL , password : TEST_PASSWORD } )
1717} )
1818
19+ test ( 'onboarding slug mirrors the full workspace name while typing' , async ( { page } ) => {
20+ await loginViaProgrammaticPage ( page , { email : TEST_EMAIL , password : TEST_PASSWORD } )
21+
22+ await page . goto ( '/onboarding' )
23+ await expect ( page . getByRole ( 'heading' , { name : 'Create your workspace' } ) ) . toBeVisible ( )
24+
25+ const workspaceNameInput = page . getByLabel ( 'Workspace name' )
26+ const workspaceSlugInput = page . getByLabel ( 'URL' )
27+
28+ await workspaceNameInput . click ( )
29+ await workspaceNameInput . type ( 'Frogbyte' , { delay : 40 } )
30+ await expect ( workspaceSlugInput ) . toHaveValue ( 'frogbyte' )
31+
32+ await workspaceNameInput . type ( ' Labs' , { delay : 40 } )
33+ await expect ( workspaceSlugInput ) . toHaveValue ( 'frogbyte-labs' )
34+ } )
35+
36+ test ( 'team creation slug mirrors the full team name while typing' , async ( { page } ) => {
37+ await loginViaProgrammaticPage ( page , { email : TEST_EMAIL , password : TEST_PASSWORD } )
38+ await ensureTeamAndOrganizationContext ( page . request )
39+
40+ await page . goto ( '/settings#team' )
41+ await page . waitForFunction ( ( ) => {
42+ const tab = document . querySelector ( '[data-testid="settings-tab-team"]' ) as any
43+ return Boolean ( tab ?. __vueParentComponent )
44+ } )
45+
46+ await expect ( page . locator ( selectors . teamOpenCreateDialog ) ) . toBeVisible ( { timeout : 20_000 } )
47+ await page . locator ( selectors . teamOpenCreateDialog ) . click ( )
48+
49+ const createDialog = page . getByRole ( 'dialog' , { name : 'Create Team' } )
50+ const teamNameInput = createDialog . getByLabel ( 'Team Name' )
51+ const teamSlugInput = createDialog . getByLabel ( 'Subdomain Slug' )
52+
53+ await teamNameInput . click ( )
54+ await teamNameInput . type ( 'DotMatrixLabs' , { delay : 40 } )
55+ await expect ( teamSlugInput ) . toHaveValue ( 'dotmatrixlabs' )
56+
57+ await teamNameInput . type ( ' Ops' , { delay : 40 } )
58+ await expect ( teamSlugInput ) . toHaveValue ( 'dotmatrixlabs-ops' )
59+ } )
60+
1961test ( 'settings navigation tabs render expected sections' , async ( { page } ) => {
2062 await loginViaProgrammaticPage ( page , { email : TEST_EMAIL , password : TEST_PASSWORD } )
2163
0 commit comments