perf: optimize app startup and background lifecycles
This commit is contained in:
@@ -478,10 +478,6 @@ describe('AgentBrowserModule', () => {
|
||||
expect(view.webContents.debugger.operationLog).toEqual([
|
||||
'load:about:blank',
|
||||
'attach:1.3',
|
||||
'command:Runtime.enable',
|
||||
'command:Log.enable',
|
||||
'command:Network.enable',
|
||||
'command:Page.enable',
|
||||
'command:Target.setAutoAttach',
|
||||
'load:http://127.0.0.1:4173/',
|
||||
]);
|
||||
@@ -662,11 +658,22 @@ describe('AgentBrowserModule', () => {
|
||||
projectPath,
|
||||
url: 'http://localhost:3000',
|
||||
});
|
||||
const view = adapter.views[0];
|
||||
if (!view) throw new Error('browser view was not created');
|
||||
await module.present({
|
||||
projectPath,
|
||||
visible: true,
|
||||
bounds: { x: 0, y: 0, width: 800, height: 600 },
|
||||
});
|
||||
await module.setDiagnostics({ projectPath, enabled: true });
|
||||
view.webContents.debugger.message('Runtime.consoleAPICalled', {
|
||||
type: 'log',
|
||||
args: [{ value: 'ready' }],
|
||||
});
|
||||
view.webContents.debugger.message('Network.requestWillBeSent', {
|
||||
requestId: 'request-1',
|
||||
request: { url: 'http://localhost:3000/api/data' },
|
||||
});
|
||||
|
||||
const page = await module.readEvents({ projectPath, after: 0 });
|
||||
expect(page.events.map((event) => event.method)).toEqual([
|
||||
@@ -863,6 +870,7 @@ describe('AgentBrowserModule', () => {
|
||||
|
||||
it('moves oversized events and command results into bounded payload handles', async () => {
|
||||
const { module, view } = await openBrowser();
|
||||
await module.setDiagnostics({ projectPath, enabled: true });
|
||||
const largeText = 'x'.repeat(70 * 1024);
|
||||
view.webContents.debugger.message('Network.dataReceived', { data: largeText });
|
||||
|
||||
@@ -905,6 +913,7 @@ describe('AgentBrowserModule', () => {
|
||||
|
||||
it('reports a debugger gap and reattaches with a new generation after DevTools closes', async () => {
|
||||
const { module, view } = await openBrowser();
|
||||
await module.setDiagnostics({ projectPath, enabled: true });
|
||||
view.webContents.debugger.message('Runtime.consoleAPICalled', { type: 'log' });
|
||||
const before = await module.readEvents({ projectPath, after: 0 });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user