• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

karma-runner/karma-firefox-launcher: A Karma plugin. Launcher for Firefox.

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

karma-runner/karma-firefox-launcher

开源软件地址:

https://github.com/karma-runner/karma-firefox-launcher

开源编程语言:

JavaScript 99.4%

开源软件介绍:

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({
    plugins: [
      require('karma-firefox-launcher')
    ],
    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.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap