GithubHelp home page GithubHelp logo

isabella232 / karma-firefox-launcher Goto Github PK

View Code? Open in Web Editor NEW

This project forked from karma-runner/karma-firefox-launcher

0.0 0.0 0.0 668 KB

A Karma plugin. Launcher for Firefox.

License: MIT License

JavaScript 100.00%

karma-firefox-launcher's Introduction

karma-firefox-launcher

js-standard-style npm version npm downloads semantic-release

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

To run Firefox in headless mode, append Headless to the version name, e.g. FirefoxHeadless, FirefoxNightlyHeadless.

Environment variables

You can specify the location of the Firefox executable using the following environment variables:

  • FIREFOX_BIN (for browser Firefox or FirefoxHeadless)
  • FIREFOX_DEVELOPER_BIN (for browser FirefoxDeveloper or FirefoxDeveloperHeadless)
  • FIREFOX_AURORA_BIN (for browser FirefoxAurora or FirefoxAuroraHeadless)
  • FIREFOX_NIGHTLY_BIN (for browser FirefoxNightly or FirefoxNightlyHeadless)

Custom Firefox location

In addition to Environment variables you can specify location of the Firefox executable in a custom launcher:

browsers: ['Firefox68', 'Firefox78'],

customLaunchers: {
    Firefox68: {
        base: 'Firefox',
        name: 'Firefox68',
        command: '<path to FF68>/firefox.exe'
    },
    Firefox78: {
        base: 'Firefox',
        name: 'Firefox78',
        command: '<path to FF78>/firefox.exe'
    }
}

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/[email protected]'),
          path.resolve(__dirname, 'helpers/extensions/[email protected]')
        ]
    }
}

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 [email protected].


For more information on Karma see the homepage.

karma-firefox-launcher's People

Contributors

andrei-khveras avatar appzuka avatar axemclion avatar azaslavsky avatar birtles avatar delapuente avatar dependabot[bot] avatar dignifiedquire avatar elmariofredo avatar honzabrecka avatar jamestalmage avatar johnjbarton avatar jprjr avatar keithamus avatar leonardoval avatar maksimr avatar markchagers avatar metatoaster avatar mgol avatar pantosha avatar petejohanson avatar rmcneely avatar semantic-release-bot avatar shankarshastri avatar tstackhouse avatar vojtajina avatar zilvinasu avatar zzo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.