Skip to content

Commit

Permalink
Merge pull request #208 from reportportal/develop
Browse files Browse the repository at this point in the history
Release 5.4.0
  • Loading branch information
AmsterGet authored Sep 23, 2024
2 parents 6ee9234 + 3e452c8 commit 7961a32
Show file tree
Hide file tree
Showing 17 changed files with 206 additions and 49 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/CI-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ on:
- README.md
- CHANGELOG.md
pull_request:
paths-ignore:
- README.md
- CHANGELOG.md

jobs:
test:
Expand All @@ -33,7 +36,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install of node dependencies
- name: Install dependencies
run: npm install
- name: Run lint
run: npm run lint
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install of node dependencies
- name: Install dependencies
run: npm install
- name: Run lint
run: npm run lint
Expand All @@ -45,7 +45,7 @@ jobs:
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- name: Install of node dependencies
- name: Install dependencies
run: npm install
- name: Publish to NPM
run: |
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@

### Changed
- **Breaking change** Drop support of Node.js 12. The version [5.3.5](https://github.com/reportportal/agent-js-cypress/releases/tag/v5.3.5) is the latest that supports it.
- The agent now supports reporting the time for launches, test items and logs with microsecond precision in the ISO string format.
For logs, microsecond precision is available on the UI from ReportPortal version 24.2.
- `@reportportal/client-javascript` bumped to version `5.3.0`.

## [5.3.5] - 2024-09-11
### Added
- `videoCompression` option. Allows compressing Cypress videos before uploading them to the ReportPortal. Check the readme for details. Thanks to [ashvinjaiswal](https://github.com/ashvinjaiswal).
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.3.5
5.3.6-SNAPSHOT
17 changes: 9 additions & 8 deletions lib/reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

const RPClient = require('@reportportal/client-javascript');
const clientHelpers = require('@reportportal/client-javascript/lib/helpers');

const { entityType, logLevels, testItemStatuses, cucumberKeywordMap } = require('./constants');
const {
Expand Down Expand Up @@ -91,7 +92,7 @@ class Reporter {
this.tempLaunchId,
Object.assign(
{
endTime: new Date().valueOf(),
endTime: clientHelpers.now(),
},
this.launchStatus && { status: this.launchStatus },
),
Expand Down Expand Up @@ -209,7 +210,7 @@ class Reporter {
{
message: `Video: '${title}' (${testFileName}.mp4)`,
level: logLevels.INFO,
time: new Date().valueOf(),
time: clientHelpers.now(),
},
file,
).promise;
Expand Down Expand Up @@ -245,7 +246,7 @@ class Reporter {
const sendFailedLogPromise = this.client.sendLog(tempTestId, {
message: test.err.stack,
level: logLevels.ERROR,
time: new Date().valueOf(),
time: clientHelpers.now(),
}).promise;
promiseErrorHandler(sendFailedLogPromise, 'Fail to save error log');
}
Expand Down Expand Up @@ -291,7 +292,7 @@ class Reporter {

const stepData = {
name: keyword ? `${keyword} ${stepName}` : stepName,
startTime: this.client.helpers.now(),
startTime: clientHelpers.now(),
type: entityType.STEP,
codeRef,
hasStats: false,
Expand Down Expand Up @@ -331,15 +332,15 @@ class Reporter {

if (testStepResult.status === testItemStatuses.FAILED) {
this.sendLog(step.tempId, {
time: this.client.helpers.now(),
time: clientHelpers.now(),
level: logLevels.ERROR,
message: testStepResult.message,
});
}

this.client.finishTestItem(step.tempId, {
status: testStepResult.status,
endTime: this.client.helpers.now(),
endTime: clientHelpers.now(),
});

this.cucumberSteps.delete(testStepId);
Expand Down Expand Up @@ -377,7 +378,7 @@ class Reporter {
this.sendLogOnFinishFailedItem(hook, tempId);
const finishHookPromise = this.client.finishTestItem(tempId, {
status: hook.status,
endTime: new Date().valueOf(),
endTime: clientHelpers.now(),
}).promise;
this.hooks.delete(hook.id);
promiseErrorHandler(finishHookPromise, 'Fail to finish hook');
Expand Down Expand Up @@ -418,7 +419,7 @@ class Reporter {
{
message,
level,
time: new Date().valueOf(),
time: clientHelpers.now(),
},
file,
).promise;
Expand Down
14 changes: 8 additions & 6 deletions lib/utils/objectCreators.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/

const path = require('path');
const clientHelpers = require('@reportportal/client-javascript/lib/helpers');

const pjson = require('../../package.json');
const { entityType, hookTypesMap, testItemStatuses } = require('../constants');
const { getCodeRef } = require('./common');
Expand Down Expand Up @@ -89,15 +91,15 @@ const getLaunchStartObject = (config) => {
rerun: config.reporterOptions.rerun,
rerunOf: config.reporterOptions.rerunOf,
mode: config.reporterOptions.mode,
startTime: new Date().valueOf(),
startTime: clientHelpers.now(),
id: config.reporterOptions.launchId,
};
};

const getSuiteStartInfo = (suite, testFileName) => ({
id: suite.id,
title: suite.title,
startTime: new Date().valueOf(),
startTime: clientHelpers.now(),
description: suite.description,
codeRef: getCodeRef(suite.titlePath(), testFileName),
parentId: !suite.root ? suite.parent.id : undefined,
Expand All @@ -113,7 +115,7 @@ const getSuiteEndInfo = (suite) => {
id: suite.id,
status: failed ? testItemStatuses.FAILED : undefined,
title: suite.title,
endTime: new Date().valueOf(),
endTime: clientHelpers.now(),
};
};

Expand Down Expand Up @@ -144,15 +146,15 @@ const getTestInfo = (test, testFileName, status, err) => ({
const getTestStartObject = (test) => ({
type: entityType.STEP,
name: test.title.slice(0, 255).toString(),
startTime: new Date().valueOf(),
startTime: clientHelpers.now(),
codeRef: test.codeRef,
attributes: [],
});

const getTestEndObject = (testInfo, skippedIssue) => {
const testEndObj = Object.assign(
{
endTime: new Date().valueOf(),
endTime: clientHelpers.now(),
status: testInfo.status,
attributes: testInfo.attributes,
description: testInfo.description,
Expand Down Expand Up @@ -190,7 +192,7 @@ const getHookStartObject = (hook) => {
const hookName = hook.title.replace(`"${hook.hookName}" hook:`, '').trim();
return {
name: hookName,
startTime: new Date().valueOf(),
startTime: clientHelpers.now(),
type: hookRPType,
codeRef: hook.codeRef,
};
Expand Down
43 changes: 36 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@reportportal/agent-js-cypress",
"version": "5.3.5",
"description": "This agent helps Cypress to communicate with Report Portal",
"description": "This agent helps Cypress to communicate with ReportPortal",
"main": "index.js",
"scripts": {
"lint": "eslint . --quiet",
Expand All @@ -14,7 +14,7 @@
"url": "https://github.com/reportportal/agent-js-cypress"
},
"dependencies": {
"@reportportal/client-javascript": "~5.1.4",
"@reportportal/client-javascript": "~5.3.0",
"glob": "^9.3.5",
"minimatch": "^3.1.2",
"mocha": "^10.2.0",
Expand All @@ -31,7 +31,7 @@
"/lib"
],
"engines": {
"node": ">=12.x"
"node": ">=14.x"
},
"license": "Apache-2.0",
"devDependencies": {
Expand Down
16 changes: 16 additions & 0 deletions test/mergeLaunches.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2024 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.
*/

const mergeLaunches = require('./../lib/mergeLaunches');
const mergeLaunchesUtils = require('./../lib/mergeLaunchesUtils');

Expand Down
16 changes: 16 additions & 0 deletions test/mergeLaunchesUtils.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2024 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.
*/

const fs = require('fs');
const mockFS = require('mock-fs');

Expand Down
22 changes: 17 additions & 5 deletions test/mock/mocks.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
const currentDate = new Date().valueOf();
/*
* Copyright 2024 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.
*/

const currentDate = '2024-09-23T12:20:59.392987Z';

class RPClient {
constructor(config) {
Expand Down Expand Up @@ -27,10 +43,6 @@ class RPClient {
this.sendLog = jest.fn().mockReturnValue({
promise: Promise.resolve('ok'),
});

this.helpers = {
now: jest.fn().mockReturnValue(currentDate),
};
}
}

Expand Down
Loading

0 comments on commit 7961a32

Please sign in to comment.