A Karma plugin. Launcher for Firefox/Chrome (evacuated from NSA/Microsoft Github)

ShankarShastri 0e37f76b5d feat(headless): add enable remote debugging by default преди 6 години
test 92cc77c9ed refactor: clean up code and add tests преди 7 години
.gitignore 267afc11ae feat: add support for loading extensions преди 9 години
.mailmap 5f352c4062 chore: add a Git .mailmap with my new name преди 7 години
.npmignore 0ca1110e0f chore: allow Karma 0.10, clean up NPM package преди 11 години
.travis.yml 66cd7ed873 chore(ci): remove depracted Node versions from Travis.yml преди 7 години
CHANGELOG.md cf20be3b93 chore(release): 1.1.0 преди 7 години
CONTRIBUTING.md 6fab41e868 chore: rename to Karma преди 11 години
LICENSE 31461aceba chore: fix the license преди 11 години
README.md e68a711760 docs(readme): add badges преди 7 години
index.js 0e37f76b5d feat(headless): add enable remote debugging by default преди 6 години
karma.conf.js a1fc1c86e0 feat: support Firefox headless преди 7 години
package.json cf20be3b93 chore(release): 1.1.0 преди 7 години
yarn.lock 66812f16cd chore: update dev dependencies преди 7 години

README.md

karma-firefox-launcher

js-standard-style npm version npm downloads

Build Status Dependency Status devDependency Status

Launcher for Mozilla Firefox.

Installation

The easiest way is to keep karma-firefox-launcher as a devDependency in your package.json.

You can simple do it by:

npm install karma-firefox-launcher --save-dev

Configuration

// karma.conf.js
module.exports = function(config) {
  config.set({
    browsers: ['Firefox', 'FirefoxDeveloper', 'FirefoxAurora', 'FirefoxNightly'],
  })
}

You can pass list of browsers as a CLI argument too:

karma start --browsers Firefox,Chrome

Custom Preferences

To configure preferences for the Firefox instance that is loaded, you can specify a custom launcher in your Karma config with the preferences under the prefs key:

browsers: ['FirefoxAutoAllowGUM'],

customLaunchers: {
    FirefoxAutoAllowGUM: {
        base: 'Firefox',
        prefs: {
            'media.navigator.permission.disabled': true
        }
    }
}

Loading Firefox Extensions

If you have extensions that you want loaded into the browser on startup, you can specify the full path to each extension in the extensions key:

browsers: ['FirefoxWithMyExtension'],

customLaunchers: {
    FirefoxWithMyExtension: {
        base: 'Firefox',
        extensions: [
          path.resolve(__dirname, 'helpers/extensions/myCustomExt@suchandsuch.xpi'),
          path.resolve(__dirname, 'helpers/extensions/myOtherExt@soandso.xpi')
        ]
    }
}

Please note: the extension name must exactly match the 'id' of the extension. You can discover the 'id' of your extension by extracting the .xpi (i.e. unzip XXX.xpi) and opening the install.RDF file with a text editor, then look for the em:id tag under the Description tag. If your extension manifest looks something like this:

<?xml version="1.0" encoding="utf-8"?>
   <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
  <Description about="urn:mozilla:install-manifest">
    <em:id>myCustomExt@suchandsuch</em:id>
    <em:version>1.0</em:version>
    <em:type>2</em:type>
    <em:bootstrap>true</em:bootstrap>
    <em:unpack>false</em:unpack>

    [...]
  </Description>
</RDF>

Then you should name your extension myCustomExt@suchandsuch.xpi.


For more information on Karma see the homepage.