From 174eae1cf49451536a8bca40609a42dc707b3fd0 Mon Sep 17 00:00:00 2001 From: Filip Proborszcz Date: Fri, 8 Apr 2022 03:37:40 +0200 Subject: [PATCH] Use selenium standalone service to run tests --- .github/workflows/ci.yml | 2 +- README.md | 24 ++++++++---------------- config/wdio.conf.js | 2 +- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 81dc768..37e3fcd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,7 +78,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - node-version: [10.x] + node-version: [16.x] steps: - uses: actions/checkout@v2 diff --git a/README.md b/README.md index cc0d940..9d3e68f 100644 --- a/README.md +++ b/README.md @@ -46,14 +46,14 @@ Install the deps, start the dev server and open the web browser on `http://local # install dependencies npm install # start dev server -npm start +npm run start ``` If you want Maputnik to be accessible externally use the [`--host` option](https://webpack.js.org/configuration/dev-server/#devserverhost): ```bash # start externally accessible dev server -npm start -- --host 0.0.0.0 +npm run start -- --host 0.0.0.0 ``` The build process will watch for changes to the filesystem, rebuild and autoreload the editor. However note this from the [webpack-dev-server docs](https://webpack.js.org/configuration/dev-server/): @@ -76,26 +76,18 @@ npm run lint-styles ## Tests -For testing we use [webdriverio](http://webdriver.io) and [selenium-standalone](https://github.com/vvo/selenium-standalone) +For testing we use [webdriverio](https://webdriver.io) and [selenium-standalone](https://github.com/webdriverio/selenium-standalone). -[selenium-standalone](https://github.com/vvo/selenium-standalone) starts a server that will launch browsers on your local machine. We use chrome so you **must** have chrome installed on your machine. +[selenium-standalone](https://github.com/webdriverio/selenium-standalone) starts a server that will launch browsers on your local machine. You need to have Java installed on your machine as well as *chrome* or *firefox*. -Now open a terminal and run the following. This will install the drivers on your local machine +Now open a terminal and run the following using *chrome*: ``` -./node_modules/.bin/selenium-standalone install +npm run test ``` - -Now start the standalone server - +or *firefox*: ``` -./node_modules/.bin/selenium-standalone start -``` - -Then open another terminal and run - -``` -npm test +BROWSER=firefox npm run test ``` After some time you should see a browser launch which will be automated by the test runner. diff --git a/config/wdio.conf.js b/config/wdio.conf.js index 68caba5..e2840e6 100644 --- a/config/wdio.conf.js +++ b/config/wdio.conf.js @@ -21,7 +21,7 @@ exports.config = { browserName: (process.env.BROWSER || 'chrome'), } ], - services: ['selenium-standalone'], + services: process.env.DOCKER_HOST ? [] : ['selenium-standalone'], logLevel: 'info', bail: 0, screenshotPath: SCREENSHOT_PATH,