Skip to content

Commit

Permalink
Hide TestCafe UI completely during screenshot creating (fixes DevExpr…
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderMoskovkin committed Jan 30, 2018
1 parent ea29623 commit 43c4c6d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/client/ui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const HIDE_RESPONSE_CMD = 'ui|hide|response';
const SHOW_REQUEST_CMD = 'ui|show|request';
const SHOW_RESPONSE_CMD = 'ui|show|response';

const HIDDEN_CLASS = 'hidden';

// Setup cross-iframe interaction
messageSandbox.on(messageSandbox.SERVICE_MSG_RECEIVED_EVENT, e => {
if (e.message.cmd === HIDE_REQUEST_CMD) {
Expand All @@ -41,20 +43,21 @@ exports.IframeStatusBar = IframeStatusBar;

exports.get = require;


exports.hide = function (hideTopRoot) {
if (hideTopRoot)
return sendRequestToFrame({ cmd: HIDE_REQUEST_CMD }, HIDE_RESPONSE_CMD, window.top);

hammerhead.shadowUI.getRoot().style.visibility = 'hidden';
hammerhead.shadowUI.addClass(hammerhead.shadowUI.getRoot(), HIDDEN_CLASS);

return Promise.resolve();
};

exports.show = function (showTopRoot) {
if (showTopRoot)
return sendRequestToFrame({ cmd: SHOW_REQUEST_CMD }, SHOW_RESPONSE_CMD, window.top);

hammerhead.shadowUI.getRoot().style.visibility = '';
hammerhead.shadowUI.removeClass(hammerhead.shadowUI.getRoot(), HIDDEN_CLASS);

return Promise.resolve();
};

Expand Down
8 changes: 8 additions & 0 deletions src/client/ui/styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
-moz-transition: none !important;
-o-transition: none !important;

&.hidden {
visibility: hidden;

* {
visibility: hidden !important;
}
}

.layout-default();

/*Mixins*/
Expand Down

0 comments on commit 43c4c6d

Please sign in to comment.