1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
# karma-firefox-launcher
> Launcher for Mozilla Firefox.
## Installation
The easiest way is to keep `karma-firefox-launcher` as a devDependency in your `package.json`.
```json
{
"devDependencies": {
"karma": "~0.10",
"karma-firefox-launcher": "~0.1"
}
}
```
You can simple do it by:
```bash
npm install karma-firefox-launcher --save-dev
```
## Configuration
```js
// 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:
```bash
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:
```js
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:
```js
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
<?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].
[homepage]: http://karma-runner.github.com
|