commit | author | age
|
f17951
|
1 |
const seleniumServer = require("selenium-server"); |
D |
2 |
const chromedriver = require("chromedriver"); |
|
3 |
const SCREENSHOT_PATH = "./reports/screenshots/"; |
|
4 |
|
|
5 |
module.exports = { |
93d04e
|
6 |
src_folders: [ |
D |
7 |
"tests/e2e/specs" // Where you are storing your Nightwatch e2e tests |
f17951
|
8 |
], |
93d04e
|
9 |
// TODO - move to the package.json |
D |
10 |
// urlToTest: process.env.E2E_ENV ? `http://app-name-labs-${process.env.E2E_ENV}.apps.company-xyz.rht-labs.com`: "http://localhost:8080", |
|
11 |
output_folder: "./reports/e2e", |
|
12 |
selenium: { |
|
13 |
start_process: true, // tells nightwatch to start/stop the selenium process |
|
14 |
server_path: seleniumServer.path, |
|
15 |
host: "127.0.0.1", |
|
16 |
port: 4444, |
|
17 |
cli_args: { |
|
18 |
"webdriver.chrome.driver": chromedriver.path |
f17951
|
19 |
} |
D |
20 |
}, |
93d04e
|
21 |
test_settings: { |
D |
22 |
jenkins: { |
|
23 |
end_session_on_fail: false, |
|
24 |
screenshots: { |
|
25 |
enabled: true, |
|
26 |
on_failure: true, |
|
27 |
path: "./reports/e2e" |
f17951
|
28 |
}, |
93d04e
|
29 |
desiredCapabilities: { |
D |
30 |
browserName: "chrome", |
|
31 |
javascriptEnabled: true, |
|
32 |
acceptSslCerts: true, |
|
33 |
chromeOptions: { |
|
34 |
args: [ |
|
35 |
"disable-web-security", |
|
36 |
"ignore-certificate-errors", |
|
37 |
"headless", |
|
38 |
"no-sandbox" |
|
39 |
] |
f17951
|
40 |
} |
D |
41 |
} |
|
42 |
} |
|
43 |
} |
|
44 |
} |
|
45 |
|
|
46 |
function padLeft (count) { // theregister.co.uk/2016/03/23/npm_left_pad_chaos/ |
93d04e
|
47 |
return count < 10 ? "0" + count: count.toString(); |
f17951
|
48 |
} |
D |
49 |
|
93d04e
|
50 |
var FILECOUNT = 0; // global screenshot file count |
f17951
|
51 |
/** |
D |
52 |
* The default is to save screenshots to the root of your project even though |
93d04e
|
53 |
* there is a screenshots path in the config object axwxxwbove! ... so we need a |
f17951
|
54 |
* function that returns the correct path for storing our screenshots. |
93d04e
|
55 |
* While we"re at it, we are adding some meta-data to the filename, specifically |
f17951
|
56 |
* the Platform/Browser where the test was run and the test (file) name. |
D |
57 |
*/ |
|
58 |
function imgpath (browser) { |
|
59 |
var a = browser.options.desiredCapabilities; |
|
60 |
var meta = [a.platform]; |
93d04e
|
61 |
meta.push(a.browserName ? a.browserName: "any"); |
D |
62 |
meta.push(a.version ? a.version: "any"); |
f17951
|
63 |
meta.push(a.name); // this is the test filename so always exists. |
93d04e
|
64 |
var metadata = meta.join("~").toLowerCase().replace(/ /g, ""); |
D |
65 |
return SCREENSHOT_PATH + metadata + "_" + padLeft(FILECOUNT++) + "_"; |
f17951
|
66 |
} |
D |
67 |
|
|
68 |
module.exports.imgpath = imgpath; |
|
69 |
module.exports.SCREENSHOT_PATH = SCREENSHOT_PATH; |