From c91b3ca00f8e1ca4818ddf8a2a8d9ff73eb15dc6 Mon Sep 17 00:00:00 2001 From: inikulin Date: Mon, 21 Mar 2016 15:01:36 +0300 Subject: [PATCH] Redesign error decorator, so it fits needs of both API versions (#374 part5) --- package.json | 6 +- src/errors/test-run/formattable-adapter.js | 21 +- .../test-run-error/formattable-adapter.js | 25 +- src/legacy/test-run-error/templates.js | 149 ++++----- src/legacy/test-run/index.js | 14 +- src/reporter/plugin-host.js | 45 ++- .../empty-first-argument | 2 +- .../empty-type-action-argument | 2 +- .../eq-assertion | 2 +- .../incorrect-dragging-second-argument | 2 +- .../incorrect-press-action-argument | 2 +- .../incorrect-select-action-arguments | 2 +- ...correct-wait-action-milliseconds-arguments | 2 +- .../incorrect-wait-for-action-event-argument | 2 +- ...incorrect-wait-for-action-timeout-argument | 2 +- .../invisible-action-element | 2 +- .../not-eq-assertion | 2 +- .../not-ok-assertion | 2 +- .../ok-assertion | 2 +- .../upload-can-not-find-file-to-upload | 2 +- .../upload-element-is-not-file-input | 2 +- .../upload-invalid-file-path-argument | 2 +- .../wait-for-action-timeout-exceeded | 8 +- .../legacy-test-run-error-formatting-test.js | 316 +++++++----------- 24 files changed, 285 insertions(+), 331 deletions(-) diff --git a/package.json b/package.json index 9c1d95ff080..9ce0fce017c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "testcafe", - "version": "0.0.11", + "version": "0.0.12", "main": "lib/index", "bin": { "testcafe": "./bin/testcafe" @@ -12,13 +12,14 @@ "babel-preset-es2015-node4": "^2.0.2", "babel-preset-stage-2": "^6.3.13", "babel-runtime": "^6.3.19", - "callsite-record": "^1.0.2", + "callsite-record": "^2.0.0", "chalk": "^1.1.0", "commander": "^2.8.1", "dedent": "^0.4.0", "elegant-spinner": "^1.0.1", "endpoint-utils": "^1.0.0", "globby": "^3.0.1", + "highlight-es": "^1.0.0", "indent-string": "^1.2.2", "is-glob": "^2.0.1", "lodash": "^4.5.1", @@ -106,6 +107,7 @@ "elegant-spinner", "endpoint-utils", "globby", + "highlight-es", "indent-string", "is-glob", "lodash", diff --git a/src/errors/test-run/formattable-adapter.js b/src/errors/test-run/formattable-adapter.js index e6905f61c4f..e0ee84a1fd5 100644 --- a/src/errors/test-run/formattable-adapter.js +++ b/src/errors/test-run/formattable-adapter.js @@ -1,21 +1,26 @@ -import { assignIn } from 'lodash'; +import { find, assignIn } from 'lodash'; import { Parser } from 'parse5'; +import { renderers } from 'callsite-record'; +import stackFilter from '../stack-filter'; var parser = new Parser(); export default class TestRunErrorFormattableAdapter { - constructor (err, userAgent) { + constructor (err, userAgent, screenshotPath, callsite) { this.TEMPLATES = null; - this.userAgent = userAgent; + + this.userAgent = userAgent; + this.screenshotPath = screenshotPath; + this.callsite = callsite; assignIn(this, err); } static _getSelector (node) { - var dataTypeAttr = node.attrs.filter(attr => attr.name === 'data-type')[0]; - var type = dataTypeAttr && dataTypeAttr.value || ''; + var classAttr = find(node.attrs, { name: 'class' }); + var cls = classAttr && classAttr.value; - return type ? `${node.tagName} ${type}` : node.tagName; + return cls ? `${node.tagName} ${cls}` : node.tagName; } static _decorateHtml (node, decorator) { @@ -40,6 +45,10 @@ export default class TestRunErrorFormattableAdapter { return msg; } + getCallsiteMarkup () { + return this.callsite.renderSync({ renderer: renderers.html, stackFilter }); + } + formatMessage (decorator, viewportWidth) { var msgHtml = this.TEMPLATES[this.type](this, viewportWidth); var fragment = parser.parseFragment(msgHtml); diff --git a/src/legacy/test-run-error/formattable-adapter.js b/src/legacy/test-run-error/formattable-adapter.js index ae082391af3..dd7936ef75f 100644 --- a/src/legacy/test-run-error/formattable-adapter.js +++ b/src/legacy/test-run-error/formattable-adapter.js @@ -1,10 +1,31 @@ +import { escape as escapeHtml } from 'lodash'; +import highlight from 'highlight-es'; import TestRunErrorFormattableAdapter from '../../errors/test-run/formattable-adapter'; import TEMPLATES from './templates'; +const NEWLINE = /\r\n|[\n\r\u2028\u2029]/; + +var renderer = ['string', 'punctuator', 'keyword', 'number', 'regex', 'comment', 'invalid'].reduce((syntaxRenderer, tokenType) => { + syntaxRenderer[tokenType] = str => `${escapeHtml(str)}`; + + return syntaxRenderer; +}, {}); + export default class LegacyTestRunErrorFormattableAdapter extends TestRunErrorFormattableAdapter { - constructor (err, userAgent) { - super(err, userAgent); + constructor (err, userAgent, screenshotPath, callsite) { + super(err, userAgent, screenshotPath, callsite); this.TEMPLATES = TEMPLATES; } + + getCallsiteMarkup () { + var code = highlight(this.callsite, renderer); + var lines = code.split(NEWLINE); + var lastLine = lines.pop(); + + lastLine = `
${lastLine}
`; + lines = lines.map(line => `
${line}
`); + + return `
${lines.join('')}${lastLine}
`; + } } diff --git a/src/legacy/test-run-error/templates.js b/src/legacy/test-run-error/templates.js index 1785717d80b..afd6bb0bd2e 100644 --- a/src/legacy/test-run-error/templates.js +++ b/src/legacy/test-run-error/templates.js @@ -8,19 +8,10 @@ function escapeNewLines (str) { return escapeHtml(str).replace(/(\r\n|\n|\r)/gm, '\\n'); } -function getStepCode (str) { - var lines = escapeHtml(str).split(/\r?\n/g); - var last = lines.pop(); - - return lines - .reduceRight((prev, line) => `${line}${prev}`, - `${last}`); -} - function getMsgPrefix (err, category) { return dedent(` - ${err.userAgent} - ${category} + ${err.userAgent} + ${category} `); } @@ -45,16 +36,16 @@ function getDiffHeader (err) { function getScreenshotInfoStr (err) { if (err.screenshotPath) - return `
Screenshot: ${escapeHtml(err.screenshotPath)}
`; + return `
Screenshot: ${escapeHtml(err.screenshotPath)}
`; return ''; } export default { [TYPE.okAssertion]: err => dedent(` - ${getAssertionMsgPrefix(err)} failed at step ${escapeHtml(err.stepName)}: + ${getAssertionMsgPrefix(err)} failed at step ${escapeHtml(err.stepName)}: - ${getStepCode(err.relatedSourceCode)} + ${err.getCallsiteMarkup()} Expected: not null, not undefined, not false, not NaN and not '' Actual: ${escapeNewLines(err.actual)} @@ -63,9 +54,9 @@ export default { `), [TYPE.notOkAssertion]: err => dedent(` - ${getAssertionMsgPrefix(err)} failed at step ${escapeHtml(err.stepName)}: + ${getAssertionMsgPrefix(err)} failed at step ${escapeHtml(err.stepName)}: - ${getStepCode(err.relatedSourceCode)} + ${err.getCallsiteMarkup()} Expected: null, undefined, false, NaN or '' Actual: ${escapeNewLines(err.actual)} @@ -78,9 +69,9 @@ export default { var diffMarkerStr = diff.marker ? ` ${diff.marker}` : ''; return dedent(` - ${getAssertionMsgPrefix(err)} failed at step ${escapeHtml(err.stepName)}: + ${getAssertionMsgPrefix(err)} failed at step ${escapeHtml(err.stepName)}: - ${getStepCode(err.relatedSourceCode)} + ${err.getCallsiteMarkup()} ${getDiffHeader(err)} @@ -93,9 +84,9 @@ export default { }, [TYPE.notEqAssertion]: err => dedent(` - ${getAssertionMsgPrefix(err)} failed at step ${escapeHtml(err.stepName)}: + ${getAssertionMsgPrefix(err)} failed at step ${escapeHtml(err.stepName)}: - ${getStepCode(err.relatedSourceCode)} + ${err.getCallsiteMarkup()} Expected: not ${escapeNewLines(err.actual)} Actual: ${escapeNewLines(err.actual)} @@ -110,7 +101,7 @@ export default { `), [TYPE.inIFrameTargetLoadingTimeout]: err => dedent(` - ${getMsgPrefix(err, CATEGORY.timeout)}Error at step ${escapeHtml(err.stepName)}: + ${getMsgPrefix(err, CATEGORY.timeout)}Error at step ${escapeHtml(err.stepName)}: IFrame target loading timed out. ${getScreenshotInfoStr(err)} @@ -133,192 +124,192 @@ export default { }, [TYPE.uncaughtJSErrorInTestCodeStep]: err => dedent(` - ${getMsgPrefix(err, CATEGORY.unhandledException)}Error at step ${escapeHtml(err.stepName)}: + ${getMsgPrefix(err, CATEGORY.unhandledException)}Error at step ${escapeHtml(err.stepName)}: Uncaught JavaScript error in test code - ${escapeHtml(err.scriptErr)}. ${getScreenshotInfoStr(err)} `), [TYPE.storeDomNodeOrJqueryObject]: err => dedent(` - ${getMsgPrefix(err, CATEGORY.unhandledException)}Error at step ${escapeHtml(err.stepName)}: + ${getMsgPrefix(err, CATEGORY.unhandledException)}Error at step ${escapeHtml(err.stepName)}: It is not allowed to share the DOM element, jQuery object or a function between test steps via "this" object. ${getScreenshotInfoStr(err)} `), [TYPE.emptyFirstArgument]: err => dedent(` - ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: + ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: - ${getStepCode(err.relatedSourceCode)} + ${err.getCallsiteMarkup()} - A target element of the ${err.action} action has not been found in the DOM tree. - If this element should be created after animation or a time-consuming operation is finished, use the waitFor action (available for use in code) to pause test execution until this element appears. + A target element of the ${err.action} action has not been found in the DOM tree. + If this element should be created after animation or a time-consuming operation is finished, use the waitFor action (available for use in code) to pause test execution until this element appears. ${getScreenshotInfoStr(err)} `), [TYPE.invisibleActionElement]: err => dedent(` - ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: + ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: - ${getStepCode(err.relatedSourceCode)} + ${err.getCallsiteMarkup()} - A target element ${escapeHtml(err.element)} of the ${err.action} action is not visible. - If this element should appear when you are hovering over another element, make sure that you properly recorded the hover action. + A target element ${escapeHtml(err.element)} of the ${err.action} action is not visible. + If this element should appear when you are hovering over another element, make sure that you properly recorded the hover action. ${getScreenshotInfoStr(err)} `), [TYPE.incorrectDraggingSecondArgument]: err => dedent(` - ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: + ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: - ${getStepCode(err.relatedSourceCode)} + ${err.getCallsiteMarkup()} - drag action drop target is incorrect. + drag action drop target is incorrect. ${getScreenshotInfoStr(err)} `), [TYPE.incorrectPressActionArgument]: err => dedent(` - ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: + ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: - ${getStepCode(err.relatedSourceCode)} + ${err.getCallsiteMarkup()} - press action parameter contains incorrect key code. + press action parameter contains incorrect key code. ${getScreenshotInfoStr(err)} `), [TYPE.emptyTypeActionArgument]: err => dedent(` - ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: + ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: - ${getStepCode(err.relatedSourceCode)} + ${err.getCallsiteMarkup()} - The type action's parameter text is empty. + The type action's parameter text is empty. ${getScreenshotInfoStr(err)} `), [TYPE.unexpectedDialog]: err => dedent(` - ${getMsgPrefix(err, CATEGORY.nativeDialogError)}Error at step ${escapeHtml(err.stepName)}: + ${getMsgPrefix(err, CATEGORY.nativeDialogError)}Error at step ${escapeHtml(err.stepName)}: Unexpected system ${err.dialog} dialog ${escapeHtml(err.message)} appeared. ${getScreenshotInfoStr(err)} `), [TYPE.expectedDialogDoesntAppear]: err => dedent(` - ${getMsgPrefix(err, CATEGORY.nativeDialogError)}Error at step ${escapeHtml(err.stepName)}: + ${getMsgPrefix(err, CATEGORY.nativeDialogError)}Error at step ${escapeHtml(err.stepName)}: The expected system ${err.dialog} dialog did not appear. ${getScreenshotInfoStr(err)} `), [TYPE.incorrectSelectActionArguments]: err => dedent(` - ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: + ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: - ${getStepCode(err.relatedSourceCode)} + ${err.getCallsiteMarkup()} - select action's parameters contain an incorrect value. + select action's parameters contain an incorrect value. ${getScreenshotInfoStr(err)} `), [TYPE.incorrectWaitActionMillisecondsArgument]: err => dedent(` - ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: + ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: - ${getStepCode(err.relatedSourceCode)} + ${err.getCallsiteMarkup()} - wait action's "milliseconds" parameter should be a positive number. + wait action's "milliseconds" parameter should be a positive number. ${getScreenshotInfoStr(err)} `), [TYPE.incorrectWaitForActionEventArgument]: err => dedent(` - ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: + ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: - ${getStepCode(err.relatedSourceCode)} + ${err.getCallsiteMarkup()} - waitFor action's first parameter should be a function, a CSS selector or an array of CSS selectors. + waitFor action's first parameter should be a function, a CSS selector or an array of CSS selectors. ${getScreenshotInfoStr(err)} `), [TYPE.incorrectWaitForActionTimeoutArgument]: err => dedent(` - ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: + ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: - ${getStepCode(err.relatedSourceCode)} + ${err.getCallsiteMarkup()} - waitFor action's "timeout" parameter should be a positive number. + waitFor action's "timeout" parameter should be a positive number. ${getScreenshotInfoStr(err)} `), [TYPE.waitForActionTimeoutExceeded]: err => dedent(` - ${getMsgPrefix(err, CATEGORY.timeout)}Error at step ${escapeHtml(err.stepName)}: + ${getMsgPrefix(err, CATEGORY.timeout)}Error at step ${escapeHtml(err.stepName)}: - ${getStepCode(err.relatedSourceCode)} + ${err.getCallsiteMarkup()} - waitFor action's timeout exceeded. + waitFor action's timeout exceeded. ${getScreenshotInfoStr(err)} `), [TYPE.incorrectGlobalWaitForActionEventArgument]: err => dedent(` - ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: + ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: - __waitFor action's first parameter should be a function. + __waitFor action's first parameter should be a function. ${getScreenshotInfoStr(err)} `), [TYPE.incorrectGlobalWaitForActionTimeoutArgument]: err => dedent(` - ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: + ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: - __waitFor action's "timeout" parameter should be a positive number. + __waitFor action's "timeout" parameter should be a positive number. ${getScreenshotInfoStr(err)} `), [TYPE.globalWaitForActionTimeoutExceeded]: err => dedent(` - ${getMsgPrefix(err, CATEGORY.timeout)}Error at step ${escapeHtml(err.stepName)}: + ${getMsgPrefix(err, CATEGORY.timeout)}Error at step ${escapeHtml(err.stepName)}: - __waitFor action's timeout exceeded. + __waitFor action's timeout exceeded. ${getScreenshotInfoStr(err)} `), [TYPE.emptyIFrameArgument]: err => dedent(` - ${getMsgPrefix(err, CATEGORY.inIFrameSelectorError)}Error at step ${escapeHtml(err.stepName)}: - The selector within the inIFrame function returns an empty value. + ${getMsgPrefix(err, CATEGORY.inIFrameSelectorError)}Error at step ${escapeHtml(err.stepName)}: + The selector within the inIFrame function returns an empty value. ${getScreenshotInfoStr(err)} `), [TYPE.iframeArgumentIsNotIFrame]: err => dedent(` - ${getMsgPrefix(err, CATEGORY.inIFrameSelectorError)}Error at step ${escapeHtml(err.stepName)}: - The selector within the inIFrame function doesn’t return an iframe element. + ${getMsgPrefix(err, CATEGORY.inIFrameSelectorError)}Error at step ${escapeHtml(err.stepName)}: + The selector within the inIFrame function doesn’t return an iframe element. ${getScreenshotInfoStr(err)} `), [TYPE.multipleIFrameArgument]: err => dedent(` - ${getMsgPrefix(err, CATEGORY.inIFrameSelectorError)}Error at step ${escapeHtml(err.stepName)}: - The selector within the inIFrame function returns more than one iframe element. + ${getMsgPrefix(err, CATEGORY.inIFrameSelectorError)}Error at step ${escapeHtml(err.stepName)}: + The selector within the inIFrame function returns more than one iframe element. ${getScreenshotInfoStr(err)} `), [TYPE.incorrectIFrameArgument]: err => dedent(` - ${getMsgPrefix(err, CATEGORY.inIFrameSelectorError)}Error at step ${escapeHtml(err.stepName)}: - The inIFrame function contains an invalid argument. + ${getMsgPrefix(err, CATEGORY.inIFrameSelectorError)}Error at step ${escapeHtml(err.stepName)}: + The inIFrame function contains an invalid argument. ${getScreenshotInfoStr(err)} `), [TYPE.uploadCanNotFindFileToUpload]: err => { var msg = dedent(` - ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: + ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: - ${getStepCode(err.relatedSourceCode)} + ${err.getCallsiteMarkup()} Cannot find the following file(s) to upload: `); @@ -329,21 +320,21 @@ export default { }, [TYPE.uploadElementIsNotFileInput]: err => dedent(` - ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: + ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: - ${getStepCode(err.relatedSourceCode)} + ${err.getCallsiteMarkup()} - upload action argument does not contain a file input element. + upload action argument does not contain a file input element. ${getScreenshotInfoStr(err)} `), [TYPE.uploadInvalidFilePathArgument]: err => dedent(` - ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: + ${getMsgPrefix(err, CATEGORY.actionError)}Error at step ${escapeHtml(err.stepName)}: - ${getStepCode(err.relatedSourceCode)} + ${err.getCallsiteMarkup()} - upload action's "path" parameter should be a string or an array of strings. + upload action's "path" parameter should be a string or an array of strings. ${getScreenshotInfoStr(err)} `), diff --git a/src/legacy/test-run/index.js b/src/legacy/test-run/index.js index 603fb744436..2845788554f 100644 --- a/src/legacy/test-run/index.js +++ b/src/legacy/test-run/index.js @@ -75,20 +75,22 @@ export default class LegacyTestRun extends Session { } async _addError (err) { - if (err.__sourceIndex !== void 0 && err.__sourceIndex !== null) { - err.relatedSourceCode = this.test.sourceIndex[err.__sourceIndex]; - delete err.__sourceIndex; - } + var screenshotPath = null; + var callsite = err.__sourceIndex !== void 0 && + err.__sourceIndex !== null && + this.test.sourceIndex[err.__sourceIndex]; try { - err.screenshotPath = await this.screenshotCapturer.captureError(err); + screenshotPath = await this.screenshotCapturer.captureError(err); } catch (e) { // NOTE: swallow the error silently if we can't take screenshots for some // reason (e.g. we don't have permissions to write a screenshot file). } - this.errs.push(new LegacyTestRunErrorFormattableAdapter(err, this.browserConnection.userAgent)); + var errAdapter = new LegacyTestRunErrorFormattableAdapter(err, this.browserConnection.userAgent, screenshotPath, callsite); + + this.errs.push(errAdapter); } async _fatalError (err) { diff --git a/src/reporter/plugin-host.js b/src/reporter/plugin-host.js index 29da5097e09..ae2ebd63ff4 100644 --- a/src/reporter/plugin-host.js +++ b/src/reporter/plugin-host.js @@ -1,6 +1,6 @@ import chalk from 'chalk'; import indentString from 'indent-string'; -import { escape as escapeHtml, assignIn } from 'lodash'; +import { identity, escape as escapeHtml, assignIn } from 'lodash'; import moment from 'moment'; import 'moment-duration-format'; import OS from 'os-family'; @@ -40,18 +40,39 @@ export default class ReporterPluginHost { // Error decorator createErrorDecorator () { return { - 'span category': () => '', - 'span step-name': str => `"${str}"`, - 'span user-agent': str => this.chalk.gray(str), - 'div screenshot-info': str => str, + 'span category': () => '', + 'span step-name': str => `"${str}"`, + 'span user-agent': str => this.chalk.gray(str), + + 'div screenshot-info': identity, 'a screenshot-path': str => this.chalk.underline(str), - 'code': str => this.chalk.yellow(str), - 'code step-source': str => this.chalk.magenta(this.indentString(str, 4)), - 'span code-line': str => `${str}\n`, - 'span last-code-line': str => str, - 'code api': str => this.chalk.yellow(str), - 'strong': str => this.chalk.cyan(str), - 'a': str => this.chalk.yellow(`"${str}"`) + + 'code': str => this.chalk.yellow(str), + 'code api': str => this.chalk.yellow(str), + + 'span syntax-string': str => this.chalk.green(str), + 'span syntax-punctuator': str => this.chalk.grey(str), + 'span syntax-keyword': str => this.chalk.cyan(str), + 'span syntax-number': str => this.chalk.magenta(str), + 'span syntax-regex': str => this.chalk.magenta(str), + 'span syntax-comment': str => this.chalk.grey.bold(str), + 'span syntax-invalid': str => this.chalk.inverse(str), + + 'div code-frame': identity, + 'div code-line': str => str + '\n', + 'div code-line-last': identity, + 'div code-line-num': str => ` ${str} |`, + 'div code-line-num-base': str => this.chalk.bgRed(` > ${str} `) + '|', + 'div code-line-src': identity, + + 'div stack': str => '\n\n' + str, + 'div stack-line': str => str + '\n', + 'div stack-line-last': identity, + 'div stack-line-name': str => ` at ${this.chalk.bold(str)}`, + 'div stack-line-location': str => ` (${this.chalk.grey.underline(str)})`, + + 'strong': str => this.chalk.cyan(str), + 'a': str => `"${this.chalk.underline(str)}"` }; } diff --git a/test/server/data/expected-legacy-test-run-errors/empty-first-argument b/test/server/data/expected-legacy-test-run-errors/empty-first-argument index 5c7f1ac37bc..fc36b211c64 100644 --- a/test/server/data/expected-legacy-test-run-errors/empty-first-argument +++ b/test/server/data/expected-legacy-test-run-errors/empty-first-argument @@ -2,7 +2,7 @@ Chrome 15.0.874 / Mac OS X 10.8.1 CATEGORY=legacy|actionError Error at step "Step with ": - code and +code and A target element of the testAction action has not been found in the DOM tree. If this element should be created after animation or a time-consuming diff --git a/test/server/data/expected-legacy-test-run-errors/empty-type-action-argument b/test/server/data/expected-legacy-test-run-errors/empty-type-action-argument index 8534cfcab22..2b6d1c473f0 100644 --- a/test/server/data/expected-legacy-test-run-errors/empty-type-action-argument +++ b/test/server/data/expected-legacy-test-run-errors/empty-type-action-argument @@ -2,7 +2,7 @@ Chrome 15.0.874 / Mac OS X 10.8.1 CATEGORY=legacy|actionError Error at step "Step with ": - code and +code and The type action's parameter text is empty. diff --git a/test/server/data/expected-legacy-test-run-errors/eq-assertion b/test/server/data/expected-legacy-test-run-errors/eq-assertion index 805eeaf4e63..999423935c6 100644 --- a/test/server/data/expected-legacy-test-run-errors/eq-assertion +++ b/test/server/data/expected-legacy-test-run-errors/eq-assertion @@ -2,7 +2,7 @@ Chrome 15.0.874 / Mac OS X 10.8.1 CATEGORY=legacy|failedAssertion " message" assertion failed at step "Step with ": - eq({"": ""}, {"": ""}) +eq({"": ""}, {"": ""}) Objects differ at the field: diff --git a/test/server/data/expected-legacy-test-run-errors/incorrect-dragging-second-argument b/test/server/data/expected-legacy-test-run-errors/incorrect-dragging-second-argument index 3698aac4464..282519034cd 100644 --- a/test/server/data/expected-legacy-test-run-errors/incorrect-dragging-second-argument +++ b/test/server/data/expected-legacy-test-run-errors/incorrect-dragging-second-argument @@ -2,7 +2,7 @@ Chrome 15.0.874 / Mac OS X 10.8.1 CATEGORY=legacy|actionError Error at step "Step with ": - code and +code and drag action drop target is incorrect. diff --git a/test/server/data/expected-legacy-test-run-errors/incorrect-press-action-argument b/test/server/data/expected-legacy-test-run-errors/incorrect-press-action-argument index 39f874245ec..b9fcb4660b0 100644 --- a/test/server/data/expected-legacy-test-run-errors/incorrect-press-action-argument +++ b/test/server/data/expected-legacy-test-run-errors/incorrect-press-action-argument @@ -2,7 +2,7 @@ Chrome 15.0.874 / Mac OS X 10.8.1 CATEGORY=legacy|actionError Error at step "Step with ": - code and +code and press action parameter contains incorrect key code. diff --git a/test/server/data/expected-legacy-test-run-errors/incorrect-select-action-arguments b/test/server/data/expected-legacy-test-run-errors/incorrect-select-action-arguments index 86127c88417..8adbd30263b 100644 --- a/test/server/data/expected-legacy-test-run-errors/incorrect-select-action-arguments +++ b/test/server/data/expected-legacy-test-run-errors/incorrect-select-action-arguments @@ -2,7 +2,7 @@ Chrome 15.0.874 / Mac OS X 10.8.1 CATEGORY=legacy|actionError Error at step "Step with ": - code and +code and select action's parameters contain an incorrect value. diff --git a/test/server/data/expected-legacy-test-run-errors/incorrect-wait-action-milliseconds-arguments b/test/server/data/expected-legacy-test-run-errors/incorrect-wait-action-milliseconds-arguments index 1634142e7e1..faedcf970e0 100644 --- a/test/server/data/expected-legacy-test-run-errors/incorrect-wait-action-milliseconds-arguments +++ b/test/server/data/expected-legacy-test-run-errors/incorrect-wait-action-milliseconds-arguments @@ -2,7 +2,7 @@ Chrome 15.0.874 / Mac OS X 10.8.1 CATEGORY=legacy|actionError Error at step "Step with ": - code and +code and wait action's "milliseconds" parameter should be a positive number. diff --git a/test/server/data/expected-legacy-test-run-errors/incorrect-wait-for-action-event-argument b/test/server/data/expected-legacy-test-run-errors/incorrect-wait-for-action-event-argument index 1488d629376..006ecf26aa9 100644 --- a/test/server/data/expected-legacy-test-run-errors/incorrect-wait-for-action-event-argument +++ b/test/server/data/expected-legacy-test-run-errors/incorrect-wait-for-action-event-argument @@ -2,7 +2,7 @@ Chrome 15.0.874 / Mac OS X 10.8.1 CATEGORY=legacy|actionError Error at step "Step with ": - code and +code and waitFor action's first parameter should be a function, a CSS selector or an array of CSS selectors. diff --git a/test/server/data/expected-legacy-test-run-errors/incorrect-wait-for-action-timeout-argument b/test/server/data/expected-legacy-test-run-errors/incorrect-wait-for-action-timeout-argument index 16caa0fa944..1f4dda7b8bf 100644 --- a/test/server/data/expected-legacy-test-run-errors/incorrect-wait-for-action-timeout-argument +++ b/test/server/data/expected-legacy-test-run-errors/incorrect-wait-for-action-timeout-argument @@ -2,7 +2,7 @@ Chrome 15.0.874 / Mac OS X 10.8.1 CATEGORY=legacy|actionError Error at step "Step with ": - code and +code and waitFor action's "timeout" parameter should be a positive number. diff --git a/test/server/data/expected-legacy-test-run-errors/invisible-action-element b/test/server/data/expected-legacy-test-run-errors/invisible-action-element index a67061c2d6c..04a82d1f785 100644 --- a/test/server/data/expected-legacy-test-run-errors/invisible-action-element +++ b/test/server/data/expected-legacy-test-run-errors/invisible-action-element @@ -2,7 +2,7 @@ Chrome 15.0.874 / Mac OS X 10.8.1 CATEGORY=legacy|actionError Error at step "Step with ": - code and +code and A target element of the test-action action is not visible. If this element should appear when you are hovering over another element, diff --git a/test/server/data/expected-legacy-test-run-errors/not-eq-assertion b/test/server/data/expected-legacy-test-run-errors/not-eq-assertion index f09aff83bce..46f10a402be 100644 --- a/test/server/data/expected-legacy-test-run-errors/not-eq-assertion +++ b/test/server/data/expected-legacy-test-run-errors/not-eq-assertion @@ -2,7 +2,7 @@ Chrome 15.0.874 / Mac OS X 10.8.1 CATEGORY=legacy|failedAssertion " message" assertion failed at step "Step with ": - notEq("", "") +notEq("", "") Expected: not "" Actual: "" diff --git a/test/server/data/expected-legacy-test-run-errors/not-ok-assertion b/test/server/data/expected-legacy-test-run-errors/not-ok-assertion index 640bf3e64c2..bfbd2828589 100644 --- a/test/server/data/expected-legacy-test-run-errors/not-ok-assertion +++ b/test/server/data/expected-legacy-test-run-errors/not-ok-assertion @@ -2,7 +2,7 @@ Chrome 15.0.874 / Mac OS X 10.8.1 CATEGORY=legacy|failedAssertion " message" assertion failed at step "Step with ": - notOk("") +notOk("") Expected: null, undefined, false, NaN or '' Actual: "" diff --git a/test/server/data/expected-legacy-test-run-errors/ok-assertion b/test/server/data/expected-legacy-test-run-errors/ok-assertion index e03f60a9f53..df91aed136b 100644 --- a/test/server/data/expected-legacy-test-run-errors/ok-assertion +++ b/test/server/data/expected-legacy-test-run-errors/ok-assertion @@ -2,7 +2,7 @@ Chrome 15.0.874 / Mac OS X 10.8.1 CATEGORY=legacy|failedAssertion " message" assertion failed at step "Step with ": - ok("" === "") +ok("" === "") Expected: not null, not undefined, not false, not NaN and not '' Actual: false diff --git a/test/server/data/expected-legacy-test-run-errors/upload-can-not-find-file-to-upload b/test/server/data/expected-legacy-test-run-errors/upload-can-not-find-file-to-upload index 7fad593b1e5..7d52789f41d 100644 --- a/test/server/data/expected-legacy-test-run-errors/upload-can-not-find-file-to-upload +++ b/test/server/data/expected-legacy-test-run-errors/upload-can-not-find-file-to-upload @@ -2,7 +2,7 @@ Chrome 15.0.874 / Mac OS X 10.8.1 CATEGORY=legacy|actionError Error at step "Step with ": - code and +code and Cannot find the following file(s) to upload: /unix/path/with/, diff --git a/test/server/data/expected-legacy-test-run-errors/upload-element-is-not-file-input b/test/server/data/expected-legacy-test-run-errors/upload-element-is-not-file-input index 9e099cff264..1c791ebc412 100644 --- a/test/server/data/expected-legacy-test-run-errors/upload-element-is-not-file-input +++ b/test/server/data/expected-legacy-test-run-errors/upload-element-is-not-file-input @@ -2,7 +2,7 @@ Chrome 15.0.874 / Mac OS X 10.8.1 CATEGORY=legacy|actionError Error at step "Step with ": - code and +code and upload action argument does not contain a file input element. diff --git a/test/server/data/expected-legacy-test-run-errors/upload-invalid-file-path-argument b/test/server/data/expected-legacy-test-run-errors/upload-invalid-file-path-argument index 94d57ccb733..d6823677a12 100644 --- a/test/server/data/expected-legacy-test-run-errors/upload-invalid-file-path-argument +++ b/test/server/data/expected-legacy-test-run-errors/upload-invalid-file-path-argument @@ -2,7 +2,7 @@ Chrome 15.0.874 / Mac OS X 10.8.1 CATEGORY=legacy|actionError Error at step "Step with ": - code and +code and upload action's "path" parameter should be a string or an array of strings. diff --git a/test/server/data/expected-legacy-test-run-errors/wait-for-action-timeout-exceeded b/test/server/data/expected-legacy-test-run-errors/wait-for-action-timeout-exceeded index 3835811127f..87e238c7686 100644 --- a/test/server/data/expected-legacy-test-run-errors/wait-for-action-timeout-exceeded +++ b/test/server/data/expected-legacy-test-run-errors/wait-for-action-timeout-exceeded @@ -2,10 +2,10 @@ Chrome 15.0.874 / Mac OS X 10.8.1 CATEGORY=legacy|timeout Error at step "Step with ": - act.waitFor(function(cb) { - $("