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

EPMRPP-86929 || Add RP config option #128

Merged
merged 2 commits into from
Nov 14, 2023
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
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.
- `extendTestDescriptionWithLastError` 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. |

| extendTestDescriptionWithLastError | 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: [],
extendTestDescriptionWithLastError: 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;
extendTestDescriptionWithLastError?: 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,
extendTestDescriptionWithLastError: 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.extendTestDescriptionWithLastError) {
const stacktrace = stripAnsi(result.error.stack || result.error.message);
this.sendLog(testItemId, {
level: LOG_LEVELS.ERROR,
Expand Down