Skip to content

Commit

Permalink
Merge pull request #3008 from dhis2/dev
Browse files Browse the repository at this point in the history
fix: merge to master
  • Loading branch information
jenniferarnesen authored Jun 17, 2024
2 parents 41851d2 + 018e07b commit 29d8256
Show file tree
Hide file tree
Showing 31 changed files with 539 additions and 474 deletions.
50 changes: 42 additions & 8 deletions .github/workflows/dhis2-verify-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'dhis2: verify (app)'

on:
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize']
types: ['opened', 'labeled', 'reopened', 'synchronize']
push:
branches:
- 'master'
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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 }}
Expand All @@ -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:
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ Builds the app for production to the `build` folder.<br />. 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/).
Expand Down
35 changes: 35 additions & 0 deletions cypress/support/generateTestMatrix.js
Original file line number Diff line number Diff line change
@@ -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))
15 changes: 9 additions & 6 deletions i18n/ar.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
"POT-Creation-Date: 2024-02-26T14:42:02.563Z\n"
"POT-Creation-Date: 2024-03-19T12:31:03.302Z\n"
"PO-Revision-Date: 2019-06-25 12:37+0000\n"
"Last-Translator: Hamza Assada <[email protected]>, 2024\n"
"Language-Team: Arabic (https://app.transifex.com/hisp-uio/teams/100509/ar/)\n"
Expand Down Expand Up @@ -66,8 +66,8 @@ msgid ""
"Use a spacer to create empty vertical space between other dashboard items."
msgstr "استخدم فاصل لإنشاء مساحة رأسية فارغة بين عناصر لوحة المعلومات الأخرى"

msgid "Text item"
msgstr "عنصر نصي"
msgid "Text box"
msgstr "مربع نص"

msgid "Add text here"
msgstr "اضف نص هنا"
Expand All @@ -81,6 +81,12 @@ msgstr ""
msgid "Filters not applied"
msgstr ""

msgid "Only Period and Organisation unit filters can be applied to this item"
msgstr ""

msgid "Some filters not applied"
msgstr ""

msgid "There was a problem loading this dashboard item"
msgstr "حدثت مشكلة أثناء تحميل عنصر لوحة المعلومات هذا"

Expand Down Expand Up @@ -332,9 +338,6 @@ msgstr "لا يمكن البحث عن عناصر لوحة معلومات بلا
msgid "Additional items"
msgstr "عناصر إضافية"

msgid "Text box"
msgstr "مربع نص"

msgid "Dashboard layout"
msgstr "تخطيط لوحة المعلومات"

Expand Down
7 changes: 2 additions & 5 deletions i18n/ar_IQ.po
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ msgid ""
"Use a spacer to create empty vertical space between other dashboard items."
msgstr "استخدم فاصل لإنشاء مساحة رأسية فارغة بين عناصر لوحة المعلومات الأخرى"

msgid "Text item"
msgstr "عنصر نصي"
msgid "Text box"
msgstr "مربع نص"

msgid "Add text here"
msgstr "اضف نص هنا"
Expand Down Expand Up @@ -325,9 +325,6 @@ msgstr ""
msgid "Additional items"
msgstr "عناصر إضافية"

msgid "Text box"
msgstr "مربع نص"

msgid "Dashboard layout"
msgstr ""

Expand Down
15 changes: 9 additions & 6 deletions i18n/cs.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
"POT-Creation-Date: 2024-02-26T14:42:02.563Z\n"
"POT-Creation-Date: 2024-03-19T12:31:03.302Z\n"
"PO-Revision-Date: 2019-06-25 12:37+0000\n"
"Last-Translator: Jiří Podhorecký, 2024\n"
"Language-Team: Czech (https://app.transifex.com/hisp-uio/teams/100509/cs/)\n"
Expand Down Expand Up @@ -66,8 +66,8 @@ msgstr ""
"Pomocí mezerníku vytvořte prázdný svislý prostor mezi ostatními položkami "
"ovládacího panelu."

msgid "Text item"
msgstr "Textová položka"
msgid "Text box"
msgstr "Textové pole"

msgid "Add text here"
msgstr "Sem přidat text"
Expand All @@ -81,6 +81,12 @@ msgstr "Filtry se nepoužívají na položky ovládacího panelu řádkového se
msgid "Filters not applied"
msgstr "Filtry nejsou použity"

msgid "Only Period and Organisation unit filters can be applied to this item"
msgstr ""

