提交 04bf2a2a 编写于 作者: J Joao Moreno

smoke: fix broken http ping

上级 bcd81812
......@@ -69,10 +69,12 @@ describe('Debug', () => {
port = await app.workbench.debug.startDebugging();
await app.screenCapturer.capture('debugging has started');
await new Promise((c, e) => http.get(`http://localhost:${port}`).on('response', c).on('error', e));
await app.screenCapturer.capture('server was pinged');
await new Promise((c, e) => {
const request = http.get(`http://localhost:${port}`);
request.on('error', e);
app.workbench.debug.waitForStackFrame(sf => sf.name === 'index.js' && sf.lineNumber === 6).then(c, e);
});
await app.workbench.debug.waitForStackFrame(sf => sf.name === 'index.js' && sf.lineNumber === 6);
await app.screenCapturer.capture('debugging is paused');
});
......@@ -108,15 +110,17 @@ describe('Debug', () => {
await app.workbench.debug.continue();
await app.screenCapturer.capture('debugging has continued');
await new Promise((c, e) => http.get(`http://localhost:${port}`).on('response', c).on('error', e));
await app.screenCapturer.capture('server was pinged');
await new Promise((c, e) => {
const request = http.get(`http://localhost:${port}`);
request.on('error', e);
app.workbench.debug.waitForStackFrame(sf => sf.name === 'index.js' && sf.lineNumber === 6).then(c, e);
});
await app.workbench.debug.waitForStackFrame(sf => sf.name === 'index.js' && sf.lineNumber === 6);
await app.screenCapturer.capture('debugging is paused');
});
it('debug console', async function () {
await app.client.waitFor(() => app.workbench.debug.console('2 + 2 \n'), r => r === '4', 'debug console should return 2 + 2 = 4');
await app.workbench.debug.waitForReplCommand('2 + 2 \n', r => r === '4');
});
it('stop debugging', async function () {
......
......@@ -25,7 +25,6 @@ const STACK_FRAME = `${VIEWLET} .monaco-tree-row .stack-frame`;
const VARIABLE = `${VIEWLET} .debug-variables .monaco-tree-row .expression`;
const CONSOLE_OUTPUT = `.repl .output.expression`;
const CONSOLE_INPUT_OUTPUT = `.repl .input-output-pair .output.expression .value`;
const SCOPE = `${VIEWLET} .debug-variables .scope`;
const REPL_FOCUSED = '.repl-input-wrapper .monaco-editor.focused';
......@@ -112,18 +111,18 @@ export class Debug extends Viewlet {
await this.spectron.workbench.waitForTab(name);
}
async console(text: string): Promise<string> {
async waitForReplCommand(text: string, accept: (result: string) => boolean): Promise<void> {
await this.spectron.workbench.quickopen.runCommand('Debug: Focus Debug Console');
await this.spectron.client.waitForElement(REPL_FOCUSED);
await this.spectron.client.type(text);
await this.spectron.client.waitForElement(CONSOLE_INPUT_OUTPUT);
const result = await this.getConsoleOutput();
return result[result.length - 1] || '';
await this.spectron.client.waitFor(async () => {
const result = await this.getConsoleOutput();
return result[result.length - 1] || '';
}, accept);
}
async getLocalVariableCount(): Promise<number> {
await this.spectron.client.waitForElement(SCOPE);
return await this.spectron.webclient.selectorExecute(VARIABLE, div => (Array.isArray(div) ? div : [div]).length);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册