From e15c137204467337810c8155c4c22999df138aab Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Fri, 8 Sep 2017 18:37:49 +0200 Subject: [PATCH] smoke: improve data loss tests --- test/smoke/src/areas/workbench/data-loss.test.ts | 5 +++-- test/smoke/src/areas/workbench/workbench.ts | 11 +++++------ test/smoke/src/spectron/client.ts | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/smoke/src/areas/workbench/data-loss.test.ts b/test/smoke/src/areas/workbench/data-loss.test.ts index f81bab831a2..12ef3e4ac22 100644 --- a/test/smoke/src/areas/workbench/data-loss.test.ts +++ b/test/smoke/src/areas/workbench/data-loss.test.ts @@ -20,13 +20,14 @@ describe('Dataloss', () => { await app.client.type(textToType); await app.reload(); + await app.screenCapturer.capture('After reload'); - assert.ok(await app.workbench.waitForActiveOpen(fileName, true), `${fileName} tab is not present or is not active after reopening.`); + await app.workbench.waitForActiveOpen(fileName, true); let actual = await app.workbench.editor.getEditorFirstLineText(); await app.screenCapturer.capture(fileName + ' text'); assert.ok(actual.startsWith(textToType), `${actual} did not start with ${textToType}`); - assert.ok(await app.workbench.waitForOpen(untitled, true), `${untitled} tab is not present after reopening.`); + await app.workbench.waitForOpen(untitled, true); await app.workbench.selectTab('Untitled-1', true); actual = await app.workbench.editor.getEditorFirstLineText(); await app.screenCapturer.capture('Untitled file text'); diff --git a/test/smoke/src/areas/workbench/workbench.ts b/test/smoke/src/areas/workbench/workbench.ts index c966e1131c3..1070006fafc 100644 --- a/test/smoke/src/areas/workbench/workbench.ts +++ b/test/smoke/src/areas/workbench/workbench.ts @@ -6,7 +6,6 @@ import { SpectronApplication } from '../../spectron/application'; import { Explorer } from '../explorer/explorer'; import { ActivityBar } from '../activitybar/activityBar'; -import { Element } from 'webdriverio'; import { QuickOpen } from '../quickopen/quickopen'; import { Extensions } from '../extensions/extensions'; import { CommandPallette } from './commandPallette'; @@ -65,14 +64,14 @@ export class Workbench { return this.spectron.client.waitForElement('.tabs-container div.tab.active.dirty', element => !element); } - public async selectTab(tabName: string, untitled: boolean = false): Promise { + public async selectTab(tabName: string, untitled: boolean = false): Promise { await this.spectron.client.waitAndClick(`.tabs-container div.tab[aria-label="${tabName}, tab"]`); await this.waitForActiveOpen(tabName); - return this.waitForEditorFocus(tabName, untitled); + await this.waitForEditorFocus(tabName, untitled); } - public async waitForEditorFocus(fileName: string, untitled: boolean = false): Promise { - return this.spectron.client.waitForElement(`.editor-container[aria-label="${fileName}. ${untitled ? 'Untitled file text editor.' : 'Text file editor.'}, Group 1."] .monaco-editor.focused`); + public async waitForEditorFocus(fileName: string, untitled: boolean = false): Promise { + await this.spectron.client.waitForElement(`.editor-container[aria-label="${fileName}. ${untitled ? 'Untitled file text editor.' : 'Text file editor.'}, Group 1."] .monaco-editor.focused`); } public async waitForActiveOpen(fileName: string, isDirty: boolean = false): Promise { @@ -83,7 +82,7 @@ export class Workbench { return this.spectron.client.waitForElement(`.tabs-container div.tab${isDirty ? '.dirty' : ''}[aria-label="${fileName}, tab"]`).then(() => true); } - public async newUntitledFile(): Promise { + public async newUntitledFile(): Promise { await this.spectron.command('workbench.action.files.newUntitledFile'); await this.waitForActiveOpen('Untitled-1'); await this.waitForEditorFocus('Untitled-1', true); diff --git a/test/smoke/src/spectron/client.ts b/test/smoke/src/spectron/client.ts index 075dea67b23..7ca8175bdd9 100644 --- a/test/smoke/src/spectron/client.ts +++ b/test/smoke/src/spectron/client.ts @@ -153,7 +153,7 @@ export class SpectronClient { while (true) { if (trial > this.retryCount) { await this.application.screenCapturer.capture('' + this.captureIndex++); - throw new Error(`${timeoutMessage}: Timed out after ${this.retryCount * this.retryDuration} seconds.`); + throw new Error(`${timeoutMessage}: Timed out after ${(this.retryCount * this.retryDuration) / 1000} seconds.`); } let result; -- GitLab