Provide more info about test failures thrugh catching more webdriverio exceptions.

This commit is contained in:
Michel Kaporin
2017-06-23 17:10:56 +02:00
parent e0d0a4ecd3
commit 8e0d8cfc1e
23 changed files with 208 additions and 91 deletions

View File

@@ -30,12 +30,12 @@ export function testConfigViews() {
it('turns off editor line numbers and verifies the live change', async function () {
await common.newUntitledFile();
await app.wait();
let elements = await configView.getEditorLineNumbers();
assert.equal(elements.value.length, 1);
let elementsCount = await configView.getEditorLineNumbers();
assert.equal(elementsCount, 1, 'Line numbers are not present in the editor before disabling them.');
await common.addSetting('editor.lineNumbers', 'off');
await app.wait();
elements = await configView.getEditorLineNumbers();
assert.equal(elements.value.length, 0);
elementsCount = await configView.getEditorLineNumbers();
assert.equal(elementsCount, 0, 'Line numbers are still present in the editor after disabling them.');
});
it(`changes 'workbench.action.toggleSidebarPosition' command key binding and verifies it`, async function () {
@@ -47,11 +47,11 @@ export function testConfigViews() {
await configView.enterBinding(['Control', 'u', 'NULL']);
await common.enter();
let html = await configView.getActivityBar(ActivityBarPosition.RIGHT);
assert.equal(html, undefined);
assert.equal(html, undefined, 'Activity bar is positioned on the right, whereas should not be.');
await app.wait();
await configView.toggleActivityBarPosition();
html = await configView.getActivityBar(ActivityBarPosition.RIGHT);
assert.ok(html);
assert.ok(html, 'Activity bar was not moved to right after toggling its position.');
});
});
}

View File

@@ -32,7 +32,7 @@ export function testCSS() {
await css.openQuickOutline();
await app.wait();
const count = await common.getQuickOpenElements();
assert.equal(count, 2);
assert.equal(count, 2, 'Quick outline symbol count is wrong.');
});
it('verifies warnings for the empty rule', async function () {
@@ -40,10 +40,10 @@ export function testCSS() {
await common.type('.foo{}');
await app.wait();
let warning = await css.getEditorProblem(CSSProblem.WARNING);
assert.ok(warning);
assert.ok(warning, `Warning squiggle is not shown in 'style.css'.`);
await css.toggleProblemsView();
warning = await css.getProblemsViewsProblem(CSSProblem.WARNING);
assert.ok(warning);
assert.ok(warning, 'Warning does not appear in Problems view.');
});
it('verifies that warning becomes an error once setting changed', async function () {
@@ -52,10 +52,10 @@ export function testCSS() {
await common.type('.foo{}');
await app.wait();
let error = await css.getEditorProblem(CSSProblem.ERROR);
assert.ok(error);
assert.ok(error, `Error squiggle is not shown in 'style.css'.`);
await css.toggleProblemsView();
error = await css.getProblemsViewsProblem(CSSProblem.ERROR);
assert.ok(error);
assert.ok(error, `Error does not appear in Problems view`);
});
});
}

View File

@@ -40,11 +40,11 @@ export function testDataLoss() {
await app.start();
// check tab presence
assert.ok(await common.getTab(untitled));
assert.ok(await common.getTab(fileName, true));
assert.ok(await common.getTab(untitled), `${untitled} tab is not present after reopening.`);
assert.ok(await common.getTab(fileName, true), `${fileName} tab is not present or is not active after reopening.`);
// check if they marked as dirty (icon) and active tab is the last opened
assert.ok(await dl.verifyTabIsDirty(untitled));
assert.ok(await dl.verifyTabIsDirty(fileName, true));
assert.ok(await dl.verifyTabIsDirty(untitled), `${untitled} tab is not dirty after reopening.`);
assert.ok(await dl.verifyTabIsDirty(fileName, true), `${fileName} tab is not dirty after reopening.`);
});
it(`verifies that contents of the dirty files are restored after 'hot exit'`, async function () {
@@ -65,10 +65,10 @@ export function testDataLoss() {
// check their contents
let fileDirt = await common.getEditorFirstLinePlainText();
assert.equal(fileDirt, 'Hello, Code'); // ignore '!' as it is a separate <span/>, first part is enough
assert.equal(fileDirt, 'Hello, Code', 'Active file contents are different after restore.'); // ignore '!' as it is a separate <span/>, first part is enough
await common.selectTab('Untitled-1');
fileDirt = await common.getEditorFirstLinePlainText();
assert.equal(fileDirt, textToType);
assert.equal(fileDirt, textToType, 'Untitled file edit are different after restore.');
});
});
}

View File

