diff --git a/.github/workflows/dhis2-verify-app.yml b/.github/workflows/dhis2-verify-app.yml index 84741d1e0..c6d3d4da7 100644 --- a/.github/workflows/dhis2-verify-app.yml +++ b/.github/workflows/dhis2-verify-app.yml @@ -2,7 +2,7 @@ name: 'dhis2: verify (app)' on: pull_request: - types: ['opened', 'edited', 'reopened', 'synchronize'] + types: ['opened', 'labeled', 'reopened', 'synchronize'] push: branches: - 'master' @@ -19,6 +19,18 @@ env: CI: true jobs: + setup-matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.specs }} + steps: + - uses: actions/checkout@v3 + - name: Generate test matrix + id: set-matrix + run: | + node cypress/support/generateTestMatrix.js > matrix.json + echo "::set-output name=specs::$(cat matrix.json)" + build: runs-on: ubuntu-latest steps: @@ -77,12 +89,16 @@ jobs: e2e-prod: runs-on: ubuntu-latest - needs: test + needs: [test, setup-matrix] if: "!contains(github.event.head_commit.message, '[skip ci]')" strategy: + fail-fast: false matrix: - containers: [1, 2, 3, 4] + spec-group: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} + + env: + SHOULD_RECORD: ${{ contains(github.event.head_commit.message, '[e2e record]') || contains(join(github.event.pull_request.labels.*.name), 'e2e record') }} steps: - uses: actions/checkout@v3 @@ -96,17 +112,35 @@ jobs: path: '**/node_modules' key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('patches/*.patch') }} + - name: Set Cypress Record Environment Variables + if: env.SHOULD_RECORD == 'true' + run: | + echo "CYPRESS_GROUP=e2e-${{ matrix.spec-group.id }}" >> $GITHUB_ENV + echo "CYPRESS_TAG=${{ github.event_name }}" >> $GITHUB_ENV + echo "CYPRESS_CI_BUILD_ID=${{ github.run_id }}" >> $GITHUB_ENV + + - name: Debug Environment Variables + run: | + echo "SHOULD_RECORD=${{ env.SHOULD_RECORD }}" + echo "CI Build ID=${{ github.run_id }}" + echo "Computed Group=${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_GROUP || '' }}" + echo "Computed Tag=${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_TAG || '' }}" + echo "Computed CI Build ID=${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_CI_BUILD_ID || '' }}" + echo "Spec=${{ join(matrix.spec-group.tests, ',') }}" + - name: End-to-End tests uses: cypress-io/github-action@v2 with: - record: true - parallel: true start: ${{ env.SERVER_START_CMD }} wait-on: ${{ env.SERVER_URL }} wait-on-timeout: 300 cache-key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('patches/*.patch') }} - group: 'e2e' - tag: ${{ github.event_name }} + record: ${{ env.SHOULD_RECORD }} + parallel: ${{ env.SHOULD_RECORD }} + group: ${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_GROUP || '' }} + tag: ${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_TAG || '' }} + ci-build-id: ${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_CI_BUILD_ID || '' }} + spec: ${{ join(matrix.spec-group.tests, ',') }} env: CI: true CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} @@ -126,7 +160,7 @@ jobs: if: | !github.event.push.repository.fork && github.actor != 'dependabot[bot]' && - (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev') + (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) steps: - uses: actions/checkout@v3 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index f290732cb..2cb261373 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## [100.2.2](https://github.com/dhis2/dashboard-app/compare/v100.2.1...v100.2.2) (2024-05-16) + + +### Bug Fixes + +* avoid re-rendering an item when adding the same again (DHIS2-17016) ([#2935](https://github.com/dhis2/dashboard-app/issues/2935)) ([dd67fc6](https://github.com/dhis2/dashboard-app/commit/dd67fc69c6b39bd177c1dd6a51cdf90d4dd4a1a2)) +* avoid reading from undefined error (DHIS2-17334) ([#2970](https://github.com/dhis2/dashboard-app/issues/2970)) ([a4e5340](https://github.com/dhis2/dashboard-app/commit/a4e5340a6605db261fd2a2af1ced272d94c760dc)) +* dimension list design (DHIS2-16270) ([#2861](https://github.com/dhis2/dashboard-app/issues/2861)) ([790afd2](https://github.com/dhis2/dashboard-app/commit/790afd2d64e8fb8252088453cdb803735b79c4de)) +* system / user setting for display name not respected in Org Unit tree (DHIS2-15000) ([#2971](https://github.com/dhis2/dashboard-app/issues/2971)) ([928b88a](https://github.com/dhis2/dashboard-app/commit/928b88a7a97816f0c0a8a9cf364bf7fa189c848a)) + ## [100.2.1](https://github.com/dhis2/dashboard-app/compare/v100.2.0...v100.2.1) (2024-04-24) diff --git a/README.md b/README.md index 400c39899..94f665056 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,15 @@ Builds the app for production to the `build` folder.
. This command is run See the [building](https://platform.dhis2.nu/#/scripts/build) section for more information. +## Conditional E2E Test Recording + +To record e2e tests in Cypress Cloud, you can use one of the following methods based on your needs: + +- **Commit Message**: Include `[e2e record]` in your commit messages to activate recording. +- **GitHub Labels**: Apply the `e2e record` label to your pull request to trigger recording. + +This setup helps in managing Cypress Cloud credits more efficiently, ensuring recordings are only made when explicitly required. + ## Learn More You can learn more about the platform in the [DHIS2 Application Platform Documentation](https://platform.dhis2.nu/). diff --git a/cypress/support/generateTestMatrix.js b/cypress/support/generateTestMatrix.js new file mode 100644 index 000000000..473181936 --- /dev/null +++ b/cypress/support/generateTestMatrix.js @@ -0,0 +1,35 @@ +const fs = require('fs') +const path = require('path') + +const getAllFiles = (dirPath, arrayOfFiles = []) => { + const files = fs.readdirSync(dirPath) + + files.forEach((file) => { + if (fs.statSync(path.join(dirPath, file)).isDirectory()) { + arrayOfFiles = getAllFiles(path.join(dirPath, file), arrayOfFiles) + } else if (path.extname(file) === '.feature') { + arrayOfFiles.push(path.join(dirPath, file)) + } + }) + + return arrayOfFiles +} + +const createGroups = (files, numberOfGroups = 8) => { + const groups = [] + for (let i = 0; i < numberOfGroups; i++) { + groups.push([]) + } + + files.forEach((file, index) => { + groups[index % numberOfGroups].push(file) + }) + + return groups.map((group, index) => ({ id: index + 1, tests: group })) +} + +const cypressSpecsPath = './cypress/integration' +const specs = getAllFiles(cypressSpecsPath) +const groupedSpecs = createGroups(specs) + +console.log(JSON.stringify(groupedSpecs)) diff --git a/i18n/lo.po b/i18n/lo.po index 19e9cce36..d04a228a8 100644 --- a/i18n/lo.po +++ b/i18n/lo.po @@ -263,7 +263,7 @@ msgid "No, stay here" msgstr "" msgid "Yes, discard changes" -msgstr "" +msgstr "ຕົກລົງ, ຍົກເລີກການປ່ຽນແປງ" msgid "No access" msgstr "ບໍ່ມີການເຂົ້າເຖີງ" @@ -458,7 +458,7 @@ msgid "" msgstr "" msgid "No, cancel" -msgstr "" +msgstr "ບໍ່, ຍົກເລີກ" msgid "Yes, remove filters" msgstr "" diff --git a/i18n/ru.po b/i18n/ru.po index 0b3a9ffad..9d86e0e86 100644 --- a/i18n/ru.po +++ b/i18n/ru.po @@ -3,13 +3,14 @@ # Philip Larsen Donnelly, 2021 # Viktor Varland , 2021 # Ulanbek Abakirov , 2024 +# Yury Rogachev , 2024 # msgid "" msgstr "" "Project-Id-Version: i18next-conv\n" "POT-Creation-Date: 2024-03-19T12:31:03.302Z\n" "PO-Revision-Date: 2019-06-25 12:37+0000\n" -"Last-Translator: Ulanbek Abakirov , 2024\n" +"Last-Translator: Yury Rogachev , 2024\n" "Language-Team: Russian (https://app.transifex.com/hisp-uio/teams/100509/ru/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -263,7 +264,7 @@ msgid "No, stay here" msgstr "Нет, остаюсь тут" msgid "Yes, discard changes" -msgstr "" +msgstr "Да, не сохранять изменения" msgid "No access" msgstr "Нет доступа" @@ -466,7 +467,7 @@ msgid "" msgstr "" msgid "No, cancel" -msgstr "" +msgstr "Нет, отменить" msgid "Yes, remove filters" msgstr "" diff --git a/package.json b/package.json index bc782471b..3e3561954 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dashboard-app", - "version": "100.2.1", + "version": "100.2.2", "description": "DHIS2 Dashboard app", "private": true, "license": "BSD-3-Clause", diff --git a/src/components/Item/VisualizationItem/Item.js b/src/components/Item/VisualizationItem/Item.js index 93f30c97b..f17f235bf 100644 --- a/src/components/Item/VisualizationItem/Item.js +++ b/src/components/Item/VisualizationItem/Item.js @@ -114,6 +114,15 @@ class Item extends Component { this.setState({ configLoaded: true }) } + componentDidUpdate(prevProps) { + if ( + this.props.isRecording && + this.props.isRecording !== prevProps.isRecording + ) { + apiFetchVisualization(this.props.item) + } + } + isFullscreenSupported = () => { const el = getGridItemElement(this.props.item.id) return !!(el?.requestFullscreen || el?.webkitRequestFullscreen) @@ -322,6 +331,7 @@ Item.propTypes = { dashboardMode: PropTypes.string, gridWidth: PropTypes.number, isEditing: PropTypes.bool, + isRecording: PropTypes.bool, item: PropTypes.object, itemFilters: PropTypes.object, setActiveType: PropTypes.func, diff --git a/src/pages/view/ItemGrid.js b/src/pages/view/ItemGrid.js index 28241b1ef..0a112be77 100644 --- a/src/pages/view/ItemGrid.js +++ b/src/pages/view/ItemGrid.js @@ -109,6 +109,7 @@ const ResponsiveItemGrid = ({ dashboardId, dashboardItems }) => { item={item} gridWidth={gridWidth} dashboardMode={VIEW} + isRecording={forceLoad} onToggleItemExpanded={onToggleItemExpanded} />