Skip to content

Commit e2da11a

Browse files
committed
universe mgr added to ctx
Change-Id: Id8ff5120b5f02cd57ed42427b182763afbf65dff
1 parent a2894a9 commit e2da11a

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

src/McpContext.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ import fs from 'node:fs/promises';
88
import os from 'node:os';
99
import path from 'node:path';
1010

11-
import {extractUrlLikeFromDevToolsTitle, urlsEqual} from './DevtoolsUtils.js';
11+
import {
12+
extractUrlLikeFromDevToolsTitle,
13+
urlsEqual,
14+
UniverseManager,
15+
} from './DevtoolsUtils.js';
1216
import type {ListenerMap} from './PageCollector.js';
1317
import {NetworkCollector, ConsoleCollector} from './PageCollector.js';
1418
import {Locator} from './third_party/index.js';
@@ -113,6 +117,7 @@ export class McpContext implements Context {
113117

114118
#nextSnapshotId = 1;
115119
#traceResults: TraceResult[] = [];
120+
#universeManager: UniverseManager;
116121

117122
#locatorClass: typeof Locator;
118123
#options: McpContextOptions;
@@ -127,6 +132,7 @@ export class McpContext implements Context {
127132
this.logger = logger;
128133
this.#locatorClass = locatorClass;
129134
this.#options = options;
135+
this.#universeManager = new UniverseManager(this.browser);
130136

131137
this.#networkCollector = new NetworkCollector(this.browser);
132138

@@ -153,11 +159,13 @@ export class McpContext implements Context {
153159

154160
async #init() {
155161
const pages = await this.createPagesSnapshot();
162+
await this.#universeManager.init(pages);
156163
await this.#networkCollector.init(pages);
157164
await this.#consoleCollector.init(pages);
158165
}
159166

160167
dispose() {
168+
this.#universeManager.dispose();
161169
this.#networkCollector.dispose();
162170
this.#consoleCollector.dispose();
163171
}

src/manual-perf-test.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,9 @@ async function run() {
9393

9494
// Check trace content (basic check)
9595
const traceResult = traces[0];
96-
// We assume traceResult is valid if we got here and storeTraceRecording was called.
97-
// startTrace.handler calls storeTraceRecording only on success.
98-
console.log(
99-
'Trace result summary:',
100-
lines.find(l => l.includes('Trace duration')),
101-
);
96+
console.log('--- Response Lines ---');
97+
console.log(lines.join('\n'));
98+
console.log('----------------------');
10299

103100
console.log('SUCCESS: Trace recorded and stopped automatically.');
104101
} catch (err) {

0 commit comments

Comments
 (0)