Skip to content

Commit a2e85b8

Browse files
committed
Fix sessionId tests
1 parent e76769f commit a2e85b8

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

test/event.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,15 @@ describe('registering event', () => {
100100
target: version.webSocketDebuggerUrl
101101
});
102102
// create the targets
103-
await chrome.Target.createTarget({url: 'about:blank'});
104-
await chrome.Target.createTarget({url: 'about:blank'});
105-
// fetch the targets (two pages) and attach to each of them
106-
const {targetInfos} = await chrome.Target.getTargets();
103+
const {targetId: targetId0} = await chrome.Target.createTarget({url: 'about:blank'});
104+
const {targetId: targetId1} = await chrome.Target.createTarget({url: 'about:blank'});
105+
// attach to each target
107106
const {sessionId: sessionId0} = await chrome.Target.attachToTarget({
108-
targetId: targetInfos[0].targetId,
107+
targetId: targetId0,
109108
flatten: true
110109
});
111110
const {sessionId: sessionId1} = await chrome.Target.attachToTarget({
112-
targetId: targetInfos[1].targetId,
111+
targetId: targetId1,
113112
flatten: true
114113
});
115114
// enable the Page events in both of them

test/send.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,10 @@ describe('sending a command', () => {
163163
target: version.webSocketDebuggerUrl
164164
});
165165
// create the target
166-
await chrome.Target.createTarget({url: 'about:blank'});
166+
const {targetId} = await chrome.Target.createTarget({url: 'about:blank'});
167167
// attach to the target
168-
const {targetInfos} = await chrome.Target.getTargets();
169168
const {sessionId} = await chrome.Target.attachToTarget({
170-
targetId: targetInfos[0].targetId,
169+
targetId,
171170
flatten: true
172171
});
173172
// send a command using the sessionId

0 commit comments

Comments
 (0)