Merge VS Code 1.23.1 (#1520)

This commit is contained in:
Matt Irvine
2018-06-05 11:24:51 -07:00
committed by GitHub
parent e3baf5c443
commit 0c58f09e59
3651 changed files with 74249 additions and 48599 deletions

View File

@@ -3,39 +3,30 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { SpectronApplication } from '../../spectron/application';
import { Application } from '../../application';
export function setup() {
describe('Dataloss', () => {
before(function () {
this.app.suiteName = 'Dataloss';
});
it(`verifies that 'hot exit' works for dirty files`, async function () {
const app = this.app as SpectronApplication;
await app.workbench.newUntitledFile();
const app = this.app as Application;
await app.workbench.editors.newUntitledFile();
const untitled = 'Untitled-1';
const textToTypeInUntitled = 'Hello, Unitled Code';
await app.workbench.editor.waitForTypeInEditor(untitled, textToTypeInUntitled);
await app.screenCapturer.capture('Untitled file before reload');
const readmeMd = 'readme.md';
const textToType = 'Hello, Code';
await app.workbench.explorer.openFile(readmeMd);
await app.workbench.editor.waitForTypeInEditor(readmeMd, textToType);
await app.screenCapturer.capture(`${readmeMd} before reload`);
await app.reload();
await app.screenCapturer.capture('After reload');
await app.workbench.waitForActiveTab(readmeMd, true);
await app.screenCapturer.capture(`${readmeMd} after reload`);
await app.workbench.editors.waitForActiveTab(readmeMd, true);
await app.workbench.editor.waitForEditorContents(readmeMd, c => c.indexOf(textToType) > -1);
await app.workbench.waitForTab(untitled, true);
await app.workbench.selectTab(untitled, true);
await app.screenCapturer.capture('Untitled file after reload');
await app.workbench.editors.waitForTab(untitled, true);
await app.workbench.editors.selectTab(untitled, true);
await app.workbench.editor.waitForEditorContents(untitled, c => c.indexOf(textToTypeInUntitled) > -1);
});
});

View File

@@ -3,130 +3,109 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { SpectronApplication, Quality } from '../../spectron/application';
import { Application, Quality } from '../../application';
import * as rimraf from 'rimraf';
export interface ICreateAppFn {
(quality: Quality): SpectronApplication | null;
(quality: Quality): Application;
}
export function setup(userDataDir: string, createApp: ICreateAppFn) {
describe('Data Migration', () => {
afterEach(async function () {
await new Promise((c, e) => rimraf(userDataDir, { maxBusyTries: 10 }, err => err ? e(err) : c()));
});
it('checks if the Untitled file is restored migrating from stable to latest', async function () {
const stableApp = createApp(Quality.Stable);
// it('checks if the Untitled file is restored migrating from stable to latest', async function () {
// const stableApp = createApp(Quality.Stable);
if (!stableApp) {
this.skip();
return;
}
// if (!stableApp) {
// this.skip();
// return;
// }
await stableApp.start();
stableApp.suiteName = 'Data Migration';
// await stableApp.start();
const textToType = 'Very dirty file';
// const textToType = 'Very dirty file';
await stableApp.workbench.newUntitledFile();
await stableApp.workbench.editor.waitForTypeInEditor('Untitled-1', textToType);
// await stableApp.workbench.editors.newUntitledFile();
// await stableApp.workbench.editor.waitForTypeInEditor('Untitled-1', textToType);
await stableApp.stop();
await new Promise(c => setTimeout(c, 500)); // wait until all resources are released (e.g. locked local storage)
// await stableApp.stop();
// await new Promise(c => setTimeout(c, 500)); // wait until all resources are released (e.g. locked local storage)
// Checking latest version for the restored state
const app = createApp(Quality.Insiders);
// // Checking latest version for the restored state
// const app = createApp(Quality.Insiders);
if (!app) {
return assert(false);
}
// await app.start(false);
await app.start(false);
app.suiteName = 'Data Migration';
// await app.workbench.editors.waitForActiveTab('Untitled-1', true);
// await app.workbench.editor.waitForEditorContents('Untitled-1', c => c.indexOf(textToType) > -1);
assert.ok(await app.workbench.waitForActiveTab('Untitled-1', true), `Untitled-1 tab is not present after migration.`);
// await app.stop();
// });
await app.workbench.editor.waitForEditorContents('Untitled-1', c => c.indexOf(textToType) > -1);
await app.screenCapturer.capture('Untitled file text');
// it('checks if the newly created dirty file is restored migrating from stable to latest', async function () {
// const stableApp = createApp(Quality.Stable);
await app.stop();
});
// if (!stableApp) {
// this.skip();
// return;
// }
it('checks if the newly created dirty file is restored migrating from stable to latest', async function () {
const stableApp = createApp(Quality.Stable);
// await stableApp.start();
if (!stableApp) {
this.skip();
return;
}
// const fileName = 'app.js';
// const textPart = 'This is going to be an unsaved file';
await stableApp.start();
stableApp.suiteName = 'Data Migration';
// await stableApp.workbench.quickopen.openFile(fileName);
const fileName = 'app.js';
const textPart = 'This is going to be an unsaved file';
// await stableApp.workbench.editor.waitForTypeInEditor(fileName, textPart);
await stableApp.workbench.quickopen.openFile(fileName);
// await stableApp.stop();
// await new Promise(c => setTimeout(c, 500)); // wait until all resources are released (e.g. locked local storage)
await stableApp.workbench.editor.waitForTypeInEditor(fileName, textPart);
// // Checking latest version for the restored state
// const app = createApp(Quality.Insiders);
await stableApp.stop();
await new Promise(c => setTimeout(c, 500)); // wait until all resources are released (e.g. locked local storage)
// await app.start(false);
// Checking latest version for the restored state
const app = createApp(Quality.Insiders);
// await app.workbench.editors.waitForActiveTab(fileName);
// await app.workbench.editor.waitForEditorContents(fileName, c => c.indexOf(textPart) > -1);
if (!app) {
return assert(false);
}
// await app.stop();
// });
await app.start(false);
app.suiteName = 'Data Migration';
// it('checks if opened tabs are restored migrating from stable to latest', async function () {
// const stableApp = createApp(Quality.Stable);
assert.ok(await app.workbench.waitForActiveTab(fileName), `dirty file tab is not present after migration.`);
await app.workbench.editor.waitForEditorContents(fileName, c => c.indexOf(textPart) > -1);
// if (!stableApp) {
// this.skip();
// return;
// }
await app.stop();
});
// await stableApp.start();
it('checks if opened tabs are restored migrating from stable to latest', async function () {
const stableApp = createApp(Quality.Stable);
// const fileName1 = 'app.js', fileName2 = 'jsconfig.json', fileName3 = 'readme.md';
if (!stableApp) {
this.skip();
return;
}
// await stableApp.workbench.quickopen.openFile(fileName1);
// await stableApp.workbench.runCommand('View: Keep Editor');
// await stableApp.workbench.quickopen.openFile(fileName2);
// await stableApp.workbench.runCommand('View: Keep Editor');
// await stableApp.workbench.quickopen.openFile(fileName3);
// await stableApp.stop();
await stableApp.start();
stableApp.suiteName = 'Data Migration';
// const app = createApp(Quality.Insiders);
const fileName1 = 'app.js', fileName2 = 'jsconfig.json', fileName3 = 'readme.md';
// await app.start(false);
await stableApp.workbench.quickopen.openFile(fileName1);
await stableApp.workbench.quickopen.runCommand('View: Keep Editor');
await stableApp.workbench.quickopen.openFile(fileName2);
await stableApp.workbench.quickopen.runCommand('View: Keep Editor');
await stableApp.workbench.quickopen.openFile(fileName3);
await stableApp.stop();
// await app.workbench.editors.waitForTab(fileName1);
// await app.workbench.editors.waitForTab(fileName2);
// await app.workbench.editors.waitForTab(fileName3);
const app = createApp(Quality.Insiders);
if (!app) {
return assert(false);
}
await app.start(false);
app.suiteName = 'Data Migration';
assert.ok(await app.workbench.waitForTab(fileName1), `${fileName1} tab was not restored after migration.`);
assert.ok(await app.workbench.waitForTab(fileName2), `${fileName2} tab was not restored after migration.`);
assert.ok(await app.workbench.waitForTab(fileName3), `${fileName3} tab was not restored after migration.`);
await app.stop();
});
// await app.stop();
// });
});
}

View File

@@ -3,15 +3,12 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { SpectronApplication, Quality } from '../../spectron/application';
import { Application, Quality } from '../../application';
export function setup() {
describe('Localization', () => {
before(async function () {
const app = this.app as SpectronApplication;
this.app.suiteName = 'Localization';
const app = this.app as Application;
if (app.quality === Quality.Dev) {
return;
@@ -21,36 +18,26 @@ export function setup() {
});
it(`starts with 'DE' locale and verifies title and viewlets text is in German`, async function () {
const app = this.app as SpectronApplication;
const app = this.app as Application;
if (app.quality === Quality.Dev) {
this.skip();
return;
}
let text = await app.workbench.explorer.getOpenEditorsViewTitle();
await app.screenCapturer.capture('Open editors title');
assert(/geöffnete editoren/i.test(text));
await app.workbench.explorer.waitForOpenEditorsViewTitle(title => /geöffnete editoren/i.test(title));
await app.workbench.search.openSearchViewlet();
text = await app.workbench.search.getTitle();
await app.screenCapturer.capture('Search title');
assert(/suchen/i.test(text));
await app.workbench.search.waitForTitle(title => /suchen/i.test(title));
await app.workbench.scm.openSCMViewlet();
text = await app.workbench.scm.getTitle();
await app.screenCapturer.capture('Scm title');
assert(/quellcodeverwaltung/i.test(text));
await app.workbench.scm.waitForTitle(title => /quellcodeverwaltung/i.test(title));
await app.workbench.debug.openDebugViewlet();
text = await app.workbench.debug.getTitle();
await app.screenCapturer.capture('Debug title');
assert(/debuggen/i.test(text));
await app.workbench.debug.waitForTitle(title => /debuggen/i.test(title));
await app.workbench.extensions.openExtensionsViewlet();
text = await app.workbench.extensions.getTitle();
await app.screenCapturer.capture('Extensions title');
assert(/erweiterungen/i.test(text));
await app.workbench.extensions.waitForTitle(title => /erweiterungen/i.test(title));
});
});
}

View File

@@ -3,16 +3,15 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { SpectronApplication } from '../../spectron/application';
'use strict';
import { Code } from '../../vscode/code';
export abstract class Viewlet {
constructor(protected spectron: SpectronApplication) {
// noop
}
constructor(protected code: Code) { }
public async getTitle(): Promise<string> {
return this.spectron.client.waitForText('.monaco-workbench-container .part.sidebar > .title > .title-label > span');
async waitForTitle(fn: (title: string) => boolean): Promise<void> {
await this.code.waitForTextContent('.monaco-workbench-container .part.sidebar > .title > .title-label > span', undefined, fn);
}
}

View File

@@ -3,7 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { SpectronApplication } from '../../spectron/application';
import { Explorer } from '../explorer/explorer';
import { ActivityBar } from '../activitybar/activityBar';
import { QuickOpen } from '../quickopen/quickopen';
@@ -16,13 +15,20 @@ import { StatusBar } from '../statusbar/statusbar';
import { Problems } from '../problems/problems';
import { SettingsEditor } from '../preferences/settings';
import { KeybindingsEditor } from '../preferences/keybindings';
import { Editors } from '../editor/editors';
import { Code } from '../../vscode/code';
import { Terminal } from '../terminal/terminal';
export class Workbench {
export interface Commands {
runCommand(command: string): Promise<any>;
}
export class Workbench implements Commands {
readonly quickopen: QuickOpen;
readonly editors: Editors;
readonly explorer: Explorer;
readonly activitybar: ActivityBar;
readonly quickopen: QuickOpen;
readonly search: Search;
readonly extensions: Extensions;
readonly editor: Editor;
@@ -34,47 +40,35 @@ export class Workbench {
readonly keybindingsEditor: KeybindingsEditor;
readonly terminal: Terminal;
constructor(private spectron: SpectronApplication) {
this.explorer = new Explorer(spectron);
this.activitybar = new ActivityBar(spectron);
this.quickopen = new QuickOpen(spectron);
this.search = new Search(spectron);
this.extensions = new Extensions(spectron);
this.editor = new Editor(spectron);
this.scm = new SCM(spectron);
this.debug = new Debug(spectron);
this.statusbar = new StatusBar(spectron);
this.problems = new Problems(spectron);
this.settingsEditor = new SettingsEditor(spectron);
this.keybindingsEditor = new KeybindingsEditor(spectron);
this.terminal = new Terminal(spectron);
constructor(private code: Code, private keybindings: any[], userDataPath: string) {
this.editors = new Editors(code, this);
this.quickopen = new QuickOpen(code, this, this.editors);
this.explorer = new Explorer(code, this.quickopen, this.editors);
this.activitybar = new ActivityBar(code);
this.search = new Search(code, this);
this.extensions = new Extensions(code, this);
this.editor = new Editor(code, this);
this.scm = new SCM(code, this);
this.debug = new Debug(code, this, this.editors, this.editor);
this.statusbar = new StatusBar(code);
this.problems = new Problems(code, this);
this.settingsEditor = new SettingsEditor(code, userDataPath, this, this.editors, this.editor);
this.keybindingsEditor = new KeybindingsEditor(code, this);
this.terminal = new Terminal(code, this);
}
public async saveOpenedFile(): Promise<any> {
await this.spectron.client.waitForElement('.tabs-container div.tab.active.dirty');
await this.spectron.workbench.quickopen.runCommand('File: Save');
}
/**
* Retrieves the command from keybindings file and executes it with WebdriverIO client API
* @param command command (e.g. 'workbench.action.files.newUntitledFile')
*/
async runCommand(command: string): Promise<void> {
const binding = this.keybindings.find(x => x['command'] === command);
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.waitForEditorFocus(tabName, untitled);
}
public async waitForEditorFocus(fileName: string, untitled: boolean = false): Promise<void> {
await this.waitForActiveTab(fileName);
await this.editor.waitForActiveEditor(fileName);
}
public async waitForActiveTab(fileName: string, isDirty: boolean = false): Promise<any> {
return this.spectron.client.waitForElement(`.tabs-container div.tab.active${isDirty ? '.dirty' : ''}[aria-selected="true"][aria-label="${fileName}, tab"]`);
}
public async waitForTab(fileName: string, isDirty: boolean = false): Promise<boolean> {
return this.spectron.client.waitForElement(`.tabs-container div.tab${isDirty ? '.dirty' : ''}[aria-label="${fileName}, tab"]`).then(() => true);
}
public async newUntitledFile(): Promise<void> {
await this.spectron.runCommand('workbench.action.files.newUntitledFile');
await this.waitForEditorFocus('Untitled-1', true);
if (binding) {
await this.code.dispatchKeybinding(binding.key);
} else {
await this.quickopen.runCommand(command);
}
}
}