Skip to content

Commit

Permalink
incorrect testing time calculation for xunit and json reporters fixed…
Browse files Browse the repository at this point in the history
… (сloses DevExpress#1674) (DevExpress#1686)

* incorrect test time calculation for xunit and json reporters fixed (closes DevExpress#1674)

* update legacy version

* Fix linting
  • Loading branch information
helen-dikareva authored and kirovboris committed Dec 18, 2019
1 parent 157d17a commit 06779b6
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"strip-bom": "^2.0.0",
"testcafe-browser-tools": "1.2.4",
"testcafe-hammerhead": "11.0.3",
"testcafe-legacy-api": "3.1.0",
"testcafe-legacy-api": "3.1.1",
"testcafe-reporter-json": "^2.1.0",
"testcafe-reporter-list": "^2.1.0",
"testcafe-reporter-minimal": "^2.1.0",
Expand Down
4 changes: 2 additions & 2 deletions src/runner/test-run-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ export default class TestRunController extends EventEmitter {
return null;
}

testRun.start();

testRun.once('start', () => this.emit('test-run-start'));
testRun.once('done', () => this._testRunDone());

testRun.start();

return this.proxy.openSession(testRun.test.pageUrl, testRun, this.opts.externalProxyHost);
}
}
5 changes: 5 additions & 0 deletions test/functional/fixtures/api/es-next/click/test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
var expect = require('chai').expect;

//GH-1674
const TEST_DURATION_BOUND = 10000;

// NOTE: we run tests in chrome only, because we mainly test server API functionality.
// Actions functionality is tested in lower-level raw API.
describe('[API] t.click()', function () {
it('Should make click on a button', function () {
return runTests('./testcafe-fixtures/click-test.js', 'Click button', { shouldFail: true, only: 'chrome' })
.catch(function (errs) {
// GH-1674
expect(testReport.durationMs).below(TEST_DURATION_BOUND);
expect(errs[0]).to.contains('Button clicked');
expect(errs[0]).to.contains(
' 15 |test(\'Incorrect action option\', async t => {' +
Expand Down
10 changes: 10 additions & 0 deletions test/functional/legacy-fixtures/page-js-errors/test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
var expect = require('chai').expect;
var CUSTOM_JS_ERROR = '%TC_TEST_ERR%';
var errorInEachBrowserContains = require('../../assertion-helper.js').errorInEachBrowserContains;

const TEST_DURATION_BOUND = 10000;

describe('[Legacy] Uncaught js errors', function () {
it('Should fail if there is no onerror handler', function () {
Expand Down Expand Up @@ -62,5 +64,13 @@ describe('[Legacy] Uncaught js errors', function () {
errorInEachBrowserContains(errs, 'on page "http://localhost:3000/legacy-fixtures/page-js-errors/pages/no-handler.html"', 0);
});
});

it('Test report should contains correct duration time (GH-22)', function () {
return runTests('./testcafe-fixtures/unreachable-page.test.js', 'Unreachable page')
.catch(function (errs) {
expect(testReport.durationMs).below(TEST_DURATION_BOUND);
errorInEachBrowserContains(errs, 'Failed to find a DNS-record for the resource at', 0);
});
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'@fixture Fixture';
'@page http://pageNotExists';

'@test'['Unreachable page'] = {
'1. Click body': function () {
act.click('body');
}
};

0 comments on commit 06779b6

Please sign in to comment.