Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add new workflow to trigger Cypress tests from core #614

Draft
wants to merge 43 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
37f7389
Add new workflow to trigger Cypress tests from core
adeldhis2 Aug 19, 2024
e48b96b
fix
adeldhis2 Aug 19, 2024
9acfc6a
fix
adeldhis2 Aug 19, 2024
3181863
chore: update workflow to use workflow_dispatch
adeldhis2 Sep 12, 2024
6947362
chore: add debug logging for matrix output
adeldhis2 Sep 12, 2024
edda2ea
chore: fix matrix parsing and sequence error
adeldhis2 Sep 12, 2024
a5b5a95
chore: fix test matrix output
adeldhis2 Sep 12, 2024
66fb0ab
chore: fix dhis2_version
adeldhis2 Sep 12, 2024
e405e73
chore: add logging to debug page state
adeldhis2 Sep 23, 2024
e44556f
chore: fix logging
adeldhis2 Sep 23, 2024
b1cb13e
chore: fix chaining issue
adeldhis2 Sep 23, 2024
80483ad
chore: remove invalid .catch()
adeldhis2 Sep 23, 2024
e247dea
chore: add cypress-multi-reporters
adeldhis2 Sep 23, 2024
6f041e1
chore: debug
adeldhis2 Oct 2, 2024
f49d957
chore: add cy.task for logging in setupNodeEvents
adeldhis2 Oct 3, 2024
d863b61
chore: add debug logging for login and session handling
adeldhis2 Oct 3, 2024
404bb4f
chore: fix async issue by moving cy.task to cy.then in login flow
adeldhis2 Oct 4, 2024
b3e7e18
chore: fix session handling by moving cy.task to cy.then
adeldhis2 Oct 4, 2024
8fb572d
chore: increase pageLoadTimeout and add reload
adeldhis2 Oct 7, 2024
538e75d
chore: disable Chrome Web Security to resolve potential CORS issues
adeldhis2 Oct 8, 2024
7c9913b
chore: intercept and log all network requests
adeldhis2 Oct 8, 2024
475e379
chore: debug
adeldhis2 Oct 8, 2024
98616c6
debug
adeldhis2 Oct 9, 2024
76f7e89
chore: update line-listing url
adeldhis2 Oct 14, 2024
8ecbdcc
chore: refactor workflow for dynamic app and API URLs
adeldhis2 Oct 23, 2024
3f3e73c
fix
adeldhis2 Nov 5, 2024
6aebe7a
chore: cleanup
adeldhis2 Nov 5, 2024
83a8425
debug: update cy.visit() to use baseUrl directly in goToStartPage
adeldhis2 Dec 3, 2024
daef56f
debug
adeldhis2 Dec 3, 2024
bf75ba3
debug: normalise base URL to fix trailing slash
adeldhis2 Dec 4, 2024
17e0e0d
debug
adeldhis2 Dec 4, 2024
6c815d6
debug
adeldhis2 Dec 4, 2024
07e6ed7
debug: test with a hardcodedUrl
adeldhis2 Dec 6, 2024
4e215a2
debug
adeldhis2 Dec 9, 2024
e6661b7
debug hardcodedUrl
adeldhis2 Dec 9, 2024
ce9a564
debug use instance created 2.39
adeldhis2 Dec 9, 2024
c6a61fb
Debug
adeldhis2 Dec 16, 2024
89aa5d9
cleanup
adeldhis2 Dec 25, 2024
1a633f9
cleanup
adeldhis2 Dec 25, 2024
6d07776
chore: remove debug + cleanup PR
adeldhis2 Dec 30, 2024
eff1096
chore: cleanup PR
adeldhis2 Dec 30, 2024
7d8bf17
chore: cleanup PR
adeldhis2 Dec 30, 2024
6bd716b
Merge branch 'master' into workflow-dispatch-cypress
jenniferarnesen Jan 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/e2e-test-dispatch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: 'dhis2: e2e tests triggered by core'

on:
workflow_dispatch:
inputs:
dhis2_version:
description: 'DHIS2 core version'
required: true
instance_url:
description: 'Instance URL'
required: 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 "Generating Test Matrix"
echo "::set-output name=specs::$(node src/generateTestMatrix.js)"

- name: Debug spec-group
run: |
echo "Matrix output: ${{ steps.set-matrix.outputs.specs }}"

call-workflow-e2e-prod:
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') }}
spec-group: ${{ needs.setup-matrix.outputs.matrix }}
api_base_url: ${{ github.event.inputs.instance_url }}
app_url: ${{ github.event.inputs.instance_url }}
dhis2_version: ${{ github.event.inputs.dhis2_version }}
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 }}
2 changes: 2 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ module.exports = defineConfig({
specPattern: 'cypress/integration/**/*.cy.js',
viewportWidth: 1280,
viewportHeight: 800,
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
Expand Down
12 changes: 8 additions & 4 deletions cypress/helpers/startScreen.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { EXTENDED_TIMEOUT } from '../support/util.js'

export const goToStartPage = (skipEval) => {
cy.visit('/', EXTENDED_TIMEOUT).log(Cypress.env('dhis2BaseUrl'))
if (!skipEval) {
expectStartScreenToBeVisible()
}
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}`)
if (!skipEval) {
expectStartScreenToBeVisible()
}
})
}

export const expectStartScreenToBeVisible = () =>
Expand Down
Loading