@@ -51,10 +51,10 @@ export function testDataMigration() {
setupSpectron(this, LATEST_PATH);
await app.start();
assert.ok(await common.getTab('Untitled-1'));
assert.ok(await common.getTab('Untitled-1'), 'Untitled-1 tab was not restored after migration.');
await common.selectTab('Untitled-1');
const editorText = await common.getEditorFirstLinePlainText();
assert.equal(editorText, textToType);
assert.equal(editorText, textToType, 'Typed editor text does not match to the one after migration.');
});
it('checks if the newly created dirty file is restored migrating from stable to latest', async function () {
@@ -77,10 +77,10 @@ export function testDataMigration() {
// Checking latest version for the restored state
setupSpectron(this, LATEST_PATH);
await app.start();
assert.ok(await common.getTab(fileName.split('/')[1]));
assert.ok(await common.getTab(fileName.split('/')[1]), `${fileName} was not restored after migration.`);
await common.selectTab(fileName.split('/')[1]);
const editorText = await common.getEditorFirstLinePlainText();
assert.equal(editorText, firstTextPart.concat(secondTextPart));
assert.equal(editorText, firstTextPart.concat(secondTextPart), 'Entered text was not correctly restored after migration.');
// Cleanup
await common.removeFile(`${fileName}`);
@@ -97,9 +97,9 @@ export function testDataMigration() {
setupSpectron(this, LATEST_PATH, [WORKSPACE_PATH]);
await app.start();
assert.ok(await common.getTab(fileName1));
assert.ok(await common.getTab(fileName2));
assert.ok(await common.getTab(fileName3));
assert.ok(await common.getTab(fileName1), `${fileName1} tab was not restored after migration.`);
assert.ok(await common.getTab(fileName2), `${fileName2} tab was not restored after migration.`);
assert.ok(await common.getTab(fileName3), `${fileName3} tab was not restored after migration.`);
});
});
}

View File

@@ -31,17 +31,17 @@ export function testGit() {
const changesCount = await git.getScmIconChanges();
assert.equal(changesCount, 2);
await git.openGitViewlet();
assert.ok(await git.verifyScmChange('app.js'));
assert.ok(await git.verifyScmChange('launch.json'));
assert.ok(await git.verifyScmChange('app.js'), 'app.js change does not appear in SCM viewlet.');
assert.ok(await git.verifyScmChange('launch.json'), 'launch.json change does not appear in SCM viewlet.');
});
it(`verifies 'app.js' diff viewer changes`, async function () {
await git.openGitViewlet();
await common.openFile('app.js');
const original = await git.getOriginalAppJsBodyVarName();
assert.equal(original, 'bodyParser');
assert.equal(original, 'bodyParser', 'Original value from diff view is wrong.');
const modified = await git.getModifiedAppJsBodyVarName();
assert.equal(modified, 'ydobParser');
assert.equal(modified, 'ydobParser', 'Modified value from diff view is wrong.');
});
it(`stages 'app.js' changes and checks stage count`, async function () {
@@ -63,7 +63,7 @@ export function testGit() {
await common.type('Test commit');
await git.pressCommit();
const changes = await git.getOutgoingChanges();
assert.equal(changes, ' 0↓ 1↑');
assert.equal(changes, ' 0↓ 1↑', 'Changes indicator is wrong in a status bar.');
});
});
}

View File

@@ -34,7 +34,7 @@ export function testIntegratedTerminal() {
await common.type(command);
await common.enter();
await app.wait();
assert.ok(await terminal.commandOutputHas('test'));
assert.ok(await terminal.commandOutputHas('test'), 'Terminal output does not contain echo.');
});
});
}

View File

@@ -38,7 +38,7 @@ export function testJavaScriptDebug() {
await common.openFirstMatchFile('index.js');
await jsDebug.setBreakpointOnLine(6);
const breakpoint = await jsDebug.verifyBreakpointOnLine(6);
assert.ok(breakpoint);
assert.ok(breakpoint, 'Breakpoint was not found on line 6.');
});
});
}

View File

@@ -73,7 +73,7 @@ export function testJavaScript() {
await common.openFirstMatchFile('app.js');
await js.goToExpressDefinition();
await app.wait();
assert.ok(await common.getTab('index.d.ts'));
assert.ok(await common.getTab('index.d.ts'), 'Tab opened when navigating to definition is not as expected.');
});
it(`verifies that 'Peek Definition' works`, async function () {
@@ -81,7 +81,7 @@ export function testJavaScript() {
await js.peekExpressDefinition();
await app.wait();
const definitionFilename = await js.getPeekExpressResultName();
assert.equal(definitionFilename, 'index.d.ts');
assert.equal(definitionFilename, 'index.d.ts', 'Peek result is not as expected.');
});
});
}

View File

@@ -53,7 +53,7 @@ export function testSearch() {
await s.dismissResult();
await app.wait();
const result = await s.getResultText();
assert.equal(result, '3 results in 3 files');
assert.equal(result, '3 results in 3 files', 'Result number after dismissal does not match to expected.');
});
it('replaces first search result with a replace term', async function () {
@@ -67,7 +67,7 @@ export function testSearch() {
await app.wait();
await common.saveOpenedFile();
const result = await s.getResultText();
assert.equal(result, '3 results in 3 files');
assert.equal(result, '3 results in 3 files', 'Result number after replacemenet does not match to expected.');
});
});
}

