]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
test: refactor e2e config
authorEduardo San Martin Morote <posva13@gmail.com>
Wed, 15 Apr 2020 14:38:51 +0000 (16:38 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Wed, 15 Apr 2020 14:38:51 +0000 (16:38 +0200)
e2e/browserstack-send-status.js
e2e/nightwatch.config.js
e2e/runner.js
package.json

index ca26ce08d29bb2f2d0c683c967b1129b87053312..c840d277c3d5ba40e95de1eb79fc1a9480eebeaa 100644 (file)
@@ -21,9 +21,9 @@ function shouldSkipBrowserstackReporting(client) {
 }
 
 /**
- * Generates an object with beforeEach and afterEach functions to be added
- * to every test suite. It cannot be added globably because these must be
- * executed before each test (instead of each test suite as it does in globalModules)
+ * Generates an object with beforeEach and afterEach functions to be added to
+ * every test suite. It cannot be added globally because these must be executed
+ * before each test (instead of each test suite as it does in globalModules)
  */
 module.exports = function sendStatus() {
   const sessionMap = Object.create(null)
index ef6a400fc47baed1c17a56bb060c43b4ff152285..b188db0416242e87cbb7e9de3e54b9643ced9b3b 100644 (file)
@@ -1,5 +1,18 @@
 // yarn nightwatch -e chrome,safari,firefox
 
+/** @type {import('nightwatch').NightwatchTestSettingScreenshots} */
+const browserDefaults = {
+  selenium_port: 4444,
+  selenium_host: 'localhost',
+  silent: true,
+  screenshots: {
+    enabled: true,
+    on_failure: true,
+    on_error: false,
+    path: 'e2e/screenshots',
+  },
+}
+
 /** @type {import('nightwatch').NightwatchOptions} */
 module.exports = {
   src_folders: ['e2e/specs'],
@@ -11,38 +24,27 @@ module.exports = {
 
   selenium: {
     start_process: true,
-    server_path: require('selenium-server').path,
+    start_session: true,
     host: '127.0.0.1',
     port: 4444,
+    server_path: require('selenium-server').path,
     cli_args: {
       'webdriver.chrome.driver': require('chromedriver').path,
-      // 'webdriver.gecko.driver': require('geckodriver').path
+      // 'webdriver.gecko.driver': require('geckodriver').path,
     },
   },
 
+  webdriver: {
+    start_process: false,
+  },
+
   test_settings: {
     default: {
-      selenium_port: 4444,
-      selenium_host: 'localhost',
-      silent: true,
-      screenshots: {
-        enabled: true,
-        on_failure: true,
-        on_error: false,
-        path: 'e2e/screenshots',
-      },
-      desiredCapabilities: {
-        browserName: 'chrome',
-        acceptSslCerts: true,
-        chromeOptions: {
-          // https://github.com/nightwatchjs/nightwatch/releases/tag/v1.1.12
-          w3c: false,
-          args: ['window-size=1280,800'],
-        },
-      },
+      launch_url: 'https://nightwatchjs.org',
     },
 
     chrome: {
+      ...browserDefaults,
       desiredCapabilities: {
         browserName: 'chrome',
         acceptSslCerts: true,
@@ -54,8 +56,8 @@ module.exports = {
       },
     },
 
-    // TODO: generate these and add skip tags
     'chrome-headless': {
+      ...browserDefaults,
       desiredCapabilities: {
         browserName: 'chrome',
         acceptSslCerts: true,
@@ -67,22 +69,22 @@ module.exports = {
     },
 
     safari: {
+      ...browserDefaults,
       desiredCapabilities: {
         browserName: 'safari',
         acceptSslCerts: true,
       },
     },
 
+    // TODO: not working
     firefox: {
+      ...browserDefaults,
       desiredCapabilities: {
         browserName: 'firefox',
         acceptSslCerts: true,
-      },
-    },
-
-    ie: {
-      desiredCapabilities: {
-        browser: 'internet explorer',
+        'moz:firefoxOptions': {
+          args: [],
+        },
       },
     },
   },
index 11fb6540a9986ccad2420c3a5d763b2dc834b0fd..759eaee5f347bff5d77a57934ee018b17ef4b3d5 100644 (file)
@@ -42,10 +42,10 @@ const NW_CONFIG = isLocal
   ? resolve(__dirname, './nightwatch.browserstack.js')
   : resolve(__dirname, './nightwatch.config.js')
 
-// check -c option is passed when usig multiple environments
+// check -c option is passed when using multiple environments
 if (args.indexOf('-c') < 0) {
   // check if multiple envs are provided. The way Nightwatch works
-  // requires to explicitely provide the conf
+  // requires to explicitly provide the conf
   const envs = args[args.indexOf('-e') + 1]
   if (envs && envs.indexOf(',') > -1) {
     console.warn(
index af27e142d5d7af239dabaa4049f36db2fbc377d8..768fe22018bfd4b086b36feb6d4770290eb1484b 100644 (file)
@@ -28,8 +28,8 @@
     "test:types": "tsc --build tsconfig.json",
     "test:unit": "jest --coverage",
     "test": "yarn run test:types && yarn run test:unit",
-    "test:e2e": "node e2e/runner.js",
-    "test:e2e:ci": "node e2e/runner.js --local -e ie,android44 -c e2e/nightwatch.browserstack.js e2e/specs/basic.js"
+    "test:e2e": "node e2e/runner.js -e chrome",
+    "test:e2e:ci": "node e2e/runner.js --local -e ie,android44 -c e2e/nightwatch.browserstack.js e2e/specs/encoding.js"
   },
   "gitHooks": {
     "pre-commit": "lint-staged",