Updated tasks tests with respect to new Express eslint config. Code cleanup.

This commit is contained in:
Michel Kaporin
2017-05-26 10:36:52 +02:00
parent c925cfb72c
commit 0335ea84d6
21 changed files with 91 additions and 112 deletions

View File

@@ -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 () {

View File

@@ -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 () {

View File

@@ -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}`]);

View File

@@ -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();

View File

@@ -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);

View File

@@ -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);
});
});
}

View File

@@ -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 () {

View File

@@ -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 () {

View File

@@ -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 () {

View File

@@ -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 () {

View File

@@ -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();
});

View File

@@ -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 () {

View File

@@ -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 () {

View File

@@ -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');
});
});
}