msgid "Some filters not applied"
msgstr ""

msgid "There was a problem loading this dashboard item"
msgstr "Při načítání této položky ovládacího panelu došlo k problému"

Expand Down Expand Up @@ -337,9 +343,6 @@ msgstr "V režimu offline nelze vyhledávat položky ovládacího panelu"
msgid "Additional items"
msgstr "Další položky"

msgid "Text box"
msgstr "Textové pole"

msgid "Dashboard layout"
msgstr "Rozložení ovládacího panelu"

Expand Down
7 changes: 2 additions & 5 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ msgstr "Spacer"
msgid "Use a spacer to create empty vertical space between other dashboard items."
msgstr "Use a spacer to create empty vertical space between other dashboard items."

msgid "Text item"
msgstr "Text item"
msgid "Text box"
msgstr "Text box"

msgid "Add text here"
msgstr "Add text here"
Expand Down Expand Up @@ -337,9 +337,6 @@ msgstr "Cannot search for dashboard items while offline"
msgid "Additional items"
msgstr "Additional items"

msgid "Text box"
msgstr "Text box"

msgid "Dashboard layout"
msgstr "Dashboard layout"

Expand Down
15 changes: 9 additions & 6 deletions i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
"POT-Creation-Date: 2024-02-26T14:42:02.563Z\n"
"POT-Creation-Date: 2024-03-19T12:31:03.302Z\n"
"PO-Revision-Date: 2019-06-25 12:37+0000\n"
"Last-Translator: Gabriela Rodriguez <[email protected]>, 2024\n"
"Language-Team: Spanish (https://app.transifex.com/hisp-uio/teams/100509/es/)\n"
Expand Down Expand Up @@ -76,8 +76,8 @@ msgstr ""
"Use el tabulador para crear un espacio vertical vacío con otro objeto del "
"tablero."

msgid "Text item"
msgstr "Elemento de texto"
msgid "Text box"
msgstr "Caja de texto"

msgid "Add text here"
msgstr "Añada texto aquí"
Expand All @@ -91,6 +91,12 @@ msgstr "Los filtros no se aplican a los elementos del tablero de listados"
msgid "Filters not applied"
msgstr "Filtros no aplicados"

msgid "Only Period and Organisation unit filters can be applied to this item"
msgstr ""

msgid "Some filters not applied"
msgstr ""

msgid "There was a problem loading this dashboard item"
msgstr "Ha habido un problema al cargar este elemento del tablero"

Expand Down Expand Up @@ -348,9 +354,6 @@ msgstr "No se pueden buscar elementos de tableros sin conexión a internet"
msgid "Additional items"
msgstr "Objetos adicionales"

msgid "Text box"
msgstr "Caja de texto"

msgid "Dashboard layout"
msgstr "Diseño del tablero"

Expand Down
15 changes: 9 additions & 6 deletions i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
"POT-Creation-Date: 2024-02-26T14:42:02.563Z\n"
"POT-Creation-Date: 2024-03-19T12:31:03.302Z\n"
"PO-Revision-Date: 2019-06-25 12:37+0000\n"
"Last-Translator: Edem Kossi <[email protected]>, 2024\n"
"Language-Team: French (https://app.transifex.com/hisp-uio/teams/100509/fr/)\n"
Expand Down Expand Up @@ -75,8 +75,8 @@ msgstr ""
"Utilisez une entretoise pour créer un espace vertical vide entre les autres "
"éléments du tableau de bord."

msgid "Text item"
msgstr "Élément de texte"
msgid "Text box"
msgstr "Zone de texte"

msgid "Add text here"
msgstr "Ajouter du texte ici"
Expand All @@ -90,6 +90,12 @@ msgstr ""
msgid "Filters not applied"
msgstr ""

msgid "Only Period and Organisation unit filters can be applied to this item"
msgstr ""

msgid "Some filters not applied"
msgstr ""

msgid "There was a problem loading this dashboard item"
msgstr ""
"Un problème est survenu lors du chargement de cet objet du tableau de bord"
Expand Down Expand Up @@ -350,9 +356,6 @@ msgstr ""
msgid "Additional items"
msgstr "Objets additionnels"

msgid "Text box"
msgstr "Zone de texte"

msgid "Dashboard layout"
msgstr "Mise en page du tableau de bord"

Expand Down
Loading

0 comments on commit 29d8256

Please sign in to comment.