From 321089bc43004505103dcb5b8810bc4ef60ce966 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Tue, 19 Dec 2023 09:08:26 +0100 Subject: [PATCH 1/2] test: send jest test results only when env is setup (#3078) * test: send jest test results only when env is setup not push the test results to report portal when running the test locally * chore: use hyphens for app names * test: add report portal attributes BRANCH_NAME CI_BUILD_ID PR_TITLE to easily identify jest tests runs in report portal --------- Co-authored-by: Jen Jones Arnesen --- .github/workflows/dhis2-verify-app.yml | 3 ++ cypress.config.js | 2 +- jest.config.js | 69 ++++++++++++++++---------- 3 files changed, 48 insertions(+), 26 deletions(-) diff --git a/.github/workflows/dhis2-verify-app.yml b/.github/workflows/dhis2-verify-app.yml index e75b52515..d5a0d2598 100644 --- a/.github/workflows/dhis2-verify-app.yml +++ b/.github/workflows/dhis2-verify-app.yml @@ -76,6 +76,9 @@ jobs: REPORTPORTAL_API_KEY: ${{ secrets.REPORTPORTAL_API_KEY }} REPORTPORTAL_ENDPOINT: ${{ vars.REPORTPORTAL_ENDPOINT }} REPORTPORTAL_PROJECT: ${{ vars.REPORTPORTAL_PROJECT }} + CI_BUILD_ID: ${{ github.sha }}-${{ github.workflow }}-${{ github.event_name }} + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + PR_TITLE: ${{ github.event.pull_request.title }} call-workflow-e2e-prod: if: "!contains(github.event.head_commit.message, '[skip ci]')" diff --git a/cypress.config.js b/cypress.config.js index 9c7b7fc49..43a62ced8 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -43,7 +43,7 @@ module.exports = defineConfig({ }, { key: 'app_name', - value: 'maps_app', + value: 'maps-app', }, { key: 'test_level', diff --git a/jest.config.js b/jest.config.js index 5d81b0b52..6faa4a75e 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,3 +1,46 @@ +const reportPortalConfig = [ + '@reportportal/agent-js-jest', + { + apiKey: process.env.REPORTPORTAL_API_KEY, + endpoint: process.env.REPORTPORTAL_ENDPOINT, + project: process.env.REPORTPORTAL_PROJECT, + launch: 'maps_app', + attributes: [ + { + key: 'dhis2_version', + value: 'master', + }, + { + key: 'app_name', + value: 'maps-app', + }, + { + key: 'test_level', + value: 'unit/integration', + }, + { + key: 'BRANCH_NAME', + value: process.env.BRANCH_NAME, + }, + { + key: 'CI_BUILD_ID', + value: process.env.CI_BUILD_ID, + }, + { + key: 'PR_TITLE', + value: process.env.PR_TITLE, + }, + ], + description: '', + debug: true, + }, +] + +const isReportPortalSetup = + process.env.REPORTPORTAL_API_KEY !== undefined && + process.env.REPORTPORTAL_ENDPOINT !== undefined && + process.env.REPORTPORTAL_PROJECT !== undefined + module.exports = { setupFilesAfterEnv: ['/config/testSetup.js'], collectCoverageFrom: ['src/**/*.js'], @@ -14,30 +57,6 @@ module.exports = { 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: 'maps_app', - attributes: [ - { - key: 'version', - value: 'master', - }, - { - key: 'app_name', - value: 'maps_app', - }, - { - key: 'test_level', - value: 'unit/integration', - }, - ], - description: '', - debug: true, - }, - ], + ...(isReportPortalSetup ? [reportPortalConfig] : []), ], } From 8a1ae3051d294ffe931b91085efcf7539587ce8c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 20 Dec 2023 14:23:12 +0100 Subject: [PATCH 2/2] chore(deps-dev): bump @dhis2/cli-app-scripts from 10.3.10 to 10.3.11 (#3083) Bumps [@dhis2/cli-app-scripts](https://github.com/dhis2/app-platform/tree/HEAD/cli) from 10.3.10 to 10.3.11. - [Release notes](https://github.com/dhis2/app-platform/releases) - [Changelog](https://github.com/dhis2/app-platform/blob/master/CHANGELOG.md) - [Commits](https://github.com/dhis2/app-platform/commits/v10.3.11/cli) --- updated-dependencies: - dependency-name: "@dhis2/cli-app-scripts" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jen Jones Arnesen --- package.json | 2 +- yarn.lock | 40 ++++++++++++++++++++-------------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index a6f7511c5..8ae5b6a2f 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "postinstall": "patch-package" }, "devDependencies": { - "@dhis2/cli-app-scripts": "^10.3.10", + "@dhis2/cli-app-scripts": "^10.3.11", "@dhis2/cli-style": "^10.5.1", "@dhis2/cypress-commands": "^10.0.3", "@dhis2/cypress-plugins": "^10.0.3", diff --git a/yarn.lock b/yarn.lock index cd5379592..fbaee7edb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2036,12 +2036,12 @@ react-beautiful-dnd "^10.1.1" resize-observer-polyfill "^1.5.1" -"@dhis2/app-adapter@10.3.10": - version "10.3.10" - resolved "https://registry.yarnpkg.com/@dhis2/app-adapter/-/app-adapter-10.3.10.tgz#31e8bc93cdb3793db412707cdaf6f2d086c06d39" - integrity sha512-YjFrCq3s8+jPoycMacezM9nMd63C+Lcbzf9Lnu1zlJlHMSjVUTZ8nbWEqy1WQUR6vvWIZ+0DWGw1PPzDJNViog== +"@dhis2/app-adapter@10.3.11": + version "10.3.11" + resolved "https://registry.yarnpkg.com/@dhis2/app-adapter/-/app-adapter-10.3.11.tgz#a5322deba404fb405f80925684d7a5d9cdc48c81" + integrity sha512-H36P1tqSuzMyu4/uxSVFsEIXrWXzqVG1NPtANY+xEJcmrOoXH7YuiKvJu/Dl4rINDkERuUM+GwWMMgfBuMmrUw== dependencies: - "@dhis2/pwa" "10.3.10" + "@dhis2/pwa" "10.3.11" moment "^2.24.0" "@dhis2/app-runtime-adapter-d2@^1.1.0": @@ -2098,15 +2098,15 @@ dependencies: lodash "^4.17.21" -"@dhis2/app-shell@10.3.10": - version "10.3.10" - resolved "https://registry.yarnpkg.com/@dhis2/app-shell/-/app-shell-10.3.10.tgz#b8511fc52a97c40f0919c8f632cfda5edd664340" - integrity sha512-14FbdP+8Q657572LBU7zxVnTxB1cxD837k9n5ir6GKeb9Obw4KzdN2tTBA2Ll76iL83WjxcdzmAEiE6jSXCjyw== +"@dhis2/app-shell@10.3.11": + version "10.3.11" + resolved "https://registry.yarnpkg.com/@dhis2/app-shell/-/app-shell-10.3.11.tgz#461a19159ae6938e705ab793005403327b1ad95b" + integrity sha512-DCEOFK5i2/oNOOz33SqQ/7J3LJN0zUYMukdS/arEQCR9zP4bs+1yHGNRXtv8XoQRiYzdlIXsimlZzOm1ZDsxTw== dependencies: - "@dhis2/app-adapter" "10.3.10" + "@dhis2/app-adapter" "10.3.11" "@dhis2/app-runtime" "^3.9.0" "@dhis2/d2-i18n" "^1.1.1" - "@dhis2/pwa" "10.3.10" + "@dhis2/pwa" "10.3.11" "@dhis2/ui" "^8.12.3" classnames "^2.2.6" moment "^2.29.1" @@ -2119,10 +2119,10 @@ typeface-roboto "^0.0.75" typescript "^3.6.3" -"@dhis2/cli-app-scripts@^10.3.10": - version "10.3.10" - resolved "https://registry.yarnpkg.com/@dhis2/cli-app-scripts/-/cli-app-scripts-10.3.10.tgz#864d7ef7bcd2ba7f1f494c0b0d130edfda87360a" - integrity sha512-b0lZIIbV3LaiOvx5ptBLBjg+qFZCgOLJbNBvdaGLaOJAGU2QHGffcOsZvGBWYcQ6ipn+o0O1AFpuo9FFIY7EkQ== +"@dhis2/cli-app-scripts@^10.3.11": + version "10.3.11" + resolved "https://registry.yarnpkg.com/@dhis2/cli-app-scripts/-/cli-app-scripts-10.3.11.tgz#024920726eb9a9057fa1f73d745b9a75b5d55b7e" + integrity sha512-j7fetbmlSSHdGz9YlGJMaKyLzfEGWnOoaKvi53UfI0e3k7EIBbc9YTLH6qoYJX4KvvXNjB9ICNjvTFEjWHeIZw== dependencies: "@babel/core" "^7.6.2" "@babel/plugin-proposal-class-properties" "^7.8.3" @@ -2131,7 +2131,7 @@ "@babel/preset-env" "^7.14.7" "@babel/preset-react" "^7.0.0" "@babel/preset-typescript" "^7.6.0" - "@dhis2/app-shell" "10.3.10" + "@dhis2/app-shell" "10.3.11" "@dhis2/cli-helpers-engine" "^3.2.0" "@jest/core" "^27.0.6" "@pmmmwh/react-refresh-webpack-plugin" "^0.5.4" @@ -2282,10 +2282,10 @@ resolved "https://registry.yarnpkg.com/@dhis2/prop-types/-/prop-types-3.1.2.tgz#65b8ad2da8cd2f72bc8b951049a6c9d1b97af3e9" integrity sha512-eM0jjLOWvtXWqSFp5YC4DHFpkP8Y1D2eUwGV7MBWjni+o27oesVan+oT7WHeOeLdlAd4acRJrnaaAyB4Ck1wGQ== -"@dhis2/pwa@10.3.10": - version "10.3.10" - resolved "https://registry.yarnpkg.com/@dhis2/pwa/-/pwa-10.3.10.tgz#2d00f06dbc1dac060d3d4b4096c4f5b7651fbc54" - integrity sha512-MBLySNo02SIXP/aHKvTvdan2/Fx3nyBhddwi3HzZFfc2LQ7/oHLLE+SvOL8JtTAet13GEu4chYyzIe3JvTzgDw== +"@dhis2/pwa@10.3.11": + version "10.3.11" + resolved "https://registry.yarnpkg.com/@dhis2/pwa/-/pwa-10.3.11.tgz#6eb5a692fe92a56bd6ffa56f06322617c15968dc" + integrity sha512-nHQhNDe0MTEG3/YcdBDcGD6NwcDoDKUyJWbtC8xErEKbHIns0HWjhIC+NPMrVu3NxEv1HZiHupK9lnfzPVJC4Q== dependencies: idb "^6.0.0" workbox-core "^6.1.5"