runbox / runbox7

Runbox 7 web app
Other
127 stars 26 forks source link

Make the protractor browser configurable #551

Open tadzik opened 4 years ago

tadzik commented 4 years ago

Since https://github.com/runbox/runbox7/pull/535 unit tests require firefox to be installed. The used to require chrome, which wasn't ideal either, and theoretically they should be runnable on bare electron as well. It'd be useful to have the browser configurable (with an env var, for example) instead of requiring anything in particular.

@castaway feel free to pick it up if you feel like it :)

tadzik commented 4 years ago

This enables using (headless) Electron for unit tests:

diff --git a/karma.conf.js b/karma.conf.js
index 5da6859..97108dc 100644
--- a/karma.conf.js
+++ b/karma.conf.js
@@ -7,6 +7,7 @@ module.exports = function (config) {
     frameworks: ['jasmine', '@angular-devkit/build-angular'],
     plugins: [
       require('karma-jasmine'),
+      require('karma-electron-launcher'),
       require('karma-firefox-launcher'),
       require('karma-jasmine-html-reporter'),
       require('karma-coverage-istanbul-reporter'),
@@ -27,7 +28,12 @@ module.exports = function (config) {
     colors: true,
     logLevel: config.LOG_INFO,
     autoWatch: true,
-    browsers: ['Firefox'],
+    browsers: ['Electron', 'Firefox'],
+    electronOpts: {
+      width: 1920,
+      height: 1080,
+      show: false
+    },
     singleRun: false
   });
 };
tadzik commented 4 years ago

Work started in https://github.com/runbox/runbox7/pull/555

castaway commented 4 years ago

Tested on my new VM with no browsers, I get the following: The SUID sandbox helper binary was found, but is not configured correctly .. any idea what it wants? (research says suid and root owned binary but.. that seems a bit OTT?) .. e2e tests run on this box fine with no similar fixes.

gtandersen commented 2 years ago

@castaway Is this still relevant?