This package contains the end-to-end test suite for all InstantSearch flavors.
The workspace automatically links the dependencies when you run yarn
at the root of the monorepo.
In addition to the test suite, this package contains two WebdriverIO configurations:
local
: run the test suite on Chrome browser on your local machine.saucelabs
: run the test suite on multiple browsers on the Sauce Labs service.
All configurations will run a static web server on your machine on port 5000
to serve the content of the website
directory in your project, containing the InstantSearch demos to run our tests against.
To run the test suite locally create a wdio.local.conf.js
file in your project root and import the local
configuration.
const { local } = require('instantsearch-e2e-tests');
exports.config = local;
Then execute the following command to run the test suite.
./node_modules/.bin/wdio wdio.local.conf.js
To run the test suite on Sauce Labs create a wdio.saucelabs.conf.js
file in your project root and import the saucelabs
configuration.
const { saucelabs } = require('instantsearch-e2e-tests');
exports.config = saucelabs;
You'll need a username and access key to be able to run the test suite on Sauce Labs. You can find them in the User Profile > User Settings section of your Sauce Labs dashboard.
instantsearch-e2e-tests
will read the username and access key from the SAUCE_USERNAME
and SAUCE_ACCESS_KEY
environment variables respectively. More information about setting up environment variables for Sauce Labs.
Alternatively you can store them in a .env
file at the root of your project, instantsearch-e2e-tests
will automatically load them using dotenv. But don't forget to add this file to your .gitignore
.
Once your config file created and your credentials set you can execute the following command to run the test suite.
./node_modules/.bin/wdio wdio.saucelabs.conf.js
The default configuration can easily be overridden if you need to change some project specific settings.
const { local } = require('instantsearch-e2e-tests');
exports.config = {
...local,
/*
* Run local tests on Firefox instead of Chrome
*/
capabilities: [
{
browserName: 'firefox',
},
],
};
CircleCI can read JUnit XML test metadata files to provide insights on the stability of the test suite. To enable this feature, you can add the following key to your e2e job in .circleci/config.yml:
test_e2e:
# ...
steps:
# ...
- store_test_results:
path: junit/wdio