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

More improvements

上级 d8540e33
......@@ -14,4 +14,18 @@ export class Editor {
const result = await this.spectron.client.waitForText('.monaco-editor.focused .view-lines span span:nth-child(1)');
return Array.isArray(result) ? result.join() : result;
}
public async waitForHighlightingLine(line: number): Promise<void> {
const currentLineIndex = await this.spectron.client.waitFor<number>(async () => {
const lineNumbers = await this.spectron.webclient.selectorExecute(`.monaco-editor .line-numbers`,
elements => (Array.isArray(elements) ? elements : [elements]).map(element => element.textContent));
for (let index = 0; index < lineNumbers.length; index++) {
if (lineNumbers[index] === `${line}`) {
return index + 1;
}
}
return undefined;
});
await this.spectron.client.waitForElement(`.monaco-editor .view-overlays>:nth-child(${currentLineIndex}) .current-line`);
}
}
\ No newline at end of file
......@@ -15,6 +15,9 @@ describe('Extensions', () => {
// await Util.rimraf(EXTENSIONS_DIR);
it(`install and activate vscode-smoketest-check extension`, async function () {
if (app.inDevMode) {
return;
}
const extensionName = 'vscode-smoketest-check';
await app.workbench.extensions.openExtensionsViewlet();
......
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { SpectronApplication, LATEST_PATH, WORKSPACE_PATH } from '../../spectron/application';
import { ActivityBarPosition } from '../../areas/activitybar/activityBar';
import { KeybindingsEditor } from './keybindings';
describe('Keybindings Customisation', () => {
let app: SpectronApplication = new SpectronApplication(LATEST_PATH, '', 0, [WORKSPACE_PATH]);
before(() => app.start());
after(() => app.stop());
it(`changes 'workbench.action.toggleSidebarPosition' command key binding and verifies it`, async function () {
let activityBarElement = await app.workbench.activitybar.getActivityBar(ActivityBarPosition.LEFT);
assert.ok(activityBarElement, 'Activity bar should be positioned on the left.');
const keybindingsEditor = new KeybindingsEditor(app);
await keybindingsEditor.openKeybindings();
await keybindingsEditor.updateKeybinding('workbench.action.toggleSidebarPosition', ['Control', 'u', 'NULL'], 'Control+U');
await app.client.keys(['Control', 'u', 'NULL']);
activityBarElement = await app.workbench.activitybar.getActivityBar(ActivityBarPosition.RIGHT);
assert.ok(activityBarElement, 'Activity bar was not moved to right after toggling its position.');
});
});
\ No newline at end of file
......@@ -4,10 +4,11 @@
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { SpectronApplication, LATEST_PATH, WORKSPACE_PATH } from '../../spectron/application';
import { SettingsEditor } from './settings';
import { ActivityBarPosition } from '../activitybar/activityBar';
describe('Settings Customisation', () => {
describe('Preferences', () => {
let app: SpectronApplication = new SpectronApplication(LATEST_PATH, '', 0, [WORKSPACE_PATH]);
before(() => app.start());
after(() => app.stop());
......@@ -17,9 +18,8 @@ describe('Settings Customisation', () => {
let lineNumbers = await app.client.waitForElements('.line-numbers');
assert.ok(!!lineNumbers.length, 'Line numbers are not present in the editor before disabling them.');
const settingsEditor = new SettingsEditor(app);
await settingsEditor.openUserSettings();
await settingsEditor.focusEditableSettings();
await app.workbench.settingsEditor.openUserSettings();
await app.workbench.settingsEditor.focusEditableSettings();
await app.client.keys(`"editor.lineNumbers": "off"`);
await app.workbench.saveOpenedFile();
......@@ -27,4 +27,16 @@ describe('Settings Customisation', () => {
lineNumbers = await app.client.waitForElements('.line-numbers', result => !result || result.length === 0);
assert.ok(!lineNumbers.length, 'Line numbers are still present in the editor after disabling them.');
});
it(`changes 'workbench.action.toggleSidebarPosition' command key binding and verifies it`, async function () {
let activityBarElement = await app.workbench.activitybar.getActivityBar(ActivityBarPosition.LEFT);
assert.ok(activityBarElement, 'Activity bar should be positioned on the left.');
await app.workbench.keybindingsEditor.openKeybindings();
await app.workbench.keybindingsEditor.updateKeybinding('workbench.action.toggleSidebarPosition', ['Control', 'u', 'NULL'], 'Control+U');
await app.client.keys(['Control', 'u', 'NULL']);
activityBarElement = await app.workbench.activitybar.getActivityBar(ActivityBarPosition.RIGHT);
assert.ok(activityBarElement, 'Activity bar was not moved to right after toggling its position.');
});
});
\ No newline at end of file
......@@ -12,32 +12,29 @@ export enum ProblemSeverity {
export class Problems {
static PROBLEMS_VIEW_SELECTOR = '.panel.markers-panel';
constructor(private spectron: SpectronApplication) {
// noop
}
public async showProblemsView(): Promise<any> {
const panelSelector = '.panel.markers-panel';
const result = await this.spectron.client.element(panelSelector);
if (result) {
return;
if (!await this.isVisible()) {
await this.spectron.command('workbench.actions.view.problems');
await this.spectron.client.waitForElement(Problems.PROBLEMS_VIEW_SELECTOR);
}
await this.spectron.command('workbench.actions.view.problems');
await this.spectron.client.waitForElement(panelSelector);
}
public async hideProblemsView(): Promise<any> {
const panelSelector = '.panel.markers-panel';
const result = await this.spectron.client.element(panelSelector);
if (!result) {
return;
if (await this.isVisible()) {
await this.spectron.command('workbench.actions.view.problems');
await this.spectron.client.waitForElement(Problems.PROBLEMS_VIEW_SELECTOR, el => !el);
}
}
await this.spectron.command('workbench.actions.view.problems');
await this.spectron.client.waitForElement(panelSelector, el => !el);
public async isVisible(): Promise<boolean> {
const element = await this.spectron.client.element(Problems.PROBLEMS_VIEW_SELECTOR);
return !!element;
}
public static getSelectorInProblemsView(problemType: ProblemSeverity): string {
......
......@@ -13,14 +13,14 @@ export class QuickOpen {
constructor(readonly spectron: SpectronApplication) {
}
public async openQuickOpen(): Promise<Element> {
public async openQuickOpen(): Promise<void> {
await this.spectron.command('workbench.action.quickOpen');
return this.waitForQuickOpen();
await this.waitForQuickOpenOpened();
}
public async closeQuickOpen(): Promise<Element> {
public async closeQuickOpen(): Promise<void> {
await this.spectron.command('workbench.action.closeQuickOpen');
return this.spectron.client.waitForElement('div.quick-open-widget[aria-hidden="true"]');
await this.waitForQuickOpenClosed();
}
public async getQuickOpenElements(): Promise<Element[]> {
......@@ -37,7 +37,32 @@ export class QuickOpen {
await this.spectron.workbench.waitForEditorFocus(fileName);
}
protected waitForQuickOpen(): Promise<Element> {
protected waitForQuickOpenOpened(): Promise<Element> {
return this.spectron.client.waitForElement('div.quick-open-widget[aria-hidden="false"]');
}
protected waitForQuickOpenClosed(): Promise<Element> {
return this.spectron.client.waitForElement('div.quick-open-widget[aria-hidden="true"]');
}
public async isQuickOpenVisible(): Promise<boolean> {
await this.waitForQuickOpenOpened();
return true;
}
public async submit(text: string): Promise<void> {
await this.spectron.type(text);
await this.spectron.client.keys(['Enter', 'NULL']);
await this.waitForQuickOpenClosed();
}
public async selectQuickOpenElement(index: number): Promise<void> {
await this.waitForQuickOpenOpened();
for (let from = 0; from < index; from++) {
await this.spectron.client.keys(['ArrowDown', 'NULL']);
this.spectron.wait(3);
}
await this.spectron.client.keys(['Enter', 'NULL']);
await this.waitForQuickOpenClosed();
}
}
......@@ -21,9 +21,15 @@ describe('Search', () => {
it('searches only for *.js files & checks for correct result number', async function () {
await app.workbench.search.openSearchViewlet();
await app.workbench.search.searchFor('body');
await app.workbench.search.showQueryDetails();
await app.workbench.search.setFilesToIncludeTextAndSearch('*.js');
await app.workbench.search.submitSearch();
const results = await app.workbench.search.getResultText();
await app.workbench.search.setFilesToIncludeTextAndSearch('');
await app.workbench.search.hideQueryDetails();
assert.equal(results, '4 results in 1 file');
});
......
......@@ -14,8 +14,15 @@ export class Search {
}
public async openSearchViewlet(): Promise<any> {
await this.spectron.command('workbench.view.search');
await this.spectron.client.waitForElement(`${Search.SEARCH_VIEWLET_XPATH} .search-widget .monaco-inputbox.synthetic-focus input[placeholder="Search"]`);
if (!await this.isSearchViewletFocused()) {
await this.spectron.command('workbench.view.search');
await this.spectron.client.waitForElement(`${Search.SEARCH_VIEWLET_XPATH} .search-widget .monaco-inputbox.synthetic-focus input[placeholder="Search"]`);
}
}
public async isSearchViewletFocused(): Promise<boolean> {
const element = await this.spectron.client.element(`${Search.SEARCH_VIEWLET_XPATH} .search-widget .monaco-inputbox.synthetic-focus input[placeholder="Search"]`);
return !!element;
}
public async searchFor(text: string): Promise<void> {
......@@ -38,13 +45,30 @@ export class Search {
}
public async setFilesToIncludeTextAndSearch(text: string): Promise<void> {
await this.spectron.client.waitAndClick(`${Search.SEARCH_VIEWLET_XPATH} .query-details .more`);
await this.spectron.client.click(`${Search.SEARCH_VIEWLET_XPATH} .query-details .monaco-inputbox input[aria-label="Search Include Patterns"]`);
await this.spectron.client.element(`${Search.SEARCH_VIEWLET_XPATH} .query-details .monaco-inputbox.synthetic-focus input[aria-label="Search Include Patterns"]`);
await this.spectron.client.clearElement(`${Search.SEARCH_VIEWLET_XPATH} .query-details .monaco-inputbox.synthetic-focus input[aria-label="Search Include Patterns"]`);
await this.spectron.client.keys(text);
if (text) {
await this.spectron.client.keys(text);
}
}
await this.submitSearch();
public async showQueryDetails(): Promise<void> {
if (!await this.areDetailsVisible()) {
await this.spectron.client.waitAndClick(`${Search.SEARCH_VIEWLET_XPATH} .query-details .more`);
}
}
public async hideQueryDetails(): Promise<void> {
if (await this.areDetailsVisible()) {
await this.spectron.client.waitAndClick(`${Search.SEARCH_VIEWLET_XPATH} .query-details.more .more`);
}
}
public async areDetailsVisible(): Promise<boolean> {
const element = await this.spectron.client.element(`${Search.SEARCH_VIEWLET_XPATH} .query-details.more`);
return !!element;
}
public async removeFileMatch(index: number): Promise<void> {
......
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { SpectronApplication, LATEST_PATH, WORKSPACE_PATH } from '../../spectron/application';
import { StatusBarElement } from './statusbar';
describe('Statusbar', () => {
let app: SpectronApplication = new SpectronApplication(LATEST_PATH, '', 0, [WORKSPACE_PATH]);
before(() => app.start());
after(() => app.stop());
it('verifies presence of all default status bar elements', async function () {
assert.ok(app.workbench.statusbar.isVisible(StatusBarElement.BRANCH_STATUS), 'Branch indicator is not visible.');
assert.ok(app.workbench.statusbar.isVisible(StatusBarElement.FEEDBACK_ICON), 'Feedback icon is not visible.');
assert.ok(app.workbench.statusbar.isVisible(StatusBarElement.SYNC_STATUS), 'Sync indicator is not visible.');
assert.ok(app.workbench.statusbar.isVisible(StatusBarElement.PROBLEMS_STATUS), 'Problems indicator is not visible.');
await app.workbench.quickopen.openFile('app.js');
assert.ok(app.workbench.statusbar.isVisible(StatusBarElement.ENCODING_STATUS), 'Encoding indicator is not visible.');
assert.ok(app.workbench.statusbar.isVisible(StatusBarElement.EOL_STATUS), 'EOL indicator is not visible.');
assert.ok(app.workbench.statusbar.isVisible(StatusBarElement.INDENTATION_STATUS), 'Indentation indicator is not visible.');
assert.ok(app.workbench.statusbar.isVisible(StatusBarElement.LANGUAGE_STATUS), 'Language indicator is not visible.');
assert.ok(app.workbench.statusbar.isVisible(StatusBarElement.SELECTION_STATUS), 'Selection indicator is not visible.');
});
it(`verifies that 'quick open' opens when clicking on status bar elements`, async function () {
await app.workbench.statusbar.clickOn(StatusBarElement.BRANCH_STATUS);
assert.ok(await app.workbench.quickopen.isQuickOpenVisible(), 'Quick open is not opened for branch indicator.');
await app.workbench.quickopen.closeQuickOpen();
await app.workbench.quickopen.openFile('app.js');
await app.workbench.statusbar.clickOn(StatusBarElement.INDENTATION_STATUS);
assert.ok(await app.workbench.quickopen.isQuickOpenVisible(), 'Quick open is not opened for indentation indicator.');
await app.workbench.quickopen.closeQuickOpen();
await app.workbench.statusbar.clickOn(StatusBarElement.ENCODING_STATUS);
assert.ok(await app.workbench.quickopen.isQuickOpenVisible(), 'Quick open is not opened for encoding indicator.');
await app.workbench.quickopen.closeQuickOpen();
await app.workbench.statusbar.clickOn(StatusBarElement.EOL_STATUS);
assert.ok(await app.workbench.quickopen.isQuickOpenVisible(), 'Quick open is not opened for EOL indicator.');
await app.workbench.quickopen.closeQuickOpen();
await app.workbench.statusbar.clickOn(StatusBarElement.LANGUAGE_STATUS);
assert.ok(await app.workbench.quickopen.isQuickOpenVisible(), 'Quick open is not opened for language indicator.');
await app.workbench.quickopen.closeQuickOpen();
});
it(`verifies that 'Problems View' appears when clicking on 'Problems' status element`, async function () {
await app.workbench.statusbar.clickOn(StatusBarElement.PROBLEMS_STATUS);
assert.ok(await app.workbench.problems.isVisible());
});
it(`verifies that 'Tweet us feedback' pop-up appears when clicking on 'Feedback' icon`, async function () {
if (app.inDevMode) {
return;
}
await app.workbench.statusbar.clickOn(StatusBarElement.FEEDBACK_ICON);
assert.ok(!!await app.client.waitForElement('.feedback-form'));
});
it(`checks if 'Go to Line' works if called from the status bar`, async function () {
await app.workbench.quickopen.openFile('app.js');
await app.workbench.statusbar.clickOn(StatusBarElement.SELECTION_STATUS);
assert.ok(await app.workbench.quickopen.isQuickOpenVisible(), 'Quick open is not opened line number selection.');
await app.workbench.quickopen.submit('15');
await app.workbench.editor.waitForHighlightingLine(15);
});
it(`verifies if changing EOL is reflected in the status bar`, async function () {
await app.workbench.quickopen.openFile('app.js');
await app.workbench.statusbar.clickOn(StatusBarElement.EOL_STATUS);
assert.ok(await app.workbench.quickopen.isQuickOpenVisible(), 'Quick open is not opened line number selection.');
app.workbench.quickopen.selectQuickOpenElement(1);
await app.workbench.statusbar.waitForEOL('CRLF');
});
});
\ No newline at end of file
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { SpectronApplication } from '../../spectron/application';
export enum StatusBarElement {
BRANCH_STATUS = 0,
SYNC_STATUS = 1,
PROBLEMS_STATUS = 2,
SELECTION_STATUS = 3,
INDENTATION_STATUS = 4,
ENCODING_STATUS = 5,
EOL_STATUS = 6,
LANGUAGE_STATUS = 7,
FEEDBACK_ICON = 8
}
export class StatusBar {
// private selectorsMap: Map<StatusBarElement, string>;
private readonly mainSelector = 'div[id="workbench.parts.statusbar"]';
constructor(private spectron: SpectronApplication) {
}
public async isVisible(element: StatusBarElement): Promise<boolean> {
return this.spectron.client.isVisible(this.getSelector(element));
}
public async clickOn(element: StatusBarElement): Promise<void> {
await this.spectron.client.waitAndClick(this.getSelector(element));
}
public async waitForEOL(eol: string): Promise<string> {
return this.spectron.client.waitForText(this.getSelector(StatusBarElement.EOL_STATUS), eol);
}
private getSelector(element: StatusBarElement): string {
switch (element) {
case StatusBarElement.BRANCH_STATUS:
return `${this.mainSelector} .octicon.octicon-git-branch`;
case StatusBarElement.SYNC_STATUS:
return `${this.mainSelector} .octicon.octicon-sync`;
case StatusBarElement.PROBLEMS_STATUS:
return `${this.mainSelector} .task-statusbar-item[title="Problems"]`;
case StatusBarElement.SELECTION_STATUS:
return `${this.mainSelector} .editor-status-selection`;
case StatusBarElement.INDENTATION_STATUS:
return `${this.mainSelector} .editor-status-indentation`;
case StatusBarElement.ENCODING_STATUS:
return `${this.mainSelector} .editor-status-encoding`;
case StatusBarElement.EOL_STATUS:
return `${this.mainSelector} .editor-status-eol`;
case StatusBarElement.LANGUAGE_STATUS:
return `${this.mainSelector} .editor-status-mode`;
case StatusBarElement.FEEDBACK_ICON:
return `${this.mainSelector} .dropdown.send-feedback`;
default:
throw new Error(element);
}
}
}
\ No newline at end of file
......@@ -14,7 +14,7 @@ export class CommandPallette extends QuickOpen {
public async runCommand(commandText: string): Promise<void> {
await this.spectron.command('workbench.action.showCommands');
await this.waitForQuickOpen();
await this.waitForQuickOpenOpened();
await this.spectron.type(commandText);
await this.spectron.client.waitForText(`div[aria-label="Quick Picker"] .monaco-tree-rows.show-twisties div.monaco-tree-row:nth-child(1) .quick-open-entry a.label-name span.monaco-highlighted-label span.highlight`, commandText);
await this.spectron.client.waitAndClick(`div[aria-label="Quick Picker"] .monaco-tree-rows.show-twisties div.monaco-tree-row:nth-child(1) .quick-open-entry`);
......
......@@ -5,49 +5,29 @@
import * as assert from 'assert';
import { SpectronApplication, USER_DIR, LATEST_PATH, WORKSPACE_PATH } from '../../spectron/application';
import * as path from 'path';
describe('Data Loss', () => {
let app: SpectronApplication = new SpectronApplication(LATEST_PATH, '', 0, [WORKSPACE_PATH], [`--user-data-dir=${USER_DIR}`]);
describe('Dataloss', () => {
let app: SpectronApplication = new SpectronApplication(LATEST_PATH, '', 0, [WORKSPACE_PATH], [`--user-data-dir=${path.join(USER_DIR, new Date().getTime().toString(), 'dataloss')}`]);
before(() => app.start());
after(() => app.stop());
// this used to run before each test
// await Util.rimraf(USER_DIR);
it(`verifies that 'hot exit' works for dirty files`, async function () {
const textToType = 'Hello, Code', fileName = 'readme.md', untitled = 'Untitled-1';
const textToType = 'Hello, Code', textToTypeInUntitled = 'Hello, Unitled Code', fileName = 'readme.md', untitled = 'Untitled-1';
await app.workbench.newUntitledFile();
await app.client.type(textToType);
await app.client.type(textToTypeInUntitled);
await app.workbench.explorer.openFile(fileName);
await app.client.type(textToType);
await app.reload();
// check tab presence
assert.ok(await app.workbench.waitForOpen(untitled, true), `${untitled} tab is not present after reopening.`);
assert.ok(await app.workbench.waitForActiveOpen(fileName, true), `${fileName} tab is not present or is not active after reopening.`);
});
it(`verifies that contents of the dirty files are restored after 'hot exit'`, async function () {
// make one dirty file,
// create one untitled file
const textToType = 'Hello, Code';
// create one untitled file
await app.workbench.newUntitledFile();
await app.client.type(textToType);
// make one dirty file,
await app.workbench.explorer.openFile('readme.md');
await app.client.type(textToType);
await app.reload();
await app.workbench.selectTab('readme.md');
let actual = await app.workbench.editor.getEditorFirstLineText();
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.selectTab('Untitled-1', true);
actual = await app.workbench.editor.getEditorFirstLineText();
assert.ok(actual.startsWith(textToType), `${actual} did not start with ${textToType}`);
assert.ok(actual.startsWith(textToTypeInUntitled), `${actual} did not start with ${textToTypeInUntitled}`);
});
});
\ No newline at end of file
......@@ -13,6 +13,10 @@ import { CommandPallette } from './commandPallette';
import { Search } from '../search/search';
import { Editor } from '../editor/editor';
import { SCM } from '../git/scm';
import { StatusBar } from '../statusbar/statusbar';
import { Problems } from '../problems/problems';
import { SettingsEditor } from '../preferences/settings';
import { KeybindingsEditor } from '../preferences/keybindings';
export class Workbench {
......@@ -24,6 +28,10 @@ export class Workbench {
readonly extensions: Extensions;
readonly editor: Editor;
readonly scm: SCM;
readonly statusbar: StatusBar;
readonly problems: Problems;
readonly settingsEditor: SettingsEditor;
readonly keybindingsEditor: KeybindingsEditor;
constructor(private spectron: SpectronApplication) {
this.explorer = new Explorer(spectron);
......@@ -34,6 +42,10 @@ export class Workbench {
this.extensions = new Extensions(spectron);
this.editor = new Editor(spectron);
this.scm = new SCM(spectron);
this.statusbar = new StatusBar(spectron);
this.problems = new Problems(spectron);
this.settingsEditor = new SettingsEditor(spectron);
this.keybindingsEditor = new KeybindingsEditor(spectron);
}
public async saveOpenedFile(): Promise<any> {
......
......@@ -36,7 +36,7 @@ function getDevElectronPath(): string {
switch (process.platform) {
case 'darwin':
return path.join(buildPath, `${product.nameLong}.app`, 'Contents', 'MacOS', 'Electron');
return path.join(buildPath, 'electron', `${product.nameLong}.app`, 'Contents', 'MacOS', 'Electron');
case 'linux':
return path.join(buildPath, 'electron', `${product.applicationName}`);
case 'win32':
......@@ -156,11 +156,11 @@ before(async () => main());
import './areas/css/css.test';
import './areas/explorer/explorer.test';
import './areas/preferences/settings.test';
import './areas/preferences/keybindings.test';
import './areas/preferences/preferences.test';
import './areas/multiroot/multiroot.test';
import './areas/extensions/extensions.test';
import './areas/search/search.test';
import './areas/workbench/data-loss.test';
import './areas/git/git.test';
import './areas/statusbar/statusbar.test';
// import './areas/workbench/data-migration.test';
\ No newline at end of file
......@@ -23,7 +23,6 @@ export const EXTENSIONS_DIR = path.join(__dirname, 'test_data/temp_extensions_di
export class SpectronApplication {
public readonly client: SpectronClient;
public readonly webclient: WebClient;
public readonly workbench: Workbench;
private spectron: Application;
......@@ -57,7 +56,7 @@ export class SpectronApplication {
}
}
if (!userDataDirIsSet) {
chromeDriverArgs.push(`--user-data-dir=${USER_DIR}/${new Date().getTime()}`);
chromeDriverArgs.push(`--user-data-dir=${path.join(USER_DIR), new Date().getTime().toString()}`);
}
const repo = process.env.VSCODE_REPOSITORY;
......@@ -75,28 +74,29 @@ export class SpectronApplication {
this.testRetry += 1; // avoid multiplication by 0 for wait times
this.screenshot = args.indexOf('--no-screenshot') === -1 ? new NullScreenshot() : new Screenshot(this, testName, testRetry);
this.client = new SpectronClient(this.spectron, this.screenshot);
this.webclient = this.spectron.client;
this.retrieveKeybindings();
this.workbench = new Workbench(this);
}
public get inDevMode(): boolean {
return process.env.VSCODE_DEV === '1';
}
public get app(): Application {
return this.spectron;
}
public get webclient(): WebClient {
return this.spectron.client;
}
public async start(): Promise<any> {
await this.spectron.start();
await this.focusOnWindow(1); // focuses on main renderer window
await this.checkWindowReady();
}
public async restart(): Promise<any> {
await this.stop();
await this.wait(.5); // wait until all resources are released (e.g. locked local storage)
await this.start();
}
public async reload(): Promise<any> {
await this.workbench.commandPallette.runCommand('Reload Window');
// TODO @sandy: Find a proper condition to wait for reload
......
......@@ -173,7 +173,6 @@ export class SpectronClient {
try {
result = await func();
} catch (e) {
// TODO: what to do?
}
if (accept(result)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册