Skip to content

Commit

Permalink
Merge pull request #80 from reportportal/develop
Browse files Browse the repository at this point in the history
EPMRPP-82453 || Agent release 5.0.1
  • Loading branch information
Bam6ycha authored Apr 18, 2023
2 parents 3c94c4a + 17f1b88 commit b468899
Show file tree
Hide file tree
Showing 14 changed files with 3,601 additions and 4,540 deletions.
9 changes: 4 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true

[*.js]
indent_style = space
indent_size = 4

end_of_line = lf
charset = utf-8
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
5 changes: 4 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
"no-cond-assign": "off",
"default-case": "off",
"no-void": "off",
"implicit-arrow-linebreak": "off"
"implicit-arrow-linebreak": "off",
"prefer-object-spread": "off",
"import/no-useless-path-segments": "off",
"import/extensions": "off"
}
}
15 changes: 14 additions & 1 deletion .github/workflows/CI-pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# Copyright 2020 EPAM Systems
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: CI-pipeline

on:
Expand All @@ -16,7 +29,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 18
- name: Clean install of node dependencies
run: npm ci
- name: Run lint
Expand Down
24 changes: 18 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
# Copyright 2020 EPAM Systems
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: publish

on:
release:
types:
- published
repository_dispatch:
types: [version-released]

jobs:
build:
Expand All @@ -14,7 +26,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 18
- name: Clean install of node dependencies
run: npm ci
- name: Run lint
Expand All @@ -33,7 +45,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v1
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 @@ -47,7 +59,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 18
registry-url: 'https://npm.pkg.github.com'
scope: '@reportportal'
- name: Publish to GPR
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# Copyright 2020 EPAM Systems
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: release

on:
Expand Down Expand Up @@ -62,6 +75,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 Expand Up @@ -128,3 +145,9 @@ jobs:
body: ${{ needs.create-tag.outputs.versionInfo }}
draft: false
prerelease: false
- name: Trigger the publish workflow
if: success()
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.GH_TOKEN }}
event-type: version-released
5 changes: 0 additions & 5 deletions .npmignore

This file was deleted.

