Skip to content

Commit

Permalink
Merge pull request #93 from reportportal/develop
Browse files Browse the repository at this point in the history
EPMRPP-82837 || Release 5.0.3
  • Loading branch information
Bam6ycha authored May 30, 2023
2 parents 1694565 + 36901d5 commit 66d025c
Show file tree
Hide file tree
Showing 14 changed files with 3,780 additions and 5,482 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/CI-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: 12.x
node-version: 18
- name: Clean install of node dependencies
run: npm ci
- name: Run lint
run: npm run lint
- name: Run tests
run: npm test
- name: Check coverage
- name: Run tests and check coverage
run: npm run test:coverage
16 changes: 7 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: 12.x
node-version: 18
- name: Clean install of node dependencies
run: npm ci
- name: Run lint
run: npm run lint
- name: Run tests
run: npm test
- name: Check coverage
- name: Run tests and check coverage
run: npm run test:coverage

publish-to-npm-and-gpr:
Expand All @@ -43,9 +41,9 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: 12.x
node-version: 18
registry-url: 'https://registry.npmjs.org'
- name: Clean install of node dependencies
run: npm ci
Expand All @@ -57,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@v2
with:
node-version: 12.x
node-version: 18
registry-url: 'https://npm.pkg.github.com'
scope: '@reportportal'
- name: Publish to GPR
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup NodeJS
uses: actions/setup-node@v2
with:
node-version: '12'
- name: Configure git
run: |
git config --global user.email "reportportal.io"
Expand Down
4 changes: 0 additions & 4 deletions .npmignore

This file was deleted.

8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
### Fixed
- [#82](https://github.com/reportportal/agent-js-postman/issues/82) Fix checks of a failure array.
- Security vulnerabilities
### Changed
- Package size reduced
- Actualized dependencies
### Added
- The ability to mark skipped tests as not to be investigated using the `skippedIssue` flag

## [5.0.2] - 2021-06-23
### Updated
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# @reportportal/agent-js-postman

Newman runtime reporter for ReportPortal which provides information about collection run.
[ReportPortal](http://reportportal.io/)<br>
[ReportPortal on GitHub](https://github.com/reportportal)
Agent to integrate Postman (based on Newman collection runner) with ReportPortal.
* More about [Postman](https://www.postman.com/)
* More about [Newman](https://github.com/postmanlabs/newman)
* More about [ReportPortal](http://reportportal.io/)

### How to use
The installation should be global if newman is installed globally, otherwise - local (replace -g from the command below with -S for a local installation).
Expand Down Expand Up @@ -101,7 +102,7 @@ Both CLI and programmatic runs support following options:
| debug | Determines whether newman's run should be logged in details. |
| mode | Launch mode. Allowable values *DEFAULT* (by default) or *DEBUG*.
| restClientConfig | 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`. |

skippedIssue | *Default: true.* ReportPortal provides feature to mark skipped tests as not 'To Investigate' items on WS side.<br> Parameter could be equal boolean values:<br> *TRUE* - skipped tests considered as issues and will be marked as 'To Investigate' on Report Portal.<br> *FALSE* - skipped tests will not be marked as 'To Investigate' on application.
### Report static attributes
* To report attributes for suite you should use collection variables.

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0.2
5.0.3-SNAPSHOT
34 changes: 0 additions & 34 deletions __tests__/index.spec.js

This file was deleted.

3 changes: 1 addition & 2 deletions __tests__/reporter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ describe('reporter', () => {
};
jest.spyOn(utils, 'getCollectionPath').mockImplementation(() => 'collectionPath');

reporter = new Reporter(emitter, options, {});
reporter.client = new RPClient();
reporter = new Reporter(emitter, options, {}, RPClient);
reporter.launchObj.tempId = 'startLaunch';
});

Expand Down
2 changes: 1 addition & 1 deletion lib/constants/patterns.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

const testPatterns = [/[\s]*pm.test\("(.*?)",/, /[\s]*tests\["(.*?)"\]/];
const testPatterns = [/[\s]*pm.test\("(.*?)",/, /[\s]*pm.test.skip\("(.*?)",/, /[\s]*tests\["(.*?)"\]/];
const pmVariablesTestCaseIdPatterns =
[/[\s]*pm.variables.set\("rp.testCaseId", "(.*?)"\)/, /[\s]*pm.variables.set\("rp.testCaseId","(.*?)"\)/];
const pmVariablesStatusPatterns =
Expand Down
21 changes: 16 additions & 5 deletions lib/reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ const errorHandler = err => {
*/
const TestStatus = Object.freeze({
PASSED: 'PASSED',
FAILED: 'FAILED'
FAILED: 'FAILED',
SKIPPED: 'SKIPPED'
});

class Reporter {
constructor (emitter, options, collectionRunOptions) {
this.client = new RPClient(utils.getClientInitObject(options), utils.getAgentInfo());
constructor (emitter, options, collectionRunOptions, rpClient) {
const client = rpClient || RPClient;
this.client = new client(utils.getClientInitObject(options), utils.getAgentInfo());
this.launchObj = this.client.startLaunch(utils.getStartLaunchObj(options));
this.collectionMap = new Map();
this.suitesInfoStack = [];
Expand Down Expand Up @@ -250,9 +252,18 @@ class Reporter {
this.logMessage(currentStep.stepId, actualError.message, 'ERROR');
}

const additionalData = {};
if (testAssertion.skipped) {
additionalData.status = TestStatus.SKIPPED;
if (this.options.skippedIssue === false) {
additionalData.issue = { issueType: 'NOT_ISSUE' };
}
}

this.client
.finishTestItem(currentStep.stepId, {
status: currentStep.status || (actualError ? TestStatus.FAILED : TestStatus.PASSED)
status: currentStep.status || (actualError ? TestStatus.FAILED : TestStatus.PASSED),
...additionalData
})
.promise.catch(errorHandler);
this.collectionMap.set(testAssertion.cursor.ref, testObj);
Expand Down Expand Up @@ -334,7 +345,7 @@ class Reporter {

this.client
.finishLaunch(this.launchObj.tempId, {
status: status || (result.run.failures ? TestStatus.FAILED : TestStatus.PASSED)
status: status || ((result.run.failures || []).length ? TestStatus.FAILED : TestStatus.PASSED)
})
.promise.catch(errorHandler);
}
Expand Down
1 change: 1 addition & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ module.exports = {
this.getArrAttributesFromString(options.reportportalAgentJsPostmanAttributes),
debug: options.debug || options.reportportalAgentJsPostmanDebug,
mode: options.mode || options.reportportalAgentJsPostmanMode,
skippedIssue: options.skippedIssue || options.reportportalAgentJsPostmanSkippedIssue,
restClientConfig: options.restClientConfig
};
},
Expand Down
Loading

0 comments on commit 66d025c

Please sign in to comment.