forked from honestbleeps/Reddit-Enhancement-Suite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nightwatch.conf.js
61 lines (56 loc) · 1.56 KB
/
nightwatch.conf.js
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
/* @noflow */
/* eslint-disable import/no-commonjs, import/no-nodejs-modules */
const fs = require('fs');
const JSZip = require('jszip');
const chromeManifest = require('./chrome/manifest.json');
const firefoxManifest = require('./firefox/manifest.json');
module.exports = {
src_folders: ['tests'],
test_workers: {
enabled: true,
workers: 5,
},
detailed_output: false,
live_output: true,
test_settings: {
default: {
selenium_host: process.env.SELENIUM_HOST,
selenium_port: process.env.SELENIUM_PORT,
username: process.env.SAUCE_USERNAME,
access_key: process.env.SAUCE_ACCESS_KEY,
globals: {
waitForConditionTimeout: 10000,
afterEach(browser, done) {
console.log('View results:', `https://saucelabs.com/tests/${browser.capabilities['webdriver.remote.sessionid']}/`);
done();
},
},
},
chrome: {
desiredCapabilities: {
browserName: 'chrome',
version: chromeManifest.minimum_chrome_version,
chromeOptions: {
args: ['--no-sandbox'],
extensions: [getChromePackage()],
},
},
},
firefox: {
desiredCapabilities: {
browserName: 'firefox',
version: 'dev',
firefox_profile: getFirefoxProfile(),
},
},
},
};
function getChromePackage() {
return fs.readFileSync('dist/zip/chrome.zip').toString('base64');
}
function getFirefoxProfile() {
const zip = new JSZip();
zip.file(`extensions/${firefoxManifest.applications.gecko.id}.xpi`, fs.readFileSync('dist/zip/firefox.zip'));
zip.file('prefs.js', 'user_pref("xpinstall.signatures.required", false);');
return zip.generate({ type: 'base64' });
}