mirror of
https://github.com/Microsoft/vscode
synced 2024-10-01 08:50:48 +00:00
Refactor smoke UI automation into separate package
This commit is contained in:
parent
3aa0fc0b52
commit
4f2c387de1
7
test/automation/.gitignore
vendored
Normal file
7
test/automation/.gitignore
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
.DS_Store
|
||||
npm-debug.log
|
||||
Thumbs.db
|
||||
node_modules/
|
||||
out/
|
||||
keybindings.*.json
|
||||
src/driver.d.ts
|
3
test/automation/README.md
Normal file
3
test/automation/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# VS Code Automation Package
|
||||
|
||||
This package contains functionality for automating various components of the VS Code UI, via an automation "driver" that connects from a separate process. It is used by the `smoke` tests.
|
41
test/automation/package.json
Normal file
41
test/automation/package.json
Normal file
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"name": "vscode-automation",
|
||||
"version": "1.39.0",
|
||||
"description": "VS Code UI automation driver",
|
||||
"author": {
|
||||
"name": "Microsoft Corporation"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "./out/index.js",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"postinstall": "npm run compile",
|
||||
"compile": "npm run copy-driver && npm run copy-driver-definition && tsc",
|
||||
"watch": "concurrently \"npm run watch-driver\" \"npm run watch-driver-definition\" \"tsc --watch\"",
|
||||
"copy-driver": "cpx src/driver.js out/",
|
||||
"watch-driver": "cpx src/driver.js out/ -w",
|
||||
"copy-driver-definition": "node tools/copy-driver-definition.js",
|
||||
"watch-driver-definition": "watch \"node tools/copy-driver-definition.js\" ../../src/vs/platform/driver/node",
|
||||
"copy-package-version": "node tools/copy-package-version.js",
|
||||
"prepublishOnly": "npm run copy-package-version"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/mkdirp": "0.5.1",
|
||||
"@types/ncp": "2.0.1",
|
||||
"@types/node": "8.0.33",
|
||||
"@types/puppeteer": "^1.19.0",
|
||||
"@types/rimraf": "2.0.2",
|
||||
"@types/tmp": "0.1.0",
|
||||
"concurrently": "^3.5.1",
|
||||
"cpx": "^1.5.0",
|
||||
"mkdirp": "^0.5.1",
|
||||
"ncp": "^2.0.0",
|
||||
"rimraf": "^2.6.1",
|
||||
"tmp": "0.1.0",
|
||||
"typescript": "2.9.2",
|
||||
"watch": "^1.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"vscode-uri": "^2.0.3"
|
||||
}
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Code } from '../../vscode/code';
|
||||
import { Code } from './code';
|
||||
|
||||
export const enum ActivityBarPosition {
|
||||
LEFT = 0,
|
||||
|
@ -27,4 +27,4 @@ export class ActivityBar {
|
|||
|
||||
await this.code.waitForElement(`.part.activitybar.${positionClass}`);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import { Workbench } from './areas/workbench/workbench';
|
||||
import { Code, spawn, SpawnOptions } from './vscode/code';
|
||||
import { Workbench } from './workbench';
|
||||
import { Code, spawn, SpawnOptions } from './code';
|
||||
import { Logger } from './logger';
|
||||
|
||||
export const enum Quality {
|
||||
|
@ -25,7 +25,7 @@ export interface ApplicationOptions extends SpawnOptions {
|
|||
export class Application {
|
||||
|
||||
private _code: Code | undefined;
|
||||
private _workbench: Workbench;
|
||||
private _workbench: Workbench | undefined;
|
||||
|
||||
constructor(private options: ApplicationOptions) {
|
||||
this._workspacePathOrFolder = options.workspacePath;
|
||||
|
@ -40,7 +40,7 @@ export class Application {
|
|||
}
|
||||
|
||||
get workbench(): Workbench {
|
||||
return this._workbench;
|
||||
return this._workbench!;
|
||||
}
|
||||
|
||||
get logger(): Logger {
|
|
@ -11,11 +11,11 @@ import * as mkdirp from 'mkdirp';
|
|||
import { tmpName } from 'tmp';
|
||||
import { IDriver, connect as connectElectronDriver, IDisposable, IElement, Thenable } from './driver';
|
||||
import { connect as connectPuppeteerDriver, launch } from './puppeteerDriver';
|
||||
import { Logger } from '../logger';
|
||||
import { Logger } from './logger';
|
||||
import { ncp } from 'ncp';
|
||||
import { URI } from 'vscode-uri';
|
||||
|
||||
const repoPath = path.join(__dirname, '../../../..');
|
||||
const repoPath = path.join(__dirname, '../../..');
|
||||
|
||||
function getDevElectronPath(): string {
|
||||
const buildPath = path.join(repoPath, '.build');
|
||||
|
@ -237,13 +237,14 @@ export class Code {
|
|||
throw new Error('Invalid usage');
|
||||
}
|
||||
|
||||
if (typeof target[prop] !== 'function') {
|
||||
return target[prop];
|
||||
const targetProp = (target as any)[prop];
|
||||
if (typeof targetProp !== 'function') {
|
||||
return targetProp;
|
||||
}
|
||||
|
||||
return function (...args) {
|
||||
return function (this: any, ...args: any[]) {
|
||||
logger.log(`${prop}`, ...args.filter(a => typeof a === 'string'));
|
||||
return target[prop].apply(this, args);
|
||||
return targetProp.apply(this, args);
|
||||
};
|
||||
}
|
||||
});
|
|
@ -3,12 +3,12 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Viewlet } from '../workbench/viewlet';
|
||||
import { Commands } from '../workbench/workbench';
|
||||
import { Code, findElement } from '../../vscode/code';
|
||||
import { Editors } from '../editor/editors';
|
||||
import { Editor } from '../editor/editor';
|
||||
import { IElement } from '../../vscode/driver';
|
||||
import { Viewlet } from './viewlet';
|
||||
import { Commands } from './workbench';
|
||||
import { Code, findElement } from './code';
|
||||
import { Editors } from './editors';
|
||||
import { Editor } from './editor';
|
||||
import { IElement } from '../src/driver';
|
||||
|
||||
const VIEWLET = 'div[id="workbench.view.debug"]';
|
||||
const DEBUG_VIEW = `${VIEWLET} .debug-view-content`;
|
||||
|
@ -25,7 +25,7 @@ const DEBUG_STATUS_BAR = `.statusbar.debugging`;
|
|||
const NOT_DEBUG_STATUS_BAR = `.statusbar:not(debugging)`;
|
||||
const TOOLBAR_HIDDEN = `.debug-toolbar[aria-hidden="true"]`;
|
||||
const STACK_FRAME = `${VIEWLET} .monaco-list-row .stack-frame`;
|
||||
const SPECIFIC_STACK_FRAME = filename => `${STACK_FRAME} .file[title*="${filename}"]`;
|
||||
const SPECIFIC_STACK_FRAME = (filename: string) => `${STACK_FRAME} .file[title*="${filename}"]`;
|
||||
const VARIABLE = `${VIEWLET} .debug-variables .monaco-list-row .expression`;
|
||||
const CONSOLE_OUTPUT = `.repl .output.expression .value`;
|
||||
const CONSOLE_INPUT_OUTPUT = `.repl .input-output-pair .output.expression .value`;
|
|
@ -4,14 +4,14 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { References } from './peek';
|
||||
import { Commands } from '../workbench/workbench';
|
||||
import { Code } from '../../vscode/code';
|
||||
import { Commands } from './workbench';
|
||||
import { Code } from './code';
|
||||
|
||||
const RENAME_BOX = '.monaco-editor .monaco-editor.rename-box';
|
||||
const RENAME_INPUT = `${RENAME_BOX} .rename-input`;
|
||||
const EDITOR = filename => `.monaco-editor[data-uri$="${filename}"]`;
|
||||
const VIEW_LINES = filename => `${EDITOR(filename)} .view-lines`;
|
||||
const LINE_NUMBERS = filename => `${EDITOR(filename)} .margin .margin-view-overlays .line-numbers`;
|
||||
const EDITOR = (filename: string) => `.monaco-editor[data-uri$="${filename}"]`;
|
||||
const VIEW_LINES = (filename: string) => `${EDITOR(filename)} .view-lines`;
|
||||
const LINE_NUMBERS = (filename: string) => `${EDITOR(filename)} .margin .margin-view-overlays .line-numbers`;
|
||||
|
||||
export class Editor {
|
||||
|
||||
|
@ -130,4 +130,4 @@ export class Editor {
|
|||
|
||||
throw new Error('Line not found');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Code } from '../../vscode/code';
|
||||
import { Code } from './code';
|
||||
|
||||
export class Editors {
|
||||
|
||||
|
@ -49,4 +49,4 @@ export class Editors {
|
|||
|
||||
await this.waitForEditorFocus('Untitled-1', true);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,9 +3,9 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Viewlet } from '../workbench/viewlet';
|
||||
import { Editors } from '../editor/editors';
|
||||
import { Code } from '../../vscode/code';
|
||||
import { Viewlet } from './viewlet';
|
||||
import { Editors } from './editors';
|
||||
import { Code } from './code';
|
||||
|
||||
export class Explorer extends Viewlet {
|
||||
|
||||
|
@ -45,4 +45,4 @@ export class Explorer extends Viewlet {
|
|||
throw new Error('No class defined for this file extension');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -3,8 +3,8 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Viewlet } from '../workbench/viewlet';
|
||||
import { Code } from '../../vscode/code';
|
||||
import { Viewlet } from './viewlet';
|
||||
import { Code } from './code';
|
||||
|
||||
const SEARCH_BOX = 'div.extensions-viewlet[id="workbench.view.extensions"] .monaco-editor textarea';
|
||||
|
||||
|
@ -40,4 +40,4 @@ export class Extensions extends Viewlet {
|
|||
await this.code.waitAndClick(`div.extensions-viewlet[id="workbench.view.extensions"] .monaco-list-row[aria-label="${ariaLabel}"] .extension li[class='action-item'] .extension-action.install`);
|
||||
await this.code.waitForElement(`.extension-editor .monaco-action-bar .action-item:not(.disabled) .extension-action.uninstall`);
|
||||
}
|
||||
}
|
||||
}
|
27
test/automation/src/index.ts
Normal file
27
test/automation/src/index.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
export * from './activityBar';
|
||||
export * from './application';
|
||||
export * from './code';
|
||||
export * from './debug';
|
||||
export * from './editor';
|
||||
export * from './editors';
|
||||
export * from './explorer';
|
||||
export * from './extensions';
|
||||
export * from './keybindings';
|
||||
export * from './logger';
|
||||
export * from './peek';
|
||||
export * from './problems';
|
||||
export * from './quickinput';
|
||||
export * from './quickopen';
|
||||
export * from './scm';
|
||||
export * from './search';
|
||||
export * from './settings';
|
||||
export * from './statusbar';
|
||||
export * from './terminal';
|
||||
export * from './viewlet';
|
||||
export * from './workbench';
|
||||
export * from '../src/driver';
|
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Code } from '../../vscode/code';
|
||||
import { Code } from './code';
|
||||
|
||||
const SEARCH_INPUT = '.keybindings-header .settings-search-input input';
|
||||
|
||||
|
@ -31,4 +31,4 @@ export class KeybindingsEditor {
|
|||
await this.code.dispatchKeybinding('enter');
|
||||
await this.code.waitForElement(`.keybindings-list-container div[aria-label="Keybinding is ${ariaLabel}."]`);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Code } from '../../vscode/code';
|
||||
import { Code } from './code';
|
||||
|
||||
export class References {
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Code } from '../../vscode/code';
|
||||
import { Code } from './code';
|
||||
|
||||
export const enum ProblemSeverity {
|
||||
WARNING = 0,
|
|
@ -8,11 +8,12 @@ import { ChildProcess, spawn } from 'child_process';
|
|||
import { join } from 'path';
|
||||
import { mkdir } from 'fs';
|
||||
import { promisify } from 'util';
|
||||
import { IDriver, IDisposable } from './driver';
|
||||
|
||||
const width = 1200;
|
||||
const height = 800;
|
||||
|
||||
const vscodeToPuppeteerKey = {
|
||||
const vscodeToPuppeteerKey: { [key: string]: string } = {
|
||||
cmd: 'Meta',
|
||||
ctrl: 'Control',
|
||||
shift: 'Shift',
|
||||
|
@ -111,7 +112,7 @@ function teardown(): void {
|
|||
|
||||
function waitForEndpoint(): Promise<string> {
|
||||
return new Promise<string>(r => {
|
||||
server!.stdout.on('data', d => {
|
||||
server!.stdout.on('data', (d: Buffer) => {
|
||||
const matches = d.toString('ascii').match(/Web UI available at (.+)/);
|
||||
if (matches !== null) {
|
||||
r(matches[1]);
|
||||
|
@ -139,54 +140,3 @@ export function connect(headless: boolean, outPath: string, handle: string): Pro
|
|||
c(result);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Thenable is a common denominator between ES6 promises, Q, jquery.Deferred, WinJS.Promise,
|
||||
* and others. This API makes no assumption about what promise library is being used which
|
||||
* enables reusing existing code without migrating to a specific promise implementation. Still,
|
||||
* we recommend the use of native promises which are available in this editor.
|
||||
*/
|
||||
export interface Thenable<T> {
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Thenable<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => void): Thenable<TResult>;
|
||||
}
|
||||
|
||||
export interface IElement {
|
||||
tagName: string;
|
||||
className: string;
|
||||
textContent: string;
|
||||
attributes: { [name: string]: string; };
|
||||
children: IElement[];
|
||||
top: number;
|
||||
left: number;
|
||||
}
|
||||
|
||||
export interface IDriver {
|
||||
_serviceBrand: undefined;
|
||||
|
||||
getWindowIds(): Promise<number[]>;
|
||||
capturePage(windowId: number): Promise<string>;
|
||||
reloadWindow(windowId: number): Promise<void>;
|
||||
exitApplication(): Promise<void>;
|
||||
dispatchKeybinding(windowId: number, keybinding: string): Promise<void>;
|
||||
click(windowId: number, selector: string, xoffset?: number | undefined, yoffset?: number | undefined): Promise<void>;
|
||||
doubleClick(windowId: number, selector: string): Promise<void>;
|
||||
setValue(windowId: number, selector: string, text: string): Promise<void>;
|
||||
getTitle(windowId: number): Promise<string>;
|
||||
isActiveElement(windowId: number, selector: string): Promise<boolean>;
|
||||
getElements(windowId: number, selector: string, recursive?: boolean): Promise<IElement[]>;
|
||||
getElementXY(windowId: number, selector: string, xoffset?: number, yoffset?: number): Promise<{ x: number; y: number; }>;
|
||||
typeInEditor(windowId: number, selector: string, text: string): Promise<void>;
|
||||
getTerminalBuffer(windowId: number, selector: string): Promise<string[]>;
|
||||
writeInTerminal(windowId: number, selector: string, text: string): Promise<void>;
|
||||
}
|
||||
|
||||
export interface IDisposable {
|
||||
dispose(): void;
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Code } from '../../vscode/code';
|
||||
import { Code } from './code';
|
||||
|
||||
export class QuickInput {
|
||||
|
|
@ -3,8 +3,8 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Editors } from '../editor/editors';
|
||||
import { Code } from '../../vscode/code';
|
||||
import { Editors } from './editors';
|
||||
import { Code } from './code';
|
||||
|
||||
export class QuickOpen {
|
||||
|
|
@ -3,9 +3,9 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Viewlet } from '../workbench/viewlet';
|
||||
import { IElement } from '../../vscode/driver';
|
||||
import { findElement, findElements, Code } from '../../vscode/code';
|
||||
import { Viewlet } from './viewlet';
|
||||
import { IElement } from '../src/driver';
|
||||
import { findElement, findElements, Code } from './code';
|
||||
|
||||
const VIEWLET = 'div[id="workbench.view.scm"]';
|
||||
const SCM_INPUT = `${VIEWLET} .scm-editor textarea`;
|
||||
|
@ -76,4 +76,4 @@ export class SCM extends Viewlet {
|
|||
await this.code.waitForSetValue(SCM_INPUT, message);
|
||||
await this.code.waitAndClick(COMMIT_COMMAND);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,13 +3,13 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Viewlet } from '../workbench/viewlet';
|
||||
import { Code } from '../../vscode/code';
|
||||
import { Viewlet } from './viewlet';
|
||||
import { Code } from './code';
|
||||
|
||||
const VIEWLET = '.search-view';
|
||||
const INPUT = `${VIEWLET} .search-widget .search-container .monaco-inputbox textarea`;
|
||||
const INCLUDE_INPUT = `${VIEWLET} .query-details .file-types.includes .monaco-inputbox input`;
|
||||
const FILE_MATCH = filename => `${VIEWLET} .results .filematch[data-resource$="${filename}"]`;
|
||||
const FILE_MATCH = (filename: string) => `${VIEWLET} .results .filematch[data-resource$="${filename}"]`;
|
||||
|
||||
async function retry(setup: () => Promise<any>, attempt: () => Promise<any>) {
|
||||
let count = 0;
|
|
@ -5,15 +5,10 @@
|
|||
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import { Editor } from '../editor/editor';
|
||||
import { Editors } from '../editor/editors';
|
||||
import { Code } from '../../vscode/code';
|
||||
import { QuickOpen } from '../quickopen/quickopen';
|
||||
|
||||
export const enum ActivityBarPosition {
|
||||
LEFT = 0,
|
||||
RIGHT = 1
|
||||
}
|
||||
import { Editor } from './editor';
|
||||
import { Editors } from './editors';
|
||||
import { Code } from './code';
|
||||
import { QuickOpen } from './quickopen';
|
||||
|
||||
export class SettingsEditor {
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Code } from '../../vscode/code';
|
||||
import { Code } from './code';
|
||||
|
||||
export const enum StatusBarElement {
|
||||
BRANCH_STATUS = 0,
|
|
@ -3,8 +3,8 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Code } from '../../vscode/code';
|
||||
import { QuickOpen } from '../quickopen/quickopen';
|
||||
import { Code } from './code';
|
||||
import { QuickOpen } from './quickopen';
|
||||
|
||||
const PANEL_SELECTOR = 'div[id="workbench.panel.terminal"]';
|
||||
const XTERM_SELECTOR = `${PANEL_SELECTOR} .terminal-wrapper`;
|
||||
|
@ -30,4 +30,4 @@ export class Terminal {
|
|||
async waitForTerminalText(accept: (buffer: string[]) => boolean): Promise<void> {
|
||||
await this.code.waitForTerminalBuffer(XTERM_SELECTOR, accept);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Code } from '../../vscode/code';
|
||||
import { Code } from './code';
|
||||
|
||||
export abstract class Viewlet {
|
||||
|
||||
|
@ -12,4 +12,4 @@ export abstract class Viewlet {
|
|||
async waitForTitle(fn: (title: string) => boolean): Promise<void> {
|
||||
await this.code.waitForTextContent('.monaco-workbench .part.sidebar > .title > .title-label > h2', undefined, fn);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,22 +3,22 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Explorer } from '../explorer/explorer';
|
||||
import { ActivityBar } from '../activitybar/activityBar';
|
||||
import { QuickOpen } from '../quickopen/quickopen';
|
||||
import { QuickInput } from '../quickinput/quickinput';
|
||||
import { Extensions } from '../extensions/extensions';
|
||||
import { Search } from '../search/search';
|
||||
import { Editor } from '../editor/editor';
|
||||
import { SCM } from '../git/scm';
|
||||
import { Debug } from '../debug/debugSmoke';
|
||||
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';
|
||||
import { Explorer } from './explorer';
|
||||
import { ActivityBar } from './activityBar';
|
||||
import { QuickOpen } from './quickopen';
|
||||
import { QuickInput } from './quickinput';
|
||||
import { Extensions } from './extensions';
|
||||
import { Search } from './search';
|
||||
import { Editor } from './editor';
|
||||
import { SCM } from './scm';
|
||||
import { Debug } from './debug';
|
||||
import { StatusBar } from './statusbar';
|
||||
import { Problems } from './problems';
|
||||
import { SettingsEditor } from './settings';
|
||||
import { KeybindingsEditor } from './keybindings';
|
||||
import { Editors } from './editors';
|
||||
import { Code } from './code';
|
||||
import { Terminal } from './terminal';
|
||||
|
||||
export interface Commands {
|
||||
runCommand(command: string): Promise<any>;
|
|
@ -44,7 +44,8 @@ export interface IDisposable {
|
|||
export function connect(outPath: string, handle: string): Promise<{ client: IDisposable, driver: IDriver }>;
|
||||
`;
|
||||
|
||||
const srcPath = path.join(path.dirname(__dirname), 'src/vscode');
|
||||
const outDriverPath = path.join(srcPath, 'driver.d.ts');
|
||||
const srcPath = path.join(path.dirname(__dirname), 'src');
|
||||
const outPath = path.join(path.dirname(__dirname), 'out');
|
||||
|
||||
fs.writeFileSync(outDriverPath, contents);
|
||||
fs.writeFileSync(path.join(srcPath, 'driver.d.ts'), contents);
|
||||
fs.writeFileSync(path.join(outPath, 'driver.d.ts'), contents);
|
19
test/automation/tools/copy-package-version.js
Normal file
19
test/automation/tools/copy-package-version.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const packageDir = path.dirname(__dirname);
|
||||
const root = path.dirname(path.dirname(path.dirname(__dirname)));
|
||||
|
||||
const rootPackageJsonFile = path.join(root, 'package.json');
|
||||
const thisPackageJsonFile = path.join(packageDir, 'package.json');
|
||||
const rootPackageJson = JSON.parse(fs.readFileSync(rootPackageJsonFile, 'utf8'));
|
||||
const thisPackageJson = JSON.parse(fs.readFileSync(thisPackageJsonFile, 'utf8'));
|
||||
|
||||
thisPackageJson.version = rootPackageJson.version;
|
||||
|
||||
fs.writeFileSync(thisPackageJsonFile, JSON.stringify(thisPackageJson, null, ' '));
|
21
test/automation/tsconfig.json
Normal file
21
test/automation/tsconfig.json
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es2016",
|
||||
"strict": true,
|
||||
"noUnusedParameters": false,
|
||||
"noUnusedLocals": true,
|
||||
"outDir": "out",
|
||||
"sourceMap": true,
|
||||
"declaration": true,
|
||||
"lib": [
|
||||
"es2016",
|
||||
"dom"
|
||||
]
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"out",
|
||||
"tools",
|
||||
]
|
||||
}
|
1745
test/automation/yarn.lock
Normal file
1745
test/automation/yarn.lock
Normal file
File diff suppressed because it is too large
Load diff
|
@ -5,10 +5,8 @@ Make sure you are on **Node v10.x**.
|
|||
### Run
|
||||
|
||||
```bash
|
||||
# Compile
|
||||
cd test/smoke
|
||||
yarn compile
|
||||
cd ../..
|
||||
# Install Dependencies and Compile
|
||||
yarn --cwd test/smoke
|
||||
|
||||
# Dev
|
||||
yarn smoketest
|
||||
|
@ -26,7 +24,7 @@ You must always run the smoketest version which matches the release you are test
|
|||
|
||||
```bash
|
||||
git checkout release/1.22
|
||||
yarn
|
||||
yarn --cwd test/smoke
|
||||
```
|
||||
|
||||
In addition to the new build to be released you will need the previous stable build so that the smoketest can test the data migration.
|
||||
|
|
|
@ -3,13 +3,10 @@
|
|||
"version": "0.1.0",
|
||||
"main": "./src/main.js",
|
||||
"scripts": {
|
||||
"preinstall": "yarn --cwd ../automation",
|
||||
"postinstall": "npm run compile",
|
||||
"compile": "npm run copy-driver && npm run copy-driver-definition && tsc",
|
||||
"watch": "concurrently \"npm run watch-driver\" \"npm run watch-driver-definition\" \"tsc --watch\"",
|
||||
"copy-driver": "cpx src/vscode/driver.js out/vscode",
|
||||
"watch-driver": "cpx src/vscode/driver.js out/vscode -w",
|
||||
"copy-driver-definition": "node tools/copy-driver-definition.js",
|
||||
"watch-driver-definition": "watch \"node tools/copy-driver-definition.js\" ../../src/vs/platform/driver/node",
|
||||
"compile": "tsc",
|
||||
"watch": "concurrently \"yarn --cwd ../automation watch\" \"tsc --watch\"",
|
||||
"mocha": "mocha"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -18,12 +15,9 @@
|
|||
"@types/mocha": "2.2.41",
|
||||
"@types/ncp": "2.0.1",
|
||||
"@types/node": "^10.14.8",
|
||||
"@types/puppeteer": "^1.19.0",
|
||||
"@types/rimraf": "2.0.2",
|
||||
"@types/webdriverio": "4.6.1",
|
||||
"concurrently": "^3.5.1",
|
||||
"cpx": "^1.5.0",
|
||||
"electron": "4.2.10",
|
||||
"htmlparser2": "^3.9.2",
|
||||
"mkdirp": "^0.5.1",
|
||||
"mocha": "^5.2.0",
|
||||
|
@ -36,9 +30,7 @@
|
|||
"strip-json-comments": "^2.0.1",
|
||||
"tmp": "0.0.33",
|
||||
"typescript": "2.9.2",
|
||||
"vscode-automation": "link:../automation",
|
||||
"watch": "^1.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"vscode-uri": "^2.0.3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Application } from '../../application';
|
||||
import { ProblemSeverity, Problems } from '../problems/problems';
|
||||
import { Application, ProblemSeverity, Problems } from 'vscode-automation';
|
||||
|
||||
export function setup() {
|
||||
describe('CSS', () => {
|
||||
|
@ -44,4 +43,4 @@ export function setup() {
|
|||
await problems.hideProblemsView();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import * as http from 'http';
|
|||
import * as path from 'path';
|
||||
import * as fs from 'fs';
|
||||
import * as stripJsonComments from 'strip-json-comments';
|
||||
import { Application } from '../../application';
|
||||
import { Application } from 'vscode-automation';
|
||||
|
||||
export function setup() {
|
||||
describe('Debug', () => {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Application } from '../../application';
|
||||
import { Application } from 'vscode-automation';
|
||||
|
||||
export function setup() {
|
||||
describe('Editor', () => {
|
||||
|
@ -67,4 +67,4 @@ export function setup() {
|
|||
await peek.waitForFile('app.js');
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Application } from '../../application';
|
||||
import { Application } from 'vscode-automation';
|
||||
|
||||
export function setup() {
|
||||
describe('Explorer', () => {
|
||||
|
@ -37,4 +37,4 @@ export function setup() {
|
|||
await app.code.dispatchKeybinding('escape');
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Application, Quality } from '../../application';
|
||||
import { Application, Quality } from 'vscode-automation';
|
||||
|
||||
export function setup() {
|
||||
describe('Extensions', () => {
|
||||
|
@ -28,4 +28,4 @@ export function setup() {
|
|||
await app.workbench.statusbar.waitForStatusbarText('smoke test', 'VS Code Smoke Test Check');
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as cp from 'child_process';
|
||||
import { Application } from '../../application';
|
||||
import { Application } from 'vscode-automation';
|
||||
|
||||
const DIFF_EDITOR_LINE_INSERT = '.monaco-diff-editor .editor.modified .line-insert';
|
||||
const SYNC_STATUSBAR = 'div[id="workbench.parts.statusbar"] .statusbar-item[title$="Synchronize Changes"]';
|
||||
|
@ -74,4 +74,4 @@ export function setup() {
|
|||
cp.execSync('git reset --hard origin/master', { cwd: app.workspacePathOrFolder });
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import { Application } from '../../application';
|
||||
import { Application } from 'vscode-automation';
|
||||
|
||||
function toUri(path: string): string {
|
||||
if (process.platform === 'win32') {
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Application } from '../../application';
|
||||
import { ActivityBarPosition } from '../activitybar/activityBar';
|
||||
import { Application, ActivityBarPosition } from 'vscode-automation';
|
||||
|
||||
export function setup() {
|
||||
describe('Preferences', () => {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as cp from 'child_process';
|
||||
import { Application } from '../../application';
|
||||
import { Application } from 'vscode-automation';
|
||||
|
||||
export function setup() {
|
||||
describe('Search', () => {
|
||||
|
@ -56,4 +56,4 @@ export function setup() {
|
|||
await app.workbench.search.waitForNoResultText();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Application, Quality } from '../../application';
|
||||
import { StatusBarElement } from './statusbar';
|
||||
import { Application, Quality, StatusBarElement } from 'vscode-automation';
|
||||
|
||||
export function setup() {
|
||||
describe('Statusbar', () => {
|
||||
|
@ -90,4 +89,4 @@ export function setup() {
|
|||
await app.workbench.statusbar.waitForEOL('CRLF');
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Application } from '../../application';
|
||||
import { Application } from 'vscode-automation';
|
||||
|
||||
export function setup() {
|
||||
describe('Terminal', () => {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Application } from '../../application';
|
||||
import { Application } from 'vscode-automation';
|
||||
|
||||
export function setup() {
|
||||
describe('Dataloss', () => {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Application, ApplicationOptions } from '../../application';
|
||||
import { Application, ApplicationOptions } from 'vscode-automation';
|
||||
import { join } from 'path';
|
||||
|
||||
export function setup(stableCodePath: string, testDataPath: string) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as path from 'path';
|
||||
import { Application, ApplicationOptions } from '../../application';
|
||||
import { Application, ApplicationOptions } from 'vscode-automation';
|
||||
|
||||
export function setup() {
|
||||
|
||||
|
@ -35,4 +35,4 @@ export function setup() {
|
|||
});
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Application, Quality } from '../../application';
|
||||
import { Application, Quality } from 'vscode-automation';
|
||||
|
||||
export function setup() {
|
||||
describe('Localization', () => {
|
||||
|
|
|
@ -11,7 +11,15 @@ import * as tmp from 'tmp';
|
|||
import * as rimraf from 'rimraf';
|
||||
import * as mkdirp from 'mkdirp';
|
||||
import { ncp } from 'ncp';
|
||||
import { Application, Quality, ApplicationOptions } from './application';
|
||||
import {
|
||||
Application,
|
||||
Quality,
|
||||
ApplicationOptions,
|
||||
MultiLogger,
|
||||
Logger,
|
||||
ConsoleLogger,
|
||||
FileLogger,
|
||||
} from 'vscode-automation';
|
||||
|
||||
import { setup as setupDataMigrationTests } from './areas/workbench/data-migration.test';
|
||||
import { setup as setupDataLossTests } from './areas/workbench/data-loss.test';
|
||||
|
@ -28,7 +36,6 @@ import { setup as setupTerminalTests } from './areas/terminal/terminal.test';
|
|||
import { setup as setupDataMultirootTests } from './areas/multiroot/multiroot.test';
|
||||
import { setup as setupDataLocalizationTests } from './areas/workbench/localization.test';
|
||||
import { setup as setupLaunchTests } from './areas/workbench/launch.test';
|
||||
import { MultiLogger, Logger, ConsoleLogger, FileLogger } from './logger';
|
||||
|
||||
if (!/^v10/.test(process.version)) {
|
||||
console.error('Error: Smoketest must be run using Node 10. Currently running', process.version);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -612,9 +612,9 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"target": "**/test/smoke2/**",
|
||||
"target": "**/test/automation/**",
|
||||
"restrictions": [
|
||||
"**/test/smoke2/**",
|
||||
"**/test/automation/**",
|
||||
"*"
|
||||
]
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue