Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Temi89 authored Sep 27, 2017
2 parents 1c0db36 + 39f0657 commit 6240f8f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
14 changes: 9 additions & 5 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,15 @@ node ./node_modules/selenium-cucumber-js/index.js -s ./step-definitions

By default tests are run using Google Chrome, to run tests using another browser supply the name of that browser along with the `-b` switch. Available options are:

| Browser | Example
| ---------- | ---------------
| Chrome | `-b chrome`
| Firefox | `-b firefox`
| Phantom JS | `-b phantomjs`
Browser | Example
---------- | ---------------
Chrome | `-b chrome`
Firefox | `-b firefox`
Phantom JS | `-b phantomjs`
Electron | `-b electron`
Custom | `-b customDriver.js`

To use your own driver, create a customDriver.js file in the root of your project and provide the filename with the `-b` switch.

#### Configuration file

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "selenium-cucumber-js",
"version": "1.4.9",
"version": "1.4.10",
"description": "JavaScript browser automation framework using official selenium-webdriver and cucumber-js",
"main": "index.js",
"scripts": {
Expand Down
5 changes: 3 additions & 2 deletions runtime/electronDriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@

var selenium = require('selenium-webdriver');
var path = require('path');

var myapp = path.resolve(process.cwd(), 'MyApp.app/Contents/MacOS/MyApp');
/**
* Creates a Selenium WebDriver using Firefox as the browser
* @returns {ThenableWebDriver} selenium web driver
*/
module.exports = function () {

var driver = new global.selenium.Builder()
var driver = new selenium.Builder()
.withCapabilities({
chromeOptions: {
// Here is the path to your Electron binary.
binary: myapp
}
})
.forBrowser('electron')
.build()
.build();

return driver;
};
10 changes: 5 additions & 5 deletions runtime/world.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var Eyes = require('eyes.selenium').Eyes;
// drivers
var FireFoxDriver = require('./firefoxDriver.js');
var PhantomJSDriver = require('./phantomDriver.js');
var electronDriver = require('./electronDriver.js');
var ElectronDriver = require('./electronDriver.js');
var ChromeDriver = require('./chromeDriver');

/**
Expand All @@ -46,9 +46,8 @@ function getDriverInstance() {
break;

case 'electron': {
driver = new electronDriver();
}
break;
driver = new ElectronDriver();
} break;

case 'chrome': {
driver = new ChromeDriver();
Expand All @@ -62,6 +61,7 @@ function getDriverInstance() {
if (!fs.isFileSync(driverFileName)) {
throw new Error('Could not find driver file: ' + driverFileName);
}

driver = require(driverFileName)();
}
}
Expand Down Expand Up @@ -237,4 +237,4 @@ module.exports = function () {
return eyes.abortIfNotClosed();
});
});
};
};

0 comments on commit 6240f8f

Please sign in to comment.