Skip to content

Commit

Permalink
Merge pull request #146 from reportportal/develop
Browse files Browse the repository at this point in the history
Release 5.2.2
  • Loading branch information
AmsterGet authored Jul 18, 2023
2 parents d7d0d77 + 212b7b4 commit a818756
Show file tree
Hide file tree
Showing 7 changed files with 5,764 additions and 4,295 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/CI-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: 12.x
- name: Clean install of node dependencies
run: npm ci
node-version: 18
- name: Install of node dependencies
run: npm install
- name: Run lint
run: npm run lint
- name: Check test coverage
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: 12.x
- name: Clean install of node dependencies
run: npm ci
node-version: 18
- name: Install of node dependencies
run: npm install
- name: Run lint
run: npm run lint
- name: Check test coverage
Expand All @@ -39,14 +39,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: 12.x
node-version: 18
registry-url: 'https://registry.npmjs.org'
- name: Clean install of node dependencies
run: npm ci
- name: Install of node dependencies
run: npm install
- name: Publish to NPM
run: |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
Expand All @@ -55,9 +55,9 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
- name: Set up Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: 12.x
node-version: 18
registry-url: 'https://npm.pkg.github.com'
scope: '@reportportal'
- name: Publish to GPR
Expand Down
9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### Added
- Add `@cucumber/cucumber` version 9 support. Addressed [147](https://github.com/reportportal/agent-js-cucumber/issues/147).
### Changed
- `token` configuration option was renamed to `apiKey` to maintain common convention.
- `@reportportal/client-javascript` bumped to version `5.0.12`.

## [5.2.1] - 2023-02-21
### Added
Expand All @@ -17,28 +22,24 @@
## [5.1.0] - 2022-11-29
### Added
- Added support for 7-8 versions of `@cucumber/cucumber` package

### Updated
- `@reportportal/client-javascript` version to the latest

## [5.0.2] - 2021-06-23
### Fixed
- Launch status calculation

### Updated
- `@reportportal/client-javascript` version to the latest

## [5.0.1] - 2020-11-04
### Fixed
- [#66](https://github.com/reportportal/agent-js-cucumber/issues/66) Incorrect calculation of test status
- Lots of other bugs

### Updated
- `@reportportal/client-javascript` version to the latest

## [5.0.0] - 2020-08-28
### Added
- Full compatibility with ReportPortal version 5.* (see [reportportal releases](https://github.com/reportportal/reportportal/releases))

### Deprecated
- Previous package versions (`reportportal-agent-cucumber`, `agent-js-cucumber`) will no longer supported by reportportal.io
75 changes: 34 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# agent-js-cucumber
# @reportportal/agent-js-cucumber

Agent for integration CucumberJS with ReportPortal.
Agent to integrate CucumberJS with ReportPortal.
* More about [CucumberJS](https://cucumber.io/docs/installation/javascript/)
* More about [ReportPortal](http://reportportal.io/)

This agent works well with cucumber versions from 7.x.
This agent works well with cucumber versions from 7.x to 9.x.
Documentation for legacy cucumber versions from 4.x to 6.x can be found [here](/modules/api/deprecated/README.md)

## Install agent to your project dir
Expand All @@ -31,48 +31,57 @@ npm install --save-dev @reportportal/agent-js-cucumber
#### Note
Protractor and Cucumber have their own **timeouts** .
When protractror start main process that lauches cucumber it would have different timeouts if there not the same they would wait for scripts different time.
If cucumbers's timeout less then protractor's it would through wrong exeption.
When protractor start main process that launches cucumber it would have different timeouts if they are not the same they would wait for scripts different time.
If cucumber's timeout less than protractor's it would through wrong exception.
For example if page that has been loaded and hasn't got angular, the next error would be thrown : `Error: function timed out after 10000 milliseconds . . .` . Instead of protractor's :
`Error: Error while running testForAngular: asynchronous script timeout: result was not received in 4 seconds . . .` .
So it must be handled manually by setting cucumbers's timeout greater then protractor's is at the hooks.js. For example if you set up protractor's timeout 9000 miliseconds , so cucumber must be at least 1 second greater = 10000 miliseconds. Example :
So it must be handled manually by setting cucumber's timeout greater than protractor's is at the hooks.js. For example if you set up protractor's timeout 9000 miliseconds , so cucumber must be at least 1 second greater = 10000 miliseconds. Example :
```javascript
var { setDefaultTimeout } = require('cucumber');
var { setDefaultTimeout } = require('@cucumber/cucumber');
setDefaultTimeout(10000);
```
2. Create Report Portal configuration file
For example `./rpConfig.json`
In example below `${text}` - is used as placeholder for your data. This data you must get from ReportPortal profile.
```json
{
"token": "${rp.token}",
"endpoint": "${rp.endpoint}/api/v1",
"launch": "${rp.launch}",
"project": "${rp.your_project}",
"takeScreenshot": "onFailure",
"apiKey": "reportportalApiKey",
"endpoint": "https://your.reportportal.server/api/v1",
"launch": "Your launch name",
"project": "Your reportportal project name",
"description": "Awesome launch description.",
"attributes": [
{
"key": "launchAttributeKey",
"value": "launchAttributeValue"
}
],
"mode": "DEFAULT",
"debug": false,
"restClientConfig": {
"timeout": 0
}
"takeScreenshot": "onFailure"
}
```
`takeScreenshot` - if this option is defined then framework will take screenshot with protractor or webdriver API if step has failed.<br/>
`mode` - Launch mode. Allowable values *DEFAULT* (by default) or *DEBUG*.<br/>
`debug` - this flag allows seeing the logs of the `client-javascript`. Useful for debugging.<br/>
`restClientConfig` (optional) - The object with `agent` property for configure [http(s)](https://nodejs.org/api/https.html#https_https_request_url_options_callback) client, may contain other client options eg. `timeout`.
The full list of available options presented below.
| Option | Necessity | Default | Description |
|-------------------------|------------|-----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| apiKey | Required | | User's reportportal token from which you want to send requests. It can be found on the profile page of this user. |
| endpoint | Required | | URL of your server. For example 'https://server:8080/api/v1'. |
| launch | Required | | Name of launch at creation. |
| project | Required | | The name of the project in which the launches will be created. |
| attributes | Optional | [] | Launch attributes. |
| description | Optional | '' | Launch description. |
| rerun | Optional | false | Enable [rerun](https://reportportal.io/docs/dev-guides/RerunDevelopersGuide) |
| rerunOf | Optional | Not set | UUID of launch you want to rerun. If not specified, reportportal will update the latest launch with the same name |
| mode | Optional | 'DEFAULT' | Results will be submitted to Launches page <br/> *'DEBUG'* - Results will be submitted to Debug page. |
| skippedIssue | Optional | true | reportportal provides feature to mark skipped tests as not 'To Investigate'. <br/> Option could be equal boolean values: <br/> *true* - skipped tests considered as issues and will be marked as 'To Investigate' on reportportal. <br/> *false* - skipped tests will not be marked as 'To Investigate' on application. |
| debug | Optional | false | This flag allows seeing the logs of the client-javascript. Useful for debugging. |
| takeScreenshot | Optional | Not set | Possible values: *onFailure*. If this option is defined then framework will take screenshot with protractor or webdriver API if step has failed. |
| scenarioBasedStatistics | Optional | false | While true, the Gherkin Scenarios considered as entity with statistics. In this case Cucumber steps will be reported to the log level as nested steps. |
| restClientConfig | Optional | Not set | The object with `agent` property for configure [http(s)](https://nodejs.org/api/https.html#https_https_request_url_options_callback) client, may contain other client options eg. [`timeout`](https://github.com/reportportal/client-javascript#timeout-30000ms-on-axios-requests). <br/> Visit [client-javascript](https://github.com/reportportal/client-javascript) for more details. |
| token | Deprecated | Not set | Use `apiKey` instead. |
3. Create Report Portal formatter in a new js file, for example `reportPortalFormatter.js`:
Expand Down Expand Up @@ -120,20 +129,6 @@ npm install --save-dev @reportportal/agent-js-cucumber
More info in the [examples](https://github.com/reportportal/examples-js/tree/master/example-cucumber) repository.
## Rerun
To report [rerun](https://github.com/reportportal/documentation/blob/master/src/md/src/DevGuides/rerun.md) to the report portal you need to specify the following options to the config file:
- rerun - to enable rerun
- rerunOf - UUID of launch you want to rerun. If not specified, report portal will update the latest launch with the same name
Example:
```json
"rerun": true,
"rerunOf": "f68f39f9-279c-4e8d-ac38-1216dffcc59c"
```

## Step reporting configuration
By default, this agent reports the following structure:
Expand All @@ -146,18 +141,16 @@ You may change this behavior to report steps to the log level by enabling scenar
- feature - TEST
- scenario - STEP
- step - log item
- step - log item (nested step)
To report your steps as logs, you need to pass an additional parameter to the agent config: `"scenarioBasedStatistics": true`
To report your steps as logs without creating statistics for every step, you need to pass an additional parameter to the agent config: `"scenarioBasedStatistics": true`
```json
{
"scenarioBasedStatistics": true
}
```

This will report your your steps with logs to a log level without creating statistics for every step.

## API

### Attachments
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.2.1
5.2.2-SNAPSHOT
Loading

0 comments on commit a818756

Please sign in to comment.