Skip to content

Commit 213151d

Browse files
author
John Doherty
committed
doc updates
1 parent 9ee464e commit 213151d

File tree

2 files changed

+35
-32
lines changed

2 files changed

+35
-32
lines changed

README.MD

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ JavaScript browser automation framework using official [selenium-webdriver](http
1313
* [Step definitions](#step-definitions)
1414
* [Page objects](#page-objects)
1515
* [Shared objects](#shared-objects)
16-
* [Reports](#reports)
1716
* [Event handlers](#event-handlers)
18-
* [How to debug](#how-to-debug)
19-
* [Default directory structure](#default-directory-structure)
17+
* [Reports](#reports)
18+
* [How to debug](#how-to-debug)
19+
* [Directory structure](#directory-structure)
2020
* [Demo](#demo)
2121
* [Bugs](#bugs)
2222
* [Contributing](#contributing)
@@ -201,12 +201,6 @@ module.exports = function () {
201201
};
202202
```
203203

204-
### Reports
205-
206-
HTML and JSON reports are automatically generated and stored in the default `./reports` folder. This location can be changed by providing a new path using the `-r` command line switch:
207-
208-
![Cucumber HTML report](img/cucumber-html-report.png)
209-
210204
### Event handlers
211205

212206
You can register event handlers for the following events within the cucumber life cycle.
@@ -219,32 +213,41 @@ You can register event handlers for the following events within the cucumber lif
219213
| AfterScenario | ```this.AfterScenario(function(scenario, callback) {});```
220214

221215
```js
222-
// add a before feature hook
223-
this.BeforeFeature(function(feature, done) {
224-
console.log('BeforeFeature: ' + feature.getName());
225-
done();
226-
});
216+
module.exports = function () {
227217

228-
// add an after feature hook
229-
this.AfterFeature(function(feature, done) {
230-
console.log('AfterFeature: ' + feature.getName());
231-
done();
232-
});
218+
// add a before feature hook
219+
this.BeforeFeature(function(feature, done) {
220+
console.log('BeforeFeature: ' + feature.getName());
221+
done();
222+
});
233223

234-
// add before scenario hook
235-
this.BeforeScenario(function(scenario, done) {
236-
console.log('BeforeScenario: ' + scenario.getName());
237-
done();
238-
});
224+
// add an after feature hook
225+
this.AfterFeature(function(feature, done) {
226+
console.log('AfterFeature: ' + feature.getName());
227+
done();
228+
});
239229

240-
// add after scenario hook
241-
this.AfterScenario(function(scenario, done) {
242-
console.log('AfterScenario: ' + scenario.getName());
243-
done();
244-
});
230+
// add before scenario hook
231+
this.BeforeScenario(function(scenario, done) {
232+
console.log('BeforeScenario: ' + scenario.getName());
233+
done();
234+
});
235+
236+
// add after scenario hook
237+
this.AfterScenario(function(scenario, done) {
238+
console.log('AfterScenario: ' + scenario.getName());
239+
done();
240+
});
241+
};
245242
```
246243

247-
## How to debug
244+
### Reports
245+
246+
HTML and JSON reports are automatically generated and stored in the default `./reports` folder. This location can be changed by providing a new path using the `-r` command line switch:
247+
248+
![Cucumber HTML report](img/cucumber-html-report.png)
249+
250+
### How to debug
248251

249252
Most selenium methods return a [JavaScript Promise](https://spring.io/understanding/javascript-promises "view JavaScript promise introduction") that is resolved when the method completes. The easiest way to step in with a debugger is to add a ```.then``` method to a selenium function and place a ```debugger``` statement within it, for example:
250253

@@ -268,7 +271,7 @@ module.exports = function () {
268271
};
269272
```
270273

271-
## Default directory structure
274+
### Directory structure
272275

273276
You can use the framework without any command line arguments if your application uses the following folder structure:
274277

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "selenium-cucumber-js",
3-
"version": "1.4.0",
3+
"version": "1.4.1",
44
"description": "JavaScript browser automation framework using official selenium-webdriver and cucumber-js",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)