Skip to content

Commit

Permalink
EPMRPP-86929 || Add RP config option
Browse files Browse the repository at this point in the history
  • Loading branch information
Dzmitry Kosarau authored and Dzmitry Kosarau committed Nov 13, 2023
1 parent a5b8d88 commit 6b1c877
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### Added
- `ReportingApi` from `@reportportal/agent-js-playwright/promises` methods (***addAttributes, setDescription, setTestCaseId, setStatus***, and all methods for setting custom statuses for test or suite) now using ***testInfo.attach*** method to attach custom data to test case.
- `reportLastErrorLog` option to the RP config to have the ability to attach the last error log

## [5.1.4] - 2023-10-05
## Changed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ The full list of available options presented below.
| uploadVideo | Optional | true | Whether to attach the Playwright's [video](https://playwright.dev/docs/api/class-testoptions#test-options-video) to the test case. |
| uploadTrace | Optional | true | Whether to attach the Playwright's [trace](https://playwright.dev/docs/api/class-testoptions#test-options-trace) to the test case. |
| token | Deprecated | Not set | Use `apiKey` instead. |

| reportLastErrorLog | Optional | true | If set to `true` the last error log will be attached to the test case description and reported on the `error` log level |
The following options can be overridden using ENVIRONMENT variables:

| Option | ENV variable |
Expand Down
1 change: 1 addition & 0 deletions src/__tests__/mocks/configMock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ export const mockConfig: ReportPortalConfig = {
launch: 'LaunchName',
description: 'Launch description',
attributes: [],
reportLastErrorLog: true,
};
1 change: 1 addition & 0 deletions src/models/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export interface ReportPortalConfig extends ClientConfig, AttachmentsConfig {
rerun?: boolean;
rerunOf?: string;
mode?: LAUNCH_MODES;
reportLastErrorLog?: boolean;

skippedIssue?: boolean;
includeTestSteps?: boolean;
Expand Down
3 changes: 2 additions & 1 deletion src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export class RPReporter implements Reporter {
this.config = {
uploadTrace: true,
uploadVideo: true,
reportLastErrorLog: true,
...config,
launchId: process.env.RP_LAUNCH_ID || config.launchId,
};
Expand Down Expand Up @@ -487,7 +488,7 @@ export class RPReporter implements Reporter {
});
}

if (result.error) {
if (result.error && this.config.reportLastErrorLog) {
const stacktrace = stripAnsi(result.error.stack || result.error.message);
this.sendLog(testItemId, {
level: LOG_LEVELS.ERROR,
Expand Down

0 comments on commit 6b1c877

Please sign in to comment.