From ae377cd4b21e8a6670220b2a4998f8f1775e0d03 Mon Sep 17 00:00:00 2001 From: Ilya Hancharyk Date: Fri, 20 Oct 2023 14:52:42 +0300 Subject: [PATCH 1/3] Add launchId option --- README.md | 40 ++++++++++++++++++++-------------------- lib/cypressReporter.js | 3 +++ lib/utils.js | 1 + 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 19a90d3..087e294 100644 --- a/README.md +++ b/README.md @@ -118,26 +118,26 @@ require('@reportportal/agent-js-cypress/lib/commands/reportPortalCommands'); The full list of available options presented below. -| Option | Necessity | Default | Description | -|------------------|------------|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| apiKey | Required | | User's reportportal token from which you want to send requests. It can be found on the profile page of this user. | -| endpoint | Required | | URL of your server. For example 'https://server:8080/api/v1'. | -| launch | Required | | Name of launch at creation. | -| project | Required | | The name of the project in which the launches will be created. | -| attributes | Optional | [] | Launch attributes. | -| description | Optional | '' | Launch description. | -| rerun | Optional | false | Enable [rerun](https://reportportal.io/docs/dev-guides/RerunDevelopersGuide) | -| rerunOf | Optional | Not set | UUID of launch you want to rerun. If not specified, reportportal will update the latest launch with the same name | -| mode | Optional | 'DEFAULT' | Results will be submitted to Launches page
*'DEBUG'* - Results will be submitted to Debug page. | -| skippedIssue | Optional | true | reportportal provides feature to mark skipped tests as not 'To Investigate'.
Option could be equal boolean values:
*true* - skipped tests considered as issues and will be marked as 'To Investigate' on reportportal.
*false* - skipped tests will not be marked as 'To Investigate' on application. | -| debug | Optional | false | This flag allows seeing the logs of the client-javascript. Useful for debugging. | -| launchId | Optional | Not set | The _ID_ of an already existing launch. The launch must be in 'IN_PROGRESS' status while the tests are running. Please note that if this _ID_ is provided, the launch will not be finished at the end of the run and must be finished separately. | -| restClientConfig | Optional | Not set | 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`](https://github.com/reportportal/client-javascript#timeout-30000ms-on-axios-requests).
Visit [client-javascript](https://github.com/reportportal/client-javascript) for more details. | -| autoMerge | Optional | false | Enable automatic report test items of all runned spec into one launch. You should install plugin or setup additional settings in reporterOptions. See [Automatically merge launch](#automatically-merge-launches). | -| reportHooks | Optional | false | Determines report before and after hooks or not. | -| isLaunchMergeRequired | Optional | false | Allows to merge Cypress run's into one launch at the end of the run. Needs additional setup. See [Manual merge launches](#manual-merge-launches). | -| parallel | Optional | false | Indicates to the reporter that spec files will be executed in parallel. Parameter could be equal boolean values. See [Parallel execution](#parallel-execution). | -| token | Deprecated | Not set | Use `apiKey` instead. | +| Option | Necessity | Default | Description | +|-----------------------|------------|-----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| apiKey | Required | | User's reportportal token from which you want to send requests. It can be found on the profile page of this user. | +| endpoint | Required | | URL of your server. For example 'https://server:8080/api/v1'. | +| launch | Required | | Name of launch at creation. | +| project | Required | | The name of the project in which the launches will be created. | +| attributes | Optional | [] | Launch attributes. | +| description | Optional | '' | Launch description. | +| rerun | Optional | false | Enable [rerun](https://reportportal.io/docs/dev-guides/RerunDevelopersGuide) | +| rerunOf | Optional | Not set | UUID of launch you want to rerun. If not specified, reportportal will update the latest launch with the same name | +| mode | Optional | 'DEFAULT' | Results will be submitted to Launches page
*'DEBUG'* - Results will be submitted to Debug page. | +| skippedIssue | Optional | true | reportportal provides feature to mark skipped tests as not 'To Investigate'.
Option could be equal boolean values:
*true* - skipped tests considered as issues and will be marked as 'To Investigate' on reportportal.
*false* - skipped tests will not be marked as 'To Investigate' on application. | +| debug | Optional | false | This flag allows seeing the logs of the client-javascript. Useful for debugging. | +| launchId | Optional | Not set | The _ID_ of an already existing launch. The launch must be in 'IN_PROGRESS' status while the tests are running. Please note that if this _ID_ is provided, the launch will not be finished at the end of the run and must be finished separately. | +| restClientConfig | Optional | Not set | 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`](https://github.com/reportportal/client-javascript#timeout-30000ms-on-axios-requests).
Visit [client-javascript](https://github.com/reportportal/client-javascript) for more details. | +| autoMerge | Optional | false | Enable automatic report test items of all runned spec into one launch. You should install plugin or setup additional settings in reporterOptions. See [Automatically merge launch](#automatically-merge-launches). | +| reportHooks | Optional | false | Determines report before and after hooks or not. | +| isLaunchMergeRequired | Optional | false | Allows to merge Cypress run's into one launch at the end of the run. Needs additional setup. See [Manual merge launches](#manual-merge-launches). | +| parallel | Optional | false | Indicates to the reporter that spec files will be executed in parallel. Parameter could be equal boolean values. See [Parallel execution](#parallel-execution). | +| token | Deprecated | Not set | Use `apiKey` instead. | ### Overwrite options from config file diff --git a/lib/cypressReporter.js b/lib/cypressReporter.js index 9a498d5..5431ff6 100644 --- a/lib/cypressReporter.js +++ b/lib/cypressReporter.js @@ -152,6 +152,9 @@ class CypressReporter extends Mocha.reporters.Base { }); this.runner.on(EVENT_RUN_END, () => { + if (CypressReporter.reporterOptions.launchId) { + return; + } CypressReporter.calcTotalLaunches(); if (CypressReporter.shouldStopLaunch()) { this.worker.send({ event: EVENT_RUN_END, launch: getLaunchStartObject(config) }); diff --git a/lib/utils.js b/lib/utils.js index 1958749..4a181ac 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -110,6 +110,7 @@ const getLaunchStartObject = (config) => { rerunOf: config.reporterOptions.rerunOf, mode: config.reporterOptions.mode, startTime: new Date().valueOf(), + id: config.reporterOptions.launchId, }; }; From 77cfe6f1f7122daefe612b7541632062494bc346 Mon Sep 17 00:00:00 2001 From: Ilya Hancharyk Date: Fri, 20 Oct 2023 14:56:46 +0300 Subject: [PATCH 2/3] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca75e41..bd86a95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +### Added +- `launchId` option to the config to attach run results to an existing launch. Related to parallel execution on one and several machines. ## [5.1.3] - 2023-07-18 ### Added From bbf100225191affd5aceda85c19fc95e7919dd5c Mon Sep 17 00:00:00 2001 From: Ilya Hancharyk Date: Fri, 20 Oct 2023 15:02:04 +0300 Subject: [PATCH 3/3] Bump client-javascript version --- CHANGELOG.md | 2 ++ README.md | 2 ++ package-lock.json | 10 +++++----- package.json | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd86a95..0a7cbfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ### Added - `launchId` option to the config to attach run results to an existing launch. Related to parallel execution on one and several machines. +### Changed +- `@reportportal/client-javascript` bumped to version `5.0.14`. `launchUuidPrint` and `launchUuidPrintOutput` configuration options introduced. ## [5.1.3] - 2023-07-18 ### Added diff --git a/README.md b/README.md index 087e294..ca7f969 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,8 @@ The full list of available options presented below. | skippedIssue | Optional | true | reportportal provides feature to mark skipped tests as not 'To Investigate'.
Option could be equal boolean values:
*true* - skipped tests considered as issues and will be marked as 'To Investigate' on reportportal.
*false* - skipped tests will not be marked as 'To Investigate' on application. | | debug | Optional | false | This flag allows seeing the logs of the client-javascript. Useful for debugging. | | launchId | Optional | Not set | The _ID_ of an already existing launch. The launch must be in 'IN_PROGRESS' status while the tests are running. Please note that if this _ID_ is provided, the launch will not be finished at the end of the run and must be finished separately. | +| launchUuidPrint | Optional | false | Whether to print the current launch UUID. | +| launchUuidPrintOutput | Optional | 'STDOUT' | Launch UUID printing output. Possible values: 'STDOUT', 'STDERR'. Works only if `launchUuidPrint` set to `true`. | | restClientConfig | Optional | Not set | 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`](https://github.com/reportportal/client-javascript#timeout-30000ms-on-axios-requests).
Visit [client-javascript](https://github.com/reportportal/client-javascript) for more details. | | autoMerge | Optional | false | Enable automatic report test items of all runned spec into one launch. You should install plugin or setup additional settings in reporterOptions. See [Automatically merge launch](#automatically-merge-launches). | | reportHooks | Optional | false | Determines report before and after hooks or not. | diff --git a/package-lock.json b/package-lock.json index f44e7dd..4445752 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,10 +6,10 @@ "packages": { "": { "name": "@reportportal/agent-js-cypress", - "version": "5.1.2", + "version": "5.1.3", "license": "Apache-2.0", "dependencies": { - "@reportportal/client-javascript": "^5.0.12", + "@reportportal/client-javascript": "^5.0.14", "glob": "^7.2.3", "minimatch": "^3.1.2", "mocha": "^10.2.0", @@ -1301,9 +1301,9 @@ } }, "node_modules/@reportportal/client-javascript": { - "version": "5.0.12", - "resolved": "https://registry.npmjs.org/@reportportal/client-javascript/-/client-javascript-5.0.12.tgz", - "integrity": "sha512-ECLvuDLV7KyKs0wG9Sis3ZqHOq9VMg3fywm1VDegd5HGDKC1hoXxFKfz6ngPY8FZ5O1nt1UJvgEs47shtPHQCg==", + "version": "5.0.14", + "resolved": "https://registry.npmjs.org/@reportportal/client-javascript/-/client-javascript-5.0.14.tgz", + "integrity": "sha512-4ge9ddOB1rFlzqI6j43qCw0cyjQOloiPChA1EFyF3dcV2BXHzGbh8S3SNhwxibvlQtV6piU8e0W9CLN4UWXvSA==", "dependencies": { "axios": "^0.27.2", "axios-retry": "^3.4.0", diff --git a/package.json b/package.json index 4079928..9ede7ca 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "url": "https://github.com/reportportal/agent-js-cypress" }, "dependencies": { - "@reportportal/client-javascript": "^5.0.12", + "@reportportal/client-javascript": "^5.0.14", "glob": "^7.2.3", "minimatch": "^3.1.2", "mocha": "^10.2.0",