MCPcopy Create free account
hub / github.com/GCWing/BitFun / ensureWorkspaceOpen

Function ensureWorkspaceOpen

tests/e2e/helpers/workspace-utils.ts:15–38  ·  view source on GitHub ↗
(startupPage: StartupPage)

Source from the content-addressed store, hash-verified

13 * @returns true if workspace is open, false otherwise
14 */
15export async function ensureWorkspaceOpen(startupPage: StartupPage): Promise<boolean> {
16 const startupVisible = await startupPage.isVisible();
17
18 if (!startupVisible) {
19 // Workspace is already open
20 return true;
21 }
22
23 const testWorkspacePath = process.env.E2E_TEST_WORKSPACE || process.cwd();
24 console.log('[WorkspaceUtils] Opening test workspace through frontend state:', testWorkspacePath);
25
26 try {
27 const opened = await openWorkspace(testWorkspacePath);
28 if (!opened) {
29 return false;
30 }
31 await ensureCodeSessionOpen();
32 console.log('[WorkspaceUtils] Test workspace opened successfully');
33 return true;
34 } catch (error) {
35 console.error('[WorkspaceUtils] Failed to open test workspace:', error);
36 return false;
37 }
38}

Callers 10

l1-session.spec.tsFile · 0.90
l1-dialog.spec.tsFile · 0.90
l1-chat.spec.tsFile · 0.90
l1-editor.spec.tsFile · 0.90

Calls 6

openWorkspaceFunction · 0.90
ensureCodeSessionOpenFunction · 0.90
cwdMethod · 0.80
isVisibleMethod · 0.45
logMethod · 0.45
errorMethod · 0.45

Tested by 1