提交 e15c1372 编写于 作者: S Sandeep Somavarapu

smoke: improve data loss tests

上级 ed6633b2
......@@ -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');
......
......@@ -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<any> {
public async selectTab(tabName: string, untitled: boolean = false): Promise<void> {
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<Element> {
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<void> {
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<boolean> {
......@@ -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<any> {
public async newUntitledFile(): Promise<void> {
await this.spectron.command('workbench.action.files.newUntitledFile');
await this.waitForActiveOpen('Untitled-1');
await this.waitForEditorFocus('Untitled-1', true);
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册