Run over clean extensions directory for data migration tests. Fixes #27537.

This commit is contained in:
Michel Kaporin 2017-05-30 14:47:40 +02:00
parent 5199dddb6f
commit 7a7965a93e
2 changed files with 12 additions and 9 deletions

View file

@ -19,7 +19,7 @@ export class CommonActions {
public async getWindowTitle(): Promise<any> {
return this.spectron.client.getTitle();
}
public enter(): Promise<any> {
return this.spectron.client.keys(['Enter', 'NULL']);
}
@ -34,7 +34,7 @@ export class CommonActions {
await this.spectron.wait();
return this.saveOpenedFile();
}
public async newUntitledFile(): Promise<any> {
await this.spectron.command('workbench.action.files.newUntitledFile');
return this.spectron.wait();
@ -45,12 +45,14 @@ export class CommonActions {
}
public async getTab(tabName: string, active?: boolean): Promise<any> {
await this.spectron.command('workbench.action.closeMessages'); // close any notification messages that could overlap tabs
let tabSelector = active ? '.tab.active' : 'div';
let el = await this.spectron.client.element(`.tabs-container ${tabSelector}[aria-label="${tabName}, tab"]`);
if (el.status === 0) {
return el;
}
return undefined;
}
@ -118,7 +120,7 @@ export class CommonActions {
selector += ' explorer-item';
}
selector += '"]';
await this.spectron.waitFor(this.spectron.client.doubleClick, selector);
return this.spectron.wait();
}
@ -132,7 +134,7 @@ export class CommonActions {
} else if (extension === 'md') {
return 'md-ext-file-icon markdown-lang-file-icon';
}
throw new Error('No class defined for this file extension');
}
@ -142,7 +144,7 @@ export class CommonActions {
if (Array.isArray(span)) {
return span[0];
}
return span;
} catch (e) {
return undefined;

View file

@ -5,7 +5,7 @@
import * as assert from 'assert';
import { SpectronApplication, USER_DIR, STABLE_PATH, LATEST_PATH, WORKSPACE_PATH } from "../spectron/application";
import { SpectronApplication, USER_DIR, STABLE_PATH, LATEST_PATH, WORKSPACE_PATH, EXTENSIONS_DIR } from "../spectron/application";
import { CommonActions } from '../areas/common';
let app: SpectronApplication;
@ -20,11 +20,12 @@ export function testDataMigration() {
afterEach(async function () {
await app.stop();
return await common.removeDirectory(USER_DIR)
await common.removeDirectory(USER_DIR);
return await common.removeDirectory(EXTENSIONS_DIR);
});
function setupSpectron(context: Mocha.ITestCallbackContext, appPath: string, workspace?: string[]): void {
app = new SpectronApplication(appPath, context.test.fullTitle(), context.test.currentRetry(), workspace, [`--user-data-dir=${USER_DIR}`]);
app = new SpectronApplication(appPath, context.test.fullTitle(), context.test.currentRetry(), workspace, [`--user-data-dir=${USER_DIR}`, `--extensions-dir=${EXTENSIONS_DIR}`]);
common = new CommonActions(app);
}