Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit 74e3bad

Browse files
igniteramcnishina
authored andcommitted
docs(cucumber): add cucumber configuration example (#3674)
1 parent 9bedcaa commit 74e3bad

File tree

2 files changed

+36
-12
lines changed

2 files changed

+36
-12
lines changed

Diff for: docs/frameworks.md

+35-11
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ expect(myElement.getText()).to.eventually.equal('some text');
4343

4444
Finally, set the 'framework' property to 'mocha', either by adding `framework: 'mocha'` to the config file or by adding `--framework=mocha` to the command line.
4545

46-
Options for Mocha such as 'reporter' and 'slow' can be given in the [config file](../spec/mochaConf.js) with mochaOpts:
46+
Options for Mocha such as 'reporter' and 'slow' can be given in the [config file](/spec/mochaConf.js) with mochaOpts:
4747

4848
```js
4949
mochaOpts: {
@@ -68,28 +68,52 @@ npm install -g cucumber
6868
npm install --save-dev protractor-cucumber-framework
6969
```
7070

71-
Set the 'framework' property to custom by adding `framework: 'custom'` and `frameworkPath: 'protractor-cucumber-framework'` to the [config file](../spec/cucumberConf.js)
71+
Set the 'framework' property to custom by adding `framework: 'custom'` and `frameworkPath: 'protractor-cucumber-framework'` to the `config file(cucumberConf.js)`
7272

73-
Options for Cucumber such as 'format' can be given in the config file with cucumberOpts:
73+
Options for Cucumber such as 'format' can be given in the config file with cucumberOpts, A basic cucumberConf.js file has been provided below:
7474

7575
```js
76+
/*
77+
Basic configuration to run your cucumber
78+
feature files and step definitions with protractor.
79+
**/
7680
exports.config = {
77-
// set to "custom" instead of cucumber.
78-
framework: 'custom',
7981

80-
// path relative to the current config file
81-
frameworkPath: require.resolve('protractor-cucumber-framework'),
82-
83-
// relevant cucumber command line options
82+
seleniumAddress: 'http://localhost:4444/wd/hub',
83+
84+
baseUrl: 'https://angularjs.org/',
85+
86+
capabilities: {
87+
browserName:'chrome'
88+
},
89+
90+
framework: 'custom', // set to "custom" instead of cucumber.
91+
92+
frameworkPath: require.resolve('protractor-cucumber-framework'), // path relative to the current config file
93+
94+
specs: [
95+
'./cucumber/*.feature' // Specs here are the cucumber feature files
96+
],
97+
98+
// cucumber command line options
8499
cucumberOpts: {
85-
format: "summary"
100+
require: ['./cucumber/*.js'], // require step definition files before executing features
101+
tags: [], // <string[]> (expression) only execute the features or scenarios with tags matching the expression
102+
strict: true, // <boolean> fail if there are any undefined or pending steps
103+
format: ["pretty"], // <string[]> (type[:path]) specify the output format, optionally supply PATH to redirect formatter output (repeatable)
104+
dryRun: false, // <boolean> invoke formatters without executing steps
105+
compiler: [] // <string[]> ("extension:module") require files with the given EXTENSION after requiring MODULE (repeatable)
106+
},
107+
108+
onPrepare: function () {
109+
browser.manage().window().maximize(); // maximize the browser before executing the feature files
86110
}
87111
};
88112
```
89113

90114
Using a Custom Framework
91115
------------------------
92116

93-
Check section [Framework Adapters for Protractor](../lib/frameworks/README.md) specifically [Custom Frameworks](../lib/frameworks/README.md#custom-frameworks)
117+
Check section [Framework Adapters for Protractor](/lib/frameworks/README.md) specifically [Custom Frameworks](/lib/frameworks/README.md#custom-frameworks)
94118

95119

Diff for: spec/mochaConf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var env = require('./environment.js');
22

3-
// A small suite to make sure the mocha frameowork works.
3+
// A small suite to make sure the mocha framework works.
44
exports.config = {
55
seleniumAddress: env.seleniumAddress,
66

0 commit comments

Comments
 (0)