karma-runner / karma-firefox-launcher

A Karma plugin. Launcher for Firefox.
MIT License
104 stars 53 forks source link

Default Preferences update #89

Open bengfarrell opened 5 years ago

bengfarrell commented 5 years ago

I had some unrelated problems when launching tests using FF 64, but thought that 2 extra tabs when Firefox loaded were my issue - I was theorizing a loss of focus.

While this ultimately wasn't my issue, I'd like to propose a cleaner start to the launcher.

One tab is a privacy notice: 'toolkit.telemetry.reportingpolicy.firstRun': false

The other is a forced load of the Acrobat add-on, which oddly happens if the build ID and app version aren't specified: 'extensions.lastAppBuildId':'20181206201918', 'extensions.lastAppVersion': '64.0',

Both of these are easily added to the karma.conf.js, but took a long time to track down, so would be nice if they were default prefs.

Westbrook commented 4 years ago

This isn't that much prettier, but not having to push version numbers should make this a little more usable for people:

browsers: ['FirefoxHeadlessCustom'],
customLaunchers: {
      FirefoxHeadlessCustom: {
            base: 'Firefox',
            flags: [ '-headless' ],
            prefs: {
                    'toolkit.telemetry.reportingpolicy.firstRun': false,
                    'extensions.enabledScopes': 0
            }
      },
},

Ben's 'toolkit.telemetry.reportingpolicy.firstRun': false, kicks things off to skip the privacy report, but it's the 'extensions.enabledScopes': 0 that kills the Acrobat tab...

It's even harder to know this is happening when working with -headless, so I think it'd be a useful add to the library for future users (with maybe some docs around the extensions.enabledScopes entry. If that make sense to add to the tooling here, I'd be happy to submit a PR. Looks like I'd just add these to https://github.com/karma-runner/karma-firefox-launcher/blob/master/index.js#L9-L19, right?

birtles commented 4 years ago

I wonder if that is too restrictive for folks who want to test their add-ons with karma-firefox-launcher. Could we make extensions.enabledScopes be, say, 5 instead? (Reference: https://mike.kaply.com/2012/02/21/understanding-add-on-scopes/)

Westbrook commented 4 years ago

That makes sense to me! I was pretty haggard after debugging this with a bunch of different preferences and was going full nuclear with the 0... 💥

If I read this link your shared correctly, 4 is the same as 5. Or am I misunderstanding? If they're the same, should we use the value that people could later find there so it's clear what is being defaulted to?

birtles commented 4 years ago

If I read this link your shared correctly, 4 is the same as 5. Or am I misunderstanding?

I believe it's a bitfield so SCOPE_PROFILE | SCOPE_APPLICATION = 1 | 4 = 5.

4 alone (SCOPE_APPLICATION) would not recognize add-ons added to the profile directory.