提交 e52d9b7e 编写于 作者: S Sandeep Somavarapu

Smoke test: Capture screen shots

上级 9b3e758d
......@@ -11,6 +11,7 @@ describe('Editor', () => {
let app: SpectronApplication;
before(() => { app = new SpectronApplication(); return app.start(); });
after(() => app.stop());
beforeEach(function () { app.createScreenshotCapturer(this.currentTest); });
it('shows correct quick outline', async function () {
await app.workbench.quickopen.openFile('www');
......@@ -18,6 +19,7 @@ describe('Editor', () => {
const outline = await app.workbench.editor.openOutline();
const symbols = await outline.getQuickOpenElements();
app.screenshot.capture('Javascript Outline result');
assert.equal(symbols.length, 12, 'Quick outline elements count does not match to expected.');
});
......@@ -27,6 +29,7 @@ describe('Editor', () => {
const references = await app.workbench.editor.findReferences('app', 7);
const countInTitle = await references.getCountFromTitle();
app.screenshot.capture('References result');
assert.equal(countInTitle, 3, 'References count in widget title is not as expected.');
const referencesCount = await references.getCount();
assert.equal(referencesCount, 3, 'References count in tree is not as expected.');
......@@ -42,6 +45,7 @@ describe('Editor', () => {
rename.rename('newApp');
const actual = await app.client.waitForText(selector, 'newApp');
app.screenshot.capture('Rename result');
assert.equal(actual, 'newApp');
});
......@@ -75,6 +79,7 @@ describe('Editor', () => {
const peek = await app.workbench.editor.peekDefinition('express', 11);
const definitionFilename = await peek.getFileNameFromTitle();
app.screenshot.capture('Peek definition result');
assert.equal(definitionFilename, 'index.d.ts', 'Peek result is not as expected.');
});
});
\ No newline at end of file
......@@ -10,6 +10,7 @@ describe('Explorer', () => {
let app: SpectronApplication;
before(() => { app = new SpectronApplication(); return app.start(); });
after(() => app.stop());
beforeEach(function () { app.createScreenshotCapturer(this.currentTest); });
it('quick open search produces correct result', async function () {
await app.workbench.quickopen.openQuickOpen();
......@@ -17,6 +18,7 @@ describe('Explorer', () => {
const elements = await app.workbench.quickopen.getQuickOpenElements();
await app.client.keys(['Escape', 'NULL']);
app.screenshot.capture('Quick open result');
assert.equal(elements.length, 7, 'There are 7 elements in quick open');
});
......@@ -27,6 +29,7 @@ describe('Explorer', () => {
const elements = await app.workbench.quickopen.getQuickOpenElements();
await app.client.keys(['Escape', 'NULL']);
app.screenshot.capture('fuzzy match result');
assert.equal(elements.length, 3, 'There are 3 elements in quick open');
});
});
\ No newline at end of file
......@@ -10,6 +10,7 @@ describe('Extensions', () => {
let app: SpectronApplication;
before(() => { app = new SpectronApplication(); return app.start(); });
after(() => app.stop());
beforeEach(function () { app.createScreenshotCapturer(this.currentTest); });
it(`install and activate vscode-smoketest-check extension`, async function () {
if (app.build === VSCODE_BUILD.DEV) {
......@@ -19,15 +20,14 @@ describe('Extensions', () => {
await app.workbench.extensions.openExtensionsViewlet();
const installed = await app.workbench.extensions.installExtension(extensionName);
assert.ok(installed);
await app.reload();
await app.workbench.extensions.waitForExtensionsViewlet();
await app.workbench.commandPallette.runCommand('Smoke Test Check');
const statusbarText = await app.workbench.statusbar.getStatusbarTextByTitle('smoke test');
app.screenshot.capture('Statusbar');
assert.equal(statusbarText, 'VS Code Smoke Test Check');
});
});
\ No newline at end of file
......@@ -13,6 +13,7 @@ describe('Git', () => {
let app: SpectronApplication;
before(() => { app = new SpectronApplication(); return app.start(); });
after(() => app.stop());
beforeEach(function () { app.createScreenshotCapturer(this.currentTest); });
it('reflects working tree changes', async function () {
await app.workbench.scm.openSCMViewlet();
......@@ -28,6 +29,7 @@ describe('Git', () => {
await app.workbench.scm.refreshSCMViewlet();
const appJs = await app.workbench.scm.waitForChange(c => c.name === 'app.js');
const indexJade = await app.workbench.scm.waitForChange(c => c.name === 'index.jade');
app.screenshot.capture('changes');
assert.equal(appJs.name, 'app.js');
assert.equal(appJs.type, 'Modified');
......
......@@ -4,25 +4,32 @@
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { SpectronApplication, CODE_WORKSPACE_PATH } from '../../spectron/application';
import { SpectronApplication, CODE_WORKSPACE_PATH, VSCODE_BUILD } from '../../spectron/application';
import { QuickOpen } from '../quickopen/quickopen';
import { Window } from '../window';
describe('Multi Root', () => {
let app: SpectronApplication;
before(() => { app = new SpectronApplication(void 0, CODE_WORKSPACE_PATH); return app.start(); });
let app: SpectronApplication = new SpectronApplication(void 0, CODE_WORKSPACE_PATH);
if (app.build === VSCODE_BUILD.STABLE) {
return;
}
before(() => app.start());
after(() => app.stop());
beforeEach(function () { app.createScreenshotCapturer(this.currentTest); });
it('shows results from all folders', async function () {
let quickOpen = new QuickOpen(app);
await quickOpen.openQuickOpen();
await app.client.type('*.*');
const elements = await quickOpen.getQuickOpenElements();
app.screenshot.capture('quick open result');
assert.equal(elements.length, 6);
});
it('shows workspace name in title', async function () {
const title = await new Window(app).getTitle();
app.screenshot.capture('window title');
assert.ok(title.indexOf('smoketest (Workspace)') >= 0);
});
});
\ No newline at end of file
......@@ -12,10 +12,12 @@ describe('Preferences', () => {
let app: SpectronApplication;
before(() => { app = new SpectronApplication(); return app.start(); });
after(() => app.stop());
beforeEach(function () { app.createScreenshotCapturer(this.currentTest); });
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');
app.screenshot.capture('line numbers');
assert.ok(!!lineNumbers.length, 'Line numbers are not present in the editor before disabling them.');
await app.workbench.settingsEditor.openUserSettings();
......@@ -25,18 +27,17 @@ describe('Preferences', () => {
await app.workbench.selectTab('app.js');
lineNumbers = await app.client.waitForElements('.line-numbers', result => !result || result.length === 0);
app.screenshot.capture('line numbers hidden');
assert.ok(!lineNumbers.length, 'Line numbers are still present in the editor after disabling them.');
});
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.');
assert.ok(await app.workbench.activitybar.getActivityBar(ActivityBarPosition.LEFT), 'Activity bar should be positioned on the left.');
await app.workbench.keybindingsEditor.openKeybindings();
await app.workbench.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.');
assert.ok(await app.workbench.activitybar.getActivityBar(ActivityBarPosition.RIGHT), 'Activity bar was not moved to right after toggling its position.');
});
});
\ No newline at end of file
......@@ -13,19 +13,20 @@ describe('Statusbar', () => {
let app: SpectronApplication;
before(() => { app = new SpectronApplication(); return app.start(); });
after(() => app.stop());
beforeEach(function () { app.createScreenshotCapturer(this.currentTest); });
it('verifies presence of all default status bar elements', async function () {
assert.ok(app.workbench.statusbar.isVisible(StatusBarElement.BRANCH_STATUS), 'Branch indicator is not visible.');
assert.ok(app.workbench.statusbar.isVisible(StatusBarElement.FEEDBACK_ICON), 'Feedback icon is not visible.');
assert.ok(app.workbench.statusbar.isVisible(StatusBarElement.SYNC_STATUS), 'Sync indicator is not visible.');
assert.ok(app.workbench.statusbar.isVisible(StatusBarElement.PROBLEMS_STATUS), 'Problems indicator is not visible.');
assert.ok(await app.workbench.statusbar.waitForStatusbarElement(StatusBarElement.BRANCH_STATUS), 'Branch indicator is not visible.');
assert.ok(await app.workbench.statusbar.waitForStatusbarElement(StatusBarElement.FEEDBACK_ICON), 'Feedback icon is not visible.');
assert.ok(await app.workbench.statusbar.waitForStatusbarElement(StatusBarElement.SYNC_STATUS), 'Sync indicator is not visible.');
assert.ok(await app.workbench.statusbar.waitForStatusbarElement(StatusBarElement.PROBLEMS_STATUS), 'Problems indicator is not visible.');
await app.workbench.quickopen.openFile('app.js');
assert.ok(app.workbench.statusbar.isVisible(StatusBarElement.ENCODING_STATUS), 'Encoding indicator is not visible.');
assert.ok(app.workbench.statusbar.isVisible(StatusBarElement.EOL_STATUS), 'EOL indicator is not visible.');
assert.ok(app.workbench.statusbar.isVisible(StatusBarElement.INDENTATION_STATUS), 'Indentation indicator is not visible.');
assert.ok(app.workbench.statusbar.isVisible(StatusBarElement.LANGUAGE_STATUS), 'Language indicator is not visible.');
assert.ok(app.workbench.statusbar.isVisible(StatusBarElement.SELECTION_STATUS), 'Selection indicator is not visible.');
assert.ok(await app.workbench.statusbar.waitForStatusbarElement(StatusBarElement.ENCODING_STATUS), 'Encoding indicator is not visible.');
assert.ok(await app.workbench.statusbar.waitForStatusbarElement(StatusBarElement.EOL_STATUS), 'EOL indicator is not visible.');
assert.ok(await app.workbench.statusbar.waitForStatusbarElement(StatusBarElement.INDENTATION_STATUS), 'Indentation indicator is not visible.');
assert.ok(await app.workbench.statusbar.waitForStatusbarElement(StatusBarElement.LANGUAGE_STATUS), 'Language indicator is not visible.');
assert.ok(await app.workbench.statusbar.waitForStatusbarElement(StatusBarElement.SELECTION_STATUS), 'Selection indicator is not visible.');
});
it(`verifies that 'quick open' opens when clicking on status bar elements`, async function () {
......
......@@ -24,8 +24,8 @@ export class StatusBar {
constructor(private spectron: SpectronApplication) {
}
public async isVisible(element: StatusBarElement): Promise<boolean> {
return this.spectron.client.isVisible(this.getSelector(element));
public async waitForStatusbarElement(element: StatusBarElement): Promise<void> {
await this.spectron.client.waitForElement(this.getSelector(element));
}
public async clickOn(element: StatusBarElement): Promise<void> {
......
......@@ -10,6 +10,7 @@ describe('Terminal', () => {
let app: SpectronApplication;
before(() => { app = new SpectronApplication(); return app.start(); });
after(() => app.stop());
beforeEach(function () { app.createScreenshotCapturer(this.currentTest); });
it(`opens terminal, runs 'echo' and verifies the output`, async function () {
const expected = new Date().getTime().toString();
......@@ -19,6 +20,7 @@ describe('Terminal', () => {
await app.workbench.terminal.runCommand(`echo ${expected}`);
const actual = await app.workbench.terminal.waitForText(currentLine + 1, text => !!text.trim());
app.screenshot.capture('Terminal text');
assert.equal(actual.trim(), expected);
});
});
\ No newline at end of file
......@@ -10,6 +10,7 @@ describe('Dataloss', () => {
let app: SpectronApplication;
before(() => { app = new SpectronApplication(); return app.start(); });
after(() => app.stop());
beforeEach(function () { app.createScreenshotCapturer(this.currentTest); });
it(`verifies that 'hot exit' works for dirty files`, async function () {
const textToType = 'Hello, Code', textToTypeInUntitled = 'Hello, Unitled Code', fileName = 'readme.md', untitled = 'Untitled-1';
......@@ -22,11 +23,13 @@ describe('Dataloss', () => {
assert.ok(await app.workbench.waitForActiveOpen(fileName, true), `${fileName} tab is not present or is not active after reopening.`);
let actual = await app.workbench.editor.getEditorFirstLineText();
app.screenshot.capture(fileName + ' text');
assert.ok(actual.startsWith(textToType), `${actual} did not start with ${textToType}`);
assert.ok(await app.workbench.waitForOpen(untitled, true), `${untitled} tab is not present after reopening.`);
await app.workbench.selectTab('Untitled-1', true);
actual = await app.workbench.editor.getEditorFirstLineText();
app.screenshot.capture('Untitled file text');
assert.ok(actual.startsWith(textToTypeInUntitled), `${actual} did not start with ${textToTypeInUntitled}`);
});
});
\ No newline at end of file
......@@ -16,6 +16,7 @@ describe('Data Migration', () => {
let app: SpectronApplication;
afterEach(() => app.stop());
beforeEach(function () { app.createScreenshotCapturer(this.currentTest); });
it('checks if the Untitled file is restored migrating from stable to latest', async function () {
const textToType = 'Very dirty file';
......@@ -36,6 +37,7 @@ describe('Data Migration', () => {
assert.ok(await app.workbench.waitForActiveOpen('Untitled-1', true), `Untitled-1 tab is not present after migration.`);
const actual = await app.workbench.editor.getEditorFirstLineText();
app.screenshot.capture('Untitled file text');
assert.ok(actual.startsWith(textToType), `${actual} did not start with ${textToType}`);
});
......@@ -62,6 +64,7 @@ describe('Data Migration', () => {
assert.ok(await app.workbench.waitForActiveOpen(fileName.split('/')[1]), `Untitled-1 tab is not present after migration.`);
const actual = await app.workbench.editor.getEditorFirstLineText();
app.screenshot.capture(fileName + ' text');
assert.ok(actual.startsWith(firstTextPart.concat(secondTextPart)), `${actual} did not start with ${firstTextPart.concat(secondTextPart)}`);
await Util.removeFile(`${fileName}`);
......
......@@ -12,6 +12,7 @@ describe('Localization', () => {
let app: SpectronApplication;
before(() => { app = new SpectronApplication(); });
after(() => app.stop());
beforeEach(function () { app.createScreenshotCapturer(this.currentTest); });
it(`starts with 'DE' locale and verifies title and viewlets text is in German`, async function () {
if (app.build === VSCODE_BUILD.DEV) {
......@@ -20,22 +21,27 @@ describe('Localization', () => {
await app.start();
let text = await app.workbench.explorer.getOpenEditorsViewTitle();
app.screenshot.capture('Open editors title');
assert.equal(text.toLowerCase(), 'geöffnete editoren');
await app.workbench.search.openSearchViewlet();
text = await app.workbench.search.getTitle();
app.screenshot.capture('Search title');
assert.equal(text.toLowerCase(), 'suchen');
await app.workbench.scm.openSCMViewlet();
text = await app.workbench.scm.getTitle();
app.screenshot.capture('Scm title');
assert.equal(text.toLowerCase(), 'quellcodeverwaltung: git');
await app.workbench.debug.openDebugViewlet();
text = await app.workbench.debug.getTitle();
app.screenshot.capture('Debug title');
assert.equal(text.toLowerCase(), 'quellcodeverwaltung: git');
await app.workbench.extensions.openExtensionsViewlet();
text = await app.workbench.extensions.getTitle();
app.screenshot.capture('Extensions title');
assert.equal(text.toLowerCase(), 'nach erweiterungen im marketplace suchen');
});
});
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册