Skip to content

Commit 734e392

Browse files
author
Lee Eggebroten
committed
Merge branch 'master' into allow-multiple-tags
# Conflicts: # index.js
2 parents 6e2d9b5 + abaaec0 commit 734e392

File tree

2 files changed

+40
-12
lines changed

2 files changed

+40
-12
lines changed

README.MD

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ JavaScript browser automation framework using official [selenium-webdriver](http
99
* [Installation](#installation)
1010
* [Usage](#usage)
1111
* [Options](#options)
12+
* [Configuration file](#configuration-file)
1213
* [Feature files](#feature-files)
1314
* [Step definitions](#step-definitions)
1415
* [Page objects](#page-objects)
@@ -61,6 +62,33 @@ By default tests are run using Google Chrome, to run tests using another browser
6162
| Firefox | `-b firefox`
6263
| Phantom JS | `-b phantomjs`
6364

65+
#### Configuration file
66+
67+
Configuration options can be set using a `selenium-cucumber-js.json` file at the root of your project. The JSON keys use the "long name" from the command line options. For example the following duplicates default configuration:
68+
69+
```json
70+
{
71+
"steps": "./step-definitions",
72+
"pageObjects": "./page-objects",
73+
"sharedObjects": "./shared-objects",
74+
"reports": "./reports",
75+
"browser": "chrome",
76+
"timeout": 10000
77+
}
78+
```
79+
80+
Whereas the following would set configuration to match the expected directory structure of IntelliJ's Cucumber plugin, and make default timeout one minute. _Note that the default browser has not been overridden and will remain 'chrome'._
81+
82+
```json
83+
{
84+
"steps": "./features/step_definitions",
85+
"pageObjects": "./features/page_objects",
86+
"sharedObjects": "./features/shared_objects",
87+
"reports": "./features/reports",
88+
"timeout": 60000
89+
}
90+
```
91+
6492
### Feature files
6593

6694
A feature file is a [Business Readable, Domain Specific Language](http://martinfowler.com/bliki/BusinessReadableDSL.html) file that lets you describe software’s behavior without detailing how that behavior is implemented. Feature files are written using the [Gherkin syntax](https://github.com/cucumber/cucumber/wiki/Gherkin) and must live in a folder named **features** within the root of your project.
@@ -338,4 +366,4 @@ node ./node_modules/selenium-cucumber-js/index.js -s ./features/step_definitions
338366

339367
## License
340368

341-
Licensed under [ISC License](LICENSE) © [John Doherty](http://www.johndoherty.info)
369+
Licensed under [ISC License](LICENSE) © [John Doherty](http://www.johndoherty.info)

index.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ function coerceInt(value, defaultValue) {
2323
}
2424

2525
var config = {
26-
step_def_dir: './step-definitions',
27-
page_obj_dir: './page-objects',
28-
shared_obj_dir: './shared-objects',
29-
reports_dir: './reports',
30-
default_browser: 'chrome',
26+
steps: './step-definitions',
27+
pageObjects: './page-objects',
28+
sharedObjects: './shared-objects',
29+
reports: './reports',
30+
browser: 'chrome',
3131
timeout: 10000
3232
};
3333

@@ -40,13 +40,13 @@ if (fs.isFileSync(configFileName)) {
4040
program
4141
.version(pjson.version)
4242
.description(pjson.description)
43-
.option('-s, --steps <path>', 'path to step definitions. defaults to ' + config.step_def_dir, config.step_def_dir)
44-
.option('-p, --pageObjects <path>', 'path to page objects. defaults to ' + config.page_obj_dir, config.page_obj_dir)
45-
.option('-o, --sharedObjects [paths]', 'path to shared objects (repeatable). defaults to ' + config.shared_obj_dir, collectPaths, [config.shared_obj_dir])
46-
.option('-b, --browser <path>', 'name of browser to use. defaults to ' + config.default_browser, config.default_browser)
47-
.option('-r, --reports <path>', 'output path to save reports. defaults to ' + config.reports_dir, config.reports_dir)
43+
.option('-s, --steps <path>', 'path to step definitions. defaults to ' + config.steps, config.steps)
44+
.option('-p, --pageObjects <path>', 'path to page objects. defaults to ' + config.pageObjects, config.pageObjects)
45+
.option('-o, --sharedObjects [paths]', 'path to shared objects (repeatable). defaults to ' + config.sharedObjects, collectPaths, [config.sharedObjects])
46+
.option('-b, --browser <path>', 'name of browser to use. defaults to ' + config.browser, config.browser)
47+
.option('-r, --reports <path>', 'output path to save reports. defaults to ' + config.reports, config.reports)
4848
.option('-d, --disableLaunchReport [optional]', 'Disables the auto opening the browser with test report')
49-
.option('-j, --junit <path>', 'output path to save junit-report.xml defaults to ' + config.reports_dir)
49+
.option('-j, --junit <path>', 'output path to save junit-report.xml defaults to ' + config.reports)
5050
.option('-t, --tags <tagName>', 'name of tag to run', collectPaths, [])
5151
.option('-f, --featureFile <path>', 'a specific feature file to run')
5252
.option('-x, --timeOut <n>', 'steps definition timeout in milliseconds. defaults to ' + config.timeout, coerceInt, config.timeout)

0 commit comments

Comments
 (0)