diff --git a/Gulpfile.js b/Gulpfile.js index cc7eea1abb1..b112b823444 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -645,7 +645,7 @@ gulp.step('test-functional-local-run', function () { return testFunctional('test/functional/fixtures', functionalTestConfig.testingEnvironmentNames.localBrowsers); }); -gulp.task('test-functional-local', gulp.series('build', 'test-functional-local-run')); +gulp.task('test-functional-local', gulp.series(/*'build',*/ 'test-functional-local-run')); gulp.step('test-functional-local-ie-run', function () { return testFunctional('test/functional/fixtures', functionalTestConfig.testingEnvironmentNames.localBrowsersIE); diff --git a/package.json b/package.json index 57d32e7874f..a5d5d8fb26a 100644 --- a/package.json +++ b/package.json @@ -106,7 +106,7 @@ "source-map-support": "^0.5.5", "strip-bom": "^2.0.0", "testcafe-browser-tools": "1.6.4", - "testcafe-hammerhead": "14.2.0", + "testcafe-hammerhead": "14.2.1", "testcafe-legacy-api": "3.1.7", "testcafe-reporter-json": "^2.1.0", "testcafe-reporter-list": "^2.1.0", diff --git a/src/api/request-hooks/hook.js b/src/api/request-hooks/hook.js index da1ed8f98b4..4ee026e2255 100644 --- a/src/api/request-hooks/hook.js +++ b/src/api/request-hooks/hook.js @@ -6,6 +6,8 @@ export default class RequestHook { this.requestFilterRules = this._prepareRequestFilterRules(requestFilterRules); this._instantiatedRequestFilterRules = []; this.responseEventConfigureOpts = responseEventConfigureOpts; + + this.warningLog = null; } _prepareRequestFilterRules (rules) { diff --git a/src/api/request-hooks/request-mock.js b/src/api/request-hooks/request-mock.js index 1134d88fc30..ef6f53fa80a 100644 --- a/src/api/request-hooks/request-mock.js +++ b/src/api/request-hooks/request-mock.js @@ -2,6 +2,7 @@ import RequestHook from './hook'; import { ResponseMock, RequestFilterRule } from 'testcafe-hammerhead'; import { APIError } from '../../errors/runtime'; import MESSAGE from '../../errors/runtime/message'; +import WARNING_MESSAGE from '../../notifications/warning-message'; class RequestMock extends RequestHook { constructor () { @@ -17,7 +18,9 @@ class RequestMock extends RequestHook { event.setMock(mock); } - onResponse () {} + onResponse (event) { + this.warningLog.addWarning(WARNING_MESSAGE.requestMockCORSValidationFailed, RequestMock.name, event._requestFilterRule); + } // API onRequestTo (requestFilterRuleInit) { diff --git a/src/notifications/warning-message.js b/src/notifications/warning-message.js index 2a521f82070..ea1f5c13d97 100644 --- a/src/notifications/warning-message.js +++ b/src/notifications/warning-message.js @@ -8,5 +8,6 @@ export default { resizeNotSupportedByBrowserProvider: 'The window resize functionality is not supported by the "{providerName}" browser provider.', maximizeNotSupportedByBrowserProvider: 'The window maximization functionality is not supported by the "{providerName}" browser provider.', resizeError: 'Was unable to resize the window due to an error.\n\n{errMessage}', - maximizeError: 'Was unable to maximize the window due to an error.\n\n{errMessage}' + maximizeError: 'Was unable to maximize the window due to an error.\n\n{errMessage}', + requestMockCORSValidationFailed: '{RequestHook}: CORS validation failed for a request specified as {requestFilterRule}' }; diff --git a/src/test-run/index.js b/src/test-run/index.js index 162972a813a..73bed7eaf35 100644 --- a/src/test-run/index.js +++ b/src/test-run/index.js @@ -110,6 +110,8 @@ export default class TestRun extends EventEmitter { this.quarantine = null; + this.warningLog = warningLog; + this.injectable.scripts.push('/testcafe-core.js'); this.injectable.scripts.push('/testcafe-ui.js'); this.injectable.scripts.push('/testcafe-automation.js'); @@ -150,6 +152,8 @@ export default class TestRun extends EventEmitter { } _initRequestHook (hook) { + hook.warningLog = this.warningLog; + hook._instantiateRequestFilterRules(); hook._instantiatedRequestFilterRules.forEach(rule => { this.session.addRequestEventListeners(rule, { @@ -161,6 +165,8 @@ export default class TestRun extends EventEmitter { } _disposeRequestHook (hook) { + hook.warningLog = null; + hook._instantiatedRequestFilterRules.forEach(rule => { this.session.removeRequestEventListeners(rule); }); diff --git a/test/functional/config.js b/test/functional/config.js index 5636cc1625d..306761cb6f6 100644 --- a/test/functional/config.js +++ b/test/functional/config.js @@ -101,7 +101,7 @@ testingEnvironments[testingEnvironmentNames.localBrowsers] = { platform: 'Windows 10', browserName: 'chrome', alias: 'chrome' - }, + }/*, { platform: 'Windows 10', browserName: 'ie', @@ -112,7 +112,7 @@ testingEnvironments[testingEnvironmentNames.localBrowsers] = { platform: 'Windows 10', browserName: 'firefox', alias: 'firefox' - } + }*/ ] }; diff --git a/test/functional/fixtures/api/es-next/request-hooks/pages/failed-cors-validation.html b/test/functional/fixtures/api/es-next/request-hooks/pages/failed-cors-validation.html new file mode 100644 index 00000000000..8e35954020d --- /dev/null +++ b/test/functional/fixtures/api/es-next/request-hooks/pages/failed-cors-validation.html @@ -0,0 +1,24 @@ + + +
+ +