From 93d04e5116678713faf80c326351920b135e48a5 Mon Sep 17 00:00:00 2001 From: donal <donalspring@gmail.com> Date: Wed, 21 Mar 2018 16:29:26 +0100 Subject: [PATCH] Tidy up nightwatch for eslint happiness --- .eslintrc | 9 ++++ nightwatch.config.js | 70 +++++++++++++++++++---------------- 2 files changed, 46 insertions(+), 33 deletions(-) diff --git a/.eslintrc b/.eslintrc index 131334d..e225209 100644 --- a/.eslintrc +++ b/.eslintrc @@ -3,5 +3,12 @@ "extends": [ "plugin:vue/essential", "@vue/prettier" - ] + ], + "env": { + "es6": true, + "node": true + }, + "ecmaFeatures": { + "modules": true + } } \ No newline at end of file diff --git a/nightwatch.config.js b/nightwatch.config.js index 3e7c9a5..128194d 100644 --- a/nightwatch.config.js +++ b/nightwatch.config.js @@ -3,34 +3,40 @@ const SCREENSHOT_PATH = "./reports/screenshots/"; module.exports = { - "src_folders": [ - "tests/e2e/specs"// Where you are storing your Nightwatch e2e tests + src_folders: [ + "tests/e2e/specs" // Where you are storing your Nightwatch e2e tests ], - // "urlToTest": process.env.E2E_ENV ? `http://app-name-labs-${process.env.E2E_ENV}.apps.company-xyz.rht-labs.com` : 'http://localhost:8080', - "output_folder": "./reports", - "selenium": { - "start_process": true, // tells nightwatch to start/stop the selenium process - "server_path": seleniumServer.path, - "host": "127.0.0.1", - "port": 4444, - "cli_args": { - "webdriver.chrome.driver" : chromedriver.path + // TODO - move to the package.json + // urlToTest: process.env.E2E_ENV ? `http://app-name-labs-${process.env.E2E_ENV}.apps.company-xyz.rht-labs.com`: "http://localhost:8080", + output_folder: "./reports/e2e", + selenium: { + start_process: true, // tells nightwatch to start/stop the selenium process + server_path: seleniumServer.path, + host: "127.0.0.1", + port: 4444, + cli_args: { + "webdriver.chrome.driver": chromedriver.path } }, - "test_settings": { - "jenkins": { - "end_session_on_fail":false, - "screenshots" : { - "enabled" : true, - "on_failure" : true, - "path" : "reports" + test_settings: { + jenkins: { + end_session_on_fail: false, + screenshots: { + enabled: true, + on_failure: true, + path: "./reports/e2e" }, - "desiredCapabilities": { - "browserName": "chrome", - "javascriptEnabled": true, - "acceptSslCerts": true, - "chromeOptions" : { - "args" : ["disable-web-security", "ignore-certificate-errors", "headless", "no-sandbox"], + desiredCapabilities: { + browserName: "chrome", + javascriptEnabled: true, + acceptSslCerts: true, + chromeOptions: { + args: [ + "disable-web-security", + "ignore-certificate-errors", + "headless", + "no-sandbox" + ] } } } @@ -38,25 +44,25 @@ } function padLeft (count) { // theregister.co.uk/2016/03/23/npm_left_pad_chaos/ - return count < 10 ? '0' + count : count.toString(); + return count < 10 ? "0" + count: count.toString(); } -var FILECOUNT = 0; // "global" screenshot file count +var FILECOUNT = 0; // global screenshot file count /** * The default is to save screenshots to the root of your project even though - * there is a screenshots path in the config object above! ... so we need a + * there is a screenshots path in the config object axwxxwbove! ... so we need a * function that returns the correct path for storing our screenshots. - * While we're at it, we are adding some meta-data to the filename, specifically + * While we"re at it, we are adding some meta-data to the filename, specifically * the Platform/Browser where the test was run and the test (file) name. */ function imgpath (browser) { var a = browser.options.desiredCapabilities; var meta = [a.platform]; - meta.push(a.browserName ? a.browserName : 'any'); - meta.push(a.version ? a.version : 'any'); + meta.push(a.browserName ? a.browserName: "any"); + meta.push(a.version ? a.version: "any"); meta.push(a.name); // this is the test filename so always exists. - var metadata = meta.join('~').toLowerCase().replace(/ /g, ''); - return SCREENSHOT_PATH + metadata + '_' + padLeft(FILECOUNT++) + '_'; + var metadata = meta.join("~").toLowerCase().replace(/ /g, ""); + return SCREENSHOT_PATH + metadata + "_" + padLeft(FILECOUNT++) + "_"; } module.exports.imgpath = imgpath; -- Gitblit v1.9.3