Skip to content

Commit

Permalink
fixed eslint issues and updated docs to reflect additional electron s…
Browse files Browse the repository at this point in the history
…upport
  • Loading branch information
John Doherty committed Sep 21, 2017
1 parent f13cdab commit 39f0657
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 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;
};
7 changes: 4 additions & 3 deletions runtime/world.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var cucumberJunit = require('cucumber-junit');
// 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 @@ -41,7 +41,7 @@ function getDriverInstance() {
} break;

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

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

driver = require(driverFileName)();
}
}
Expand Down Expand Up @@ -206,4 +207,4 @@ module.exports = function () {
return driver.quit();
});
});
};
};

0 comments on commit 39f0657

Please sign in to comment.