Skip to content

Commit

Permalink
Redesign legacy errors (closes #685) (#693)
Browse files Browse the repository at this point in the history
* Redesign legacy errors

* Try fix unstable iframe test in IE

* Remove iframe fix
  • Loading branch information
inikulin authored and AlexanderMoskovkin committed Jul 28, 2016
1 parent da687e0 commit f3949f3
Show file tree
Hide file tree
Showing 41 changed files with 230 additions and 339 deletions.
3 changes: 3 additions & 0 deletions src/legacy/test-run-error/formattable-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ export default class LegacyTestRunErrorFormattableAdapter extends TestRunErrorFo
}

getCallsiteMarkup () {
if (!this.callsite)
return null;

var code = highlight(this.callsite, renderer);
var lines = code.split(NEWLINE);
var lastLine = lines.pop();
Expand Down
323 changes: 107 additions & 216 deletions src/legacy/test-run-error/templates.js

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions src/reporter/plugin-host.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export default class ReporterPluginHost {
// Error decorator
createErrorDecorator () {
return {
'span step-name': str => `"${str}"`,
'span user-agent': str => this.chalk.grey(str),

'span subtitle': str => `- ${this.chalk.bold.red(str)} -`,
Expand All @@ -50,8 +49,7 @@ export default class ReporterPluginHost {
'div screenshot-info': identity,
'a screenshot-path': str => this.chalk.grey.underline(str),

'code': str => this.chalk.yellow(str),
'code api': str => this.chalk.yellow(str),
'code': identity,

'span syntax-string': str => this.chalk.green(str),
'span syntax-punctuator': str => this.chalk.grey(str),
Expand Down
12 changes: 4 additions & 8 deletions test/functional/legacy-fixtures/api/click/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ describe('[Legacy API] act.click()', function () {
.catch(function (errs) {
var expectedError = [
'Error at step "1.Click on invisible element":',
'',
'act.click($input);',
'',
'A target element \<input id="input"\> of the click 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.'
].join(' ');

expect(errs[0]).eql(expectedError);
expect(errs[0]).contains(expectedError);
expect(errs[0]).contains('act.click($input);');
});
});

Expand All @@ -24,15 +22,13 @@ describe('[Legacy API] act.click()', function () {
.catch(function (errs) {
var expectedError = [
'Error at step "1.Click on invisible element":',
'',
'act.click($input);',
'',
'A target element \<input id="input"\> of the click 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.'
].join(' ');

expect(errs[0]).eql(expectedError);
expect(errs[0]).contains(expectedError);
expect(errs[0]).contains('act.click($input);');
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('Before unload handling', function () {
' The expected system beforeUnload dialog did not appear.'
].join('');

expect(errs[0]).eql(expectedError);
expect(errs[0]).contains(expectedError);
});
});

Expand All @@ -26,7 +26,7 @@ describe('Before unload handling', function () {
' Unexpected system beforeUnload dialog message appeared.'
].join('');

expect(errs[0]).eql(expectedError);
expect(errs[0]).contains(expectedError);
});
});

Expand All @@ -42,7 +42,7 @@ describe('Before unload handling', function () {
' The expected system beforeUnload dialog did not appear.'
].join('');

expect(errs[0]).eql(expectedError);
expect(errs[0]).contains(expectedError);
});
});

Expand All @@ -54,7 +54,7 @@ describe('Before unload handling', function () {
' Unexpected system beforeUnload dialog message appeared.'
].join('');

expect(errs[0]).eql(expectedError);
expect(errs[0]).contains(expectedError);
});
});
});
28 changes: 14 additions & 14 deletions test/functional/legacy-fixtures/native-dialogs-handling/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Native dialogs handling', function () {
'Unexpected system alert dialog Alert dialog appeared.'
].join(' ');

expect(errs[0]).eql(expectedError);
expect(errs[0]).contains(expectedError);
});
});

Expand All @@ -30,7 +30,7 @@ describe('Native dialogs handling', function () {
'Unexpected system confirm dialog Confirm dialog appeared.'
].join(' ');

expect(errs[0]).eql(expectedError);
expect(errs[0]).contains(expectedError);
});
});

Expand All @@ -42,7 +42,7 @@ describe('Native dialogs handling', function () {
'Unexpected system confirm dialog Confirm dialog appeared.'
].join(' ');

expect(errs[0]).eql(expectedError);
expect(errs[0]).contains(expectedError);
});
});

