I'm currently testing with Chrome(driver) only. I want to test it with Firefox and Safari too. One after the other, it cannot be in parallel.
Here's my gulp task to start the tests:
gulp.task('test', function() {
return gulp.src('*test/features/*').pipe(cucumber({
'steps': '*test/features/steps/*.js'
}));
});
A simple feature file:
Feature: UI
Testing UI
Scenario: Check the title of the page
When I open the homepage
Then I should see "Test - IntApp" in the title
And the step file:
const chrome = require('selenium-webdriver/chrome');
const webdriver = require('selenium-webdriver');
const assert = require('assert');
module.exports = function () {
let options = new chrome.Options();
options.addArguments('start-maximized');
var driver = new webdriver.Builder()
.forBrowser('chrome')
.setChromeOptions(options)
.build();
this.When('I open the homepage', function (done) {
driver.get('http://intapp.dev/').then(done);
});
this.Then('I should see "Test - IntApp" in the title', function (done) {
driver.getTitle().then(function(title) {
assert.equal(title, "Test - IntApp");
}).then(done);
});
this.registerHandler('AfterFeatures', function (features) {
return driver.quit();
});
};
I was thinking that maybe I could pass the browser's name as parameter somehow from the gulp task, but it doesn't seem to be possible.