Skip to content

Commit

Permalink
Bump version (v1.4.0-rc.2); Bump hh (v14.7.2); Prevent form.submit (fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKamaev authored and AndreyBelym committed Aug 1, 2019
1 parent f28c907 commit 7d32524
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -2,7 +2,7 @@
"name": "testcafe",
"description": "Automated browser testing for the modern web development stack.",
"license": "MIT",
"version": "1.4.0-rc.1",
"version": "1.4.0-rc.2",
"author": {
"name": "Developer Express Inc.",
"url": "https://www.devexpress.com/"
Expand Down Expand Up @@ -114,7 +114,7 @@
"source-map-support": "^0.5.5",
"strip-bom": "^2.0.0",
"testcafe-browser-tools": "1.6.8",
"testcafe-hammerhead": "14.7.1",
"testcafe-hammerhead": "14.7.2",
"testcafe-legacy-api": "3.1.11",
"testcafe-reporter-json": "^2.1.0",
"testcafe-reporter-list": "^2.1.0",
Expand Down
9 changes: 9 additions & 0 deletions src/client/driver/driver.js
Expand Up @@ -138,6 +138,7 @@ export default class Driver {
hammerhead.on(hammerhead.EVENTS.uncaughtJsError, err => this._onJsError(err));
hammerhead.on(hammerhead.EVENTS.unhandledRejection, err => this._onJsError(err));
hammerhead.on(hammerhead.EVENTS.consoleMethCalled, e => this._onConsoleMessage(e));
hammerhead.on(hammerhead.EVENTS.beforeFormSubmit, e => this._onFormSubmit(e));

this.setCustomCommandHandlers(COMMAND_TYPE.unlockPage, () => this._unlockPageAfterTestIsDone());
}
Expand Down Expand Up @@ -205,6 +206,14 @@ export default class Driver {
this.contextStorage.setItem(PENDING_PAGE_ERROR, error);
}

// HACK: For https://github.com/DevExpress/testcafe/issues/3560
// We have to cancel every form submit after a test is done
// to prevent requests to a closed session
_onFormSubmit (e) {
if (this.contextStorage.getItem(TEST_DONE_SENT_FLAG))
e.preventSubmit = true;
}

// Console messages
_onConsoleMessage ({ meth, line }) {
const messages = this.consoleMessages;
Expand Down
6 changes: 3 additions & 3 deletions test/client/before-test.js
Expand Up @@ -39,13 +39,13 @@
.replace('{{{cookie}}}', cookie || '');
};

window.initIFrameTestHandler = function (e) {
window.initIFrameTestHandler = function (iframe) {
const referer = location;
const serviceMsg = '/service-msg/100';
const iframeTaskScript = window.getIframeTaskScript(referer, serviceMsg, location).replace(/"/g, '\\"');

if (e.iframe.id.indexOf('test') !== -1) {
e.iframe.contentWindow.eval.call(e.iframe.contentWindow, [
if (iframe.id.indexOf('test') !== -1) {
iframe.contentWindow.eval.call(iframe.contentWindow, [
'window["%hammerhead%"].get("./utils/destination-location").forceLocation("' + location + '");',
'window["%hammerhead%"].start({',
' referer : "' + referer + '",',
Expand Down

0 comments on commit 7d32524

Please sign in to comment.