From 89f671a4db3e1f553fbc14c0962553894fecf4a7 Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Fri, 22 Sep 2017 17:29:25 +0200 Subject: [PATCH] smoke: add tracing message --- test/smoke/src/areas/debug/debug.test.ts | 16 ++++++++-------- test/smoke/src/areas/debug/debug.ts | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/test/smoke/src/areas/debug/debug.test.ts b/test/smoke/src/areas/debug/debug.test.ts index a6fcf6c9bb2..05f5c3c983c 100644 --- a/test/smoke/src/areas/debug/debug.test.ts +++ b/test/smoke/src/areas/debug/debug.test.ts @@ -74,7 +74,7 @@ describe('Debug', () => { 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); + app.workbench.debug.waitForStackFrame(sf => sf.name === 'index.js' && sf.lineNumber === 6, 'looking for index.js and line 6').then(c, e); }); await app.screenCapturer.capture('debugging is paused'); @@ -83,13 +83,13 @@ describe('Debug', () => { it('focus stack frames and variables', async function () { await app.client.waitFor(() => app.workbench.debug.getLocalVariableCount(), c => c === 4, 'there should be 4 local variables'); - await app.workbench.debug.focusStackFrame('layer.js'); + await app.workbench.debug.focusStackFrame('layer.js', 'looking for layer.js'); await app.client.waitFor(() => app.workbench.debug.getLocalVariableCount(), c => c === 5, 'there should be 5 local variables'); - await app.workbench.debug.focusStackFrame('route.js'); + await app.workbench.debug.focusStackFrame('route.js', 'looking for route.js'); await app.client.waitFor(() => app.workbench.debug.getLocalVariableCount(), c => c === 3, 'there should be 3 local variables'); - await app.workbench.debug.focusStackFrame('index.js'); + await app.workbench.debug.focusStackFrame('index.js', 'looking for index.js'); await app.client.waitFor(() => app.workbench.debug.getLocalVariableCount(), c => c === 4, 'there should be 4 local variables'); }); @@ -97,15 +97,15 @@ describe('Debug', () => { await app.workbench.debug.stepIn(); await app.screenCapturer.capture('debugging has stepped in'); - const first = await app.workbench.debug.waitForStackFrame(sf => sf.name === 'response.js'); + const first = await app.workbench.debug.waitForStackFrame(sf => sf.name === 'response.js', 'looking for response.js'); await app.workbench.debug.stepOver(); await app.screenCapturer.capture('debugging has stepped over'); - await app.workbench.debug.waitForStackFrame(sf => sf.name === 'response.js' && sf.lineNumber === first.lineNumber + 1); + await app.workbench.debug.waitForStackFrame(sf => sf.name === 'response.js' && sf.lineNumber === first.lineNumber + 1, `looking for response.js and line ${first.lineNumber + 1}`); await app.workbench.debug.stepOut(); await app.screenCapturer.capture('debugging has stepped out'); - await app.workbench.debug.waitForStackFrame(sf => sf.name === 'index.js' && sf.lineNumber === 7); + await app.workbench.debug.waitForStackFrame(sf => sf.name === 'index.js' && sf.lineNumber === 7, `looking for index.js and line 7`); }); it('continue', async function () { @@ -115,7 +115,7 @@ describe('Debug', () => { 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); + app.workbench.debug.waitForStackFrame(sf => sf.name === 'index.js' && sf.lineNumber === 6, `looking for index.js and line 6`).then(c, e); }); await app.screenCapturer.capture('debugging is paused'); diff --git a/test/smoke/src/areas/debug/debug.ts b/test/smoke/src/areas/debug/debug.ts index e500d129446..ae2770f5260 100644 --- a/test/smoke/src/areas/debug/debug.ts +++ b/test/smoke/src/areas/debug/debug.ts @@ -94,19 +94,19 @@ export class Debug extends Viewlet { await this.spectron.client.waitForElement(NOT_DEBUG_STATUS_BAR); } - async waitForStackFrame(func: (stackFrame: IStackFrame) => boolean): Promise { + async waitForStackFrame(func: (stackFrame: IStackFrame) => boolean, message: string): Promise { return await this.spectron.client.waitFor(async () => { const stackFrames = await this.getStackFrames(); return stackFrames.filter(func)[0]; - }, void 0, 'Waiting for Stack Frame'); + }, void 0, `Waiting for Stack Frame: ${message}`); } async waitForStackFrameLength(length: number): Promise { return await this.spectron.client.waitFor(() => this.getStackFrames(), stackFrames => stackFrames.length === length); } - async focusStackFrame(name: string): Promise { - const stackFrame = await this.waitForStackFrame(sf => sf.name === name); + async focusStackFrame(name: string, message: string): Promise { + const stackFrame = await this.waitForStackFrame(sf => sf.name === name, message); await this.spectron.client.spectron.client.elementIdClick(stackFrame.id); await this.spectron.workbench.waitForTab(name); }