From c7afe52f580719a70617888559324897f1bd1adb Mon Sep 17 00:00:00 2001 From: AlexanderMoskovkin Date: Tue, 30 Jan 2018 16:55:50 +0300 Subject: [PATCH] Hide TestCafe UI completely during screenshot creating (fixes #2076) --- Gulpfile.js | 2 ++ test/client/config-qunit-server-app.js | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/Gulpfile.js b/Gulpfile.js index 0aa8ad3fa51..3ae7fddca7c 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -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') }; diff --git a/test/client/config-qunit-server-app.js b/test/client/config-qunit-server-app.js index e569439dcea..9be5b489f73 100644 --- a/test/client/config-qunit-server-app.js +++ b/test/client/config-qunit-server-app.js @@ -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 @@ -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)); + }); + }); };