Use selenium standalone service to run tests

This commit is contained in:
Filip Proborszcz 2022-04-08 03:37:40 +02:00
parent d73add77e7
commit 174eae1cf4
3 changed files with 10 additions and 18 deletions

View file

@ -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

View file

@ -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.

View file

@ -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,