-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat]: Allure reports in integration tests PoC (#190)
* [feat]: Allure reports in integration tests PoC Signed-off-by: Dmitry Balashov <[email protected]> * [fix]: lint, format, type errors Signed-off-by: Dmitry Balashov <[email protected]> * [docs]: extend docs Signed-off-by: Dmitry Balashov <[email protected]> * [docs]: typos Signed-off-by: Dmitry Balashov <[email protected]> --------- Signed-off-by: Dmitry Balashov <[email protected]>
- Loading branch information
Showing
23 changed files
with
898 additions
and
607 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ module.exports = { | |
}, | ||
globals: { | ||
BigInt: true, | ||
globalThis: true | ||
}, | ||
overrides: [ | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
allure-results |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
allure-results |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Client Node Integration Tests | ||
|
||
This project is a collection of integration tests running from Node.js with actual Iroha peer. | ||
|
||
## SDK Compatibility Matrix | ||
|
||
Tests for [compatibility matrix](https://hyperledger.github.io/iroha-2-docs/reference/compatibility-matrix.html) | ||
are defined at [`compatibility.spec.ts`](./test/compatibility.spec.ts). | ||
|
||
The easiest way to run tests: | ||
|
||
```shell | ||
# run these commands anywhere in the repo | ||
|
||
# install packages, once | ||
pnpm i | ||
|
||
# prepare artifacts for tests, once | ||
pnpm jake test:prepare-client-integration | ||
|
||
# run tests | ||
pnpm --filter client-test-node test | ||
``` | ||
|
||
Allure reports are stored after tests run at `./allure-results` directory. | ||
**Note:** these reports contain _all_ tests, not only compatibility tests results. | ||
So, be sure to filter the results by their metadata before submitting them to TestOps. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
packages/client/test/integration/test-node/test/compatibility.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/** | ||
* This file is for Compatibility Matrix tests, which assigns specific | ||
* Allure context tags. | ||
*/ | ||
|
||
import * as allure from 'allure-vitest' | ||
import { pipe } from 'fp-ts/function' | ||
import { describe, expect, test } from 'vitest' | ||
import { clientFactory, setupPeerTestsLifecycle } from './util' | ||
import { datamodel, sugar } from '@iroha2/data-model' | ||
|
||
setupPeerTestsLifecycle() | ||
|
||
// TODO: consider adding shared context for tests? | ||
// beforeEach(() => { ... }) | ||
|
||
// Read Allure API: https://allurereport.org/docs/vitest-reference/ | ||
describe('Compatibility Matrix tests', () => { | ||
// Based on https://github.com/AlexStroke/iroha-java/blob/007a9ac55991cd8a2b519e62a10144156d9f8301/modules/client/src/test/kotlin/jp/co/soramitsu/iroha2/InstructionsTest.kt#L134 | ||
test('register domain', async (ctx) => { | ||
await allure.feature(ctx, 'Domains') | ||
await allure.story(ctx, 'Account registers a domain') | ||
// TODO: add more Allure context | ||
|
||
const DOMAIN_NAME = 'new_domain_name' | ||
|
||
const { pre, client, getBlocksListener } = clientFactory() | ||
const blocks = await getBlocksListener() | ||
|
||
await blocks.wait(async () => { | ||
await client.submitExecutable( | ||
pre, | ||
pipe(sugar.identifiable.newDomain(DOMAIN_NAME), sugar.instruction.register, sugar.executable.instructions), | ||
) | ||
}) | ||
|
||
const result = ( | ||
await client.requestWithQueryBox( | ||
pre, | ||
datamodel.QueryBox( | ||
'FindDomainById', | ||
datamodel.FindDomainById({ | ||
id: datamodel.Expression( | ||
'Raw', | ||
datamodel.Value('Id', datamodel.IdBox('DomainId', sugar.domainId(DOMAIN_NAME))), | ||
), | ||
}), | ||
), | ||
) | ||
) | ||
.as('Ok') | ||
.batch.enum.as('Identifiable') | ||
.enum.as('Domain') | ||
|
||
expect(result.id.name).toEqual(DOMAIN_NAME) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.