Skip to content

Commit

Permalink
smoke: omit warnings, clean imports
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomoreno committed Sep 4, 2017
1 parent 12d8f1c commit 4fe77bc
Show file tree
Hide file tree
Showing 9 changed files with 228 additions and 247 deletions.
87 changes: 42 additions & 45 deletions test/smoke/src/areas/css/css.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,51 @@
*--------------------------------------------------------------------------------------------*/

import * as assert from 'assert';

import { SpectronApplication, LATEST_PATH, WORKSPACE_PATH } from '../../spectron/application';
import { ProblemSeverity, Problems } from '../problems/problems';
import { QuickOutline } from '../editor/quickoutline';
import { SettingsEditor } from '../preferences/settings';

export function testCSS() {
describe('CSS', () => {
let app: SpectronApplication = new SpectronApplication(LATEST_PATH, '', 0, [WORKSPACE_PATH]);
before(() => app.start());
after(() => app.stop());

it('verifies quick outline', async function () {
await app.workbench.quickopen.openFile('style.css');
const outline = new QuickOutline(app);
await outline.openSymbols();
const elements = await app.client.waitForElements(QuickOutline.QUICK_OPEN_ENTRY_SELECTOR, elements => elements.length === 2);
assert.ok(elements, `Did not find two outline elements`);
});

it('verifies warnings for the empty rule', async function () {
await app.workbench.quickopen.openFile('style.css');
await app.client.waitForElement(`.monaco-editor.focused`);
await app.type('.foo{}');

let warning = await app.client.waitForElement(Problems.getSelectorInEditor(ProblemSeverity.WARNING));
assert.ok(warning, `Warning squiggle is not shown in 'style.css'.`);

const problems = new Problems(app);
await problems.showProblemsView();
warning = await app.client.waitForElement(Problems.getSelectorInProblemsView(ProblemSeverity.WARNING));
assert.ok(warning, 'Warning does not appear in Problems view.');
await problems.hideProblemsView();
});

it('verifies that warning becomes an error once setting changed', async function () {
await new SettingsEditor(app).addUserSetting('css.lint.emptyRules', '"error"');
await app.workbench.quickopen.openFile('style.css');
await app.type('.foo{}');

let error = await app.client.waitForElement(Problems.getSelectorInEditor(ProblemSeverity.ERROR));
assert.ok(error, `Warning squiggle is not shown in 'style.css'.`);

const problems = new Problems(app);
await problems.showProblemsView();
error = await app.client.waitForElement(Problems.getSelectorInProblemsView(ProblemSeverity.ERROR));
assert.ok(error, 'Warning does not appear in Problems view.');
await problems.hideProblemsView();
});
describe('CSS', () => {
let app: SpectronApplication = new SpectronApplication(LATEST_PATH, '', 0, [WORKSPACE_PATH]);
before(() => app.start());
after(() => app.stop());

it('verifies quick outline', async function () {
await app.workbench.quickopen.openFile('style.css');
const outline = new QuickOutline(app);
await outline.openSymbols();
const elements = await app.client.waitForElements(QuickOutline.QUICK_OPEN_ENTRY_SELECTOR, elements => elements.length === 2);
assert.ok(elements, `Did not find two outline elements`);
});

it('verifies warnings for the empty rule', async function () {
await app.workbench.quickopen.openFile('style.css');
await app.client.waitForElement(`.monaco-editor.focused`);
await app.type('.foo{}');

let warning = await app.client.waitForElement(Problems.getSelectorInEditor(ProblemSeverity.WARNING));
assert.ok(warning, `Warning squiggle is not shown in 'style.css'.`);

const problems = new Problems(app);
await problems.showProblemsView();
warning = await app.client.waitForElement(Problems.getSelectorInProblemsView(ProblemSeverity.WARNING));
assert.ok(warning, 'Warning does not appear in Problems view.');
await problems.hideProblemsView();
});

it('verifies that warning becomes an error once setting changed', async function () {
await new SettingsEditor(app).addUserSetting('css.lint.emptyRules', '"error"');
await app.workbench.quickopen.openFile('style.css');
await app.type('.foo{}');

let error = await app.client.waitForElement(Problems.getSelectorInEditor(ProblemSeverity.ERROR));
assert.ok(error, `Warning squiggle is not shown in 'style.css'.`);

const problems = new Problems(app);
await problems.showProblemsView();
error = await app.client.waitForElement(Problems.getSelectorInProblemsView(ProblemSeverity.ERROR));
assert.ok(error, 'Warning does not appear in Problems view.');
await problems.hideProblemsView();
});
}
});
39 changes: 18 additions & 21 deletions test/smoke/src/areas/explorer/explorer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,29 @@
*--------------------------------------------------------------------------------------------*/

import * as assert from 'assert';

import { SpectronApplication, LATEST_PATH, WORKSPACE_PATH } from '../../spectron/application';

export function testExplorer() {
describe('Explorer', () => {
let app: SpectronApplication = new SpectronApplication(LATEST_PATH, '', 0, [WORKSPACE_PATH]);
before(() => app.start());
after(() => app.stop());
describe('Explorer', () => {
let app: SpectronApplication = new SpectronApplication(LATEST_PATH, '', 0, [WORKSPACE_PATH]);
before(() => app.start());
after(() => app.stop());

it('quick open search produces correct result', async function () {
await app.workbench.quickopen.openQuickOpen();
await app.client.type('.js');
const elements = await app.workbench.quickopen.getQuickOpenElements();
await app.client.keys(['Escape', 'NULL']);
it('quick open search produces correct result', async function () {
await app.workbench.quickopen.openQuickOpen();
await app.client.type('.js');
const elements = await app.workbench.quickopen.getQuickOpenElements();
await app.client.keys(['Escape', 'NULL']);

assert.equal(elements.length, 7, 'There are 7 elements in quick open');
});
assert.equal(elements.length, 7, 'There are 7 elements in quick open');
});

it('quick open respects fuzzy matching', async function () {
await app.workbench.quickopen.openQuickOpen();
await app.client.type('a.s');
it('quick open respects fuzzy matching', async function () {
await app.workbench.quickopen.openQuickOpen();
await app.client.type('a.s');

const elements = await app.workbench.quickopen.getQuickOpenElements();
await app.client.keys(['Escape', 'NULL']);
const elements = await app.workbench.quickopen.getQuickOpenElements();
await app.client.keys(['Escape', 'NULL']);

assert.equal(elements.length, 3, 'There are 3 elements in quick open');
});
assert.equal(elements.length, 3, 'There are 3 elements in quick open');
});
}
});
39 changes: 17 additions & 22 deletions test/smoke/src/areas/extensions/extensions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,29 @@
*--------------------------------------------------------------------------------------------*/

import * as assert from 'assert';

import { SpectronApplication, LATEST_PATH, WORKSPACE_PATH } from '../../spectron/application';

export function testExtensions() {

describe('Extensions', () => {
let app: SpectronApplication = new SpectronApplication(LATEST_PATH, '', 0, [WORKSPACE_PATH]);
before(() => app.start());
after(() => app.stop());

// this used to run before each test
// await Util.rimraf(EXTENSIONS_DIR);
describe('Extensions', () => {
let app: SpectronApplication = new SpectronApplication(LATEST_PATH, '', 0, [WORKSPACE_PATH]);
before(() => app.start());
after(() => app.stop());

it(`install and activate vscode-smoketest-check extension`, async function () {
const extensionName = 'vscode-smoketest-check';
await app.workbench.extensions.openExtensionsViewlet();
// this used to run before each test
// await Util.rimraf(EXTENSIONS_DIR);

const installed = await app.workbench.extensions.installExtension(extensionName);
it(`install and activate vscode-smoketest-check extension`, async function () {
const extensionName = 'vscode-smoketest-check';
await app.workbench.extensions.openExtensionsViewlet();

assert.ok(installed);
const installed = await app.workbench.extensions.installExtension(extensionName);

await app.reload();
await app.workbench.extensions.waitForExtensionsViewlet();
await app.workbench.commandPallette.runCommand('Smoke Test Check');
assert.ok(installed);

const statusbarText = await app.client.waitForText('.statusbar-item.statusbar-entry span[title="smoke test"]');
assert.equal(statusbarText, 'VS Code Smoke Test Check');
});
await app.reload();
await app.workbench.extensions.waitForExtensionsViewlet();
await app.workbench.commandPallette.runCommand('Smoke Test Check');

const statusbarText = await app.client.waitForText('.statusbar-item.statusbar-entry span[title="smoke test"]');
assert.equal(statusbarText, 'VS Code Smoke Test Check');
});
}
});
33 changes: 15 additions & 18 deletions test/smoke/src/areas/multiroot/multiroot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,25 @@
*--------------------------------------------------------------------------------------------*/

import * as assert from 'assert';

import { SpectronApplication, LATEST_PATH, CODE_WORKSPACE_PATH } from '../../spectron/application';
import { QuickOpen } from '../quickopen/quickopen';
import { Window } from '../window';

export function testMultiRoot() {
describe('Multi Root', () => {
let app: SpectronApplication = new SpectronApplication(LATEST_PATH, '', 0, [CODE_WORKSPACE_PATH]);
before(() => app.start());
after(() => app.stop());
describe('Multi Root', () => {
let app: SpectronApplication = new SpectronApplication(LATEST_PATH, '', 0, [CODE_WORKSPACE_PATH]);
before(() => app.start());
after(() => app.stop());

it('shows results from all folders', async function () {
let quickOpen = new QuickOpen(app);
await quickOpen.openQuickOpen();
await app.type('*.*');
const elements = await quickOpen.getQuickOpenElements();
assert.equal(elements.length, 6);
});
it('shows results from all folders', async function () {
let quickOpen = new QuickOpen(app);
await quickOpen.openQuickOpen();
await app.type('*.*');
const elements = await quickOpen.getQuickOpenElements();
assert.equal(elements.length, 6);
});

it('shows workspace name in title', async function () {
const title = await new Window(app).getTitle();
assert.ok(title.indexOf('smoketest (Workspace)') >= 0);
});
it('shows workspace name in title', async function () {
const title = await new Window(app).getTitle();
assert.ok(title.indexOf('smoketest (Workspace)') >= 0);
});
}
});
32 changes: 14 additions & 18 deletions test/smoke/src/areas/preferences/keybindings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,25 @@
*--------------------------------------------------------------------------------------------*/

import * as assert from 'assert';

import { SpectronApplication, LATEST_PATH, WORKSPACE_PATH } from '../../spectron/application';
import { ActivityBarPosition } from '../../areas/activitybar/activityBar';
import { KeybindingsEditor } from './keybindings';

export function testKeybindings() {

describe('Keybindings Customisation', () => {
let app: SpectronApplication = new SpectronApplication(LATEST_PATH, '', 0, [WORKSPACE_PATH]);
before(() => app.start());
after(() => app.stop());
describe('Keybindings Customisation', () => {
let app: SpectronApplication = new SpectronApplication(LATEST_PATH, '', 0, [WORKSPACE_PATH]);
before(() => app.start());
after(() => app.stop());

it(`changes 'workbench.action.toggleSidebarPosition' command key binding and verifies it`, async function () {
let activityBarElement = await app.workbench.activitybar.getActivityBar(ActivityBarPosition.LEFT);
assert.ok(activityBarElement, 'Activity bar should be positioned on the left.');
it(`changes 'workbench.action.toggleSidebarPosition' command key binding and verifies it`, async function () {
let activityBarElement = await app.workbench.activitybar.getActivityBar(ActivityBarPosition.LEFT);
assert.ok(activityBarElement, 'Activity bar should be positioned on the left.');

const keybindingsEditor = new KeybindingsEditor(app);
await keybindingsEditor.openKeybindings();
await keybindingsEditor.updateKeybinding('workbench.action.toggleSidebarPosition', ['Control', 'u', 'NULL'], 'Control+U');
const keybindingsEditor = new KeybindingsEditor(app);
await keybindingsEditor.openKeybindings();
await keybindingsEditor.updateKeybinding('workbench.action.toggleSidebarPosition', ['Control', 'u', 'NULL'], 'Control+U');

await app.client.keys(['Control', 'u', 'NULL']);
activityBarElement = await app.workbench.activitybar.getActivityBar(ActivityBarPosition.RIGHT);
assert.ok(activityBarElement, 'Activity bar was not moved to right after toggling its position.');
});
await app.client.keys(['Control', 'u', 'NULL']);
activityBarElement = await app.workbench.activitybar.getActivityBar(ActivityBarPosition.RIGHT);
assert.ok(activityBarElement, 'Activity bar was not moved to right after toggling its position.');
});
}
});
37 changes: 17 additions & 20 deletions test/smoke/src/areas/preferences/settings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,27 @@
*--------------------------------------------------------------------------------------------*/

import * as assert from 'assert';

import { SpectronApplication, LATEST_PATH, WORKSPACE_PATH } from '../../spectron/application';
import { SettingsEditor } from './settings';

export function testSettings() {
describe('Settings Customisation', () => {
let app: SpectronApplication = new SpectronApplication(LATEST_PATH, '', 0, [WORKSPACE_PATH]);
before(() => app.start());
after(() => app.stop());
describe('Settings Customisation', () => {
let app: SpectronApplication = new SpectronApplication(LATEST_PATH, '', 0, [WORKSPACE_PATH]);
before(() => app.start());
after(() => app.stop());

it('turns off editor line numbers and verifies the live change', async function () {
await app.workbench.explorer.openFile('app.js');
let lineNumbers = await app.client.waitForElements('.line-numbers');
assert.ok(!!lineNumbers.length, 'Line numbers are not present in the editor before disabling them.');
it('turns off editor line numbers and verifies the live change', async function () {
await app.workbench.explorer.openFile('app.js');
let lineNumbers = await app.client.waitForElements('.line-numbers');
assert.ok(!!lineNumbers.length, 'Line numbers are not present in the editor before disabling them.');

const settingsEditor = new SettingsEditor(app);
await settingsEditor.openUserSettings();
await settingsEditor.focusEditableSettings();
await app.client.keys(`"editor.lineNumbers": "off"`);
await app.workbench.saveOpenedFile();
const settingsEditor = new SettingsEditor(app);
await settingsEditor.openUserSettings();
await settingsEditor.focusEditableSettings();
await app.client.keys(`"editor.lineNumbers": "off"`);
await app.workbench.saveOpenedFile();

await app.workbench.selectTab('app.js');
lineNumbers = await app.client.waitForElements('.line-numbers', result => !result || result.length === 0);
assert.ok(!lineNumbers.length, 'Line numbers are still present in the editor after disabling them.');
});
await app.workbench.selectTab('app.js');
lineNumbers = await app.client.waitForElements('.line-numbers', result => !result || result.length === 0);
assert.ok(!lineNumbers.length, 'Line numbers are still present in the editor after disabling them.');
});
}
});
Loading

0 comments on commit 4fe77bc

Please sign in to comment.