зеркало из 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:
Родитель
2bd3a9fe65
Коммит
70e0b0200c
|
@ -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 });
|
||||
|
|
Загрузка…
Ссылка в новой задаче