mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
Updated tasks tests with respect to new Express eslint config. Code cleanup.
This commit is contained in:
parent
c925cfb72c
commit
0335ea84d6
26
test/smoke/.vscode/launch.json
vendored
26
test/smoke/.vscode/launch.json
vendored
|
@ -1,26 +0,0 @@
|
|||
{
|
||||
// Use IntelliSense to learn about possible Node.js debug attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Mocha Tests",
|
||||
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
|
||||
"args": [
|
||||
"-u",
|
||||
"tdd",
|
||||
"--timeout",
|
||||
"999999",
|
||||
"--colors",
|
||||
"${workspaceRoot}/out/tests.js"
|
||||
],
|
||||
"outFiles": [ "${workspaceRoot}/out/**/*.js" ],
|
||||
"internalConsoleOptions": "openOnSessionStart",
|
||||
"sourceMaps": true,
|
||||
"cwd": "${workspaceRoot}"
|
||||
}
|
||||
]
|
||||
}
|
10
test/smoke/.vscode/tasks.json
vendored
10
test/smoke/.vscode/tasks.json
vendored
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "0.1.0",
|
||||
"command": "tsc",
|
||||
"isShellCommand": true,
|
||||
"args": ["-p", "."],
|
||||
"showOutput": "silent",
|
||||
"problemMatcher": "$tsc"
|
||||
}
|
|
@ -15,8 +15,9 @@ export class Tasks {
|
|||
// noop
|
||||
}
|
||||
|
||||
public build(): Promise<any> {
|
||||
return this.spectron.command('workbench.action.tasks.build');
|
||||
public async build(): Promise<any> {
|
||||
await this.spectron.command('workbench.action.tasks.build');
|
||||
return this.spectron.wait(); // wait for build to finish
|
||||
}
|
||||
|
||||
public openProblemsView(): Promise<any> {
|
||||
|
@ -25,12 +26,12 @@ export class Tasks {
|
|||
|
||||
public async firstOutputLineEndsWith(fileName: string): Promise<boolean> {
|
||||
const firstLine = await this.spectron.waitFor(this.spectron.client.getText, `${this.outputViewSelector}>:nth-child(2)`);
|
||||
|
||||
|
||||
return firstLine.endsWith(fileName);
|
||||
}
|
||||
|
||||
public getOutputResult(): Promise<any> {
|
||||
return this.spectron.waitFor(this.spectron.client.getText, `${this.outputViewSelector}>:nth-child(10) span.mtk1`);
|
||||
return this.spectron.waitFor(this.spectron.client.getText, `${this.outputViewSelector}>:nth-child(5) span.mtk1`);
|
||||
}
|
||||
|
||||
public selectOutputViewType(type: string): Promise<any> {
|
||||
|
@ -41,7 +42,7 @@ export class Tasks {
|
|||
return this.spectron.client.getValue(`${this.workbenchPanelSelector} .select-box`);
|
||||
}
|
||||
|
||||
public getProblemsViewFirstElementName(): Promise<any> {
|
||||
public getProblemsViewFirstElementName(): Promise<any> {
|
||||
return this.spectron.waitFor(this.spectron.client.getText, `${this.problemsViewSelector} .label-name`);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,6 @@ else if (os === 'win32') os = 'win';
|
|||
var promises = [];
|
||||
|
||||
try {
|
||||
// promises.push(execute('npm install'), process.cwd());
|
||||
promises.push(getKeybindings(`${keybindingsUrl}/doc.keybindings.${os}.json`, `${tempFolder}/keybindings.json`));
|
||||
promises.push(cleanOrClone(testRepoUrl, testRepoLocalDir));
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ var mocha = new Mocha({
|
|||
useColors: true
|
||||
});
|
||||
|
||||
mocha.addFile(path.join(process.cwd(), 'out/tests.js'));
|
||||
mocha.addFile(path.join(process.cwd(), 'out/test.js'));
|
||||
mocha.run((failures) => {
|
||||
process.on('exit', () => {
|
||||
process.exit(failures);
|
||||
|
|
36
test/smoke/src/test.ts
Normal file
36
test/smoke/src/test.ts
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { testDataLoss } from "./tests/data-loss";
|
||||
import { testDataMigration } from "./tests/data-migration";
|
||||
import { testExplorer } from "./tests/explorer";
|
||||
import { testConfigViews } from "./tests/configuration-views";
|
||||
import { testSearch } from "./tests/search";
|
||||
import { testCSS } from "./tests/css";
|
||||
import { testJavaScript } from "./tests/javascript";
|
||||
import { testJavaScriptDebug } from "./tests/javascript-debug";
|
||||
import { testGit } from "./tests/git";
|
||||
import { testIntegratedTerminal } from "./tests/integrated-terminal";
|
||||
import { testStatusbar } from "./tests/statusbar";
|
||||
import { testTasks } from "./tests/tasks";
|
||||
import { testExtensions } from "./tests/extensions";
|
||||
import { testLocalization } from "./tests/localization";
|
||||
|
||||
describe('Smoke Test Suite', async () => {
|
||||
testDataMigration();
|
||||
testDataLoss();
|
||||
testExplorer();
|
||||
testConfigViews();
|
||||
testSearch();
|
||||
testCSS();
|
||||
testJavaScript();
|
||||
testJavaScriptDebug();
|
||||
testGit();
|
||||
testIntegratedTerminal();
|
||||
testStatusbar();
|
||||
testTasks();
|
||||
testExtensions();
|
||||
testLocalization();
|
||||
});
|
|
@ -1,36 +0,0 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { dataLoss } from "./tests/data-loss";
|
||||
import { dataMigration } from "./tests/data-migration";
|
||||
import { explorer } from "./tests/explorer";
|
||||
import { configurationViews } from "./tests/configuration-views";
|
||||
import { search } from "./tests/search";
|
||||
import { css } from "./tests/css";
|
||||
import { javascript } from "./tests/javascript";
|
||||
import { javascriptDebug } from "./tests/javascript-debug";
|
||||
import { test_git } from "./tests/git";
|
||||
import { integratedTerminal } from "./tests/integrated-terminal";
|
||||
import { statusBar } from "./tests/statusbar";
|
||||
import { tasks } from "./tests/tasks";
|
||||
import { extensions } from "./tests/extensions";
|
||||
import { localization } from "./tests/localization";
|
||||
|
||||
describe('Smoke Test Suite', function () {
|
||||
dataMigration();
|
||||
dataLoss();
|
||||
explorer();
|
||||
configurationViews();
|
||||
search();
|
||||
css();
|
||||
javascript();
|
||||
javascriptDebug();
|
||||
test_git();
|
||||
integratedTerminal();
|
||||
statusBar();
|
||||
tasks();
|
||||
extensions();
|
||||
localization();
|
||||
});
|
|
@ -12,8 +12,8 @@ import { ConfigurationView, ActivityBarPosition } from "../areas/configuration-v
|
|||
let app: SpectronApplication;
|
||||
let common: CommonActions;
|
||||
|
||||
export function configurationViews() {
|
||||
context('Configuration and views', function () {
|
||||
export function testConfigViews() {
|
||||
context('Configuration and views', () => {
|
||||
let configView: ConfigurationView;
|
||||
|
||||
beforeEach(async function () {
|
||||
|
|
|
@ -12,8 +12,8 @@ import { CSS, CSSProblem } from '../areas/css';
|
|||
let app: SpectronApplication;
|
||||
let common: CommonActions;
|
||||
|
||||
export function css() {
|
||||
context('CSS', function () {
|
||||
export function testCSS() {
|
||||
context('CSS', () => {
|
||||
let css: CSS;
|
||||
|
||||
beforeEach(async function () {
|
||||
|
|
|
@ -13,8 +13,8 @@ let app: SpectronApplication;
|
|||
let common: CommonActions;
|
||||
let dl: DataLoss;
|
||||
|
||||
export function dataLoss() {
|
||||
context('Data Loss', function () {
|
||||
export function testDataLoss() {
|
||||
context('Data Loss', () => {
|
||||
|
||||
beforeEach(async function () {
|
||||
app = new SpectronApplication(LATEST_PATH, this.currentTest.fullTitle(), (this.currentTest as any).currentRetry(), [WORKSPACE_PATH], [`--user-data-dir=${USER_DIR}`]);
|
||||
|
|
|
@ -11,11 +11,12 @@ import { CommonActions } from '../areas/common';
|
|||
let app: SpectronApplication;
|
||||
let common: CommonActions;
|
||||
|
||||
export function dataMigration() {
|
||||
export function testDataMigration() {
|
||||
if (!STABLE_PATH) {
|
||||
return;
|
||||
}
|
||||
context('Data Migration', function () {
|
||||
|
||||
context('Data Migration', () => {
|
||||
|
||||
afterEach(async function () {
|
||||
await app.stop();
|
||||
|
|
|
@ -11,8 +11,9 @@ import { CommonActions } from '../areas/common';
|
|||
let app: SpectronApplication;
|
||||
let common: CommonActions;
|
||||
|
||||
export function explorer() {
|
||||
context('Explorer', function () {
|
||||
export function testExplorer() {
|
||||
context('Explorer', () => {
|
||||
|
||||
beforeEach(async function () {
|
||||
app = new SpectronApplication(LATEST_PATH, this.currentTest.fullTitle(), (this.currentTest as any).currentRetry(), [WORKSPACE_PATH]);
|
||||
common = new CommonActions(app);
|
||||
|
|
|
@ -9,11 +9,18 @@ import { SpectronApplication, LATEST_PATH, WORKSPACE_PATH, EXTENSIONS_DIR } from
|
|||
import { CommonActions } from '../areas/common';
|
||||
import { Extensions } from "../areas/extensions";
|
||||
|
||||
var dns = require('dns');
|
||||
|
||||
let app: SpectronApplication;
|
||||
let common: CommonActions;
|
||||
|
||||
export function extensions() {
|
||||
context('Extensions', function () {
|
||||
export async function testExtensions() {
|
||||
const network = await networkAttached();
|
||||
if (!network) {
|
||||
return;
|
||||
}
|
||||
|
||||
context('Extensions', () => {
|
||||
let extensions: Extensions;
|
||||
|
||||
beforeEach(async function () {
|
||||
|
@ -54,4 +61,12 @@ export function extensions() {
|
|||
assert.ok(x);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function networkAttached(): Promise<boolean> {
|
||||
return new Promise((res, rej) => {
|
||||
dns.resolve('marketplace.visualstudio.com', (err) => {
|
||||
err ? res(false) : res(true);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -12,8 +12,8 @@ import { Git } from "../areas/git";
|
|||
let app: SpectronApplication;
|
||||
let common: CommonActions;
|
||||
|
||||
export function test_git() {
|
||||
context('Git', function () {
|
||||
export function testGit() {
|
||||
context('Git', () => {
|
||||
let git: Git;
|
||||
|
||||
beforeEach(async function () {
|
||||
|
|
|
@ -12,8 +12,8 @@ import { IntegratedTerminal } from "../areas/integrated-terminal";
|
|||
let app: SpectronApplication;
|
||||
let common: CommonActions;
|
||||
|
||||
export function integratedTerminal() {
|
||||
context('Integrated Terminal', function () {
|
||||
export function testIntegratedTerminal() {
|
||||
context('Integrated Terminal', () => {
|
||||
let terminal: IntegratedTerminal;
|
||||
|
||||
beforeEach(async function () {
|
||||
|
|
|
@ -12,8 +12,8 @@ import { JavaScriptDebug } from "../areas/javascript-debug";
|
|||
let app: SpectronApplication;
|
||||
let common: CommonActions;
|
||||
|
||||
export function javascriptDebug() {
|
||||
context('Debugging JavaScript', function () {
|
||||
export function testJavaScriptDebug() {
|
||||
context('Debugging JavaScript', () => {
|
||||
let jsDebug: JavaScriptDebug;
|
||||
|
||||
beforeEach(async function () {
|
||||
|
|
|
@ -12,8 +12,8 @@ import { JavaScript } from "../areas/javascript";
|
|||
let app: SpectronApplication;
|
||||
let common: CommonActions;
|
||||
|
||||
export function javascript() {
|
||||
context('JavaScript', function () {
|
||||
export function testJavaScript() {
|
||||
context('JavaScript', () => {
|
||||
let js: JavaScript;
|
||||
|
||||
beforeEach(async function () {
|
||||
|
|
|
@ -12,8 +12,8 @@ import { Localization, ViewletType } from "../areas/localization";
|
|||
let app: SpectronApplication;
|
||||
let common: CommonActions;
|
||||
|
||||
export function localization() {
|
||||
context('Localization', function () {
|
||||
export function testLocalization() {
|
||||
context('Localization', () => {
|
||||
afterEach(async function () {
|
||||
return await app.stop();
|
||||
});
|
||||
|
|
|
@ -12,8 +12,8 @@ import { Search } from "../areas/search";
|
|||
let app: SpectronApplication;
|
||||
let common: CommonActions;
|
||||
|
||||
export function search() {
|
||||
context('Search', function () {
|
||||
export function testSearch() {
|
||||
context('Search', () => {
|
||||
let search: Search;
|
||||
|
||||
beforeEach(async function () {
|
||||
|
|
|
@ -12,8 +12,8 @@ import { StatusBarElement, StatusBar } from "../areas/statusBar";
|
|||
let app: SpectronApplication;
|
||||
let common: CommonActions;
|
||||
|
||||
export function statusBar() {
|
||||
context('Status Bar', function () {
|
||||
export function testStatusbar() {
|
||||
context('Status Bar', () => {
|
||||
let statusBar: StatusBar;
|
||||
|
||||
beforeEach(async function () {
|
||||
|
|
|
@ -10,8 +10,8 @@ import { Tasks } from "../areas/tasks";
|
|||
|
||||
let app: SpectronApplication;
|
||||
|
||||
export function tasks() {
|
||||
context('Tasks', function () {
|
||||
export function testTasks() {
|
||||
context('Tasks', () => {
|
||||
let tasks: Tasks;
|
||||
|
||||
beforeEach(async function () {
|
||||
|
@ -24,15 +24,14 @@ export function tasks() {
|
|||
return await app.stop();
|
||||
});
|
||||
|
||||
it('verifies that build task produces 6 errors', async function () {
|
||||
it('verifies that eslint task results in 1 problem', async function () {
|
||||
await tasks.build();
|
||||
const res = await tasks.getOutputResult();
|
||||
assert.equal(res, '✖ 6 problems (6 errors, 0 warnings)');
|
||||
assert.equal(res, '✖ 1 problem (0 errors, 1 warning)');
|
||||
});
|
||||
|
||||
it(`is able to select 'Git' output`, async function () {
|
||||
await tasks.build();
|
||||
await app.wait();
|
||||
await tasks.selectOutputViewType('Git');
|
||||
const viewType = await tasks.getOutputViewType();
|
||||
assert.equal(viewType, 'Git');
|
||||
|
@ -45,12 +44,11 @@ export function tasks() {
|
|||
|
||||
it(`verifies build errors are reflected in 'Problems View'`, async function () {
|
||||
await tasks.build();
|
||||
await app.wait();
|
||||
await tasks.openProblemsView();
|
||||
const problemName = await tasks.getProblemsViewFirstElementName();
|
||||
assert.equal(problemName, 'index.js');
|
||||
const problemsCount = await tasks.getProblemsViewFirstElementCount();
|
||||
assert.equal(problemsCount, '6');
|
||||
assert.equal(problemsCount, '1');
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Reference in a new issue