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 Feb 10, 2018
1 parent 007774b commit c7afe52
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ var CLIENT_TESTS_SETTINGS_BASE = {
{ src: '/before-test.js', path: 'test/client/before-test.js' }
],

css: [ { src: '/styles.css', path: 'lib/client/ui/styles.css' } ],

configApp: require('./test/client/config-qunit-server-app')
};

Expand Down
11 changes: 11 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,13 @@ 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) {
/* eslint-disable no-console */
console.log('GOT!');
res.set('Content-Type', 'text/css');
res.send(createShadowStylesheet(css));
});
});
};

0 comments on commit c7afe52

Please sign in to comment.