Skip to content

Commit

Permalink
[WIP] Hide TestCafe UI completely during screenshot creating (fixes D…
Browse files Browse the repository at this point in the history
…evExpress#2076) (DevExpress#2084)

Hide TestCafe UI completely during screenshot creating (fixes DevExpress#2076)
  • Loading branch information
AlexanderMoskovkin authored and kirovboris committed Dec 18, 2019
1 parent c646949 commit df3e2b9
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions test/client/before-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
(function () {
$('<link rel="stylesheet" type="text/css" href="/styles.css">').appendTo('head');

//NOTE: Prohibit Hammerhead from processing testing environment resources.
// There are only testing environment resources on the page when this script is being executed. So, we can add
// the hammerhead class to all script and link elements on the page.
Expand Down
9 changes: 9 additions & 0 deletions test/client/config-qunit-server-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ var url = require('url');
var fs = require('fs');
var path = require('path');

var createShadowStylesheet = require('testcafe-hammerhead/lib/shadow-ui/create-shadow-stylesheet');


//The following code is copied from testcafe-hammerhead
//NOTE: Url rewrite proxied requests (e.g. for iframes), so they will hit our server
Expand Down Expand Up @@ -65,4 +67,11 @@ module.exports = function (app) {
app.get('/close-request', function (req) {
req.destroy();
});

app.all('/styles.css', function (req, res) {
fs.readFile(path.join(__dirname, '../../lib/client/ui/styles.css'), function (err, css) {
res.set('Content-Type', 'text/css');
res.send(createShadowStylesheet(css.toString()));
});
});
};
2 changes: 1 addition & 1 deletion test/client/data/dom-utils/iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<script src="/ui.js" class="script-hammerhead-shadow-ui"></script>
<script src="/jquery.js" class="script-hammerhead-shadow-ui"></script>

<link type="text/css" rel=stylesheet href="/ui.css" class="ui-stylesheet-hammerhead-shadow-ui">
<link type="text/css" rel=stylesheet href="/styles.css" class="ui-stylesheet-hammerhead-shadow-ui">
</head>
<body>
<script type="text/javascript">
Expand Down
2 changes: 1 addition & 1 deletion test/client/data/focus-blur-change/iframe.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel=stylesheet href="/ui.css" class="ui-stylesheet-hammerhead-shadow-ui">
<link type="text/css" rel=stylesheet href="/styles.css" class="ui-stylesheet-hammerhead-shadow-ui">

<script src="/hammerhead.js" class="script-hammerhead-shadow-ui"></script>
</head>
Expand Down
2 changes: 1 addition & 1 deletion test/client/data/runner/iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<script src="/legacy-runner.js" class="script-hammerhead-shadow-ui"></script>
<script src="/jquery.js" class="script-hammerhead-shadow-ui"></script>

<link type="text/css" rel=stylesheet href="/ui.css" class="ui-stylesheet-hammerhead-shadow-ui">
<link type="text/css" rel=stylesheet href="/styles.css" class="ui-stylesheet-hammerhead-shadow-ui">
</head>
<body>
<script type="text/javascript">
Expand Down

0 comments on commit df3e2b9

Please sign in to comment.