]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
chore: upgrade nightwatch
authorEduardo San Martin Morote <posva13@gmail.com>
Wed, 8 Jun 2022 16:49:42 +0000 (18:49 +0200)
committerEduardo San Martin Morote <posva@users.noreply.github.com>
Thu, 30 Jun 2022 07:59:00 +0000 (09:59 +0200)
12 files changed:
packages/router/.gitignore
packages/router/e2e/encoding/index.html [moved from packages/router/old-e2e/encoding/index.html with 100% similarity]
packages/router/e2e/encoding/index.ts [moved from packages/router/old-e2e/encoding/index.ts with 96% similarity]
packages/router/e2e/global.css [moved from packages/router/old-e2e/global.css with 100% similarity]
packages/router/e2e/index.html [moved from packages/router/old-e2e/index.html with 100% similarity]
packages/router/e2e/index.ts [moved from packages/router/old-e2e/index.ts with 63% similarity]
packages/router/e2e/specs/encoding.js [moved from packages/router/old-e2e/specs/encoding.js with 94% similarity]
packages/router/e2e/tsconfig.json [moved from packages/router/old-e2e/tsconfig.json with 83% similarity]
packages/router/e2e/vite.config.ts [moved from packages/router/old-e2e/vite.config.js with 83% similarity]
packages/router/nightwatch.conf.js [new file with mode: 0644]
packages/router/package.json
pnpm-lock.yaml

index 9f7024d4bfbeed3520f3df9f5b5a44dd7be28442..6b1632b93bf1ea9c800e8202b49d6327d3a81b04 100644 (file)
@@ -2,3 +2,5 @@ e2e/reports
 e2e/screenshots
 old-e2e/reports
 old-e2e/screenshots
+tests_output
+logs
similarity index 96%
rename from packages/router/old-e2e/encoding/index.ts
rename to packages/router/e2e/encoding/index.ts
index d9361c6c5e812ca93121022576135d8e24ac662e..d91170229595845c1a121397ec9b9e8d47668e93 100644 (file)
@@ -1,6 +1,5 @@
 import '../global.css'
