Skip to content

Commit

Permalink
test: publish cypress test results to reportportal (#349)
Browse files Browse the repository at this point in the history
* test: publish cypress test results to reportportal

* test: update API_KEY name and merge parallel launches

* test: debug merging launches

* test: cleaning PR

* test: use import instead of require
  • Loading branch information
adeldhis2 authored Aug 4, 2023
1 parent d7cefe8 commit 418bf92
Show file tree
Hide file tree
Showing 5 changed files with 260 additions and 48 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/dhis2-verify-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ jobs:
runs-on: ubuntu-latest
if: "!github.event.push.repository.fork && github.actor != 'dependabot[bot]'"

env:
CI_BUILD_ID: ${{ github.sha }}-${{ github.workflow }}-${{ github.event_name }}

strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -116,6 +119,7 @@ jobs:
CYPRESS_dhis2BaseUrl: https://debug.dhis2.org/dev
CYPRESS_dhis2ApiVersion: 40
CYPRESS_networkMode: stub
REPORTPORTAL_API_KEY: ${{ secrets.REPORTPORTAL_API_KEY }}

release:
runs-on: ubuntu-latest
Expand Down
26 changes: 26 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ const {
chromeAllowXSiteCookies,
cucumberPreprocessor,
} = require('@dhis2/cypress-plugins')
const registerReportPortalPlugin = require('@reportportal/agent-js-cypress/lib/plugin')
const { defineConfig } = require('cypress')

// This function will be modified when we add plugins
async function setupNodeEvents(on, config) {
await cucumberPreprocessor(on, config)
networkShim(on, config)
chromeAllowXSiteCookies(on, config)
registerReportPortalPlugin(on, config)
return config
}

Expand All @@ -18,6 +20,30 @@ module.exports = defineConfig({
projectId: 's6p5xs',
experimentalInteractiveRunEvents: true,
defaultCommandTimeout: 30000,
reporter: '@reportportal/agent-js-cypress',
reporterOptions: {
endpoint: 'https://test.tools.dhis2.org/reportportal/api/v1',
apiKey: process.env.REPORTPORTAL_API_KEY,
launch: 'aggregate_data_entry_app_master',
project: 'dhis2_auto',
description: '',
autoMerge: true,
parallel: true,
debug: false,
restClientConfig: {
timeout: 360000,
},
attributes: [
{
key: 'version',
value: 'master',
},
{
key: 'app_name',
value: 'aggregate_data_entry_app',
},
],
},
e2e: {
setupNodeEvents,
baseUrl: 'http://localhost:3000',
Expand Down
1 change: 1 addition & 0 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { enableAutoLogin, enableNetworkShim } from '@dhis2/cypress-commands'
import './get-selector-value-label-by-content.js'
import './visit-and-load.js'
import '@reportportal/agent-js-cypress/lib/commands/reportPortalCommands'

enableAutoLogin()
enableNetworkShim()
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"@dhis2/cli-style": "10.5.1",
"@dhis2/cypress-commands": "^10.0.1",
"@dhis2/cypress-plugins": "^10.0.1",
"@reportportal/agent-js-cypress": "^5.1.3",
"@testing-library/jest-dom": "5.16.5",
"@testing-library/react": "12.1.5",
"@testing-library/react-hooks": "7.0.2",
Expand Down
Loading

1 comment on commit 418bf92

@dhis2-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.