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

feature: support author field #686

Merged
merged 1 commit into from
Sep 18, 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
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 31 additions & 21 deletions qase-javascript-commons/changelog.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# [email protected]

## What's new

Support `author` field in the test result data.
You can specify author name or email in fields.

# [email protected]

## What's new

Reporters will send all data on the results of the autotests. Including the data of the title, the description, etc.


# [email protected]

## What's new
Expand All @@ -21,8 +27,10 @@ Minor release of the commons package

## What's new

- update a `InternalReporterInterface`. Added a new methods `sendResults` and `complete` to send the results and complete the test run.
- add `StateManager` class to manage and share the state of the reporter between the different instances of the reporter.
- update a `InternalReporterInterface`. Added a new methods `sendResults` and `complete` to send the results and
complete the test run.
- add `StateManager` class to manage and share the state of the reporter between the different instances of the
reporter.

# [email protected]

Expand All @@ -37,7 +45,6 @@ Minor release of the commons package

Support qaseio package version 2.2.0


# [email protected]

## What's new
Expand All @@ -60,7 +67,6 @@ Now the reporter will send the test results only once.
The Cypress calls the `publish` method multiple times for the same test results because of the Cypress architecture.
It calls the `publish` method for each test file.


# [email protected]

## What's new
Expand All @@ -82,13 +88,15 @@ This option is available in the config file and the `QASE_ROOT_SUITE` env variab

## What's new

Fixed an issue with creating a test run with environment when the reporter ignored the `environment` parameter in the configuration.
Fixed an issue with creating a test run with environment when the reporter ignored the `environment` parameter in the
configuration.

# [email protected]

## What's new

Fixed an issue with creating a defect for failed tests when the reporter ignored the `defect` parameter in the configuration.
Fixed an issue with creating a defect for failed tests when the reporter ignored the `defect` parameter in the
configuration.

# [email protected]

Expand Down Expand Up @@ -143,7 +151,7 @@ Before this fix, the reporter added ANSI escape codes to the message and stack t
## What's new

This is the first release version of the Qase JavaScript SDK.
It is numbered `2.0.0` (and not `1.0.0`) to match the release series of
It is numbered `2.0.0` (and not `1.0.0`) to match the release series of
test reporters for Playwright, Cypress, Jest, and other frameworks.

### Annotating test with field data
Expand All @@ -153,9 +161,9 @@ This feature is already implemented in the Playwright reporter:

```js
test('Test with annotated fields', () => {
qase.id(1);
qase.fields({ 'severity': 'high', 'priority': 'medium' })
// ...
qase.id(1);
qase.fields({ 'severity': 'high', 'priority': 'medium' })
// ...
});
```

Expand All @@ -182,7 +190,8 @@ It helps bring test results faster and enables acting on them long before the te
Qase JavaScript SDK brings configuration with config files and environment variables
to a common standard, used with Qase reporters in all languages and frameworks.

For details, see the [Configuration](https://github.com/qase-tms/qase-javascript/tree/main/qase-javascript-commons#configuration)
For details, see
the [Configuration](https://github.com/qase-tms/qase-javascript/tree/main/qase-javascript-commons#configuration)
section in the README.

### Latest API
Expand Down Expand Up @@ -221,17 +230,17 @@ Fixed an issue when the results published before the test run creation.

Improved debug logging for better testing and reporting errors.

- Separate `logger` class for use in reporters, supporting logging to console and files.
- Extra debug logs in both reporter modes: TestOps and Local.
- Separate `logger` class for use in reporters, supporting logging to console and files.
- Extra debug logs in both reporter modes: TestOps and Local.

Fixed an issue with duplicate test runs created when the testing framework
(such as Cypress) uses more than one instance of the Qase reporter.
Now reporter handles Qase test runs in the following way:

1. The first instance of the reporter creates a Qase test run and stores the run ID
in the ENV variable `QASE_TESTOPS_RUN_ID`.
2. Other instances of the reporter read this variable and report test results
to the existing test run.
1. The first instance of the reporter creates a Qase test run and stores the run ID
in the ENV variable `QASE_TESTOPS_RUN_ID`.
2. Other instances of the reporter read this variable and report test results
to the existing test run.

Nothing has changed in cases when there is a single instance of a reporter or
when it is using a test run, created with other tools, such as with an API request
Expand Down Expand Up @@ -303,7 +312,7 @@ This commit introduces a way to select the API version to use.
It enables using all new features of v2 JS reporters with the stable v1 API,
and elso experimenting with the new v2 API.

**Warning**: v2 API is still in beta.
**Warning**: v2 API is still in beta.
If you want to try the v2 JS reporters, you don't have to enable the new API.

To enable using API v2, set an environment variable before running the tests:
Expand All @@ -319,16 +328,17 @@ Such description can be collected from test's location and attributes
or explicitly declared in the test.

Add new data models:

- Relation
- Suite
- SuiteData


# [email protected]

## What's new

* Update the config of reporters. Added `captureLogs` field. If it is set to `true`, the reporter will capture logs from the test framework.
* Update the config of reporters. Added `captureLogs` field. If it is set to `true`, the reporter will capture logs from
the test framework.
* Added `getMimeType` function to the commons package. It returns the MIME type of the file by its extension.

# [email protected]
Expand Down
4 changes: 2 additions & 2 deletions qase-javascript-commons/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qase-javascript-commons",
"version": "2.2.0",
"version": "2.2.1",
"description": "Qase JS Reporters",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down Expand Up @@ -33,7 +33,7 @@
"lodash.merge": "^4.6.2",
"lodash.mergewith": "^4.6.2",
"mime-types": "^2.1.33",
"qaseio": "~2.3.0",
"qaseio": "~2.3.1",
"strip-ansi": "^6.0.1",
"uuid": "^9.0.0"
},
Expand Down
8 changes: 8 additions & 0 deletions qase-javascript-commons/src/reporters/testops-reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,14 @@ export class TestOpsReporter extends AbstractReporter {
resultCreate.case.layer = result.fields['layer'];
}

if (result.fields['author']) {
const resp = await this.api.authors.getAuthors(result.fields['author']);
if (resp.data.result?.entities && resp.data.result.entities.length > 0) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
resultCreate.author_id = resp.data.result.entities[0]?.author_id ?? null;
}
}

this.logger.logDebug(`Transformed result: ${JSON.stringify(resultCreate)}`);

return resultCreate;
Expand Down
Loading