-import { createRouter, createWebHistory } from '../../src'
-import { RouteComponent } from '../../src/types'
+import { createRouter, createWebHistory, RouteComponent } from 'vue-router'
 import { createApp, defineComponent, FunctionalComponent, h } from 'vue'
 
 const component: RouteComponent = {
similarity index 63%
rename from packages/router/old-e2e/index.ts
rename to packages/router/e2e/index.ts
index fdae87ee3cdcbcce0f24102b262a815ad0bc3e38..a7d652d0d71b3731917ca98bb3555dfb2a46f31d 100644 (file)
@@ -12,21 +12,9 @@ const examples: string[] = Object.keys(tsmap)
   .map(match => match![1] + '/')
   .sort()
 
-// const context = require.context('.', true, /^.{2,}\/index\.ts$/)
-// const DIR_RE = /^\.\/([^/]+)\//
-
-// const examples: string[] = []
-// context.keys().forEach(path => {
-//   const match = DIR_RE.exec(path)
-//   if (match) examples.push(match[1])
-//   return name
-// })
-
-examples.sort()
-
 declare global {
   interface Window {
-    app: App<Element>
+    app: App
     vm: ComponentPublicInstance
     r: Router
   }
similarity index 94%
rename from packages/router/old-e2e/specs/encoding.js
rename to packages/router/e2e/specs/encoding.js
index 05c6a48bfc4d3159d17b9efb5457e4f9f5cf5846..17bcb535a53d1495352c5055452a8e8ae8584cff 100644 (file)
@@ -1,4 +1,4 @@
-const bsStatus = require('../browserstack-send-status')
+// const bsStatus = require('../browserstack-send-status')
 
 const baseURL = 'http://localhost:3000/encoding'
 
@@ -7,12 +7,12 @@ const rawText = ' !"#$&\'()*+,/:;<=>?@[]^`{|}'
 const TIMEOUT = 2000
 
 module.exports = {
-  ...bsStatus(),
+  // ...bsStatus(),
 
   '@tags': ['history', 'encoding', 'browserstack'],
 
   /** @type {import('nightwatch').NightwatchTest} */
-  'encodes values': function (browser) {
+  'encodes values'(browser) {
     browser
       .url(baseURL + '/')
       .assert.urlEquals(baseURL + '/')
similarity index 83%
rename from packages/router/old-e2e/tsconfig.json
rename to packages/router/e2e/tsconfig.json
index d61bd724c8da44d3f9d9855519c52e90fbfc0d0c..f5ea3fe73e2f5e0124ecf138c929eccb72916456 100644 (file)
@@ -2,7 +2,7 @@
   "include": ["index.ts", "*/*.ts", "../src/global.d.ts"],
   "compilerOptions": {
     "target": "es6",
-    "module": "commonjs",
+    "module": "ESNext",
     // "lib": ["es2017.object"] /* Specify library files to be included in the compilation. */,
     "declaration": true,
     // "declarationMap": true,
@@ -19,6 +19,9 @@
 
     "moduleResolution": "node",
     "esModuleInterop": true,
-    "types": ["vite/client"]
+    "types": ["vite/client"],
+    "paths": {
+      "vue-router": ["../src"]
+    }
   }
 }
similarity index 83%
rename from packages/router/old-e2e/vite.config.js
rename to packages/router/e2e/vite.config.ts
index 2755f979921b5a18ced7c84626f1887fd73977df..67a562f82cea6f3bb3b4faec751809ffd79b3ff6 100644 (file)
@@ -1,11 +1,10 @@
-const fs = require('fs')
-const { resolve, join } = require('path')
-const { defineConfig } = require('vite')
-const vue = require('@vitejs/plugin-vue')
-const history = require('connect-history-api-fallback')
+import fs from 'fs'
+import { resolve, join } from 'path'
+import { defineConfig } from 'vite'
+import vue from '@vitejs/plugin-vue'
+import history from 'connect-history-api-fallback'
 
-/** @type {string[]} */
-let examples = []
+const examples: string[] = []
 fs.readdirSync(__dirname).forEach(dir => {
   const fullDir = join(__dirname, dir)
   const entry = join(fullDir, 'index.ts')
@@ -15,7 +14,7 @@ fs.readdirSync(__dirname).forEach(dir => {
 })
 
 // https://vitejs.dev/config/
-const config = (env = {}) => {
+const config = (env: Record<string, string> = {}) => {
   return defineConfig({
     root: resolve(__dirname),
     resolve: {
@@ -28,23 +27,26 @@ const config = (env = {}) => {
     },
     build: {
       outDir: join(__dirname, '__build__'),
-      filename: '[name].js',
-      chunkFilename: '[id].chunk.js',
-      publicPath: '/',
+      // publicPath: '/',
       rollupOptions: {
+        output: {
+          file: '[name].js',
+          chunkFileNames: '[id].chunk.js',
+        },
         plugins: [],
         input: examples.reduce(
           (entries, name) => {
             entries[name] = resolve(__dirname, name, 'index.html')
             return entries
           },
-          { index: resolve(__dirname, 'index.html') }
+          { index: resolve(__dirname, 'index.html') } as Record<string, string>
         ),
       },
     },
     plugins: [
       vue(),
       {
+        name: 'custom history',
         configureServer({ middlewares }) {
           middlewares.use(
             history({
diff --git a/packages/router/nightwatch.conf.js b/packages/router/nightwatch.conf.js
new file mode 100644 (file)
index 0000000..de2d5fd
--- /dev/null
@@ -0,0 +1,356 @@
+//
+// Refer to the online docs for more details:
+// https://nightwatchjs.org/gettingstarted/configuration/
+//
+//  _   _  _         _      _                     _          _
+// | \ | |(_)       | |    | |                   | |        | |
+// |  \| | _   __ _ | |__  | |_ __      __  __ _ | |_   ___ | |__
+// | . ` || | / _` || '_ \ | __|\ \ /\ / / / _` || __| / __|| '_ \
+// | |\  || || (_| || | | || |_  \ V  V / | (_| || |_ | (__ | | | |
+// \_| \_/|_| \__, ||_| |_| \__|  \_/\_/   \__,_| \__| \___||_| |_|
+//             __/ |
+//            |___/
+//
+
+module.exports = {
+  // An array of folders (excluding subfolders) where your tests are located;
+  // if this is not specified, the test source must be passed as the second argument to the test runner.
+  src_folders: [],
+
+  // See https://nightwatchjs.org/guide/working-with-page-objects/using-page-objects.html
+  page_objects_path: ['node_modules/nightwatch/examples/pages/'],
+
+  // See https://nightwatchjs.org/guide/extending-nightwatch/custom-commands.html
+  custom_commands_path: ['node_modules/nightwatch/examples/custom-commands/'],
+
+  // See https://nightwatchjs.org/guide/extending-nightwatch/custom-assertions.html
+  custom_assertions_path: '',
+
+  // See https://nightwatchjs.org/guide/extending-nightwatch/plugin-api.html
+  plugins: [],
+
+  // See https://nightwatchjs.org/guide/#external-globals
+  globals_path: '',
+
+  webdriver: {},
+
+  test_settings: {
+    default: {
+      disable_error_log: false,
+      launch_url: 'https://nightwatchjs.org',
+
+      screenshots: {
+        enabled: false,
+        path: 'screens',
+        on_failure: true,
+      },
+
+      desiredCapabilities: {
+        browserName: 'firefox',
+      },
+
+      webdriver: {
+        start_process: true,
+        server_path: '',
+      },
+    },
+
+    safari: {
+      desiredCapabilities: {
+        browserName: 'safari',
+        alwaysMatch: {
+          acceptInsecureCerts: false,
+        },
+      },
+      webdriver: {
+        start_process: true,
+        server_path: '',
+      },
+    },
+
+    firefox: {
+      desiredCapabilities: {
+        browserName: 'firefox',
+        alwaysMatch: {
+          acceptInsecureCerts: true,
+          'moz:firefoxOptions': {
+            args: [
+              // '-headless',
+              // '-verbose'
+            ],
+          },
+        },
+      },
+      webdriver: {
+        start_process: true,
+        server_path: '',
+        cli_args: [
+          // very verbose geckodriver logs
+          // '-vv'
+        ],
+      },
+    },
+
+    chrome: {
+      desiredCapabilities: {
+        browserName: 'chrome',
+        'goog:chromeOptions': {
+          // More info on Chromedriver: https://sites.google.com/a/chromium.org/chromedriver/
+          //
+          // w3c:false tells Chromedriver to run using the legacy JSONWire protocol (not required in Chrome 78)
+          w3c: true,
+          args: [
+            //'--no-sandbox',
+            //'--ignore-certificate-errors',
+            //'--allow-insecure-localhost',
+            //'--headless'
+          ],
+        },
+      },
+
+      webdriver: {
+        start_process: true,
+        server_path: '',
+        cli_args: [
+          // --verbose
+        ],
+      },
+    },
+
+    edge: {
+      desiredCapabilities: {
+        browserName: 'MicrosoftEdge',
+        'ms:edgeOptions': {
+          w3c: true,
+          // More info on EdgeDriver: https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/capabilities-edge-options
+          args: [
+            //'--headless'
+          ],
+        },
+      },
+
+      webdriver: {
+        start_process: true,
+        // Download msedgedriver from https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/
+        //  and set the location below:
+        server_path: '',
+        cli_args: [
+          // --verbose
+        ],
+      },
+    },
+
+    //////////////////////////////////////////////////////////////////////////////////
+    // Configuration for when using cucumber-js (https://cucumber.io)                |
+    //                                                                               |
+    // It uses the bundled examples inside the nightwatch examples folder; feel free |
+    // to adapt this to your own project needs                                       |
+    //////////////////////////////////////////////////////////////////////////////////
+    'cucumber-js': {
+      src_folders: ['examples/cucumber-js/features/step_definitions'],
+
+      test_runner: {
+        // set cucumber as the runner
+        type: 'cucumber',
+
+        // define cucumber specific options
+        options: {
+          //set the feature path
+          feature_path:
+            'node_modules/nightwatch/examples/cucumber-js/*/*.feature',
+
+          // start the webdriver session automatically (enabled by default)
+          // auto_start_session: true
+
+          // use parallel execution in Cucumber
+          // parallel: 2 // set number of workers to use (can also be defined in the cli as --parallel 2
+        },
+      },
+    },
+
+    //////////////////////////////////////////////////////////////////////////////////
+    // Configuration for when using the browserstack.com cloud service               |
+    //                                                                               |
+    // Please set the username and access key by setting the environment variables:  |
+    // - BROWSERSTACK_USERNAME                                                       |
+    // - BROWSERSTACK_ACCESS_KEY                                                     |
+    // .env files are supported                                                      |
+    //////////////////////////////////////////////////////////////////////////////////
+    browserstack: {
+      selenium: {
+        host: 'hub.browserstack.com',
+        port: 443,
+      },
+      // More info on configuring capabilities can be found on:
+      // https://www.browserstack.com/automate/capabilities?tag=selenium-4
+      desiredCapabilities: {
+        'bstack:options': {
+          userName: '${BROWSERSTACK_USERNAME}',
+          accessKey: '${BROWSERSTACK_ACCESS_KEY}',
+        },
+      },
+
+      disable_error_log: true,
+      webdriver: {
+        timeout_options: {
+          timeout: 15000,
+          retry_attempts: 3,
+        },
+        keep_alive: true,
+        start_process: false,
+      },
+    },
+
+    'browserstack.local': {
+      extends: 'browserstack',
+      desiredCapabilities: {
+        'browserstack.local': true,
+      },
+    },
+
+    'browserstack.chrome': {
+      extends: 'browserstack',
+      desiredCapabilities: {
+        browserName: 'chrome',
+        chromeOptions: {
+          w3c: true,
+        },
+      },
+    },
+
+    'browserstack.firefox': {
+      extends: 'browserstack',
+      desiredCapabilities: {
+        browserName: 'firefox',
+      },
+    },
+
+    'browserstack.ie': {
+      extends: 'browserstack',
+      desiredCapabilities: {
+        browserName: 'internet explorer',
+        browserVersion: '11.0',
+      },
+    },
+
+    'browserstack.safari': {
+      extends: 'browserstack',
+      desiredCapabilities: {
+        browserName: 'safari',
+      },
+    },
+
+    'browserstack.local_chrome': {
+      extends: 'browserstack.local',
+      desiredCapabilities: {
+        browserName: 'chrome',
+      },
+    },
+
+    'browserstack.local_firefox': {
+      extends: 'browserstack.local',
+      desiredCapabilities: {
+        browserName: 'firefox',
+      },
+    },
+    //////////////////////////////////////////////////////////////////////////////////
+    // Configuration for when using the SauceLabs cloud service                      |
+    //                                                                               |
+    // Please set the username and access key by setting the environment variables:  |
+    // - SAUCE_USERNAME                                                              |
+    // - SAUCE_ACCESS_KEY                                                            |
+    //////////////////////////////////////////////////////////////////////////////////
+    saucelabs: {
+      selenium: {
+        host: 'ondemand.saucelabs.com',
+        port: 443,
+      },
+      // More info on configuring capabilities can be found on:
+      // https://wiki.saucelabs.com/display/DOCS/Test+Configuration+Options
+      desiredCapabilities: {
+        'sauce:options': {
+          username: '${SAUCE_USERNAME}',
+          accessKey: '${SAUCE_ACCESS_KEY}',
+          screenResolution: '1280x1024',
+          // https://docs.saucelabs.com/dev/cli/sauce-connect-proxy/#--region
+          // region: 'us-west-1'
+          // https://docs.saucelabs.com/dev/test-configuration-options/#tunnelidentifier
+          // parentTunnel: '',
+          // tunnelIdentifier: '',
+        },
+      },
+      disable_error_log: false,
+      webdriver: {
+        start_process: false,
+      },
+    },
+    'saucelabs.chrome': {
+      extends: 'saucelabs',
+      desiredCapabilities: {
+        browserName: 'chrome',
+        browserVersion: 'latest',
+        javascriptEnabled: true,
+        acceptSslCerts: true,
+        timeZone: 'London',
+        chromeOptions: {
+          w3c: true,
+        },
+      },
+    },
+    'saucelabs.firefox': {
+      extends: 'saucelabs',
+      desiredCapabilities: {
+        browserName: 'firefox',
+        browserVersion: 'latest',
+        javascriptEnabled: true,
+        acceptSslCerts: true,
+        timeZone: 'London',
+      },
+    },
+    //////////////////////////////////////////////////////////////////////////////////
+    // Configuration for when using the Selenium service, either locally or remote,  |
+    //  like Selenium Grid                                                           |
+    //////////////////////////////////////////////////////////////////////////////////
+    selenium_server: {
+      // Selenium Server is running locally and is managed by Nightwatch
+      // Install the NPM package @nightwatch/selenium-server or download the selenium server jar file from https://github.com/SeleniumHQ/selenium/releases/, e.g.: selenium-server-4.1.1.jar
+      selenium: {
+        start_process: true,
+        port: 4444,
+        server_path: '', // Leave empty if @nightwatch/selenium-server is installed
+        command: 'standalone', // Selenium 4 only
+        cli_args: {
+          //'webdriver.gecko.driver': '',
+          //'webdriver.chrome.driver': ''
+        },
+      },
+      webdriver: {
+        start_process: false,
+        default_path_prefix: '/wd/hub',
+      },
+    },
+
+    'selenium.chrome': {
+      extends: 'selenium_server',
+      desiredCapabilities: {
+        browserName: 'chrome',
+        chromeOptions: {
+          w3c: true,
+        },
+      },
+    },
+
+    'selenium.firefox': {
+      extends: 'selenium_server',
+      desiredCapabilities: {
+        browserName: 'firefox',
+        'moz:firefoxOptions': {
+          args: [
+            // '-headless',
+            // '-verbose'
+          ],
+        },
+      },
+    },
+  },
+}
index 209e414bf58b93a60be9c02736d96094561faca7..ab644380f5c7aa493560469b403ac007312ff3f6 100644 (file)
@@ -55,7 +55,7 @@
     "build:playground": "vue-tsc --noEmit && vite build --config playground/vite.config.js",
     "build:e2e": "vue-tsc --noEmit && vite build --config e2e/vite.config.js",
     "build:size": "yarn run build && rollup -c size-checks/rollup.config.js",
-    "dev:e2e": "vite --config e2e/vite.config.js",
+    "dev:e2e": "vite --config e2e/vite.config.ts",
     "docs": "vitepress dev docs",
     "docs:build": "vitepress build docs",
     "lint": "yarn run lint:script && yarn run lint:html",
     "@sucrase/jest-plugin": "^2.1.1",
     "@types/jest": "^27.4.1",
     "@types/jsdom": "^16.2.13",
+    "@types/nightwatch": "^2.0.8",
     "@vitejs/plugin-vue": "^2.2.2",
     "@vue/compiler-sfc": "^3.2.31",
     "@vue/server-renderer": "^3.2.31",
index d37753d059b0061ea74b0bc38f02c1e1e7efdb6d..dc26dee56f11e75cb583ded4dcb03002950dd67f 100644 (file)
@@ -21,6 +21,7 @@ importers:
       '@sucrase/jest-plugin': ^2.1.1
       '@types/jest': ^27.4.1
       '@types/jsdom': ^16.2.13
+      '@types/nightwatch': ^2.0.8
       '@vitejs/plugin-vue': ^2.2.2
       '@vue/compiler-sfc': ^3.2.31
       '@vue/devtools-api': ^6.1.4
@@ -65,6 +66,7 @@ importers:
       '@sucrase/jest-plugin': 2.2.1
       '@types/jest': 27.5.2
       '@types/jsdom': 16.2.14
+      '@types/nightwatch': 2.0.8
       '@vitejs/plugin-vue': 2.3.3_vite@2.9.10+vue@3.2.37
       '@vue/compiler-sfc': 3.2.37
       '@vue/server-renderer': 3.2.37_vue@3.2.37
@@ -1128,6 +1130,12 @@ packages:
     resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==}
     dev: true
 
+  /@types/nightwatch/2.0.8:
+    resolution: {integrity: sha512-QxWcHZjdkNRU+524zOkwt5N809pcBklymGVfCGIzWPdf0s2Y573pXNkIomQ4ZFjxyvPevg8izZflQ7DMyeE8HA==}
+    dependencies:
+      '@types/selenium-webdriver': 4.1.1
+    dev: true
+
   /@types/node/12.20.24:
     resolution: {integrity: sha512-yxDeaQIAJlMav7fH5AQqPH1u8YIuhYJXYBzxaQ4PifsU0GDO38MSdmEDeRlIxrKbC6NbEaaEHDanWb+y30U8SQ==}
     dev: true
@@ -1160,6 +1168,12 @@ packages:
       '@types/node': 17.0.41
     dev: true
 
+  /@types/selenium-webdriver/4.1.1:
+    resolution: {integrity: sha512-NxxZZek50ylIACiXebKQYHD3D4One3WXOasEXWazL6aTfYbZob7ClNKxUpg8I4/oWArX87oPWvj1cHKqfel3Hg==}
+    dependencies:
+      '@types/ws': 8.5.3
+    dev: true
+
   /@types/stack-utils/2.0.1:
     resolution: {integrity: sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==}
     dev: true
@@ -1168,6 +1182,12 @@ packages:
     resolution: {integrity: sha512-Q5vtl1W5ue16D+nIaW8JWebSSraJVlK+EthKn7e7UcD4KWsaSJ8BqGPXNaPghgtcn/fhvrN17Tv8ksUsQpiplw==}
     dev: true
 
+  /@types/ws/8.5.3:
+    resolution: {integrity: sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==}
+    dependencies:
+      '@types/node': 17.0.41
+    dev: true
+
   /@types/yargs-parser/21.0.0:
     resolution: {integrity: sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==}
     dev: true