-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprotractor.conf.js
59 lines (53 loc) · 1.83 KB
/
protractor.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
// Firefox isn't run default since it has a bug with mousemove (See https://github.com/angular/protractor/issues/4715 )
const [width, height] = [800, 1000];
const common = {
shardTestFiles: parseInt(process.env.THREADS) !== 1,
maxInstances: process.env.THREADS ? parseInt(process.env.THREADS) : 4
};
const chrome = {
...common,
browserName: "chrome",
chromeOptions: {
args: ["--headless", "--disable-gpu", `window-size=${width}x${height}`, "--no-sandbox", "--disable-dev-shm-usage"]
},
};
const firefox = {
...common,
browserName: "firefox",
"firefoxOptions": {
args: ["--headless", `--width=${width}', '--height=${height}`]
},
"moz:firefoxOptions": {
args: ["--headless", `--width=${width}', '--height=${height}`]
}
};
let multiCapabilities = [chrome];
if (process.env.TEST_BROWSER === "firefox") {
multiCapabilities = [firefox];
} else if (process.env.TEST_BROWSER === "multi") {
multiCapabilities = [chrome, firefox];
}
if (process.env.HEADLESS && process.env.HEADLESS !== "true") multiCapabilities.forEach(capabilities => {
const options = [capabilities["chromeOptions"], capabilities["firefoxOptions"], capabilities["moz:firefoxOptions"]];
options.filter(o => o).forEach(_options => {
_options.args = _options.args.filter(a => a !== "--headless");
});
});
exports.config = {
specs: ["test/*-spec.ts"],
multiCapabilities,
maxSessions: 4,
SELENIUM_PROMISE_MANAGER: false,
onPrepare: async () => {
require("ts-node").register({
project: require("path").join(__dirname, "./tsconfig.json")
});
browser.waitForAngularEnabled(false);
// Set manually since Firefox cli size options don't work.
await browser.driver.manage().window().setSize(width, height);
},
plugins: multiCapabilities.length === 1 && multiCapabilities[0] === chrome && [{
package: "protractor-console-plugin",
exclude: [/Uncaught \(in promise\)/]
}]
};