7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
### Fixed
- Potential security vulnerabilities in dependencies.
- [#64](https://github.com/reportportal/agent-js-jasmine/issues/64) Fixed error when cannot read property 'replace' of undefined while iterating over describe block
- [#69](https://github.com/reportportal/agent-js-jasmine/issues/69) Fixed error `Value is not allowed for field 'status'`. Thanks to [NanoTechnolog3000](https://github.com/NanoTechnolog3000)

### Changed
- Package size reduced

## [5.0.0] - 2020-06-18
### Added
Expand Down
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
# @reportportal/agent-js-jasmine

Agent for integration Jasmine with ReportPortal.
[ReportPortal](http://reportportal.io/)<br>
[ReportPortal on GitHub](https://github.com/reportportal)
Agent to integrate Jasmine with ReportPortal.
* More about [Jasmine](https://jasmine.github.io/)
* More about [ReportPortal](http://reportportal.io/)

### How to use
1. Install the agent in your project:
```cmd
npm i @reportportal/agent-js-jasmine --save-dev
npm install @reportportal/agent-js-jasmine --save-dev
```
2. Create an agent instance:
```javascript
var ReportportalAgent = require('@reportportal/agent-js-jasmine');
const ReportportalAgent = require('@reportportal/agent-js-jasmine');

var agent = new ReportportalAgent({
// client settings
const agent = new ReportportalAgent({
token: "00000000-0000-0000-0000-000000000000",
endpoint: "http://your.reportportal.server/api/v1",
launch: "LAUNCH_NAME",
project: "PROJECT_NAME",
// agent settings
attachPicturesToLogs: true,
attributes: [
{
Expand Down Expand Up @@ -106,7 +104,8 @@ description | true | "string" - text description for your suite | "Your descript
Parameter | Required | Description | Examples
--------- | ----------- | ----------- | -----------
attributes | true | attributes, pairs of key and value | [{ "key": "YourKey", "value": "YourValue" }]
To integrate with Sauce Labs just add attributes:

To integrate report with Sauce Labs just add attributes:

```javascript
[{
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0.0
5.0.1-SNAPSHOT
1 change: 1 addition & 0 deletions lib/constants/testStatuses.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
const JasmineStatuses = {
PENDING: 'pending',
DISABLED: 'disabled',
EXCLUDED: 'excluded',
};

module.exports = { JasmineStatuses };
12 changes: 8 additions & 4 deletions lib/jasmine-reportportal-reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class ReportportalReporter {
this.hookIds = new Map();
this.itemStartTime = null;
this.currentTestFilePathIndex;
this.prevSuite;
}

reportHooks() {
Expand Down Expand Up @@ -206,13 +207,16 @@ class ReportportalReporter {
return;
}

if (this.prevSuite === suite.fullName) return;

if (suite.description === suite.fullName) {
this.currentTestFilePathIndex = this.currentTestFilePathIndex + 1;
this.currentTestFilePathIndex += 1;
}
}

suiteStarted(suite) {
this.changeCurrentTestFilePath(suite);
this.prevSuite = suite.fullName;

const fullSuiteName = SpecificUtils.getFullTestName(suite);
const promise = SpecificUtils.getCodeRef(this.currentTestFilePathIndex, fullSuiteName);
Expand All @@ -239,7 +243,7 @@ class ReportportalReporter {
codeRef && { codeRef }), this.tempLaunchId, parent && parent.tempId);

this.setParentInfo({ tempId: suiteObj.tempId, startTime: this.itemStartTime });
logs && logs.forEach(log => this.sendLog(suiteObj.tempId, log));
logs && logs.forEach((log) => this.sendLog(suiteObj.tempId, log));
promiseErrorHandler(suiteObj.promise);

this.additionalCustomParams = {};
Expand Down Expand Up @@ -314,7 +318,7 @@ class ReportportalReporter {
attributes, description, testCaseId, logs = [], customStatus,
} = this.additionalCustomParams;
let status = customStatus || spec.status;
if (status === JasmineStatuses.PENDING || status === JasmineStatuses.DISABLED) {
if (Object.values(JasmineStatuses).includes(status)) {
status = RP_STATUSES.SKIPPED;
}
let level = '';
Expand All @@ -340,7 +344,7 @@ class ReportportalReporter {
? { issueType: 'NOT_ISSUE' }
: null;

allLogs && allLogs.forEach(log => this.sendLog(parent && parent.tempId, log));
allLogs && allLogs.forEach((log) => this.sendLog(parent && parent.tempId, log));

const finishTestItemPromise = this.client.finishTestItem(parent && parent.tempId, Object.assign({
status,
Expand Down
18 changes: 9 additions & 9 deletions lib/publicReportingAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ const PublicReportingAPI = {
setDescription: (text, suite) => ClientPublicReportingAPI.setDescription(text, suite),
setTestCaseId: (testCaseId, suite) => ClientPublicReportingAPI.setTestCaseId(testCaseId, suite),
setStatus: (status, suite) => ClientPublicReportingAPI.setStatus(status, suite),
setLaunchStatus: status => ClientPublicReportingAPI.setLaunchStatus(status),
setStatusPassed: suite => PublicReportingAPI.setStatus(RP_STATUSES.PASSED, suite),
setStatusFailed: suite => PublicReportingAPI.setStatus(RP_STATUSES.FAILED, suite),
setStatusSkipped: suite => PublicReportingAPI.setStatus(RP_STATUSES.SKIPPED, suite),
setStatusStopped: suite => PublicReportingAPI.setStatus(RP_STATUSES.STOPPED, suite),
setStatusInterrupted: suite => PublicReportingAPI.setStatus(RP_STATUSES.INTERRUPTED, suite),
setStatusCancelled: suite => PublicReportingAPI.setStatus(RP_STATUSES.CANCELLED, suite),
setStatusInfo: suite => PublicReportingAPI.setStatus(RP_STATUSES.INFO, suite),
setStatusWarn: suite => PublicReportingAPI.setStatus(RP_STATUSES.WARN, suite),
setLaunchStatus: (status) => ClientPublicReportingAPI.setLaunchStatus(status),
setStatusPassed: (suite) => PublicReportingAPI.setStatus(RP_STATUSES.PASSED, suite),
setStatusFailed: (suite) => PublicReportingAPI.setStatus(RP_STATUSES.FAILED, suite),
setStatusSkipped: (suite) => PublicReportingAPI.setStatus(RP_STATUSES.SKIPPED, suite),
setStatusStopped: (suite) => PublicReportingAPI.setStatus(RP_STATUSES.STOPPED, suite),
setStatusInterrupted: (suite) => PublicReportingAPI.setStatus(RP_STATUSES.INTERRUPTED, suite),
setStatusCancelled: (suite) => PublicReportingAPI.setStatus(RP_STATUSES.CANCELLED, suite),
setStatusInfo: (suite) => PublicReportingAPI.setStatus(RP_STATUSES.INFO, suite),
setStatusWarn: (suite) => PublicReportingAPI.setStatus(RP_STATUSES.WARN, suite),
setLaunchStatusPassed: () => PublicReportingAPI.setLaunchStatus(RP_STATUSES.PASSED),
setLaunchStatusFailed: () => PublicReportingAPI.setLaunchStatus(RP_STATUSES.FAILED),
setLaunchStatusSkipped: () => PublicReportingAPI.setLaunchStatus(RP_STATUSES.SKIPPED),
Expand Down
Loading

0 comments on commit b468899

Please sign in to comment.