|
4 | 4 |
|
5 | 5 | JavaScript browser automation framework using official [selenium-webdriver](http://seleniumhq.github.io/selenium/docs/api/javascript/ "view webdriver js documentation") and [cucumber-js](https://github.com/cucumber/cucumber-js "view cucumber js documentation"). |
6 | 6 |
|
| 7 | +**Table of Contents** |
| 8 | + |
| 9 | +* [Installation](#installation) |
| 10 | +* [Usage](#usage) |
| 11 | + * [Options](#options) |
| 12 | + * [Feature files](#feature-files) |
| 13 | + * [Step definitions](#step-definitions) |
| 14 | + * [Page objects](#page-objects) |
| 15 | + * [Shared objects](#shared-objects) |
| 16 | + * [Reports](#reports) |
| 17 | + * [Event handlers](#event-handlers) |
| 18 | +* [How to debug](#how-to-debug) |
| 19 | +* [Default directory structure](#default-directory-structure) |
| 20 | +* [Demo](#demo) |
| 21 | +* [Bugs](#bugs) |
| 22 | +* [Contributing](#contributing) |
| 23 | +* [Troubleshooting](#troubleshooting) |
| 24 | + * [IntelliJ Cucumber Plugin](#intellij-cucumber-plugin) |
| 25 | + |
7 | 26 | ## Installation |
8 | 27 |
|
9 | 28 | ```bash |
@@ -35,11 +54,11 @@ node ./node_modules/selenium-cucumber-js/index.js -s ./step-definitions |
35 | 54 |
|
36 | 55 | 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: |
37 | 56 |
|
38 | | -| Browser | Example | |
39 | | -| :--- | :--- | |
40 | | -| Chrome | `-b chrome` | |
41 | | -| Firefox | `-b firefox` | |
42 | | -| Phantom JS | `-b phantomjs` | |
| 57 | +| Browser | Example |
| 58 | +| ---------- | --------------- |
| 59 | +| Chrome | `-b chrome` |
| 60 | +| Firefox | `-b firefox` |
| 61 | +| Phantom JS | `-b phantomjs` |
43 | 62 |
|
44 | 63 | ### Feature files |
45 | 64 |
|
@@ -90,20 +109,18 @@ module.exports = function () { |
90 | 109 |
|
91 | 110 | The following variables are available within the ```Given()```, ```When()``` and ```Then()``` functions: |
92 | 111 |
|
93 | | -| Variable | Description | |
94 | | -| :--- | :--- | |
95 | | -| `driver` | an instance of [selenium web driver](http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/lib/webdriver_exports_WebDriver.html) (_the browser_) | |
96 | | -| `selenium` | the raw [selenium-webdriver](http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/) module, providing access to static properties/methods | |
97 | | -| `page` | collection of **page** objects loaded from disk and keyed by filename | |
98 | | -| `shared` | collection of **shared** objects loaded from disk and keyed by filename | |
99 | | -| `helpers` | a collection of [helper methods](runtime/helpers.js) _things selenium does not provide but really should!_ | |
100 | | -| `by` | the selenium [By](http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_By.html) class used to locate elements on the page | |
101 | | -| `until` | the selenium [until](http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/lib/until.html) class used to wait for elements/events | |
102 | | -| `expect` | instance of [chai expect](http://chaijs.com/api/bdd/) to ```expect('something').to.equal('something')``` | |
103 | | -| `assert` | instance of [chai assert](http://chaijs.com/api/assert/) to ```assert.isOk('everything', 'everything is ok')``` | |
104 | | -| `trace` | handy trace method to log console output with increased visibility | |
105 | | - |
106 | | - |
| 112 | +| Variable | Description | |
| 113 | +| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| 114 | +| `driver` | an instance of [selenium web driver](http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/lib/webdriver_exports_WebDriver.html) (_the browser_) |
| 115 | +| `selenium` | the raw [selenium-webdriver](http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/) module, providing access to static properties/methods |
| 116 | +| `page` | collection of **page** objects loaded from disk and keyed by filename |
| 117 | +| `shared` | collection of **shared** objects loaded from disk and keyed by filename |
| 118 | +| `helpers` | a collection of [helper methods](runtime/helpers.js) _things selenium does not provide but really should!_ |
| 119 | +| `by` | the selenium [By](http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_By.html) class used to locate elements on the page |
| 120 | +| `until` | the selenium [until](http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/lib/until.html) class used to wait for elements/events |
| 121 | +| `expect` | instance of [chai expect](http://chaijs.com/api/bdd/) to ```expect('something').to.equal('something')``` |
| 122 | +| `assert` | instance of [chai assert](http://chaijs.com/api/assert/) to ```assert.isOk('everything', 'everything is ok')``` |
| 123 | +| `trace` | handy trace method to log console output with increased visibility |
107 | 124 |
|
108 | 125 | ### Page objects |
109 | 126 |
|
@@ -194,12 +211,12 @@ HTML and JSON reports are automatically generated and stored in the default `./r |
194 | 211 |
|
195 | 212 | You can register event handlers for the following events within the cucumber life cycle. |
196 | 213 |
|
197 | | -| Event | Example | |
198 | | -|----------------|-------------------------------------------------------------| |
199 | | -| BeforeFeature | ```this.BeforeFeatures(function(feature, callback) {}) ``` | |
200 | | -| BeforeScenario | ```this.BeforeScenario(function(scenario, callback) {});``` | |
201 | | -| AfterScenario | ```this.AfterScenario(function(scenario, callback) {});``` | |
202 | | -| AfterFeature | ```this.AfterFeature(function(feature, callback) {});``` | |
| 214 | +| Event | Example |
| 215 | +| -------------- | ------------------------------------------------------------ |
| 216 | +| BeforeFeature | ```this.BeforeFeatures(function(feature, callback) {}) ``` |
| 217 | +| BeforeScenario | ```this.BeforeScenario(function(scenario, callback) {});``` |
| 218 | +| AfterScenario | ```this.AfterScenario(function(scenario, callback) {});``` |
| 219 | +| AfterFeature | ```this.AfterFeature(function(feature, callback) {});``` |
203 | 220 |
|
204 | 221 | ## How to debug |
205 | 222 |
|
|
0 commit comments