From 69ec0802a86b24d93041405714ee0e39847cb513 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Mon, 19 Aug 2024 12:57:17 +0100 Subject: [PATCH 01/39] Add new workflow to trigger Cypress tests from core --- .github/workflows/e2e-test-dispatch.yml | 43 +++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/e2e-test-dispatch.yml diff --git a/.github/workflows/e2e-test-dispatch.yml b/.github/workflows/e2e-test-dispatch.yml new file mode 100644 index 000000000..699b92133 --- /dev/null +++ b/.github/workflows/e2e-test-dispatch.yml @@ -0,0 +1,43 @@ +name: 'dhis2: e2e tests triggered by core' + +on: + repository_dispatch: + types: [apps-e2e-tests-trigger] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + +env: + GIT_AUTHOR_NAME: '@dhis2-bot' + GIT_AUTHOR_EMAIL: 'apps@dhis2.org' + GIT_COMMITTER_NAME: '@dhis2-bot' + GIT_COMMITTER_EMAIL: 'apps@dhis2.org' + GH_TOKEN: ${{ secrets.DHIS2_BOT_GITHUB_TOKEN }} + D2_VERBOSE: true + 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: echo "::set-output name=specs::$(node src/generateTestMatrix.js)" + + call-workflow-e2e-prod: + needs: setup-matrix + uses: ./.github/workflows/analytics-e2e-tests-triggered-by-core.yml@workflow-dispatch-cypress + with: + should_record: ${{ contains(github.event.head_commit.message, '[e2e record]') || contains(join(github.event.pull_request.labels.*.name), 'e2e record')}} + spec-group: ${{ needs.setup-matrix.outputs.matrix }} + instance_url: ${{ github.event.client_payload.instance_url }} + secrets: + username: ${{ secrets.CYPRESS_DHIS2_USERNAME }} + password: ${{ secrets.CYPRESS_DHIS2_PASSWORD }} + recordkey: ${{ secrets.CYPRESS_RECORD_KEY }} + reportportal_api_key: ${{ secrets.REPORTPORTAL_API_KEY }} + reportportal_endpoint: ${{ vars.REPORTPORTAL_ENDPOINT }} + reportportal_project: ${{ vars.REPORTPORTAL_PROJECT }} From 7489a2b05d73f4b5f947b72d6b2d91a56ba63064 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Mon, 19 Aug 2024 13:02:41 +0100 Subject: [PATCH 02/39] fix --- .github/workflows/e2e-test-dispatch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-test-dispatch.yml b/.github/workflows/e2e-test-dispatch.yml index 699b92133..160bfc698 100644 --- a/.github/workflows/e2e-test-dispatch.yml +++ b/.github/workflows/e2e-test-dispatch.yml @@ -29,7 +29,7 @@ jobs: call-workflow-e2e-prod: needs: setup-matrix - uses: ./.github/workflows/analytics-e2e-tests-triggered-by-core.yml@workflow-dispatch-cypress + uses: ./.github/workflows/analytics-e2e-tests-triggered-by-core.yml with: should_record: ${{ contains(github.event.head_commit.message, '[e2e record]') || contains(join(github.event.pull_request.labels.*.name), 'e2e record')}} spec-group: ${{ needs.setup-matrix.outputs.matrix }} From f6445cc8636fb691c9701d96675ceee8be90981a Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Mon, 19 Aug 2024 13:27:11 +0100 Subject: [PATCH 03/39] fix --- .github/workflows/e2e-test-dispatch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-test-dispatch.yml b/.github/workflows/e2e-test-dispatch.yml index 160bfc698..ce77eff56 100644 --- a/.github/workflows/e2e-test-dispatch.yml +++ b/.github/workflows/e2e-test-dispatch.yml @@ -29,7 +29,7 @@ jobs: call-workflow-e2e-prod: needs: setup-matrix - uses: ./.github/workflows/analytics-e2e-tests-triggered-by-core.yml + uses: dhis2/workflows/.github/workflows/analytics-e2e-tests-triggered-by-core.yml@workflow-dispatch-cypress with: should_record: ${{ contains(github.event.head_commit.message, '[e2e record]') || contains(join(github.event.pull_request.labels.*.name), 'e2e record')}} spec-group: ${{ needs.setup-matrix.outputs.matrix }} From 4b5cc83b479977522a2ccd44278fb02fac8b792a Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Thu, 12 Sep 2024 10:16:01 +0100 Subject: [PATCH 04/39] chore: update workflow to use workflow_dispatch with inputs for DHIS2 version and instance URL Resolves issue with triggering tests from non-default branches. --- .github/workflows/e2e-test-dispatch.yml | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/.github/workflows/e2e-test-dispatch.yml b/.github/workflows/e2e-test-dispatch.yml index ce77eff56..b5cc79d27 100644 --- a/.github/workflows/e2e-test-dispatch.yml +++ b/.github/workflows/e2e-test-dispatch.yml @@ -1,20 +1,14 @@ name: 'dhis2: e2e tests triggered by core' on: - repository_dispatch: - types: [apps-e2e-tests-trigger] - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - -env: - GIT_AUTHOR_NAME: '@dhis2-bot' - GIT_AUTHOR_EMAIL: 'apps@dhis2.org' - GIT_COMMITTER_NAME: '@dhis2-bot' - GIT_COMMITTER_EMAIL: 'apps@dhis2.org' - GH_TOKEN: ${{ secrets.DHIS2_BOT_GITHUB_TOKEN }} - D2_VERBOSE: true - CI: true + workflow_dispatch: + inputs: + dhis2_version: + description: 'DHIS2 core version' + required: true + instance_url: + description: 'Instance URL' + required: true jobs: setup-matrix: @@ -33,7 +27,7 @@ jobs: with: should_record: ${{ contains(github.event.head_commit.message, '[e2e record]') || contains(join(github.event.pull_request.labels.*.name), 'e2e record')}} spec-group: ${{ needs.setup-matrix.outputs.matrix }} - instance_url: ${{ github.event.client_payload.instance_url }} + instance_url: ${{ github.event.inputs.instance_url }} secrets: username: ${{ secrets.CYPRESS_DHIS2_USERNAME }} password: ${{ secrets.CYPRESS_DHIS2_PASSWORD }} From b8faae3f37c7fff6443ae13445674b47dd019ca5 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Thu, 12 Sep 2024 10:51:49 +0100 Subject: [PATCH 05/39] chore: add debug logging for matrix output and ensure proper JSON parsing with fromJson --- .github/workflows/e2e-test-dispatch.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e-test-dispatch.yml b/.github/workflows/e2e-test-dispatch.yml index b5cc79d27..9322265da 100644 --- a/.github/workflows/e2e-test-dispatch.yml +++ b/.github/workflows/e2e-test-dispatch.yml @@ -17,12 +17,23 @@ jobs: matrix: ${{ steps.set-matrix.outputs.specs }} steps: - uses: actions/checkout@v3 + - name: Generate Test matrix id: set-matrix - run: echo "::set-output name=specs::$(node src/generateTestMatrix.js)" + run: | + echo "Generating Test Matrix" + specs=$(node src/generateTestMatrix.js) + echo "specs=$specs" >> $GITHUB_OUTPUT + + - name: Debug spec-group + run: | + echo "Matrix output: ${{ steps.set-matrix.outputs.specs }}" call-workflow-e2e-prod: needs: setup-matrix + strategy: + matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} + uses: dhis2/workflows/.github/workflows/analytics-e2e-tests-triggered-by-core.yml@workflow-dispatch-cypress with: should_record: ${{ contains(github.event.head_commit.message, '[e2e record]') || contains(join(github.event.pull_request.labels.*.name), 'e2e record')}} From c8e8b2043bef006aa3b37d4325f1c199297ec8e4 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Thu, 12 Sep 2024 11:14:47 +0100 Subject: [PATCH 06/39] chore: fix matrix parsing and sequence error --- .github/workflows/e2e-test-dispatch.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e-test-dispatch.yml b/.github/workflows/e2e-test-dispatch.yml index 9322265da..e2d8d3d79 100644 --- a/.github/workflows/e2e-test-dispatch.yml +++ b/.github/workflows/e2e-test-dispatch.yml @@ -32,7 +32,8 @@ jobs: call-workflow-e2e-prod: needs: setup-matrix strategy: - matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} + matrix: + group: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} uses: dhis2/workflows/.github/workflows/analytics-e2e-tests-triggered-by-core.yml@workflow-dispatch-cypress with: From 2559a73749196b318b02401b780b6c6bdc793aed Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Thu, 12 Sep 2024 11:59:01 +0100 Subject: [PATCH 07/39] chore: fix test matrix output --- .github/workflows/e2e-test-dispatch.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/e2e-test-dispatch.yml b/.github/workflows/e2e-test-dispatch.yml index e2d8d3d79..f85511980 100644 --- a/.github/workflows/e2e-test-dispatch.yml +++ b/.github/workflows/e2e-test-dispatch.yml @@ -24,6 +24,7 @@ jobs: echo "Generating Test Matrix" specs=$(node src/generateTestMatrix.js) echo "specs=$specs" >> $GITHUB_OUTPUT + echo "::set-output name=matrix::$(echo $specs)" - name: Debug spec-group run: | From 868d93b41867f59e75654cfc785474a23db25d27 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Thu, 12 Sep 2024 15:16:52 +0100 Subject: [PATCH 08/39] chore: fix dhis2_version --- .github/workflows/e2e-test-dispatch.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/e2e-test-dispatch.yml b/.github/workflows/e2e-test-dispatch.yml index f85511980..6f2de01a5 100644 --- a/.github/workflows/e2e-test-dispatch.yml +++ b/.github/workflows/e2e-test-dispatch.yml @@ -22,9 +22,7 @@ jobs: id: set-matrix run: | echo "Generating Test Matrix" - specs=$(node src/generateTestMatrix.js) - echo "specs=$specs" >> $GITHUB_OUTPUT - echo "::set-output name=matrix::$(echo $specs)" + echo "::set-output name=specs::$(node src/generateTestMatrix.js)" - name: Debug spec-group run: | @@ -32,15 +30,12 @@ jobs: call-workflow-e2e-prod: needs: setup-matrix - strategy: - matrix: - group: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} - uses: dhis2/workflows/.github/workflows/analytics-e2e-tests-triggered-by-core.yml@workflow-dispatch-cypress with: should_record: ${{ contains(github.event.head_commit.message, '[e2e record]') || contains(join(github.event.pull_request.labels.*.name), 'e2e record')}} spec-group: ${{ needs.setup-matrix.outputs.matrix }} instance_url: ${{ github.event.inputs.instance_url }} + dhis2_version: ${{ github.event.inputs.dhis2_version }} secrets: username: ${{ secrets.CYPRESS_DHIS2_USERNAME }} password: ${{ secrets.CYPRESS_DHIS2_PASSWORD }} From 0142e586fbe4f513441e69427f5125aa613c41e0 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Mon, 23 Sep 2024 08:18:09 +0100 Subject: [PATCH 09/39] chore: add logging to debug page state --- cypress/helpers/startScreen.js | 37 ++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/cypress/helpers/startScreen.js b/cypress/helpers/startScreen.js index 504ffef64..5b723f255 100644 --- a/cypress/helpers/startScreen.js +++ b/cypress/helpers/startScreen.js @@ -1,11 +1,36 @@ import { EXTENDED_TIMEOUT } from '../support/util.js' +// Helper function to log page state and check if specific content is present +const logPageState = () => { + cy.url().then((url) => { + cy.log(`Current URL: ${url}`) + }) + + cy.get('body').then((body) => { + const bodyText = body.text() + cy.log(`Page Body Content: ${bodyText.slice(0, 500)}...`) + }) +} + export const goToStartPage = (skipEval) => { - cy.visit('/', EXTENDED_TIMEOUT).log(Cypress.env('dhis2BaseUrl')) - if (!skipEval) { - expectStartScreenToBeVisible() - } + cy.visit('/', EXTENDED_TIMEOUT).then(() => { + cy.log(`Visiting the base URL: ${Cypress.env('dhis2BaseUrl')}`) + logPageState() + + if (!skipEval) { + expectStartScreenToBeVisible() + } + }) } -export const expectStartScreenToBeVisible = () => - cy.contains('Getting started', EXTENDED_TIMEOUT).should('be.visible') +export const expectStartScreenToBeVisible = () => { + cy.contains('Getting started', EXTENDED_TIMEOUT) + .should('be.visible') + .then(() => { + cy.log('Confirmed: "Getting started" is visible') + }) + .catch(() => { + cy.log('Failed to find "Getting started" content') + logPageState() + }) +} From 06fe62f56322e7011245a0c992d1d86e8d711507 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Mon, 23 Sep 2024 10:11:30 +0100 Subject: [PATCH 10/39] chore: fix logging --- cypress/helpers/startScreen.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cypress/helpers/startScreen.js b/cypress/helpers/startScreen.js index 5b723f255..17047ce61 100644 --- a/cypress/helpers/startScreen.js +++ b/cypress/helpers/startScreen.js @@ -29,8 +29,9 @@ export const expectStartScreenToBeVisible = () => { .then(() => { cy.log('Confirmed: "Getting started" is visible') }) - .catch(() => { + .catch((error) => { cy.log('Failed to find "Getting started" content') logPageState() + throw error }) } From a8c2ab10b0b1ca5e502715c337ebbc484896bfc0 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Mon, 23 Sep 2024 10:33:00 +0100 Subject: [PATCH 11/39] chore: fix chaining issue handling visibility check in then block --- cypress/helpers/startScreen.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/helpers/startScreen.js b/cypress/helpers/startScreen.js index 17047ce61..28ea0ad4c 100644 --- a/cypress/helpers/startScreen.js +++ b/cypress/helpers/startScreen.js @@ -25,9 +25,9 @@ export const goToStartPage = (skipEval) => { export const expectStartScreenToBeVisible = () => { cy.contains('Getting started', EXTENDED_TIMEOUT) - .should('be.visible') - .then(() => { + .then(($el) => { cy.log('Confirmed: "Getting started" is visible') + expect($el).to.be.visible }) .catch((error) => { cy.log('Failed to find "Getting started" content') From 0035109182657fe0006b3da2c3ebe2be85495d39 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Mon, 23 Sep 2024 11:01:34 +0100 Subject: [PATCH 12/39] chore: remove invalid .catch() --- cypress/helpers/startScreen.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/cypress/helpers/startScreen.js b/cypress/helpers/startScreen.js index 28ea0ad4c..f7e7a1b7d 100644 --- a/cypress/helpers/startScreen.js +++ b/cypress/helpers/startScreen.js @@ -25,13 +25,9 @@ export const goToStartPage = (skipEval) => { export const expectStartScreenToBeVisible = () => { cy.contains('Getting started', EXTENDED_TIMEOUT) - .then(($el) => { + .should('be.visible') + .then(() => { cy.log('Confirmed: "Getting started" is visible') - expect($el).to.be.visible - }) - .catch((error) => { - cy.log('Failed to find "Getting started" content') - logPageState() - throw error }) + logPageState() } From c4e9c3c862a965c7b90e8b8fac68485fa0637ed0 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Mon, 23 Sep 2024 11:49:00 +0100 Subject: [PATCH 13/39] chore: add cypress-multi-reporters for ReportPortal and console logs in CI --- cypress.config.js | 53 +++++++++++++++++---------------- package.json | 2 ++ yarn.lock | 74 +++++++++++++---------------------------------- 3 files changed, 50 insertions(+), 79 deletions(-) diff --git a/cypress.config.js b/cypress.config.js index 91e229b63..1d84e217b 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -42,33 +42,36 @@ async function setupNodeEvents(on, config) { module.exports = defineConfig({ projectId: 'm5qvjx', - reporter: '@reportportal/agent-js-cypress', + reporter: 'cypress-multi-reporters', reporterOptions: { - endpoint: process.env.REPORTPORTAL_ENDPOINT, - apiKey: process.env.REPORTPORTAL_API_KEY, - launch: 'line_listing_app', - project: process.env.REPORTPORTAL_PROJECT, - description: '', - autoMerge: true, - parallel: true, - debug: false, - restClientConfig: { - timeout: 660000, - }, - attributes: [ - { - key: 'dhis2_version', - value: process.env.DHIS2_VERSION, - }, - { - key: 'app_name', - value: 'line-listing-app', + reporterEnabled: ['@reportportal/agent-js-cypress', 'spec'], + reportportalAgentJsCypressReporterOptions: { + endpoint: process.env.REPORTPORTAL_ENDPOINT, + apiKey: process.env.REPORTPORTAL_API_KEY, + launch: 'line_listing_app', + project: process.env.REPORTPORTAL_PROJECT, + description: '', + autoMerge: true, + parallel: true, + debug: false, + restClientConfig: { + timeout: 660000, }, - { - key: 'test_level', - value: 'e2e', - }, - ], + attributes: [ + { + key: 'dhis2_version', + value: process.env.DHIS2_VERSION, + }, + { + key: 'app_name', + value: 'line-listing-app', + }, + { + key: 'test_level', + value: 'e2e', + }, + ], + }, }, e2e: { setupNodeEvents, diff --git a/package.json b/package.json index a40099467..6541b39c2 100644 --- a/package.json +++ b/package.json @@ -30,12 +30,14 @@ "@testing-library/jest-dom": "^5.16.4", "@testing-library/react": "^12.1.4", "cypress": "^13.10.0", + "cypress-multi-reporters": "^1.6.4", "cypress-tags": "^1.2.2", "enzyme": "^3.11.0", "enzyme-adapter-react-16": "^1.15.8", "eslint-plugin-cypress": "^2.12.1", "identity-obj-proxy": "^3.0.0", "jest-enzyme": "^7.1.2", + "mochawesome": "^7.1.3", "redux-mock-store": "^1.5.4", "semantic-release": "^20", "start-server-and-test": "^1.14.0", diff --git a/yarn.lock b/yarn.lock index 7b251820e..fb6a5d828 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7007,6 +7007,14 @@ csstype@^3.0.2: resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.1.tgz#841b532c45c758ee546a11d5bd7b7b473c8c30b9" integrity sha512-DJR/VvkAvSZW9bTouZue2sSxDwdTN92uHjqeKVm+0dAqdfNykRzQ95tay8aXMBAAPpUiq4Qcug2L7neoRh2Egw== +cypress-multi-reporters@^1.6.4: + version "1.6.4" + resolved "https://registry.yarnpkg.com/cypress-multi-reporters/-/cypress-multi-reporters-1.6.4.tgz#6f9d25ed8a0d8d7fa5597977adcd2237d1249931" + integrity sha512-3xU2t6pZjZy/ORHaCvci5OT1DAboS4UuMMM8NBAizeb2C9qmHt+cgAjXgurazkwkPRdO7ccK39M5ZaPCju0r6A== + dependencies: + debug "^4.3.4" + lodash "^4.17.21" + cypress-tags@^1.2.2: version "1.2.2" resolved "https://registry.yarnpkg.com/cypress-tags/-/cypress-tags-1.2.2.tgz#1d992a3eb7f5db9b8b87911cc82c94d7ee9dd217" @@ -7149,11 +7157,6 @@ data-view-byte-offset@^1.0.0: es-errors "^1.3.0" is-data-view "^1.0.1" -dateformat@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" - integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q== - dayjs@^1.10.4: version "1.11.7" resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.7.tgz#4b296922642f70999544d1144a2c25730fce63e2" @@ -7488,11 +7491,6 @@ diff@5.0.0: resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b" integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w== -diff@^5.1.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-5.2.0.tgz#26ded047cd1179b78b9537d5ef725503ce1ae531" - integrity sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A== - diffie-hellman@^5.0.0: version "5.0.3" resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" @@ -9244,6 +9242,11 @@ fsevents@^2.3.2, fsevents@~2.3.2: resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== +fsu@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/fsu/-/fsu-1.1.1.tgz#bd36d3579907c59d85b257a75b836aa9e0c31834" + integrity sha512-xQVsnjJ/5pQtcKh+KjUoZGzVWn4uNkchxTF6Lwjr4Gf7nQr8fmUfhKJ62zE77+xQg9xnxi5KUps7XGs+VC986A== + function-bind@^1.1.1, function-bind@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" @@ -11857,12 +11860,7 @@ json-stable-stringify@~0.0.0: dependencies: jsonify "~0.0.0" -json-stringify-nice@^1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/json-stringify-nice/-/json-stringify-nice-1.1.4.tgz#2c937962b80181d3f317dd39aa323e14f5a60a67" - integrity sha512-5Z5RFW63yxReJ7vANgW6eZFGWaQvnPE3WNmZoOJrSkGju2etKA2L5rrOa1sm877TVTFt57A80BH1bArcmlLfPw== - -json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: +json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== @@ -12369,6 +12367,11 @@ lodash.isboolean@^3.0.3: resolved "https://registry.yarnpkg.com/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz#6c2e171db2a257cd96802fd43b01b20d5f5870f6" integrity sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg== +lodash.isempty@^4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/lodash.isempty/-/lodash.isempty-4.4.0.tgz#6f86cbedd8be4ec987be9aaf33c9684db1b31e7e" + integrity sha512-oKMuF3xEeqDltrGMfDxAPGIVMSSRv8tbRSODbrs4KGsRRLEhrW8N8Rd4DRgB2+621hY8A8XwwrTVhXWpxFvMzg== + lodash.isequal@^3.0: version "3.0.4" resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-3.0.4.tgz#1c35eb3b6ef0cd1ff51743e3ea3cf7fdffdacb64" @@ -12382,7 +12385,7 @@ lodash.isequal@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" integrity sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ== -lodash.isfunction@^3.0.8: +lodash.isfunction@^3.0.8, lodash.isfunction@^3.0.9: version "3.0.9" resolved "https://registry.yarnpkg.com/lodash.isfunction/-/lodash.isfunction-3.0.9.tgz#06de25df4db327ac931981d1bdb067e5af68d051" integrity sha512-AirXNj15uRIMMPihnkInB4i3NHeb4iBtNg9WRWuK2o31S+ePwwNmDPaTL3o7dTJ+VXNZim7rFs4rxN4YU1oUJw== @@ -13080,11 +13083,6 @@ mocha@^10.2.0: yargs-parser "20.2.4" yargs-unparser "2.0.0" -modify-values@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" - integrity sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw== - module-deps@^6.2.3: version "6.2.3" resolved "https://registry.yarnpkg.com/module-deps/-/module-deps-6.2.3.tgz#15490bc02af4b56cf62299c7c17cba32d71a96ee" @@ -17393,18 +17391,6 @@ tar@^4.4.8: safe-buffer "^5.2.1" yallist "^3.1.1" -tar@^6.1.0, tar@^6.1.11, tar@^6.1.2: - version "6.2.1" - resolved "https://registry.yarnpkg.com/tar/-/tar-6.2.1.tgz#717549c541bc3c2af15751bea94b1dd068d4b03a" - integrity sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A== - dependencies: - chownr "^2.0.0" - fs-minipass "^2.0.0" - minipass "^5.0.0" - minizlib "^2.1.1" - mkdirp "^1.0.3" - yallist "^4.0.0" - temp-dir@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/temp-dir/-/temp-dir-2.0.0.tgz#bde92b05bdfeb1516e804c9c00ad45177f31321e" @@ -18259,13 +18245,6 @@ validate-npm-package-license@^3.0.1, validate-npm-package-license@^3.0.4: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" -validate-npm-package-name@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/validate-npm-package-name/-/validate-npm-package-name-4.0.0.tgz#fe8f1c50ac20afdb86f177da85b3600f0ac0d747" - integrity sha512-mzR0L8ZDktZjpX4OB46KT+56MAhl4EIazWP/+G/HPGuvfdaqg4YsCdtOm6U9+LOFyYDoh4dpnpxZRB9MQQns5Q== - dependencies: - builtins "^5.0.0" - value-or-function@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/value-or-function/-/value-or-function-3.0.0.tgz#1c243a50b595c1be54a754bfece8563b9ff8d813" @@ -19053,19 +19032,6 @@ yargs@^13.1.0: y18n "^4.0.0" yargs-parser "^13.1.2" -yargs@^17.5.1: - version "17.7.2" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" - integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== - dependencies: - cliui "^8.0.1" - escalade "^3.1.1" - get-caller-file "^2.0.5" - require-directory "^2.1.1" - string-width "^4.2.3" - y18n "^5.0.5" - yargs-parser "^21.1.1" - yauzl@^2.10.0: version "2.10.0" resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.10.0.tgz#c7eb17c93e112cb1086fa6d8e51fb0667b79a5f9" From 9f563d4e0c389893ede0c3f8ee6e28440e68d10f Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Wed, 2 Oct 2024 12:49:53 +0100 Subject: [PATCH 14/39] chore: debug --- cypress/helpers/startScreen.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cypress/helpers/startScreen.js b/cypress/helpers/startScreen.js index f7e7a1b7d..4b94555ec 100644 --- a/cypress/helpers/startScreen.js +++ b/cypress/helpers/startScreen.js @@ -4,17 +4,23 @@ import { EXTENDED_TIMEOUT } from '../support/util.js' const logPageState = () => { cy.url().then((url) => { cy.log(`Current URL: ${url}`) + cy.task('log', `Current URL: ${url}`) + console.log(`Current URL: ${url}`) }) cy.get('body').then((body) => { const bodyText = body.text() cy.log(`Page Body Content: ${bodyText.slice(0, 500)}...`) + cy.task('log', `Page Body Content: ${bodyText.slice(0, 500)}...`) + console.log(`Page Body Content: ${bodyText.slice(0, 500)}...`) }) } export const goToStartPage = (skipEval) => { cy.visit('/', EXTENDED_TIMEOUT).then(() => { cy.log(`Visiting the base URL: ${Cypress.env('dhis2BaseUrl')}`) + cy.task('log', `Visiting the base URL: ${Cypress.env('dhis2BaseUrl')}`) + console.log(`Visiting the base URL: ${Cypress.env('dhis2BaseUrl')}`) logPageState() if (!skipEval) { @@ -28,6 +34,8 @@ export const expectStartScreenToBeVisible = () => { .should('be.visible') .then(() => { cy.log('Confirmed: "Getting started" is visible') + cy.task('log', 'Confirmed: "Getting started" is visible') + console.log('Confirmed: "Getting started" is visible') }) logPageState() } From 1fc63fd720010ac460ff94dabd6e19c5f603ad52 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Thu, 3 Oct 2024 09:32:20 +0100 Subject: [PATCH 15/39] chore: add cy.task for logging in setupNodeEvents --- cypress.config.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cypress.config.js b/cypress.config.js index 1d84e217b..04cdcd657 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -9,6 +9,13 @@ async function setupNodeEvents(on, config) { chromeAllowXSiteCookies(on, config) excludeByVersionTags(on, config) + on('task', { + log(message) { + console.log(message) + return null + }, + }) + // Delete videos for passing tests on('after:spec', (spec, results) => { try { From 158f67b292558f8414413d28af5b45eba30f480c Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Thu, 3 Oct 2024 09:59:30 +0100 Subject: [PATCH 16/39] chore: add debug logging for login and session handling --- cypress/support/e2e.js | 46 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/cypress/support/e2e.js b/cypress/support/e2e.js index 641209a96..7c3ba3015 100644 --- a/cypress/support/e2e.js +++ b/cypress/support/e2e.js @@ -36,6 +36,11 @@ before(() => { const baseUrl = Cypress.env('dhis2BaseUrl') const instanceVersion = Cypress.env('dhis2InstanceVersion') + cy.task( + 'log', + `Attempting to log in with user: ${username} on base URL: ${baseUrl}` + ) + cy.request({ url: `${baseUrl}/${LOGIN_ENDPOINT}`, method: 'POST', @@ -46,12 +51,20 @@ before(() => { j_password: password, '2fa_code': '', }, - }).should((response) => { + }).then((response) => { + cy.task('log', `Login request returned status: ${response.status}`) expect(response.status).to.eq(200) + if (response.redirectedToUrl) { + cy.task('log', `Redirected to URL: ${response.redirectedToUrl}`) + } }) cy.getAllCookies() .should((cookies) => { + cy.task( + 'log', + `Cookies after login attempt: ${JSON.stringify(cookies)}` + ) expect(cookies.length).to.be.at.least(1) }) .then((cookies) => { @@ -59,10 +72,23 @@ before(() => { baseUrl, cookies ) - Cypress.env( - computeEnvVariableName(instanceVersion), - JSON.stringify(sessionCookieForBaseUrl) - ) + if (sessionCookieForBaseUrl) { + cy.task( + 'log', + `Found session cookie for base URL: ${JSON.stringify( + sessionCookieForBaseUrl + )}` + ) + Cypress.env( + computeEnvVariableName(instanceVersion), + JSON.stringify(sessionCookieForBaseUrl) + ) + } else { + cy.task( + 'log', + `Session cookie not found for base URL: ${baseUrl}` + ) + } }) }) @@ -70,12 +96,20 @@ beforeEach(() => { const baseUrl = Cypress.env('dhis2BaseUrl') const instanceVersion = Cypress.env('dhis2InstanceVersion') const envVariableName = computeEnvVariableName(instanceVersion) - const { name, value, ...options } = JSON.parse(Cypress.env(envVariableName)) + const sessionCookie = Cypress.env(envVariableName) + + cy.task( + 'log', + `Setting session cookie for base URL: ${baseUrl} with cookie data: ${sessionCookie}` + ) + + const { name, value, ...options } = JSON.parse(sessionCookie) localStorage.setItem(LOCAL_STORAGE_KEY, baseUrl) cy.setCookie(name, value, options) cy.getAllCookies().should((cookies) => { + cy.task('log', `Cookies in beforeEach: ${JSON.stringify(cookies)}`) expect(findSessionCookieForBaseUrl(baseUrl, cookies)).to.exist expect(localStorage.getItem(LOCAL_STORAGE_KEY)).to.equal(baseUrl) }) From 038493d40b47fdb9f0f81337c2376eb009c04f50 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Fri, 4 Oct 2024 07:31:21 +0100 Subject: [PATCH 17/39] chore: fix async issue by moving cy.task to cy.then in login flow --- cypress/support/e2e.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cypress/support/e2e.js b/cypress/support/e2e.js index 7c3ba3015..7732ed3a2 100644 --- a/cypress/support/e2e.js +++ b/cypress/support/e2e.js @@ -61,13 +61,14 @@ before(() => { cy.getAllCookies() .should((cookies) => { + expect(cookies.length).to.be.at.least(1) + }) + .then((cookies) => { cy.task( 'log', `Cookies after login attempt: ${JSON.stringify(cookies)}` ) - expect(cookies.length).to.be.at.least(1) - }) - .then((cookies) => { + const sessionCookieForBaseUrl = findSessionCookieForBaseUrl( baseUrl, cookies From 5d0374ce95e70bd75e140eb98a667385a387e537 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Fri, 4 Oct 2024 08:07:50 +0100 Subject: [PATCH 18/39] chore: fix session handling by moving cy.task to cy.then --- cypress/support/e2e.js | 65 +++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/cypress/support/e2e.js b/cypress/support/e2e.js index 7732ed3a2..3ca042a65 100644 --- a/cypress/support/e2e.js +++ b/cypress/support/e2e.js @@ -54,43 +54,33 @@ before(() => { }).then((response) => { cy.task('log', `Login request returned status: ${response.status}`) expect(response.status).to.eq(200) - if (response.redirectedToUrl) { - cy.task('log', `Redirected to URL: ${response.redirectedToUrl}`) - } }) - cy.getAllCookies() - .should((cookies) => { - expect(cookies.length).to.be.at.least(1) - }) - .then((cookies) => { + cy.getAllCookies().then((cookies) => { + cy.task( + 'log', + `Cookies after login attempt: ${JSON.stringify(cookies)}` + ) + + const sessionCookieForBaseUrl = findSessionCookieForBaseUrl( + baseUrl, + cookies + ) + if (sessionCookieForBaseUrl) { cy.task( 'log', - `Cookies after login attempt: ${JSON.stringify(cookies)}` + `Found session cookie for base URL: ${JSON.stringify( + sessionCookieForBaseUrl + )}` ) - - const sessionCookieForBaseUrl = findSessionCookieForBaseUrl( - baseUrl, - cookies + Cypress.env( + computeEnvVariableName(instanceVersion), + JSON.stringify(sessionCookieForBaseUrl) ) - if (sessionCookieForBaseUrl) { - cy.task( - 'log', - `Found session cookie for base URL: ${JSON.stringify( - sessionCookieForBaseUrl - )}` - ) - Cypress.env( - computeEnvVariableName(instanceVersion), - JSON.stringify(sessionCookieForBaseUrl) - ) - } else { - cy.task( - 'log', - `Session cookie not found for base URL: ${baseUrl}` - ) - } - }) + } else { + cy.task('log', `Session cookie not found for base URL: ${baseUrl}`) + } + }) }) beforeEach(() => { @@ -109,9 +99,20 @@ beforeEach(() => { localStorage.setItem(LOCAL_STORAGE_KEY, baseUrl) cy.setCookie(name, value, options) - cy.getAllCookies().should((cookies) => { + cy.getAllCookies().then((cookies) => { cy.task('log', `Cookies in beforeEach: ${JSON.stringify(cookies)}`) expect(findSessionCookieForBaseUrl(baseUrl, cookies)).to.exist expect(localStorage.getItem(LOCAL_STORAGE_KEY)).to.equal(baseUrl) }) + + // Additional check to ensure we're not redirected to the login page + cy.url().then((currentUrl) => { + cy.task( + 'log', + `Current URL after setting session cookie: ${currentUrl}` + ) + if (currentUrl.includes('login')) { + throw new Error('Still on login page after setting session cookie.') + } + }) }) From 418043102e44c696e1f47d5a0e8ee0b538f2f2a3 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Mon, 7 Oct 2024 12:39:23 +0100 Subject: [PATCH 19/39] chore: increase pageLoadTimeout and add reload --- cypress.config.js | 1 + cypress/support/e2e.js | 3 +++ 2 files changed, 4 insertions(+) diff --git a/cypress.config.js b/cypress.config.js index 04cdcd657..ffad1310d 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -86,6 +86,7 @@ module.exports = defineConfig({ specPattern: 'cypress/integration/**/*.cy.js', viewportWidth: 1280, viewportHeight: 800, + pageLoadTimeout: 60000, // Record video video: true, // Enabled to reduce the risk of out-of-memory issues diff --git a/cypress/support/e2e.js b/cypress/support/e2e.js index 3ca042a65..05d98b371 100644 --- a/cypress/support/e2e.js +++ b/cypress/support/e2e.js @@ -115,4 +115,7 @@ beforeEach(() => { throw new Error('Still on login page after setting session cookie.') } }) + + // Force a reload to ensure all resources are loaded + cy.reload() }) From d931e2e9ddf289720cbcdcb46c574a45020c1c51 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Tue, 8 Oct 2024 10:04:29 +0100 Subject: [PATCH 20/39] chore: disable Chrome Web Security to resolve potential CORS issues --- cypress.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/cypress.config.js b/cypress.config.js index ffad1310d..02a83df07 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -89,6 +89,7 @@ module.exports = defineConfig({ pageLoadTimeout: 60000, // Record video video: true, + chromeWebSecurity: false, // Disable Chrome Web Security // Enabled to reduce the risk of out-of-memory issues experimentalMemoryManagement: true, /* When allowing 1 retry on CI, the test suite will pass if From add40597be16a2e1fa783fa7fc23831056798e0b Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Tue, 8 Oct 2024 11:11:42 +0100 Subject: [PATCH 21/39] chore: intercept and log all network requests --- cypress/support/e2e.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cypress/support/e2e.js b/cypress/support/e2e.js index 05d98b371..377ac13dc 100644 --- a/cypress/support/e2e.js +++ b/cypress/support/e2e.js @@ -105,7 +105,13 @@ beforeEach(() => { expect(localStorage.getItem(LOCAL_STORAGE_KEY)).to.equal(baseUrl) }) - // Additional check to ensure we're not redirected to the login page + // Intercept and log all network requests + cy.intercept('*').as('allRequests') // Intercept all requests + cy.wait('@allRequests').then((interception) => { + cy.task('log', `Intercepted request: ${JSON.stringify(interception)}`) + }) + + // Log the current URL cy.url().then((currentUrl) => { cy.task( 'log', From af08b56d20628625d6be8911e7577ef745b50e92 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Tue, 8 Oct 2024 14:42:00 +0100 Subject: [PATCH 22/39] chore: debug --- cypress/support/e2e.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cypress/support/e2e.js b/cypress/support/e2e.js index 377ac13dc..b91e60d88 100644 --- a/cypress/support/e2e.js +++ b/cypress/support/e2e.js @@ -105,9 +105,9 @@ beforeEach(() => { expect(localStorage.getItem(LOCAL_STORAGE_KEY)).to.equal(baseUrl) }) - // Intercept and log all network requests - cy.intercept('*').as('allRequests') // Intercept all requests - cy.wait('@allRequests').then((interception) => { + // Intercept and log api requests + cy.intercept('/api/**').as('apiRequests') + cy.wait('@apiRequests').then((interception) => { cy.task('log', `Intercepted request: ${JSON.stringify(interception)}`) }) From 193209980a443b362e0f55d9531fb244b21154f8 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Wed, 9 Oct 2024 17:05:19 +0100 Subject: [PATCH 23/39] debug --- cypress/support/e2e.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cypress/support/e2e.js b/cypress/support/e2e.js index b91e60d88..a2dce0177 100644 --- a/cypress/support/e2e.js +++ b/cypress/support/e2e.js @@ -105,11 +105,11 @@ beforeEach(() => { expect(localStorage.getItem(LOCAL_STORAGE_KEY)).to.equal(baseUrl) }) - // Intercept and log api requests - cy.intercept('/api/**').as('apiRequests') - cy.wait('@apiRequests').then((interception) => { - cy.task('log', `Intercepted request: ${JSON.stringify(interception)}`) - }) + // // Intercept and log api requests + // cy.intercept('/api/**').as('apiRequests') + // cy.wait('@apiRequests').then((interception) => { + // cy.task('log', `Intercepted request: ${JSON.stringify(interception)}`) + // }) // Log the current URL cy.url().then((currentUrl) => { @@ -123,5 +123,5 @@ beforeEach(() => { }) // Force a reload to ensure all resources are loaded - cy.reload() + // cy.reload() }) From 1d8cdad30dd6e463161f0f2a84d8e7dc721c37e4 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Mon, 14 Oct 2024 08:40:57 +0100 Subject: [PATCH 24/39] chore: update line-listing url --- .github/workflows/e2e-test-dispatch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-test-dispatch.yml b/.github/workflows/e2e-test-dispatch.yml index 6f2de01a5..a48449e19 100644 --- a/.github/workflows/e2e-test-dispatch.yml +++ b/.github/workflows/e2e-test-dispatch.yml @@ -34,7 +34,7 @@ jobs: with: should_record: ${{ contains(github.event.head_commit.message, '[e2e record]') || contains(join(github.event.pull_request.labels.*.name), 'e2e record')}} spec-group: ${{ needs.setup-matrix.outputs.matrix }} - instance_url: ${{ github.event.inputs.instance_url }} + instance_url: ${{ github.event.inputs.instance_url }}/api/apps/line-listing/index.html dhis2_version: ${{ github.event.inputs.dhis2_version }} secrets: username: ${{ secrets.CYPRESS_DHIS2_USERNAME }} From d24b04ab087d312dcf5d7dedc138cd656caeb5d6 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Wed, 23 Oct 2024 11:31:59 +0100 Subject: [PATCH 25/39] chore: refactor workflow for dynamic app and API URLs --- .github/workflows/e2e-test-dispatch.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e-test-dispatch.yml b/.github/workflows/e2e-test-dispatch.yml index a48449e19..792f4f202 100644 --- a/.github/workflows/e2e-test-dispatch.yml +++ b/.github/workflows/e2e-test-dispatch.yml @@ -32,9 +32,10 @@ jobs: needs: setup-matrix uses: dhis2/workflows/.github/workflows/analytics-e2e-tests-triggered-by-core.yml@workflow-dispatch-cypress with: - should_record: ${{ contains(github.event.head_commit.message, '[e2e record]') || contains(join(github.event.pull_request.labels.*.name), 'e2e record')}} + should_record: ${{ contains(github.event.head_commit.message, '[e2e record]') || contains(join(github.event.pull_request.labels.*.name), 'e2e record') }} spec-group: ${{ needs.setup-matrix.outputs.matrix }} - instance_url: ${{ github.event.inputs.instance_url }}/api/apps/line-listing/index.html + api_base_url: ${{ github.event.inputs.instance_url }} + app_url: ${{ github.event.inputs.instance_url }}/api/apps/line-listing/index.html dhis2_version: ${{ github.event.inputs.dhis2_version }} secrets: username: ${{ secrets.CYPRESS_DHIS2_USERNAME }} From 747711a8b4194303fe50672a88d21eaa9acd1265 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Tue, 5 Nov 2024 19:46:34 +0000 Subject: [PATCH 26/39] fix --- yarn.lock | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 109 insertions(+), 1 deletion(-) diff --git a/yarn.lock b/yarn.lock index fb6a5d828..827aa65f7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7157,6 +7157,16 @@ data-view-byte-offset@^1.0.0: es-errors "^1.3.0" is-data-view "^1.0.1" +dateformat@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" + integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q== + +dateformat@^4.5.1: + version "4.6.3" + resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-4.6.3.tgz#556fa6497e5217fedb78821424f8a1c22fa3f4b5" + integrity sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA== + dayjs@^1.10.4: version "1.11.7" resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.7.tgz#4b296922642f70999544d1144a2c25730fce63e2" @@ -7491,6 +7501,11 @@ diff@5.0.0: resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b" integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w== +diff@^5.0.0, diff@^5.1.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-5.2.0.tgz#26ded047cd1179b78b9537d5ef725503ce1ae531" + integrity sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A== + diffie-hellman@^5.0.0: version "5.0.3" resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" @@ -11860,7 +11875,12 @@ json-stable-stringify@~0.0.0: dependencies: jsonify "~0.0.0" -json-stringify-safe@~5.0.1: +json-stringify-nice@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/json-stringify-nice/-/json-stringify-nice-1.1.4.tgz#2c937962b80181d3f317dd39aa323e14f5a60a67" + integrity sha512-5Z5RFW63yxReJ7vANgW6eZFGWaQvnPE3WNmZoOJrSkGju2etKA2L5rrOa1sm877TVTFt57A80BH1bArcmlLfPw== + +json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== @@ -13083,6 +13103,45 @@ mocha@^10.2.0: yargs-parser "20.2.4" yargs-unparser "2.0.0" +mochawesome-report-generator@^6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/mochawesome-report-generator/-/mochawesome-report-generator-6.2.0.tgz#65a30a11235ba7a68e1cf0ca1df80d764b93ae78" + integrity sha512-Ghw8JhQFizF0Vjbtp9B0i//+BOkV5OWcQCPpbO0NGOoxV33o+gKDYU0Pr2pGxkIHnqZ+g5mYiXF7GMNgAcDpSg== + dependencies: + chalk "^4.1.2" + dateformat "^4.5.1" + escape-html "^1.0.3" + fs-extra "^10.0.0" + fsu "^1.1.1" + lodash.isfunction "^3.0.9" + opener "^1.5.2" + prop-types "^15.7.2" + tcomb "^3.2.17" + tcomb-validation "^3.3.0" + validator "^13.6.0" + yargs "^17.2.1" + +mochawesome@^7.1.3: + version "7.1.3" + resolved "https://registry.yarnpkg.com/mochawesome/-/mochawesome-7.1.3.tgz#07b358138f37f5b07b51a1b255d84babfa36fa83" + integrity sha512-Vkb3jR5GZ1cXohMQQ73H3cZz7RoxGjjUo0G5hu0jLaW+0FdUxUwg3Cj29bqQdh0rFcnyV06pWmqmi5eBPnEuNQ== + dependencies: + chalk "^4.1.2" + diff "^5.0.0" + json-stringify-safe "^5.0.1" + lodash.isempty "^4.4.0" + lodash.isfunction "^3.0.9" + lodash.isobject "^3.0.2" + lodash.isstring "^4.0.1" + mochawesome-report-generator "^6.2.0" + strip-ansi "^6.0.1" + uuid "^8.3.2" + +modify-values@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" + integrity sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw== + module-deps@^6.2.3: version "6.2.3" resolved "https://registry.yarnpkg.com/module-deps/-/module-deps-6.2.3.tgz#15490bc02af4b56cf62299c7c17cba32d71a96ee" @@ -17391,6 +17450,30 @@ tar@^4.4.8: safe-buffer "^5.2.1" yallist "^3.1.1" +tar@^6.1.0, tar@^6.1.11, tar@^6.1.2: + version "6.2.1" + resolved "https://registry.yarnpkg.com/tar/-/tar-6.2.1.tgz#717549c541bc3c2af15751bea94b1dd068d4b03a" + integrity sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A== + dependencies: + chownr "^2.0.0" + fs-minipass "^2.0.0" + minipass "^5.0.0" + minizlib "^2.1.1" + mkdirp "^1.0.3" + yallist "^4.0.0" + +tcomb-validation@^3.3.0: + version "3.4.1" + resolved "https://registry.yarnpkg.com/tcomb-validation/-/tcomb-validation-3.4.1.tgz#a7696ec176ce56a081d9e019f8b732a5a8894b65" + integrity sha512-urVVMQOma4RXwiVCa2nM2eqrAomHROHvWPuj6UkDGz/eb5kcy0x6P0dVt6kzpUZtYMNoAqJLWmz1BPtxrtjtrA== + dependencies: + tcomb "^3.0.0" + +tcomb@^3.0.0, tcomb@^3.2.17: + version "3.2.29" + resolved "https://registry.yarnpkg.com/tcomb/-/tcomb-3.2.29.tgz#32404fe9456d90c2cf4798682d37439f1ccc386c" + integrity sha512-di2Hd1DB2Zfw6StGv861JoAF5h/uQVu/QJp2g8KVbtfKnoHdBQl5M32YWq6mnSYBQ1vFFrns5B1haWJL7rKaOQ== + temp-dir@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/temp-dir/-/temp-dir-2.0.0.tgz#bde92b05bdfeb1516e804c9c00ad45177f31321e" @@ -18245,6 +18328,18 @@ validate-npm-package-license@^3.0.1, validate-npm-package-license@^3.0.4: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" +validate-npm-package-name@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/validate-npm-package-name/-/validate-npm-package-name-4.0.0.tgz#fe8f1c50ac20afdb86f177da85b3600f0ac0d747" + integrity sha512-mzR0L8ZDktZjpX4OB46KT+56MAhl4EIazWP/+G/HPGuvfdaqg4YsCdtOm6U9+LOFyYDoh4dpnpxZRB9MQQns5Q== + dependencies: + builtins "^5.0.0" + +validator@^13.6.0: + version "13.12.0" + resolved "https://registry.yarnpkg.com/validator/-/validator-13.12.0.tgz#7d78e76ba85504da3fee4fd1922b385914d4b35f" + integrity sha512-c1Q0mCiPlgdTVVVIJIrBuxNicYE+t/7oKeI9MWLj3fh/uq2Pxh/3eeWbVZ4OcGW1TUf53At0njHw5SMdA3tmMg== + value-or-function@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/value-or-function/-/value-or-function-3.0.0.tgz#1c243a50b595c1be54a754bfece8563b9ff8d813" @@ -19032,6 +19127,19 @@ yargs@^13.1.0: y18n "^4.0.0" yargs-parser "^13.1.2" +yargs@^17.2.1, yargs@^17.5.1: + version "17.7.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" + integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== + dependencies: + cliui "^8.0.1" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.3" + y18n "^5.0.5" + yargs-parser "^21.1.1" + yauzl@^2.10.0: version "2.10.0" resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.10.0.tgz#c7eb17c93e112cb1086fa6d8e51fb0667b79a5f9" From 48f0b4c557854c1c5df7e724d733b53948ad8aea Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Tue, 5 Nov 2024 20:52:42 +0000 Subject: [PATCH 27/39] chore: cleanup --- package.json | 1 - yarn.lock | 72 +++------------------------------------------------- 2 files changed, 3 insertions(+), 70 deletions(-) diff --git a/package.json b/package.json index 6541b39c2..d292e8ee4 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,6 @@ "eslint-plugin-cypress": "^2.12.1", "identity-obj-proxy": "^3.0.0", "jest-enzyme": "^7.1.2", - "mochawesome": "^7.1.3", "redux-mock-store": "^1.5.4", "semantic-release": "^20", "start-server-and-test": "^1.14.0", diff --git a/yarn.lock b/yarn.lock index 827aa65f7..b7329a0cc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7162,11 +7162,6 @@ dateformat@^3.0.0: resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q== -dateformat@^4.5.1: - version "4.6.3" - resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-4.6.3.tgz#556fa6497e5217fedb78821424f8a1c22fa3f4b5" - integrity sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA== - dayjs@^1.10.4: version "1.11.7" resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.7.tgz#4b296922642f70999544d1144a2c25730fce63e2" @@ -7501,7 +7496,7 @@ diff@5.0.0: resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b" integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w== -diff@^5.0.0, diff@^5.1.0: +diff@^5.1.0: version "5.2.0" resolved "https://registry.yarnpkg.com/diff/-/diff-5.2.0.tgz#26ded047cd1179b78b9537d5ef725503ce1ae531" integrity sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A== @@ -9257,11 +9252,6 @@ fsevents@^2.3.2, fsevents@~2.3.2: resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== -fsu@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/fsu/-/fsu-1.1.1.tgz#bd36d3579907c59d85b257a75b836aa9e0c31834" - integrity sha512-xQVsnjJ/5pQtcKh+KjUoZGzVWn4uNkchxTF6Lwjr4Gf7nQr8fmUfhKJ62zE77+xQg9xnxi5KUps7XGs+VC986A== - function-bind@^1.1.1, function-bind@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" @@ -12387,11 +12377,6 @@ lodash.isboolean@^3.0.3: resolved "https://registry.yarnpkg.com/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz#6c2e171db2a257cd96802fd43b01b20d5f5870f6" integrity sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg== -lodash.isempty@^4.4.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/lodash.isempty/-/lodash.isempty-4.4.0.tgz#6f86cbedd8be4ec987be9aaf33c9684db1b31e7e" - integrity sha512-oKMuF3xEeqDltrGMfDxAPGIVMSSRv8tbRSODbrs4KGsRRLEhrW8N8Rd4DRgB2+621hY8A8XwwrTVhXWpxFvMzg== - lodash.isequal@^3.0: version "3.0.4" resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-3.0.4.tgz#1c35eb3b6ef0cd1ff51743e3ea3cf7fdffdacb64" @@ -12405,7 +12390,7 @@ lodash.isequal@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" integrity sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ== -lodash.isfunction@^3.0.8, lodash.isfunction@^3.0.9: +lodash.isfunction@^3.0.8: version "3.0.9" resolved "https://registry.yarnpkg.com/lodash.isfunction/-/lodash.isfunction-3.0.9.tgz#06de25df4db327ac931981d1bdb067e5af68d051" integrity sha512-AirXNj15uRIMMPihnkInB4i3NHeb4iBtNg9WRWuK2o31S+ePwwNmDPaTL3o7dTJ+VXNZim7rFs4rxN4YU1oUJw== @@ -13103,40 +13088,6 @@ mocha@^10.2.0: yargs-parser "20.2.4" yargs-unparser "2.0.0" -mochawesome-report-generator@^6.2.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/mochawesome-report-generator/-/mochawesome-report-generator-6.2.0.tgz#65a30a11235ba7a68e1cf0ca1df80d764b93ae78" - integrity sha512-Ghw8JhQFizF0Vjbtp9B0i//+BOkV5OWcQCPpbO0NGOoxV33o+gKDYU0Pr2pGxkIHnqZ+g5mYiXF7GMNgAcDpSg== - dependencies: - chalk "^4.1.2" - dateformat "^4.5.1" - escape-html "^1.0.3" - fs-extra "^10.0.0" - fsu "^1.1.1" - lodash.isfunction "^3.0.9" - opener "^1.5.2" - prop-types "^15.7.2" - tcomb "^3.2.17" - tcomb-validation "^3.3.0" - validator "^13.6.0" - yargs "^17.2.1" - -mochawesome@^7.1.3: - version "7.1.3" - resolved "https://registry.yarnpkg.com/mochawesome/-/mochawesome-7.1.3.tgz#07b358138f37f5b07b51a1b255d84babfa36fa83" - integrity sha512-Vkb3jR5GZ1cXohMQQ73H3cZz7RoxGjjUo0G5hu0jLaW+0FdUxUwg3Cj29bqQdh0rFcnyV06pWmqmi5eBPnEuNQ== - dependencies: - chalk "^4.1.2" - diff "^5.0.0" - json-stringify-safe "^5.0.1" - lodash.isempty "^4.4.0" - lodash.isfunction "^3.0.9" - lodash.isobject "^3.0.2" - lodash.isstring "^4.0.1" - mochawesome-report-generator "^6.2.0" - strip-ansi "^6.0.1" - uuid "^8.3.2" - modify-values@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" @@ -17462,18 +17413,6 @@ tar@^6.1.0, tar@^6.1.11, tar@^6.1.2: mkdirp "^1.0.3" yallist "^4.0.0" -tcomb-validation@^3.3.0: - version "3.4.1" - resolved "https://registry.yarnpkg.com/tcomb-validation/-/tcomb-validation-3.4.1.tgz#a7696ec176ce56a081d9e019f8b732a5a8894b65" - integrity sha512-urVVMQOma4RXwiVCa2nM2eqrAomHROHvWPuj6UkDGz/eb5kcy0x6P0dVt6kzpUZtYMNoAqJLWmz1BPtxrtjtrA== - dependencies: - tcomb "^3.0.0" - -tcomb@^3.0.0, tcomb@^3.2.17: - version "3.2.29" - resolved "https://registry.yarnpkg.com/tcomb/-/tcomb-3.2.29.tgz#32404fe9456d90c2cf4798682d37439f1ccc386c" - integrity sha512-di2Hd1DB2Zfw6StGv861JoAF5h/uQVu/QJp2g8KVbtfKnoHdBQl5M32YWq6mnSYBQ1vFFrns5B1haWJL7rKaOQ== - temp-dir@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/temp-dir/-/temp-dir-2.0.0.tgz#bde92b05bdfeb1516e804c9c00ad45177f31321e" @@ -18335,11 +18274,6 @@ validate-npm-package-name@^4.0.0: dependencies: builtins "^5.0.0" -validator@^13.6.0: - version "13.12.0" - resolved "https://registry.yarnpkg.com/validator/-/validator-13.12.0.tgz#7d78e76ba85504da3fee4fd1922b385914d4b35f" - integrity sha512-c1Q0mCiPlgdTVVVIJIrBuxNicYE+t/7oKeI9MWLj3fh/uq2Pxh/3eeWbVZ4OcGW1TUf53At0njHw5SMdA3tmMg== - value-or-function@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/value-or-function/-/value-or-function-3.0.0.tgz#1c243a50b595c1be54a754bfece8563b9ff8d813" @@ -19127,7 +19061,7 @@ yargs@^13.1.0: y18n "^4.0.0" yargs-parser "^13.1.2" -yargs@^17.2.1, yargs@^17.5.1: +yargs@^17.5.1: version "17.7.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== From 20903c190f8804c86626e837ca0332585a814c77 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Tue, 3 Dec 2024 11:25:33 +0000 Subject: [PATCH 28/39] debug: update cy.visit() to use baseUrl directly in goToStartPage --- cypress/helpers/startScreen.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/helpers/startScreen.js b/cypress/helpers/startScreen.js index 4b94555ec..9f58cec9e 100644 --- a/cypress/helpers/startScreen.js +++ b/cypress/helpers/startScreen.js @@ -17,7 +17,7 @@ const logPageState = () => { } export const goToStartPage = (skipEval) => { - cy.visit('/', EXTENDED_TIMEOUT).then(() => { + cy.visit('', EXTENDED_TIMEOUT).then(() => { cy.log(`Visiting the base URL: ${Cypress.env('dhis2BaseUrl')}`) cy.task('log', `Visiting the base URL: ${Cypress.env('dhis2BaseUrl')}`) console.log(`Visiting the base URL: ${Cypress.env('dhis2BaseUrl')}`) From 2f50370641893df0eb5f2036ac51c74c8cb70dae Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Tue, 3 Dec 2024 12:11:32 +0000 Subject: [PATCH 29/39] debug --- .../conditions/alphanumericConditions.cy.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/cypress/integration/conditions/alphanumericConditions.cy.js b/cypress/integration/conditions/alphanumericConditions.cy.js index 44655fee1..fe8f09334 100644 --- a/cypress/integration/conditions/alphanumericConditions.cy.js +++ b/cypress/integration/conditions/alphanumericConditions.cy.js @@ -49,6 +49,28 @@ const periodLabel = event[DIMENSION_ID_EVENT_DATE] const currentYear = getCurrentYearStr() +// Debugging Block +describe.only('Debug Trailing Slash Issue', () => { + it('Logs requests and responses for trailing slash', () => { + cy.intercept('**', (req) => { + console.log(`Request URL: ${req.url}`) + req.on('response', (res) => { + console.log(`Response Status: ${res.statusCode}`) + if (res.headers.location) { + console.log(`Redirected To: ${res.headers.location}`) + } + }) + }).as('requests') + + // Visit the base URL without appending a trailing slash + cy.visit( + 'https://test.e2e.dhis2.org/analytics-2.41/api/apps/line-listing/index.html' + ) + + // Wait for intercepted requests + cy.wait('@requests') + }) + /* // one way to make sure that conditions work for TE is to simply duplicate the tests we have today and adapt them to TE, here's a quick plan for that: // TODO: make a copy of the "describe('text conditions..." below From ba2fadfcf6aa417328adb49b169126e1bbb36fcb Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Wed, 4 Dec 2024 09:13:57 +0000 Subject: [PATCH 30/39] debug: normalise base URL to fix trailing slash --- cypress/helpers/startScreen.js | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/cypress/helpers/startScreen.js b/cypress/helpers/startScreen.js index 9f58cec9e..d0d39c405 100644 --- a/cypress/helpers/startScreen.js +++ b/cypress/helpers/startScreen.js @@ -17,16 +17,22 @@ const logPageState = () => { } export const goToStartPage = (skipEval) => { - cy.visit('', EXTENDED_TIMEOUT).then(() => { - cy.log(`Visiting the base URL: ${Cypress.env('dhis2BaseUrl')}`) - cy.task('log', `Visiting the base URL: ${Cypress.env('dhis2BaseUrl')}`) - console.log(`Visiting the base URL: ${Cypress.env('dhis2BaseUrl')}`) - logPageState() + const processedUrl = Cypress.env('dhis2BaseUrl').replace(/\/$/, '') + cy.log(`dhis2BaseUrl: ${Cypress.env('dhis2BaseUrl')}`) + cy.log(`Visiting URL: ${processedUrl}`) - if (!skipEval) { - expectStartScreenToBeVisible() - } - }) + cy.visit(processedUrl, EXTENDED_TIMEOUT) + .then(() => { + cy.log(`Visited URL: ${processedUrl}`) + logPageState() + + if (!skipEval) { + expectStartScreenToBeVisible() + } + }) + .catch((error) => { + cy.log(`Error visiting URL: ${error.message}`) + }) } export const expectStartScreenToBeVisible = () => { From e0903ffcfa2de40d39d0f33c3ff535c2e54d9287 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Wed, 4 Dec 2024 09:34:05 +0000 Subject: [PATCH 31/39] debug --- cypress/helpers/startScreen.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cypress/helpers/startScreen.js b/cypress/helpers/startScreen.js index d0d39c405..16d48f003 100644 --- a/cypress/helpers/startScreen.js +++ b/cypress/helpers/startScreen.js @@ -18,12 +18,12 @@ const logPageState = () => { export const goToStartPage = (skipEval) => { const processedUrl = Cypress.env('dhis2BaseUrl').replace(/\/$/, '') - cy.log(`dhis2BaseUrl: ${Cypress.env('dhis2BaseUrl')}`) - cy.log(`Visiting URL: ${processedUrl}`) + cy.task('log', `dhis2BaseUrl: ${Cypress.env('dhis2BaseUrl')}`) + cy.task('log', `Visiting URL: ${processedUrl}`) cy.visit(processedUrl, EXTENDED_TIMEOUT) .then(() => { - cy.log(`Visited URL: ${processedUrl}`) + cy.task('log', `Visited URL: ${processedUrl}`) logPageState() if (!skipEval) { @@ -31,7 +31,7 @@ export const goToStartPage = (skipEval) => { } }) .catch((error) => { - cy.log(`Error visiting URL: ${error.message}`) + cy.task('log', `Error visiting URL: ${error.message}`) }) } From 25677d09339cf70b87df80c03bf8d97e9d5c9b6d Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Wed, 4 Dec 2024 10:28:44 +0000 Subject: [PATCH 32/39] debug --- cypress/helpers/startScreen.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cypress/helpers/startScreen.js b/cypress/helpers/startScreen.js index 16d48f003..0bf41c3e9 100644 --- a/cypress/helpers/startScreen.js +++ b/cypress/helpers/startScreen.js @@ -17,9 +17,10 @@ const logPageState = () => { } export const goToStartPage = (skipEval) => { + const initialBaseURL = Cypress.env('dhis2BaseUrl') + cy.task('log', `** initialBaseURL URL: ${initialBaseURL}`) const processedUrl = Cypress.env('dhis2BaseUrl').replace(/\/$/, '') - cy.task('log', `dhis2BaseUrl: ${Cypress.env('dhis2BaseUrl')}`) - cy.task('log', `Visiting URL: ${processedUrl}`) + cy.task('log', `** Visiting URL: ${processedUrl}`) cy.visit(processedUrl, EXTENDED_TIMEOUT) .then(() => { From 4987f3767c21b5f0e7d71a97fb7db5fb584e4c68 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Fri, 6 Dec 2024 09:49:18 +0000 Subject: [PATCH 33/39] debug: test with a hardcodedUrl --- cypress/helpers/startScreen.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cypress/helpers/startScreen.js b/cypress/helpers/startScreen.js index 0bf41c3e9..c3b21db8e 100644 --- a/cypress/helpers/startScreen.js +++ b/cypress/helpers/startScreen.js @@ -17,14 +17,14 @@ const logPageState = () => { } export const goToStartPage = (skipEval) => { - const initialBaseURL = Cypress.env('dhis2BaseUrl') - cy.task('log', `** initialBaseURL URL: ${initialBaseURL}`) - const processedUrl = Cypress.env('dhis2BaseUrl').replace(/\/$/, '') - cy.task('log', `** Visiting URL: ${processedUrl}`) + // Hardcoded URL for testing + const hardcodedUrl = + 'https://test.e2e.dhis2.org/analytics-2.41/api/apps/line-listing/index.html' + cy.task('log', `** Hardcoded URL: ${hardcodedUrl}`) - cy.visit(processedUrl, EXTENDED_TIMEOUT) + cy.visit(hardcodedUrl, EXTENDED_TIMEOUT) .then(() => { - cy.task('log', `Visited URL: ${processedUrl}`) + cy.task('log', `***Visited URL: ${hardcodedUrl}`) logPageState() if (!skipEval) { From 75932a4b3a8083124bc109e08f6a7464209363c2 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Mon, 9 Dec 2024 09:26:40 +0000 Subject: [PATCH 34/39] debug --- cypress/helpers/startScreen.js | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/cypress/helpers/startScreen.js b/cypress/helpers/startScreen.js index c3b21db8e..a6b26a6c0 100644 --- a/cypress/helpers/startScreen.js +++ b/cypress/helpers/startScreen.js @@ -20,20 +20,17 @@ export const goToStartPage = (skipEval) => { // Hardcoded URL for testing const hardcodedUrl = 'https://test.e2e.dhis2.org/analytics-2.41/api/apps/line-listing/index.html' - cy.task('log', `** Hardcoded URL: ${hardcodedUrl}`) - cy.visit(hardcodedUrl, EXTENDED_TIMEOUT) - .then(() => { - cy.task('log', `***Visited URL: ${hardcodedUrl}`) - logPageState() + cy.visit(hardcodedUrl, EXTENDED_TIMEOUT).then(() => { + cy.log(`Visiting the URL: ${hardcodedUrl}`) + cy.task('log', `Visiting the URL: ${hardcodedUrl}`) + console.log(`Visiting the URL: ${hardcodedUrl}`) + logPageState() - if (!skipEval) { - expectStartScreenToBeVisible() - } - }) - .catch((error) => { - cy.task('log', `Error visiting URL: ${error.message}`) - }) + if (!skipEval) { + expectStartScreenToBeVisible() + } + }) } export const expectStartScreenToBeVisible = () => { From 60124d4851f2b260801337cf9782b45221754fbc Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Mon, 9 Dec 2024 10:03:35 +0000 Subject: [PATCH 35/39] debug hardcodedUrl --- cypress/helpers/startScreen.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cypress/helpers/startScreen.js b/cypress/helpers/startScreen.js index a6b26a6c0..e8c1fe46f 100644 --- a/cypress/helpers/startScreen.js +++ b/cypress/helpers/startScreen.js @@ -19,7 +19,9 @@ const logPageState = () => { export const goToStartPage = (skipEval) => { // Hardcoded URL for testing const hardcodedUrl = - 'https://test.e2e.dhis2.org/analytics-2.41/api/apps/line-listing/index.html' + 'https://play.im.dhis2.org/stable-2-39-7-1/api/apps/line-listing/index.html' + + // 'https://test.e2e.dhis2.org/analytics-2.41/api/apps/line-listing/index.html' cy.visit(hardcodedUrl, EXTENDED_TIMEOUT).then(() => { cy.log(`Visiting the URL: ${hardcodedUrl}`) From 85f6475a94b3ec88e2fff744689dfc6a3151b753 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Mon, 9 Dec 2024 10:49:37 +0000 Subject: [PATCH 36/39] debug use instance created 2.39 --- cypress/helpers/startScreen.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/helpers/startScreen.js b/cypress/helpers/startScreen.js index e8c1fe46f..0fd5352f4 100644 --- a/cypress/helpers/startScreen.js +++ b/cypress/helpers/startScreen.js @@ -19,7 +19,7 @@ const logPageState = () => { export const goToStartPage = (skipEval) => { // Hardcoded URL for testing const hardcodedUrl = - 'https://play.im.dhis2.org/stable-2-39-7-1/api/apps/line-listing/index.html' + 'https://qa.im.dhis2.org/core-triggerexternalappstest-107/api/apps/line-listing/index.html' // 'https://test.e2e.dhis2.org/analytics-2.41/api/apps/line-listing/index.html' From 0bf518aa4e201a4bc19fad3426aad11d2f62faf8 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Mon, 16 Dec 2024 09:10:51 +0000 Subject: [PATCH 37/39] Debug --- cypress/helpers/startScreen.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/helpers/startScreen.js b/cypress/helpers/startScreen.js index 0fd5352f4..95a2daa8c 100644 --- a/cypress/helpers/startScreen.js +++ b/cypress/helpers/startScreen.js @@ -19,9 +19,9 @@ const logPageState = () => { export const goToStartPage = (skipEval) => { // Hardcoded URL for testing const hardcodedUrl = - 'https://qa.im.dhis2.org/core-triggerexternalappstest-107/api/apps/line-listing/index.html' + 'https://test.e2e.dhis2.org/analytics-2.41/api/apps/line-listing/index.html' - // 'https://test.e2e.dhis2.org/analytics-2.41/api/apps/line-listing/index.html' + // 'https://qa.im.dhis2.org/core-triggerexternalappstest-107/api/apps/line-listing/index.html' cy.visit(hardcodedUrl, EXTENDED_TIMEOUT).then(() => { cy.log(`Visiting the URL: ${hardcodedUrl}`) From 9c022179ecfec02555f893f9cf9c37d8efa1385f Mon Sep 17 00:00:00 2001 From: adeldhis2 Date: Wed, 25 Dec 2024 11:54:48 +0100 Subject: [PATCH 38/39] cleanup --- cypress/helpers/startScreen.js | 16 +++++--------- .../conditions/alphanumericConditions.cy.js | 22 ------------------- 2 files changed, 6 insertions(+), 32 deletions(-) diff --git a/cypress/helpers/startScreen.js b/cypress/helpers/startScreen.js index 95a2daa8c..220c3171f 100644 --- a/cypress/helpers/startScreen.js +++ b/cypress/helpers/startScreen.js @@ -17,16 +17,12 @@ const logPageState = () => { } export const goToStartPage = (skipEval) => { - // Hardcoded URL for testing - const hardcodedUrl = - 'https://test.e2e.dhis2.org/analytics-2.41/api/apps/line-listing/index.html' - - // 'https://qa.im.dhis2.org/core-triggerexternalappstest-107/api/apps/line-listing/index.html' - - cy.visit(hardcodedUrl, EXTENDED_TIMEOUT).then(() => { - cy.log(`Visiting the URL: ${hardcodedUrl}`) - cy.task('log', `Visiting the URL: ${hardcodedUrl}`) - console.log(`Visiting the URL: ${hardcodedUrl}`) + const appPath = '/api/apps/line-listing/index.html'; + const baseUrl = Cypress.env('dhis2BaseUrl') + appPath; + cy.visit(baseUrl, EXTENDED_TIMEOUT).then(() => { + cy.log(`Visiting the base URL: ${baseUrl}`) + cy.task('log', `Visiting the base URL: ${baseUrl}`) + console.log(`Visiting the base URL: ${baseUrl}`) logPageState() if (!skipEval) { diff --git a/cypress/integration/conditions/alphanumericConditions.cy.js b/cypress/integration/conditions/alphanumericConditions.cy.js index fe8f09334..44655fee1 100644 --- a/cypress/integration/conditions/alphanumericConditions.cy.js +++ b/cypress/integration/conditions/alphanumericConditions.cy.js @@ -49,28 +49,6 @@ const periodLabel = event[DIMENSION_ID_EVENT_DATE] const currentYear = getCurrentYearStr() -// Debugging Block -describe.only('Debug Trailing Slash Issue', () => { - it('Logs requests and responses for trailing slash', () => { - cy.intercept('**', (req) => { - console.log(`Request URL: ${req.url}`) - req.on('response', (res) => { - console.log(`Response Status: ${res.statusCode}`) - if (res.headers.location) { - console.log(`Redirected To: ${res.headers.location}`) - } - }) - }).as('requests') - - // Visit the base URL without appending a trailing slash - cy.visit( - 'https://test.e2e.dhis2.org/analytics-2.41/api/apps/line-listing/index.html' - ) - - // Wait for intercepted requests - cy.wait('@requests') - }) - /* // one way to make sure that conditions work for TE is to simply duplicate the tests we have today and adapt them to TE, here's a quick plan for that: // TODO: make a copy of the "describe('text conditions..." below From 8b6c5c2633907b3c193a51fa02bb83e5f43362dd Mon Sep 17 00:00:00 2001 From: adeldhis2 Date: Wed, 25 Dec 2024 12:01:16 +0100 Subject: [PATCH 39/39] cleanup --- .github/workflows/e2e-test-dispatch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-test-dispatch.yml b/.github/workflows/e2e-test-dispatch.yml index 792f4f202..01aedcb12 100644 --- a/.github/workflows/e2e-test-dispatch.yml +++ b/.github/workflows/e2e-test-dispatch.yml @@ -35,7 +35,7 @@ jobs: should_record: ${{ contains(github.event.head_commit.message, '[e2e record]') || contains(join(github.event.pull_request.labels.*.name), 'e2e record') }} spec-group: ${{ needs.setup-matrix.outputs.matrix }} api_base_url: ${{ github.event.inputs.instance_url }} - app_url: ${{ github.event.inputs.instance_url }}/api/apps/line-listing/index.html + app_url: ${{ github.event.inputs.instance_url }} dhis2_version: ${{ github.event.inputs.dhis2_version }} secrets: username: ${{ secrets.CYPRESS_DHIS2_USERNAME }}