Webdriver.io - how to use beforeEach hooks in the config
I am building an app using the MEAN stack and Webdriver for testing.
At the moment I am cleaning the database between tests by using Mocha's beforeEach and afterEach hooks, e.g.:
describe('Links', function() {
// drop DB collections
beforeEach(function(done){
//create database objects
});
afterEach(function(done){
// drop DB collections
});
});
Is there a way of setting up wdio.conf.js for this to happen before and after each of my tests automatically? The config's before: and after: function() {} run as a beforeAll / afterAll rather than for each test.