View File

@@ -29,37 +29,37 @@ export function testStatusbar() {
it('verifies presence of all default status bar elements', async function () {
await app.wait();
assert.ok(await statusBar.isVisible(StatusBarElement.BRANCH_STATUS));
assert.ok(await statusBar.isVisible(StatusBarElement.FEEDBACK_ICON));
assert.ok(await statusBar.isVisible(StatusBarElement.SYNC_STATUS));
assert.ok(await statusBar.isVisible(StatusBarElement.PROBLEMS_STATUS));
assert.ok(await statusBar.isVisible(StatusBarElement.BRANCH_STATUS), 'Branch indicator is not visible.');
assert.ok(await statusBar.isVisible(StatusBarElement.FEEDBACK_ICON), 'Feedback icon is not visible.');
assert.ok(await statusBar.isVisible(StatusBarElement.SYNC_STATUS), 'Sync indicator is not visible.');
assert.ok(await statusBar.isVisible(StatusBarElement.PROBLEMS_STATUS), 'Problems indicator is not visible.');
await common.openFirstMatchFile('app.js');
assert.ok(await statusBar.isVisible(StatusBarElement.ENCODING_STATUS));
assert.ok(await statusBar.isVisible(StatusBarElement.EOL_STATUS));
assert.ok(await statusBar.isVisible(StatusBarElement.INDENTATION_STATUS));
assert.ok(await statusBar.isVisible(StatusBarElement.LANGUAGE_STATUS));
assert.ok(await statusBar.isVisible(StatusBarElement.SELECTION_STATUS));
assert.ok(await statusBar.isVisible(StatusBarElement.ENCODING_STATUS), 'Encoding indicator is not visible.');
assert.ok(await statusBar.isVisible(StatusBarElement.EOL_STATUS), 'EOL indicator is not visible.');
assert.ok(await statusBar.isVisible(StatusBarElement.INDENTATION_STATUS), 'Indentation indicator is not visible.');
assert.ok(await statusBar.isVisible(StatusBarElement.LANGUAGE_STATUS), 'Language indicator is not visible.');
assert.ok(await statusBar.isVisible(StatusBarElement.SELECTION_STATUS), 'Selection indicator is not visible.');
});
it(`verifies that 'quick open' opens when clicking on 'Branch', 'Indentation Status, 'Encoding', 'EOL' and 'Language' status elements`, async function () {
it(`verifies that 'quick open' opens when clicking on status bar elements`, async function () {
await app.wait();
await statusBar.clickOn(StatusBarElement.BRANCH_STATUS);
assert.ok(await statusBar.isQuickOpenWidgetVisible());
assert.ok(await statusBar.isQuickOpenWidgetVisible(), 'Quick open is not opened for branch indicator.');
await common.closeQuickOpen();
await common.openFirstMatchFile('app.js');
await statusBar.clickOn(StatusBarElement.INDENTATION_STATUS);
assert.ok(await statusBar.isQuickOpenWidgetVisible());
assert.ok(await statusBar.isQuickOpenWidgetVisible(), 'Quick open is not opened for indentation indicator.');
await common.closeQuickOpen();
await statusBar.clickOn(StatusBarElement.ENCODING_STATUS);
assert.ok(await statusBar.isQuickOpenWidgetVisible());
assert.ok(await statusBar.isQuickOpenWidgetVisible(), 'Quick open is not opened for encoding indicator.');
await common.closeQuickOpen();
await statusBar.clickOn(StatusBarElement.EOL_STATUS);
assert.ok(await statusBar.isQuickOpenWidgetVisible());
assert.ok(await statusBar.isQuickOpenWidgetVisible(), 'Quick open is not opened for EOL indicator.');
await common.closeQuickOpen();
await statusBar.clickOn(StatusBarElement.LANGUAGE_STATUS);
assert.ok(await statusBar.isQuickOpenWidgetVisible());
assert.ok(await statusBar.isQuickOpenWidgetVisible(), 'Quick open is not opened for language indicator.');
await common.closeQuickOpen();
});
@@ -79,7 +79,7 @@ export function testStatusbar() {
const lineNumber = 15;
await common.type(lineNumber.toString());
await common.enter();
assert.ok(await statusBar.getEditorHighlightedLine(lineNumber));
assert.ok(await statusBar.getEditorHighlightedLine(lineNumber), 'Editor does not highlight the line.');
});
it(`verifies if changing EOL is reflected in the status bar`, async function () {

View File

@@ -48,9 +48,9 @@ export function testTasks() {
await tasks.build();
await tasks.openProblemsView();
const problemName = await tasks.getProblemsViewFirstElementName();
assert.equal(problemName, 'index.js');
assert.equal(problemName, 'index.js', `'index.js' is not a build error.`);
const problemsCount = await tasks.getProblemsViewFirstElementCount();
assert.equal(problemsCount, '1');
assert.equal(problemsCount, '1', `Problem count is different to expected.`);
});
});
}