File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ const env = {
1717
1818await fs . mkdir ( path . join ( ROOT , '.tmp' ) , { recursive : true } ) ;
1919await stopRuntime ( { stateDir, env } ) . catch ( ( ) => undefined ) ;
20+ await fs . rm ( stateDir , { recursive : true , force : true } ) ;
2021await startRuntime ( {
2122 stateDir,
2223 host : '127.0.0.1' ,
Original file line number Diff line number Diff line change @@ -12,20 +12,37 @@ const TAB_STABILITY_DIRS = [
1212] ;
1313const TAB_STABILITY_LABELS = TAB_STABILITY_DIRS . map ( ( dir ) => path . basename ( dir ) ) ;
1414
15+ const gotoWorkspaceRoot = async ( page : Page ) => {
16+ await Promise . all ( [
17+ page . waitForResponse ( ( response ) =>
18+ response . request ( ) . method ( ) === 'POST' && response . url ( ) . includes ( '/api/rpc/workbench_bootstrap' )
19+ ) ,
20+ page . goto ( '/' ) ,
21+ ] ) ;
22+ await page . waitForFunction ( ( ) =>
23+ Boolean ( document . querySelector ( '[data-testid="overlay"]' ) )
24+ || document . querySelectorAll ( '.workspace-top-tab' ) . length > 0
25+ ) ;
26+ } ;
27+
28+ const countWorkspaceTabs = async ( page : Page ) => page . locator ( '.workspace-top-tab' ) . count ( ) ;
29+
1530const openLaunchOverlay = async ( page : Page ) => {
16- await page . goto ( '/' ) ;
31+ await gotoWorkspaceRoot ( page ) ;
1732 const overlay = page . getByTestId ( 'overlay' ) ;
18- if ( await overlay . count ( ) ) {
33+ if ( await overlay . isVisible ( ) ) {
1934 await expect ( overlay ) . toBeVisible ( ) ;
2035 return ;
2136 }
37+
38+ await expect . poll ( ( ) => countWorkspaceTabs ( page ) ) . toBeGreaterThan ( 0 ) ;
2239 await page . getByRole ( 'button' , { name : 'Add workspace' } ) . click ( ) ;
2340 await expect ( overlay ) . toBeVisible ( ) ;
2441} ;
2542
2643const launchLocalWorkspace = async ( page : Page ) => {
27- await page . goto ( '/' ) ;
28- if ( await page . getByTestId ( 'workspace-topbar' ) . count ( ) ) {
44+ await gotoWorkspaceRoot ( page ) ;
45+ if ( await countWorkspaceTabs ( page ) ) {
2946 return ;
3047 }
3148
You can’t perform that action at this time.
0 commit comments