Skip to content

Commit

Permalink
test: publish jest test results to reportportal (#352)
Browse files Browse the repository at this point in the history
* test: publish jest test results to reportportal

* test: use org variables + add RP attributes

* test: fix ci
  • Loading branch information
adeldhis2 authored Aug 14, 2023
1 parent 24661e2 commit 0668a62
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/dhis2-verify-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ jobs:

- name: Test
run: yarn d2-app-scripts test
env:
REPORTPORTAL_API_KEY: ${{ secrets.REPORTPORTAL_API_KEY }}
REPORTPORTAL_ENDPOINT: ${{ vars.REPORTPORTAL_ENDPOINT }}
REPORTPORTAL_PROJECT: ${{ vars.REPORTPORTAL_PROJECT }}

e2e:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -120,6 +124,8 @@ jobs:
CYPRESS_dhis2ApiVersion: 40
CYPRESS_networkMode: stub
REPORTPORTAL_API_KEY: ${{ secrets.REPORTPORTAL_API_KEY }}
REPORTPORTAL_ENDPOINT: ${{ vars.REPORTPORTAL_ENDPOINT }}
REPORTPORTAL_PROJECT: ${{ vars.REPORTPORTAL_PROJECT }}

release:
runs-on: ubuntu-latest
Expand Down
8 changes: 6 additions & 2 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ module.exports = defineConfig({
defaultCommandTimeout: 30000,
reporter: '@reportportal/agent-js-cypress',
reporterOptions: {
endpoint: 'https://test.tools.dhis2.org/reportportal/api/v1',
endpoint: process.env.REPORTPORTAL_ENDPOINT,
apiKey: process.env.REPORTPORTAL_API_KEY,
launch: 'aggregate_data_entry_app_master',
project: 'dhis2_auto',
project: process.env.REPORTPORTAL_PROJECT,
description: '',
autoMerge: true,
parallel: true,
Expand All @@ -42,6 +42,10 @@ module.exports = defineConfig({
key: 'app_name',
value: 'aggregate_data_entry_app',
},
{
key: 'test_level',
value: 'e2e',
},
],
},
e2e: {
Expand Down
29 changes: 29 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,33 @@ module.exports = {
moduleNameMapper: {
'\\.css$': 'identity-obj-proxy',
},
testRunner: 'jest-circus/runner',
reporters: [
'default',
[
'@reportportal/agent-js-jest',
{
apiKey: process.env.REPORTPORTAL_API_KEY,
endpoint: process.env.REPORTPORTAL_ENDPOINT,
project: process.env.REPORTPORTAL_PROJECT,
launch: 'aggregate_data_entry_app_master',
attributes: [
{
key: 'version',
value: 'master',
},
{
key: 'app_name',
value: 'aggregate_data_entry_app',
},
{
key: 'test_level',
value: 'unit/integration',
},
],
description: '',
debug: true,
},
],
],
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"@dhis2/cypress-commands": "^10.0.1",
"@dhis2/cypress-plugins": "^10.0.1",
"@reportportal/agent-js-cypress": "^5.1.3",
"@reportportal/agent-js-jest": "^5.0.6",
"@testing-library/jest-dom": "5.16.5",
"@testing-library/react": "12.1.5",
"@testing-library/react-hooks": "7.0.2",
Expand Down
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3363,6 +3363,14 @@
mocha "^10.2.0"
node-ipc "9.1.1"

"@reportportal/agent-js-jest@^5.0.6":
version "5.0.6"
resolved "https://registry.yarnpkg.com/@reportportal/agent-js-jest/-/agent-js-jest-5.0.6.tgz#336ed06c3c80d70bd8e50824bc3c883cb5d2548e"
integrity sha512-Gt2oOZ/k5HxZ2J3Hb6X43y6XZmvpldt3yM2wPdrU5CPhXb9hxdiZUl+e2MfI3y0aB+d6T/AkKcUyT7f91sZaYw==
dependencies:
"@reportportal/client-javascript" "^5.0.12"
strip-ansi "^6.0.1"

"@reportportal/client-javascript@^5.0.12":
version "5.0.12"
resolved "https://registry.yarnpkg.com/@reportportal/client-javascript/-/client-javascript-5.0.12.tgz#b6d9254014545ca56599c05105854ea814561f1e"
Expand Down

1 comment on commit 0668a62

@dhis2-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.