I'm using
- React: application
- npm: package manager
- mocha/chai/sinon: unit test
- protractor: e2e testing
in my application. The entire application is written with ES6, but the e2e tests are plain javascript. I would like to use ES6 styling for my e2e tests files as well, but the issue that I am facing is to preprocess or compile the ES6 files to plain javascript and then run the protractor agains compiled files. Can anyone please point how to use webpack with babel to convert those ES6 files into plain javascript?
here is my protractor.conf.js
:
/*eslint-disable no-var*/
'use strict';
exports.config = {
specs: ['../tests/e2e/**/*.js'],
capabilities: {
browserName: 'chrome'
},
baseUrl: 'http://localhost:3000',
frameworks: ['mocha', 'chai'],
onPrepare: function() {
browser.ignoreSynchronization = true;
}
};
and a simple test:
/*eslint-disable no-var*/
'use strict';
var chai = require('chai');
var sinon = require('sinon');
var sinonChai = require('sinon-chai');
var expect = chai.expect;
chai.use(sinonChai);
describe('app login flow', function() {
var loginUrl, homeUrl;
it('sets up initial variables', function() {
browser.get('/teams');
loginUrl = browser.getCurrentUrl();
browser.sleep(6000).then(function() {
homeUrl = browser.getCurrentUrl();
expect('1').to.equal('1');
})
});
});