Skip to content

Commit

Permalink
Fix problems with node@11 & mobile browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyBelym committed Oct 24, 2018
1 parent 16276f5 commit fd42bf3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion test/functional/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ testingEnvironments[testingEnvironmentNames.mobileBrowsers] = {
realMobile: true,
os: 'android',
osVersion: '8.0',
device: 'Google Pixel',
device: 'Google Pixel 2',
name: 'Android',
alias: 'android'
},
Expand Down
16 changes: 13 additions & 3 deletions test/functional/fixtures/api/es-next/generic-errors/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,15 @@ describe('[API] Generic errors', function () {

describe('External assertion library error', function () {
it('Should handle Node built-in assertion lib error', function () {
const NEW_NODE_ASSERTION_MESSAGE = [
const NODE_11_ASSERTION_MESSAGE = [
'AssertionError [ERR_ASSERTION]: Input A expected to strictly equal input B:',
'+ actual - expected',
'',
'+ \'answer\'',
'- \'42\''
].join(' ');

const NODE_10_ASSERTION_MESSAGE = [
'AssertionError [ERR_ASSERTION]: Input A expected to strictly equal input B:',
'+ expected - actual',
'',
Expand All @@ -65,8 +73,10 @@ describe('[API] Generic errors', function () {
.catch(function (errs) {
expect(errs[0]).to.contains('> 13 | assert.strictEqual(\'answer\', \'42\');');

if (nodeVersion.major >= 10)
expect(errs[0]).to.contain(NEW_NODE_ASSERTION_MESSAGE);
if (nodeVersion.major >= 11)
expect(errs[0]).to.contain(NODE_11_ASSERTION_MESSAGE);
else if (nodeVersion.major >= 10)
expect(errs[0]).to.contain(NODE_10_ASSERTION_MESSAGE);
else
expect(errs[0]).to.match(OLD_NODE_ASSERTION_MESSAGE_RE);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
describe('Should wait for the window.load event if necessary', function () {
it('Should wait for the window.load event if there are user event handlers for it (set timeout via an option)', function () {
return runTests('testcafe-fixtures/index-test.js', 'Wait for window.load (set timeout via an option)', { pageLoadTimeout: 3000 });
return runTests('testcafe-fixtures/index-test.js', 'Wait for window.load (set timeout via an option)', { pageLoadTimeout: 5000 });
});

it('Should wait for the window.load event if there are user event handlers for it (set timeout via `t`)', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ test
test
('Wait for window.load (set timeout via `t`)', async t => {
await t
.setPageLoadTimeout(3000)
.setPageLoadTimeout(5000)
.navigateTo('http://localhost:3000/fixtures/api/es-next/page-load-timeout/pages/window-load.html')
.expect(ClientFunction(() => window.loadEventRaised)()).ok('Test started before window.load', { timeout: 0 });
});

test
('Wait for window.load in iframe', async t => {
await t
.setPageLoadTimeout(3000)
.setPageLoadTimeout(5000)
.navigateTo('http://localhost:3000/fixtures/api/es-next/page-load-timeout/pages/with-iframe.html')
.switchToIframe('#iframe')
.expect(ClientFunction(() => window.loadEventRaised)()).ok('Test started before window.load', { timeout: 0 });
Expand Down

0 comments on commit fd42bf3

Please sign in to comment.