Expand All @@ -54,7 +54,7 @@ describe('Native dialogs handling', function () {
'Unexpected system prompt dialog Prompt dialog appeared.'
].join(' ');

expect(errs[0]).eql(expectedError);
expect(errs[0]).contains(expectedError);
});
});

Expand All @@ -66,7 +66,7 @@ describe('Native dialogs handling', function () {
'Unexpected system alert dialog Alert dialog appeared.'
].join(' ');

expect(errs[0]).eql(expectedError);
expect(errs[0]).contains(expectedError);
});
});

Expand All @@ -78,7 +78,7 @@ describe('Native dialogs handling', function () {
'The expected system confirm dialog did not appear.'
].join(' ');

expect(errs[0]).eql(expectedError);
expect(errs[0]).contains(expectedError);
});
});

Expand All @@ -90,7 +90,7 @@ describe('Native dialogs handling', function () {
'The expected system prompt dialog did not appear.'
].join(' ');

expect(errs[0]).eql(expectedError);
expect(errs[0]).contains(expectedError);
});
});

Expand All @@ -102,7 +102,7 @@ describe('Native dialogs handling', function () {
'The expected system alert dialog did not appear.'
].join(' ');

expect(errs[0]).eql(expectedError);
expect(errs[0]).contains(expectedError);
});
});

Expand All @@ -119,7 +119,7 @@ describe('Native dialogs handling', function () {
'Unexpected system confirm dialog Confirm dialog appeared.'
].join(' ');

expect(errs[0]).eql(expectedError);
expect(errs[0]).contains(expectedError);
});
});

Expand All @@ -131,7 +131,7 @@ describe('Native dialogs handling', function () {
'The expected system confirm dialog did not appear.'
].join(' ');

expect(errs[0]).eql(expectedError);
expect(errs[0]).contains(expectedError);
});
});
});
Expand All @@ -149,7 +149,7 @@ describe('Native dialogs handling', function () {
'Unexpected system confirm dialog Confirm dialog appeared.'
].join(' ');

expect(errs[0]).eql(expectedError);
expect(errs[0]).contains(expectedError);
});
});

Expand All @@ -161,7 +161,7 @@ describe('Native dialogs handling', function () {
'The expected system confirm dialog did not appear.'
].join(' ');

expect(errs[0]).eql(expectedError);
expect(errs[0]).contains(expectedError);
});
});

Expand All @@ -177,7 +177,7 @@ describe('Native dialogs handling', function () {
'Unexpected system confirm dialog Confirm dialog appeared.'
].join(' ');

expect(errs[0]).eql(expectedError);
expect(errs[0]).contains(expectedError);
});
});

Expand All @@ -189,7 +189,7 @@ describe('Native dialogs handling', function () {
'The expected system confirm dialog did not appear.'
].join(' ');

expect(errs[0]).eql(expectedError);
expect(errs[0]).contains(expectedError);
});
});
});
Expand Down
7 changes: 4 additions & 3 deletions test/functional/legacy-fixtures/regression/gh-414/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ describe("[Regression](GH-414) Should restart a test step if redirect occurs whi
.catch(function (errs) {
var expectedError = [
'Error at step "2.Click div "The second div"":',
" act.click('#div2'); ",
'A target element of the click 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.'].join(' ');
'to pause test execution until this element appears.'
].join(' ');

expect(errs[0]).eql(expectedError);
expect(errs[0]).contains(expectedError);
expect(errs[0]).contains("act.click('#div2');");
});
});

Expand Down
4 changes: 2 additions & 2 deletions test/functional/legacy-fixtures/regression/t200501/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ it('[Regression](T200501) Wait parameters are not verified', function () {
.catch(function (errs) {
var expectedError = [
'Error at step "1.Wait with mixed up parameters":',
' act.wait(function () { return false; }, 500); ',
'wait action\'s "milliseconds" parameter should be a positive number.'
].join(' ');

expect(errs[0]).eql(expectedError);
expect(errs[0]).contains(expectedError);
expect(errs[0]).contains('act.wait(function () { return false; }, 500);');
});
});
6 changes: 2 additions & 4 deletions test/functional/legacy-fixtures/selector-timeout/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ describe('Selector timeout', function () {
.catch(function (errs) {
var expectedError = [
'Error at step "2.Click on button":',
'',
"act.click('#button');",
'',
'A target element \<button id="button"\> of the click 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.'
].join(' ');

expect(errs[0]).eql(expectedError);
expect(errs[0]).contains(expectedError);
expect(errs[0]).contains("act.click('#button');");
});
});
});
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Chrome 15.0.874 / Mac OS X 10.8.1
Error at step "Step with <tag>":

