Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 5.3.2 #197

Merged
merged 6 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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