зеркало из https://github.com/electron/electron.git
test: run script to help target discovery and reduce flakes
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
This commit is contained in:
Родитель
0010d976c5
Коммит
7b751cb1c5
|
@ -227,20 +227,25 @@ describe('debugger module', () => {
|
|||
it('creates unique session id for each target', (done) => {
|
||||
w.webContents.loadFile(path.join(__dirname, 'fixtures', 'sub-frames', 'debug-frames.html'));
|
||||
w.webContents.debugger.attach();
|
||||
let session: String;
|
||||
let debuggerSessionId: string;
|
||||
|
||||
w.webContents.debugger.on('message', (event, ...args) => {
|
||||
const [method, params, sessionId] = args;
|
||||
if (method === 'Target.targetCreated') {
|
||||
w.webContents.debugger.sendCommand('Target.attachToTarget', { targetId: params.targetInfo.targetId, flatten: true }).then(result => {
|
||||
session = result.sessionId;
|
||||
debuggerSessionId = result.sessionId;
|
||||
w.webContents.debugger.sendCommand('Debugger.enable', {}, result.sessionId);
|
||||
|
||||
// Ensure debugger finds a script to pause to possibly reduce flaky
|
||||
// tests.
|
||||
w.webContents.mainFrame.executeJavaScript('void 0;');
|
||||
});
|
||||
}
|
||||
if (method === 'Debugger.scriptParsed') {
|
||||
expect(sessionId).to.equal(session);
|
||||
w.webContents.debugger.detach();
|
||||
done();
|
||||
if (sessionId === debuggerSessionId) {
|
||||
w.webContents.debugger.detach();
|
||||
done();
|
||||
}
|
||||
}
|
||||
});
|
||||
w.webContents.debugger.sendCommand('Target.setDiscoverTargets', { discover: true });
|
||||
|
|
Загрузка…
Ссылка в новой задаче