code and <tag>

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
operation is finished, use the waitFor action (available for use in code) to
pause test execution until this element appears.

Browser: Chrome 15.0.874 / Mac OS X 10.8.1
Screenshot: /unix/path/with/<tag>

Code:
code and <tag>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Chrome 15.0.874 / Mac OS X 10.8.1
Error at step "Step with <tag>":
The selector within the inIFrame function returns an empty value.

Browser: Chrome 15.0.874 / Mac OS X 10.8.1
Screenshot: /unix/path/with/<tag>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Chrome 15.0.874 / Mac OS X 10.8.1
Error at step "Step with <tag>":

code and <tag>

The type action's parameter text is empty.

Browser: Chrome 15.0.874 / Mac OS X 10.8.1
Screenshot: /unix/path/with/<tag>

Code:
code and <tag>
7 changes: 4 additions & 3 deletions test/server/data/expected-legacy-test-run-errors/eq-assertion
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
Chrome 15.0.874 / Mac OS X 10.8.1
"<tagged> message" assertion failed at step "Step with <tag>":

eq({"<tag>": "<some-tag>"}, {"<tag>": "<another-tag>"})

Objects differ at the <tag> field:

Expected: "<another-tag>"
Actual: "<some-tag>"
^

Browser: Chrome 15.0.874 / Mac OS X 10.8.1
Screenshot: /unix/path/with/<tag>

Code:
eq({"<tag>": "<some-tag>"}, {"<tag>": "<another-tag>"})
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Chrome 15.0.874 / Mac OS X 10.8.1
Error at step "Step with <tag>":
The expected system test-dialog dialog did not appear.

Browser: Chrome 15.0.874 / Mac OS X 10.8.1
Screenshot: /unix/path/with/<tag>
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
Chrome 15.0.874 / Mac OS X 10.8.1
Error at step "Step with <tag>":

__waitFor action's timeout exceeded.

Browser: Chrome 15.0.874 / Mac OS X 10.8.1
Screenshot: /unix/path/with/<tag>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Chrome 15.0.874 / Mac OS X 10.8.1
Error at step "Step with <tag>":
The selector within the inIFrame function doesn’t return an iframe element.

Browser: Chrome 15.0.874 / Mac OS X 10.8.1
Screenshot: /unix/path/with/<tag>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Chrome 15.0.874 / Mac OS X 10.8.1
IFrame loading timed out.

Browser: Chrome 15.0.874 / Mac OS X 10.8.1
Screenshot: /unix/path/with/<tag>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Chrome 15.0.874 / Mac OS X 10.8.1
Error at step "Step with <tag>":
IFrame target loading timed out.

Browser: Chrome 15.0.874 / Mac OS X 10.8.1
Screenshot: /unix/path/with/<tag>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Chrome 15.0.874 / Mac OS X 10.8.1
Error at step "Step with <tag>":

code and <tag>

drag action drop target is incorrect.

Browser: Chrome 15.0.874 / Mac OS X 10.8.1
Screenshot: /unix/path/with/<tag>

Code:
code and <tag>
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
Chrome 15.0.874 / Mac OS X 10.8.1
Error at step "Step with <tag>":

__waitFor action's first parameter should be a function.

Browser: Chrome 15.0.874 / Mac OS X 10.8.1
Screenshot: /unix/path/with/<tag>
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
Chrome 15.0.874 / Mac OS X 10.8.1
Error at step "Step with <tag>":

__waitFor action's "timeout" parameter should be a positive number.

Browser: Chrome 15.0.874 / Mac OS X 10.8.1
Screenshot: /unix/path/with/<tag>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Chrome 15.0.874 / Mac OS X 10.8.1
Error at step "Step with <tag>":
The inIFrame function contains an invalid argument.

Browser: Chrome 15.0.874 / Mac OS X 10.8.1
Screenshot: /unix/path/with/<tag>
Loading

0 comments on commit f3949f3

Please sign in to comment.