diff --git a/.github/workflows/CI-pipeline.yml b/.github/workflows/CI-pipeline.yml index a979f2c..b6fea47 100644 --- a/.github/workflows/CI-pipeline.yml +++ b/.github/workflows/CI-pipeline.yml @@ -1,4 +1,4 @@ -# Copyright 2021 EPAM Systems +# 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 @@ -28,9 +28,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18 - name: Install of node dependencies diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 67cf1e5..c0edc27 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,4 +1,4 @@ -# Copyright 2021 EPAM Systems +# 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 @@ -22,9 +22,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18 - name: Install of node dependencies @@ -41,9 +41,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18 registry-url: 'https://registry.npmjs.org' @@ -59,7 +59,7 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18 registry-url: 'https://npm.pkg.github.com' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f3e1e55..e126ab9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -# Copyright 2021 EPAM Systems +# 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 @@ -33,7 +33,7 @@ jobs: releaseVersion: ${{ steps.exposeVersion.outputs.releaseVersion }} steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Read version id: readVersion run: | @@ -78,9 +78,9 @@ jobs: versionInfo: ${{ steps.readChangelogEntry.outputs.log_entry }} steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup NodeJS - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: '12' - name: Configure git @@ -139,7 +139,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Create Release id: createRelease uses: actions/create-release@v1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 4adc5bb..e1158cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### Changed +- `@reportportal/client-javascript` bumped to version `5.1.4`. +### Security +- Updated versions of vulnerable packages (braces, ws). ## [5.1.0] - 2024-02-06 ### Added diff --git a/README.md b/README.md index cdc5bf2..6c26d73 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,8 @@ Create `wdio.conf.js` [Testrunner Configuration](https://webdriver.io/docs/confi const { Reporter } = require('@reportportal/agent-js-webdriverio'); const config = { - token: '00000000-0000-0000-0000-00000000000', - endpoint: 'http://your.reportportal.server:8080/api/v1', + apiKey: '00000000-0000-0000-0000-00000000000', + endpoint: 'http://your.reportportal.server:8080/api/v2', project: 'YourReportPortalProjectName', launch: 'YourLauncherName', description: 'Static launch description', @@ -43,29 +43,29 @@ exports.config = { 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. | -| 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`. | -| isLaunchMergeRequired | Optional | false | Allows to merge several run's into one launch at the end of the run. Needs additional setup. See [Manual merge launches](#manual-merge-launches). | -| attachPicturesToLogs | Optional | false | Automatically add screenshots. | -| cucumberNestedSteps | Optional | false | [Report your steps as logs](https://github.com/reportportal/agent-js-webdriverio#step-reporting-configuration). | -| reportSeleniumCommands | Optional | false | Add selenium logs to each test case. | -| seleniumCommandsLogLevel | Optional | 'info' | If set *reportSeleniumCommands* to *true*, you need to provide log level witch can be one of: *'trace', 'debug', 'info', 'warn', 'error', 'fatal'*. | -| 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/v2'. | +| 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. If this option used, launch related options (eg. description, attributes, rerun, rerunOf, mode) will not take any effect as they are used within launch start. | +| restClientConfig | Optional | Not set | `axios` like http client [config](https://github.com/axios/axios#request-config). May contain `agent` property for configure [http(s)](https://nodejs.org/api/https.html#https_https_request_url_options_callback) client, and other client options eg. `proxy`, [`timeout`](https://github.com/reportportal/client-javascript#timeout-30000ms-on-axios-requests). For debugging and displaying logs the `debug: true` option can be used.
Visit [client-javascript](https://github.com/reportportal/client-javascript) for more details. | +| launchUuidPrint | Optional | false | Whether to print the current launch UUID. | +| launchUuidPrintOutput | Optional | 'STDOUT' | Launch UUID printing output. Possible values: 'STDOUT', 'STDERR', 'FILE', 'ENVIRONMENT'. Works only if `launchUuidPrint` set to `true`. File format: `rp-launch-uuid-${launch_uuid}.tmp`. Env variable: `RP_LAUNCH_UUID`. | +| isLaunchMergeRequired | Optional | false | Allows to merge several run's into one launch at the end of the run. Needs additional setup. See [Manual merge launches](#manual-merge-launches). | +| attachPicturesToLogs | Optional | false | Automatically attach screenshots taken during test execution. See [Screenshots](#screenshots) for more details. | +| cucumberNestedSteps | Optional | false | [Report Cucumber steps as logs](#cucumber-scenario-based-reporting). | +| reportSeleniumCommands | Optional | false | Add selenium logs to each test case. | +| seleniumCommandsLogLevel | Optional | 'info' | If set `reportSeleniumCommands` to `true`, you need to provide log level witch can be one of: *'trace', 'debug', 'info', 'warn', 'error', 'fatal'*. | +| token | Deprecated | Not set | Use `apiKey` instead. | The following options can be overridden using ENVIRONMENT variables: @@ -73,7 +73,14 @@ The following options can be overridden using ENVIRONMENT variables: |-------------|-----------------| | launchId | RP_LAUNCH_ID | -## Step reporting configuration (for Cucumber setup) +After completing the above configuration, you will be able to see a basic report of test results in ReportPortal. +To make the report more informative and utilize all features of ReportPortal, the agent provides additional features described below. + +You can also refer the [example-webdriverio](https://github.com/reportportal/examples-js/tree/main/example-webdriverio) example to see how to use the agent with WebdriverIO in action. + +## Structure of reports + +### Cucumber scenario-based reporting By default, this agent reports the following structure: @@ -87,13 +94,52 @@ You may change this behavior to report steps to the log level by enabling scenar - scenario - STEP - step - log item (nested step) -To report your steps as logs, you need to pass an additional parameter to the agent config: `"cucumberNestedSteps": true` +To report scenarios as test cases and steps as logs, you need to pass an additional parameter to the agent config: `cucumberNestedSteps: true`. -## Reporting +## Screenshots -This reporter provides Reporting API to use it directly in tests to send some additional data to the report. +To attach screenshots to the test, the option `attachPicturesToLogs` need to be enabled in the agent config. + +Then, in case the screenshot is taken within the test execution, it will be attached to the test result in ReportPortal automatically. + +### Jasmine/Mocha + +Examples: +```javascript +describe('suite name', () => { + it('Test should be FAILED', async () => { + await browser.url('https://webdriver.io'); + const title = await browser.getTitle(); + await browser.saveScreenshot('./screenshots/screenshot.png'); + + expect(title).toBe('WebdriverIO'); + }); +}); +``` + +### Cucumber + +```javascript +Given('I do something awesome', async () => { + await browser.takeScreenshot(); + assert.strictEqual(this.value, expectedValue); +}); +``` + +It is also may be useful to take the screenshot on test failure in the `afterStep` function for Cucumber in `wdio.conf.js` file: +```javascript +afterStep: async function(step, scenario, { error, result, duration, passed }, context) { + if (!passed) { + await browser.takeScreenshot(); + } +} +``` + +Another way to add any files to the test (not only screenshots) is to use the [ReportingAPI.log() method](#log). + +## Reporting API -## Using `ReportingApi`: +This reporter provides Reporting API to use it directly in tests to send some additional data to the report. To start using the `ReportingApi` in tests, just import it from `'@reportportal/agent-js-webdriverio'`: ```javascript @@ -103,7 +149,7 @@ const { ReportingApi } = require('@reportportal/agent-js-webdriverio'); `ReportingApi.addAttributes(attributes: Array, suite?: string);` **required**: `attributes` -```ts +```typescript interface Attribute { key?: string; value: string; @@ -112,7 +158,7 @@ interface Attribute { Examples: ```javascript -// Jasmine +// Jasmine/Mocha describe('suite name', () => { ReportingApi.addAttributes([ { @@ -160,7 +206,7 @@ Given('I do something awesome', () => { //... }); ``` -> **Note:** Agent is not supported adding attributes to the `scenario`. +> **Note:** The agent does not support adding attributes to the `scenario`. ### setDescription `ReportingApi.setDescription(description: string, suite?: string);` @@ -168,7 +214,7 @@ Given('I do something awesome', () => { Examples: ```javascript -// Jasmine +// Jasmine/Mocha describe('suite name', () => { ReportingApi.setDescription('suite description', 'suite name'); // the second parameter must match the name of the suite it('test with attributes', () => { @@ -200,7 +246,7 @@ Given('I do something awesome', () => { Examples: ```javascript -// Jasmine +// Jasmine/Mocha describe('suite name', () => { ReportingApi.setTestCaseId('suiteTestCaseId', 'suite name'); // the second parameter must match the name of the suite it('some test', () => { @@ -227,7 +273,7 @@ where `status` must be one of the following: *passed*, *failed*, *stopped*, *ski Examples: ```javascript -// Jasmine +// Jasmine/Mocha describe('should have status FAILED', () => { ReportingApi.setStatus('failed', 'should have status FAILED'); // the second parameter must match the name of the suite it('test with INFO status', () => { @@ -259,7 +305,7 @@ Assign corresponding status to the current test item or suite. Examples: ```javascript -// Jasmine +// Jasmine/Mocha describe('manual statuses assigning', () => { ReportingApi.setStatusInfo('manual statuses assigning'); // string must match the name of the suite it('should call ReportingApi to set statuses', () => { @@ -286,7 +332,7 @@ where `status` must be one of the following: *passed*, *failed*, *stopped*, *ski Examples: ```javascript -// Jasmine +// Jasmine/Mocha it('launch should have status FAILED', () => { ReportingApi.setLaunchStatus('failed'); // ... @@ -313,7 +359,7 @@ Assign corresponding status to the current launch. Examples: ```javascript -// Jasmine +// Jasmine/Mocha it('should call ReportingApi to set launch statuses', () => { ReportingApi.setLaunchStatusInfo(); }); @@ -327,14 +373,15 @@ Given('I do something awesome', () => { ``` ### log -Send logs to report portal for the current test. + +Send logs to the ReportPortal for the current test. `ReportingApi.log(level: LOG_LEVELS, message: string, file?: Attachmentm, suite?: string);` **required**: `level`, `message` where `level` can be one of the following: *TRACE*, *DEBUG*, *WARN*, *INFO*, *ERROR*, *FATAL* Examples: ```javascript -// Jasmine +// Jasmine/Mocha it('should contain logs with attachments', () => { const fileName = 'test.jpg'; const fileContent = fs.readFileSync(path.resolve(__dirname, './attachments', fileName)); @@ -348,8 +395,23 @@ it('should contain logs with attachments', () => { }); ``` +```javascript +// Cucumber +Given('I do something awesome', () => { + const fileName = 'test.jpg'; + const fileContent = fs.readFileSync(path.resolve(__dirname, './attachments', fileName)); + const attachment = { + name: fileName, + type: 'image/jpg', + content: fileContent.toString('base64'), + }; + ReportingApi.log('INFO', 'info log with attachment', attachment); + //... +}); +``` + ##### info, debug, warn, error, trace, fatal -Send logs with corresponding level to report portal for the current suite/test. Should be called inside corresponding suite/test. +Send logs with corresponding level to the ReportPortal for the current suite/test. Should be called inside corresponding suite/test. `ReportingApi.info(message: string, file?: Attachment, suite?: string);` `ReportingApi.debug(message: string, file?: Attachment, suite?: string);` `ReportingApi.warn(message: string, file?: Attachment, suite?: string);` @@ -360,7 +422,7 @@ Send logs with corresponding level to report portal for the current suite/test. Examples: ```javascript -// Jasmine +// Jasmine/Mocha describe('should containe suite log', () => { ReportingApi.info('Log message', null, 'should containe suite log'); // last parameter must match the name of the suite it('should contain logs with different levels', () => { @@ -374,18 +436,33 @@ describe('should containe suite log', () => { }); }); ``` + > **Note:** Pay attention if you want to provide log to the `suite` you should pass describe name as a last parameter. +```javascript +// Cucumber +Given('I do something awesome', () => { + ReportingApi.info('Log message'); + ReportingApi.debug('Log message'); + ReportingApi.warn('Log message'); + ReportingApi.error('Log message'); + ReportingApi.trace('Log message'); + ReportingApi.fatal('Log message'); + //... +}); +``` + ### launchLog -Send logs to report portal for the current launch. Should be called inside the any test. + +Send logs to the ReportPortal for the current launch. Should be called inside the any test. `ReportingApi.launchLog(level: LOG_LEVELS, message: string, file?: Attachment);` **required**: `level`, `message` where `level` can be one of the following: *TRACE*, *DEBUG*, *WARN*, *INFO*, *ERROR*, *FATAL* Examples: ```javascript -// Jasmine -it('should contain logs with attachments', async (page) => { +// Jasmine/Mocha +it('should send log with attachment to launch', async (page) => { const fileName = 'test.jpg'; const fileContent = fs.readFileSync(path.resolve(__dirname, './attachments', fileName)); const attachment = { @@ -393,12 +470,29 @@ it('should contain logs with attachments', async (page) => { type: 'image/jpg', content: fileContent.toString('base64'), }; - ReportingApi.launchLog('INFO', 'info log with attachment', attachment); // this log attaching to the laucnh + ReportingApi.launchLog('INFO', 'info log with attachment', attachment); // attaching log to the launch // ... }); ``` + +```javascript +// Cucumber +Given('I do something awesome', () => { + const fileName = 'test.jpg'; + const fileContent = fs.readFileSync(path.resolve(__dirname, './attachments', fileName)); + const attachment = { + name: fileName, + type: 'image/jpg', + content: fileContent.toString('base64'), + }; + ReportingApi.launchLog('INFO', 'info log with attachment', attachment); // attaching log to the launch + //... +}); +``` + ##### launchInfo, launchDebug, launchWarn, launchError, launchTrace, launchFatal -Send logs with corresponding level to report portal for the current launch. Should be called inside the any test. + +Send logs with corresponding level to the ReportPortal for the current launch. Should be called inside the any test. `ReportingApi.launchInfo(message: string, file?: Attachment);` `ReportingApi.launchDebug(message: string, file?: Attachment);` `ReportingApi.launchWarn(message: string, file?: Attachment);` @@ -409,18 +503,31 @@ Send logs with corresponding level to report portal for the current launch. Shou Examples: ```javascript -// Jasmine +// Jasmine/Mocha it('launch should contain logs with with different levels', () => { + ReportingApi.launchInfo('Log message'); + ReportingApi.launchDebug('Log message'); + ReportingApi.launchWarn('Log message'); + ReportingApi.launchError('Log message'); + ReportingApi.launchTrace('Log message'); + ReportingApi.launchFatal('Log message'); + // ... +}); +``` +> **Note:** Pay attention if you want to provide log to the `launch` you should call ReportingApi methods inside test/it blocks. + +```javascript +// Cucumber +Given('I do something awesome', () => { ReportingApi.launchInfo('Log message'); ReportingApi.launchDebug('Log message'); ReportingApi.launchWarn('Log message'); ReportingApi.launchError('Log message'); ReportingApi.launchTrace('Log message'); ReportingApi.launchFatal('Log message'); - // ... + //... }); ``` -> **Note:** Pay attention if you want to provide log to the `launch` you should call ReportingApi methods inside test/it blocks. #### Integration with Sauce Labs diff --git a/VERSION b/VERSION index 831446c..99a2954 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5.1.0 +5.1.1-SNAPSHOT diff --git a/package-lock.json b/package-lock.json index f31bb48..dce4ae4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,10 +6,10 @@ "packages": { "": { "name": "@reportportal/agent-js-webdriverio", - "version": "5.0.3", + "version": "5.1.0", "license": "Apache-2.0", "dependencies": { - "@reportportal/client-javascript": "^5.1.1", + "@reportportal/client-javascript": "~5.1.4", "@wdio/reporter": "^7.31.1", "json-stringify-safe": "^5.0.1" }, @@ -1306,13 +1306,13 @@ } }, "node_modules/@reportportal/client-javascript": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/@reportportal/client-javascript/-/client-javascript-5.1.1.tgz", - "integrity": "sha512-GgWRODR4twqFkBMSDhsck4JZVeIJPRLMuNjbypnCJXbvZ8JYMJoMk30Mw5M9QGByAFFrpZZ7Ih9pXCsccxscSA==", + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/@reportportal/client-javascript/-/client-javascript-5.1.4.tgz", + "integrity": "sha512-Pk00dSYX8TANmEkg2CN06PxoSW1f83d1mew1M0kw5pDZOif+1cYrjy1E4HNrdLBoYhAH6oQIISvJSKc7K6A8fg==", "dependencies": { - "axios": "^1.6.5", - "axios-retry": "^4.0.0", - "glob": "^7.2.3", + "axios": "^1.6.8", + "axios-retry": "^4.1.0", + "glob": "^8.1.0", "ini": "^2.0.0", "uniqid": "^5.4.0", "uuid": "^9.0.1" @@ -1321,6 +1321,43 @@ "node": ">=12.x" } }, + "node_modules/@reportportal/client-javascript/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@reportportal/client-javascript/node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@reportportal/client-javascript/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@sindresorhus/is": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", @@ -2087,19 +2124,19 @@ } }, "node_modules/axios": { - "version": "1.6.7", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.7.tgz", - "integrity": "sha512-/hDJGff6/c7u0hDkvkGxR/oy6CbCs8ziCsC7SqmhjfozqiJGc8Z11wrv9z9lYfY4K8l+H9TpjcMDX0xOZmx+RA==", + "version": "1.6.8", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz", + "integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==", "dependencies": { - "follow-redirects": "^1.15.4", + "follow-redirects": "^1.15.6", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" } }, "node_modules/axios-retry": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/axios-retry/-/axios-retry-4.0.0.tgz", - "integrity": "sha512-F6P4HVGITD/v4z9Lw2mIA24IabTajvpDZmKa6zq/gGwn57wN5j1P3uWrAV0+diqnW6kTM2fTqmWNfgYWGmMuiA==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/axios-retry/-/axios-retry-4.1.0.tgz", + "integrity": "sha512-svdth4H00yhlsjBbjfLQ/sMLkXqeLxhiFC1nE1JtkN/CIssGxqk0UwTEdrVjwA2gr3yJkAulwvDSIm4z4HyPvg==", "dependencies": { "is-retry-allowed": "^2.2.0" }, @@ -2208,18 +2245,19 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -2495,7 +2533,8 @@ "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true }, "node_modules/confusing-browser-globals": { "version": "1.0.11", @@ -3576,9 +3615,9 @@ } }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, "dependencies": { "to-regex-range": "^5.0.1" @@ -3621,9 +3660,9 @@ "dev": true }, "node_modules/follow-redirects": { - "version": "1.15.5", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", - "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==", + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", "funding": [ { "type": "individual", @@ -3811,6 +3850,7 @@ "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -5594,6 +5634,7 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -5900,6 +5941,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -7414,9 +7456,9 @@ } }, "node_modules/ws": { - "version": "7.5.9", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", - "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", "dev": true, "engines": { "node": ">=8.3.0" diff --git a/package.json b/package.json index 8fb69e5..9f3d237 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "test:coverage": "jest --coverage" }, "dependencies": { - "@reportportal/client-javascript": "^5.1.1", + "@reportportal/client-javascript": "~5.1.4", "@wdio/reporter": "^7.31.1", "json-stringify-safe": "^5.0.1" }, diff --git a/src/reporter.ts b/src/reporter.ts index 96d092f..9cf7239 100644 --- a/src/reporter.ts +++ b/src/reporter.ts @@ -57,13 +57,14 @@ export class Reporter extends WDIOReporter { constructor(options: Partial) { super(options); - - const agentInfo = getAgentInfo(); - const clientConfig = getClientConfig(options); this.options = { seleniumCommandsLogLevel: 'info', + launchId: process.env.RP_LAUNCH_ID || options.launchId, ...options, }; + const agentInfo = getAgentInfo(); + const clientConfig = getClientConfig(this.options); + this.syncReporting = false; this.client = new RPClient(clientConfig, agentInfo); this.storage = new Storage(); @@ -240,11 +241,13 @@ export class Reporter extends WDIOReporter { async onRunnerEnd(): Promise { try { await this.client.getPromiseFinishAllItems(this.tempLaunchId); - const { promise } = await this.client.finishLaunch(this.tempLaunchId, { - ...(this.customLaunchStatus && { status: this.customLaunchStatus }), - }); - promiseErrorHandler(promise); - await promise; + if (!this.options.launchId) { + const { promise } = await this.client.finishLaunch(this.tempLaunchId, { + ...(this.customLaunchStatus && { status: this.customLaunchStatus }), + }); + promiseErrorHandler(promise); + await promise; + } this.tempLaunchId = null; this.customLaunchStatus = null; } catch (e) { @@ -358,7 +361,9 @@ export class Reporter extends WDIOReporter { } sendLaunchLog(log: LogRQ): void { - this.sendLog(this.tempLaunchId, log); + if (this.tempLaunchId) { + this.sendLog(this.tempLaunchId, log); + } } sendLog(tempId: string, { level, message = '', file }: LogRQ): void { diff --git a/version_fragment b/version_fragment index acb503f..9eb7b90 100644 --- a/version_fragment +++ b/version_fragment @@ -1 +1 @@ -minor +patch