Skip to content

Commit

Permalink
Merge pull request #197 from reportportal/develop
Browse files Browse the repository at this point in the history
Release 5.3.2
  • Loading branch information
AmsterGet authored Jul 1, 2024
2 parents c69ca08 + bd5eea5 commit c6ade1a
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 45 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
### Fixed
- Launch finishing for tests annotated with '.skip'.

## [5.3.1] - 2024-06-24
### Fixed
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ const registerReportPortalPlugin = require('@reportportal/agent-js-cypress/lib/p
module.exports = defineConfig({
reporter: '@reportportal/agent-js-cypress',
reporterOptions: {
endpoint: 'http://your-instance.com:8080/api/v1',
apiKey: 'reportportalApiKey',
launch: 'LAUNCH_NAME',
project: 'PROJECT_NAME',
description: 'LAUNCH_DESCRIPTION',
apiKey: '<API_KEY>',
endpoint: 'https://your.reportportal.server/api/v1',
project: 'Your reportportal project name',
launch: 'Your launch name',
description: 'Your launch description',
attributes: [
{
key: 'attributeKey',
Expand Down Expand Up @@ -76,11 +76,11 @@ Add the following options to cypress.json
{
"reporter": "@reportportal/agent-js-cypress",
"reporterOptions": {
"endpoint": "http://your-instance.com:8080/api/v1",
"apiKey": "reportportalApiKey",
"launch": "LAUNCH_NAME",
"project": "PROJECT_NAME",
"description": "LAUNCH_DESCRIPTION",
"apiKey": "<API_KEY>",
"endpoint": "https://your.reportportal.server/api/v1",
"project": "Your reportportal project name",
"launch": "Your launch name",
"description": "Your launch description",
"attributes": [
{
"key": "attributeKey",
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.3.1
5.3.2-SNAPSHOT
11 changes: 7 additions & 4 deletions lib/reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ class Reporter {
this.currentTestTempInfo = null;
this.suitesStackTempInfo = [];
this.suiteTestCaseIds = new Map();
// TODO: use a single Map for test info
this.pendingTestsIds = [];
// TODO: use a single Map for suite info
this.suiteStatuses = new Map();
this.cucumberSteps = new Map();
}
Expand Down Expand Up @@ -150,6 +152,7 @@ class Reporter {
};
if (this.pendingTestsIds.includes(test.id)) {
this.testEnd(test);
this.pendingTestsIds = this.pendingTestsIds.filter((id) => id !== test.id);
}
}

Expand All @@ -165,10 +168,9 @@ class Reporter {
}

testEnd(test) {
let testId = this.testItemIds.get(test.id);
const testId = this.testItemIds.get(test.id);
if (!testId) {
this.testStart(test);
testId = this.testItemIds.get(test.id);
return;
}
this.sendLogOnFinishFailedItem(test, testId);
this.finishFailedStep(test);
Expand All @@ -180,12 +182,13 @@ class Reporter {
promiseErrorHandler(finishTestItemPromise, 'Fail to finish test');
this.resetCurrentTestFinishParams();
this.currentTestTempInfo = null;
this.testItemIds.delete(test.id);
}

testPending(test) {
// if test has not been started, save test.id to finish in testStart().
// if testStarted() has been called, call testEnd() directly.
if (this.testItemIds.get(test.id) != null) {
if (this.testItemIds.get(test.id)) {
this.testEnd(test);
} else {
this.pendingTestsIds.push(test.id);
Expand Down
1 change: 1 addition & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ const getSuiteEndObject = (suite) => ({
endTime: new Date().valueOf(),
});

// TODO: update/split to not return the redundant and confusing data for items start
const getTestInfo = (test, testFileName, status, err) => ({
id: test.id,
status: status || (test.state === 'pending' ? testItemStatuses.SKIPPED : test.state),
Expand Down
27 changes: 13 additions & 14 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"license": "Apache-2.0",
"devDependencies": {
"@types/jest": "^29.5.3",
"cypress": "^12.17.1",
"cypress": "^13.12.0",
"eslint": "^8.45.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.8.0",
Expand Down
15 changes: 0 additions & 15 deletions test/reporter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,21 +297,6 @@ describe('reporter script', () => {
expect(spyFinishTestItem).toHaveBeenCalledWith('tempTestItemId', expectedTestFinishObj);
});

it('end not started test: should call testStart', function () {
const spyTestStart = jest.spyOn(reporter, 'testStart');
const testInfoObject = {
id: 'testId',
title: 'test name',
status: 'failed',
parentId: 'suiteId',
err: 'error message',
};

reporter.testEnd(testInfoObject);

expect(spyTestStart).toHaveBeenCalled();
});

it('end failed test: should call sendLog on test fail', function () {
const spySendLogOnFinishFailedItem = jest.spyOn(reporter, 'sendLogOnFinishFailedItem');
const testInfoObject = {
Expand Down

0 comments on commit c6ade1a

Please sign in to comment.