Skip to content

Commit

Permalink
Merge pull request #1 from DevExpress/latest-tc
Browse files Browse the repository at this point in the history
Use latest TestCafe API for testing. Update test data. Change error p…
  • Loading branch information
inikulin authored Jun 28, 2016
2 parents f9c6a8b + 12059cf commit 3171a44
Show file tree
Hide file tree
Showing 12 changed files with 302 additions and 272 deletions.
13 changes: 13 additions & 0 deletions .publishrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"validations": {
"vulnerableDependencies": true,
"uncommittedChanges": true,
"untrackedFiles": true,
"sensitiveData": true,
"branch": "master",
"gitTag": true
},
"confirm": true,
"publishTag": "latest",
"prePublishScript": "npm test"
}
15 changes: 5 additions & 10 deletions Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ var eslint = require('gulp-eslint');
var babel = require('gulp-babel');
var mocha = require('gulp-mocha');
var del = require('del');
var publish = require('publish-please');

gulp.task('clean', function (cb) {
del('lib', cb);
Expand Down Expand Up @@ -39,20 +38,16 @@ gulp.task('test', ['build'], function () {
});

gulp.task('preview', ['build'], function () {
var pluginTestingUtils = require('testcafe').pluginTestingUtils;
var pluginFactory = require('./lib');
var testCalls = require('./test/data/test-calls');
var plugin = pluginTestingUtils.buildReporterPlugin(pluginFactory);
var buildReporterPlugin = require('testcafe').embeddingUtils.buildReporterPlugin;
var pluginFactory = require('./lib');
var reporterTestCalls = require('./test/utils/reporter-test-calls');
var plugin = buildReporterPlugin(pluginFactory);

console.log();

testCalls.forEach(function (call) {
reporterTestCalls.forEach(function (call) {
plugin[call.method].apply(plugin, call.args);
});

process.exit(0);
});

gulp.task('publish', ['test'], function () {
return publish();
});
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "testcafe-reporter-list",
"version": "1.0.1",
"version": "1.0.2",
"description": "List TestCafe reporter plugin.",
"repository": "https://github.com/DevExpress/testcafe-reporter-list",
"author": {
Expand All @@ -12,7 +12,9 @@
"lib"
],
"scripts": {
"test": "gulp test"
"test": "gulp test",
"publish-please": "publish-please",
"prepublish": "publish-please guard"
},
"keywords": [
"testcafe",
Expand All @@ -23,15 +25,16 @@
"license": "MIT",
"devDependencies": {
"babel-eslint": "^4.0.10",
"callsite-record": "^3.2.0",
"del": "^1.2.0",
"gulp": "^3.9.0",
"gulp-babel": "^5.2.1",
"gulp-eslint": "^1.1.1",
"gulp-mocha": "^2.2.0",
"normalize-newline": "^1.0.2",
"os-family": "^1.0.0",
"publish-please": "^1.0.1",
"publish-please": "^2.1.4",
"read-file-relative": "^1.2.0",
"testcafe": "0.0.15"
"testcafe": "0.0.21"
}
}
8 changes: 5 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export default function () {

reportTestDone (name, errs, durationMs, unstable, screenshotPath) {
var hasErr = !!errs.length;
var nameStyle = hasErr ? this.chalk.red : this.chalk.gray;
var symbol = hasErr ? this.chalk.red(this.symbols.err) : this.chalk.green(this.symbols.ok);
var nameStyle = hasErr ? this.chalk.red.bold : this.chalk.gray;
var symbol = hasErr ? this.chalk.red.bold(this.symbols.err) : this.chalk.green(this.symbols.ok);

name = `${this.currentFixtureName} - ${name}`;

Expand All @@ -49,8 +49,10 @@ export default function () {
.newline();

errs.forEach((err, idx) => {
var prefix = this.chalk.red(`${idx + 1}) `);

this.newline()
.write(this.formatError(err, `${idx + 1}) `))
.write(this.formatError(err, prefix))
.newline()
.newline();
});
Expand Down
2 changes: 1 addition & 1 deletion test/data/report-with-colors-win.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"\u001b[1mRunning tests in: \u001b[94mChrome\u001b[39m, \u001b[94mFirefox\u001b[39m\u001b[22m\n\n \u001b[32m✓\u001b[39m \u001b[90mfixture1 - fixture1test1\u001b[39m\u001b[33m (unstable)\u001b[39m (screenshots:\n \u001b[4m/screenshots/1445437598847\u001b[24m)\n \u001b[31m✖\u001b[39m \u001b[31mfixture1 - fixture1test2\u001b[39m (screenshots: \u001b[4m/screenshots/1445437598847\u001b[24m)\n\n 1) Chrome\n Assertion failed at step \"Step\":\n\n eq([\"12345678901\"], [\"00000000000\"])\n\n Arrays differ at index 0:\n\n Expected: [0]: \"12345678901\"\n Actual: [0]: \"00000000000\"\n ^\n\n Screenshot: /screenshots/1445437598847/userAgent/1.Fail.png\n\n\n 2) Chrome\n Assertion failed at step \"Step\":\n\n notEq(\"test\", \"test\")\n\n Expected: not \"test\"\n Actual: \"test\"\n\n\n 3) Firefox\n Assertion failed at step \"Step\":\n\n ok(false)\n\n Expected: not null, not undefined, not false, not NaN and not ''\n Actual: false\n\n\n \u001b[32m✓\u001b[39m \u001b[90mfixture1 - fixture1test3\u001b[39m\n \u001b[32m✓\u001b[39m \u001b[90mfixture2 - fixture2test1\u001b[39m\n \u001b[32m✓\u001b[39m \u001b[90mfixture2 - fixture2test2\u001b[39m\n \u001b[31m✖\u001b[39m \u001b[31mfixture3 - fixture3test1\u001b[39m\u001b[33m (unstable)\u001b[39m\n\n 1) Firefox\n Assertion failed at step \"Step\":\n\n eq([\"12345678901\"], [\"00000000000\"])\n\n Arrays differ at index 0:\n\n Expected: [0]: \"12345678901\"\n Actual: [0]: \"00000000000\"\n ^\n\n\n\n \u001b[1m\u001b[31m2/6 failed\u001b[39m\u001b[22m\u001b[90m (15m 25s)\u001b[39m\n"
"\u001b[1mRunning tests in: \u001b[94mChrome 41.0.2227 / Mac OS X 10.10.1\u001b[39m, \u001b[94mFirefox 47 / Mac OS X\n10.10.1\u001b[39m\u001b[22m\n\n \u001b[32m✓\u001b[39m \u001b[90mFirst fixture - First test in first fixture\u001b[39m\u001b[33m (unstable)\u001b[39m (screenshots:\n \u001b[4m/screenshots/1445437598847\u001b[24m)\n \u001b[31m\u001b[1m✖\u001b[22m\u001b[39m \u001b[31m\u001b[1mFirst fixture - Second test in first fixture\u001b[22m\u001b[39m (screenshots:\n \u001b[4m/screenshots/1445437598847\u001b[24m)\n\n \u001b[31m1) \u001b[39mChrome 41.0.2227 / Mac OS X 10.10.1\n Error on page \"http://example.org\":\n\n Some error\n\n 1 |var createCallsiteRecord = require('callsite-record');\n 2 |\n 3 |function someFunc () {\n > 4 | throw new Error('Hey ya!');\n 5 |}\n 6 |\n 7 |try {\n 8 | someFunc();\n 9 |}\n\n at someFunc (some-file:1:1)\n at Object.<anonymous> (some-file:1:1)\n at Object.<anonymous> (some-file:1:1)\n\n Screenshot: /screenshots/1445437598847/errors\n\n\n \u001b[31m2) \u001b[39mFirefox 47 / Mac OS X 10.10.1\n The specified selector does not match any element in the DOM tree.\n\n 1 |var createCallsiteRecord = require('callsite-record');\n 2 |\n 3 |function someFunc () {\n > 4 | throw new Error('Hey ya!');\n 5 |}\n 6 |\n 7 |try {\n 8 | someFunc();\n 9 |}\n\n at someFunc (some-file:1:1)\n at Object.<anonymous> (some-file:1:1)\n at Object.<anonymous> (some-file:1:1)\n\n\n \u001b[32m✓\u001b[39m \u001b[90mFirst fixture - Third test in first fixture\u001b[39m\n \u001b[32m✓\u001b[39m \u001b[90mSecond fixture - First test in second fixture\u001b[39m\n \u001b[32m✓\u001b[39m \u001b[90mSecond fixture - Second test in second fixture\u001b[39m\n \u001b[31m\u001b[1m✖\u001b[22m\u001b[39m \u001b[31m\u001b[1mThird fixture - First test in third fixture\u001b[22m\u001b[39m\u001b[33m (unstable)\u001b[39m\n\n \u001b[31m1) \u001b[39mFirefox 47 / Mac OS X 10.10.1\n - Error in beforeEach hook -\n The specified selector does not match any element in the DOM tree.\n\n 1 |var createCallsiteRecord = require('callsite-record');\n 2 |\n 3 |function someFunc () {\n > 4 | throw new Error('Hey ya!');\n 5 |}\n 6 |\n 7 |try {\n 8 | someFunc();\n 9 |}\n\n at someFunc (some-file:1:1)\n at Object.<anonymous> (some-file:1:1)\n at Object.<anonymous> (some-file:1:1)\n\n\n\n \u001b[1m\u001b[31m2/6 failed\u001b[39m\u001b[22m\u001b[90m (15m 25s)\u001b[39m\n"
2 changes: 1 addition & 1 deletion test/data/report-with-colors.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"\u001b[1mRunning tests in: \u001b[34mChrome\u001b[39m, \u001b[34mFirefox\u001b[39m\u001b[22m\n\n \u001b[32m✓\u001b[39m \u001b[90mfixture1 - fixture1test1\u001b[39m\u001b[33m (unstable)\u001b[39m (screenshots:\n \u001b[4m/screenshots/1445437598847\u001b[24m)\n \u001b[31m✖\u001b[39m \u001b[31mfixture1 - fixture1test2\u001b[39m (screenshots: \u001b[4m/screenshots/1445437598847\u001b[24m)\n\n 1) Chrome\n Assertion failed at step \"Step\":\n\n eq([\"12345678901\"], [\"00000000000\"])\n\n Arrays differ at index 0:\n\n Expected: [0]: \"12345678901\"\n Actual: [0]: \"00000000000\"\n ^\n\n Screenshot: /screenshots/1445437598847/userAgent/1.Fail.png\n\n\n 2) Chrome\n Assertion failed at step \"Step\":\n\n notEq(\"test\", \"test\")\n\n Expected: not \"test\"\n Actual: \"test\"\n\n\n 3) Firefox\n Assertion failed at step \"Step\":\n\n ok(false)\n\n Expected: not null, not undefined, not false, not NaN and not ''\n Actual: false\n\n\n \u001b[32m✓\u001b[39m \u001b[90mfixture1 - fixture1test3\u001b[39m\n \u001b[32m✓\u001b[39m \u001b[90mfixture2 - fixture2test1\u001b[39m\n \u001b[32m✓\u001b[39m \u001b[90mfixture2 - fixture2test2\u001b[39m\n \u001b[31m✖\u001b[39m \u001b[31mfixture3 - fixture3test1\u001b[39m\u001b[33m (unstable)\u001b[39m\n\n 1) Firefox\n Assertion failed at step \"Step\":\n\n eq([\"12345678901\"], [\"00000000000\"])\n\n Arrays differ at index 0:\n\n Expected: [0]: \"12345678901\"\n Actual: [0]: \"00000000000\"\n ^\n\n\n\n \u001b[1m\u001b[31m2/6 failed\u001b[39m\u001b[22m\u001b[90m (15m 25s)\u001b[39m\n"
"\u001b[1mRunning tests in: \u001b[34mChrome 41.0.2227 / Mac OS X 10.10.1\u001b[39m, \u001b[34mFirefox 47 / Mac OS X\n10.10.1\u001b[39m\u001b[22m\n\n \u001b[32m✓\u001b[39m \u001b[90mFirst fixture - First test in first fixture\u001b[39m\u001b[33m (unstable)\u001b[39m (screenshots:\n \u001b[4m/screenshots/1445437598847\u001b[24m)\n \u001b[31m\u001b[1m✖\u001b[22m\u001b[39m \u001b[31m\u001b[1mFirst fixture - Second test in first fixture\u001b[22m\u001b[39m (screenshots:\n \u001b[4m/screenshots/1445437598847\u001b[24m)\n\n \u001b[31m1) \u001b[39mChrome 41.0.2227 / Mac OS X 10.10.1\n Error on page \"http://example.org\":\n\n Some error\n\n 1 |var createCallsiteRecord = require('callsite-record');\n 2 |\n 3 |function someFunc () {\n > 4 | throw new Error('Hey ya!');\n 5 |}\n 6 |\n 7 |try {\n 8 | someFunc();\n 9 |}\n\n at someFunc (some-file:1:1)\n at Object.<anonymous> (some-file:1:1)\n at Object.<anonymous> (some-file:1:1)\n\n Screenshot: /screenshots/1445437598847/errors\n\n\n \u001b[31m2) \u001b[39mFirefox 47 / Mac OS X 10.10.1\n The specified selector does not match any element in the DOM tree.\n\n 1 |var createCallsiteRecord = require('callsite-record');\n 2 |\n 3 |function someFunc () {\n > 4 | throw new Error('Hey ya!');\n 5 |}\n 6 |\n 7 |try {\n 8 | someFunc();\n 9 |}\n\n at someFunc (some-file:1:1)\n at Object.<anonymous> (some-file:1:1)\n at Object.<anonymous> (some-file:1:1)\n\n\n \u001b[32m✓\u001b[39m \u001b[90mFirst fixture - Third test in first fixture\u001b[39m\n \u001b[32m✓\u001b[39m \u001b[90mSecond fixture - First test in second fixture\u001b[39m\n \u001b[32m✓\u001b[39m \u001b[90mSecond fixture - Second test in second fixture\u001b[39m\n \u001b[31m\u001b[1m✖\u001b[22m\u001b[39m \u001b[31m\u001b[1mThird fixture - First test in third fixture\u001b[22m\u001b[39m\u001b[33m (unstable)\u001b[39m\n\n \u001b[31m1) \u001b[39mFirefox 47 / Mac OS X 10.10.1\n - Error in beforeEach hook -\n The specified selector does not match any element in the DOM tree.\n\n 1 |var createCallsiteRecord = require('callsite-record');\n 2 |\n 3 |function someFunc () {\n > 4 | throw new Error('Hey ya!');\n 5 |}\n 6 |\n 7 |try {\n 8 | someFunc();\n 9 |}\n\n at someFunc (some-file:1:1)\n at Object.<anonymous> (some-file:1:1)\n at Object.<anonymous> (some-file:1:1)\n\n\n\n \u001b[1m\u001b[31m2/6 failed\u001b[39m\u001b[22m\u001b[90m (15m 25s)\u001b[39m\n"
117 changes: 67 additions & 50 deletions test/data/report-without-colors
Original file line number Diff line number Diff line change
@@ -1,56 +1,73 @@
Running tests in: Chrome, Firefox
Running tests in: Chrome 41.0.2227 / Mac OS X 10.10.1, Firefox 47 / Mac OS X
10.10.1

✓ fixture1 - fixture1test1 (unstable) (screenshots:
✓ First fixture - First test in first fixture (unstable) (screenshots:
/screenshots/1445437598847)
✖ First fixture - Second test in first fixture (screenshots:
/screenshots/1445437598847)
✖ fixture1 - fixture1test2 (screenshots: /screenshots/1445437598847)

1) Chrome
Assertion failed at step "Step":

eq(["12345678901"], ["00000000000"])

Arrays differ at index 0:

Expected: [0]: "12345678901"
Actual: [0]: "00000000000"
^

Screenshot: /screenshots/1445437598847/userAgent/1.Fail.png


2) Chrome
Assertion failed at step "Step":

notEq("test", "test")

Expected: not "test"
Actual: "test"


3) Firefox
Assertion failed at step "Step":

ok(false)

Expected: not null, not undefined, not false, not NaN and not ''
Actual: false


✓ fixture1 - fixture1test3
✓ fixture2 - fixture2test1
✓ fixture2 - fixture2test2
✖ fixture3 - fixture3test1 (unstable)

1) Firefox
Assertion failed at step "Step":

eq(["12345678901"], ["00000000000"])

Arrays differ at index 0:

Expected: [0]: "12345678901"
Actual: [0]: "00000000000"
^
1) Chrome 41.0.2227 / Mac OS X 10.10.1
Error on page "http://example.org":

Some error

1 |var createCallsiteRecord = require('callsite-record');
2 |
3 |function someFunc () {
> 4 | throw new Error('Hey ya!');
5 |}
6 |
7 |try {
8 | someFunc();
9 |}

at someFunc (some-file:1:1)
at Object.<anonymous> (some-file:1:1)
at Object.<anonymous> (some-file:1:1)

Screenshot: /screenshots/1445437598847/errors


2) Firefox 47 / Mac OS X 10.10.1
The specified selector does not match any element in the DOM tree.

1 |var createCallsiteRecord = require('callsite-record');
2 |
3 |function someFunc () {
> 4 | throw new Error('Hey ya!');
5 |}
6 |
7 |try {
8 | someFunc();
9 |}

at someFunc (some-file:1:1)
at Object.<anonymous> (some-file:1:1)
at Object.<anonymous> (some-file:1:1)


✓ First fixture - Third test in first fixture
✓ Second fixture - First test in second fixture
✓ Second fixture - Second test in second fixture
✖ Third fixture - First test in third fixture (unstable)

1) Firefox 47 / Mac OS X 10.10.1
- Error in beforeEach hook -
The specified selector does not match any element in the DOM tree.

1 |var createCallsiteRecord = require('callsite-record');
2 |
3 |function someFunc () {
> 4 | throw new Error('Hey ya!');
5 |}
6 |
7 |try {
8 | someFunc();
9 |}

at someFunc (some-file:1:1)
at Object.<anonymous> (some-file:1:1)
at Object.<anonymous> (some-file:1:1)



Expand Down
159 changes: 0 additions & 159 deletions test/data/test-calls.js

This file was deleted.

Loading

0 comments on commit 3171a44

Please sign in to comment.