MCPcopy
hub / github.com/callstack/agent-device / createWebSmokeContext

Function createWebSmokeContext

test/integration/smoke-web-platform.test.ts:62–88  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60}
61
62async function createWebSmokeContext(): Promise<WebSmokeContext> {
63 const artifactDir = createArtifactDir();
64 const stateDir = path.join(artifactDir, 'agent-device-state');
65 const agentBrowserConfigPath = path.join(artifactDir, 'agent-browser.json');
66 const session = `ws-${process.pid.toString(36)}-${(Date.now() % 1_679_616).toString(36)}`;
67 const fixture = await startFixtureServer();
68 const env = {
69 ...process.env,
70 AGENT_DEVICE_STATE_DIR: stateDir,
71 AGENT_BROWSER_CONFIG: agentBrowserConfigPath,
72 AGENT_BROWSER_HEADED: 'false',
73 AGENT_BROWSER_IDLE_TIMEOUT_MS: '30000',
74 };
75
76 mkdirSync(stateDir, { recursive: true });
77 writeFileSync(agentBrowserConfigPath, JSON.stringify({ headed: false }, null, 2));
78
79 return {
80 artifactDir,
81 common: ['--platform', 'web', '--session', session, '--json'],
82 env,
83 screenshotPath: path.join(artifactDir, 'web-smoke.png'),
84 server: fixture.server,
85 stepHistory: [],
86 url: fixture.url,
87 };
88}
89
90async function assertInitialWebSurface(context: WebSmokeContext): Promise<void> {
91 const snapshot = await runStep(context, 'capture interactive snapshot', [

Callers 1

Calls 2

createArtifactDirFunction · 0.85
startFixtureServerFunction · 0.85

Tested by

no test coverage detected