Skip to content

Commit 6210340

Browse files
BACKLOG-22012: Add integration tests (#2)
* Init integration tests setup * Add html filtering tests
1 parent 6db2cbe commit 6210340

39 files changed

+11711
-161
lines changed

.eslintignore

Whitespace-only changes.

.github/workflows/manual-run.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
runs-on: self-hosted
3030
steps:
3131
- uses: jahia/jahia-modules-action/helper@v2
32-
- uses: actions/checkout@v2
32+
- uses: actions/checkout@v4
3333
- uses: KengoTODA/actions-setup-docker-compose@main
3434
with:
3535
version: '1.29.2'

.github/workflows/on-code-change.yml

Lines changed: 62 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
name: Static Analysis (linting, vulns)
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v4
1717
- uses: Jahia/jahia-modules-action/static-analysis@v2
1818
with:
1919
# In some situations it might be necessary to specify a particular version of node
@@ -29,126 +29,79 @@ jobs:
2929
username: ${{ secrets.DOCKERHUB_USERNAME }}
3030
password: ${{ secrets.DOCKERHUB_PASSWORD }}
3131
steps:
32-
- uses: actions/checkout@v2
32+
- uses: actions/checkout@v4
3333
- uses: jahia/jahia-modules-action/build@v2
3434
with:
3535
module_id: richtext-configuration
3636

37+
integration-tests:
38+
name: Integration Tests
39+
needs: build
40+
# Use self-hosted if you want to run on our own runners
41+
# you would typically want to use self-hosted runners for integration tests
42+
runs-on: self-hosted
43+
# Timeout is important as it forces the job to fail if it hangs for any reason,
44+
# If not specified it will be left running until workflow run limit is reached (72h)
45+
timeout-minutes: 45
46+
steps:
47+
# The helper is used to print instructions, such as how to connect to the runner.
48+
# It should be defined as a workflow step (vs a step in an action itself) since some
49+
# annotations are only posted upon completion of the step (i.e. you'd only see
50+
# the connection instructions annotation posted once the integration tests are done)
51+
- uses: jahia/jahia-modules-action/helper@v2
52+
- uses: actions/checkout@v4
53+
- uses: KengoTODA/actions-setup-docker-compose@main
54+
with:
55+
version: '2.23.0'
56+
- uses: actions/setup-node@v4
57+
with:
58+
node-version: 'lts/*'
59+
- uses: jahia/jahia-modules-action/integration-tests@v2
60+
with:
61+
module_id: richtext-configuration
62+
testrail_project: Richtext Configuration Module
63+
tests_manifest: provisioning-manifest-build.yml
64+
jahia_image: jahia/jahia-discovery-dev:8-SNAPSHOT
65+
should_use_build_artifacts: true
66+
github_artifact_name: richtext-configuration-artifacts-${{ github.run_number }}
67+
bastion_ssh_private_key: ${{ secrets.BASTION_SSH_PRIVATE_KEY_JAHIACI }}
68+
jahia_license: ${{ secrets.JAHIA_LICENSE_8X_FULL }}
69+
docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
70+
docker_password: ${{ secrets.DOCKERHUB_PASSWORD }}
71+
nexus_username: ${{ secrets.NEXUS_USERNAME }}
72+
nexus_password: ${{ secrets.NEXUS_PASSWORD }}
73+
# Test report is useful when posting annotation if multiple similar jobs are performed
74+
# For example, there could be one report for standalone and one report for cluster test
75+
# It is not needed if there is only one type of integration tests within the workflow
76+
tests_report_name: Test report (Standalone)
77+
testrail_username: ${{ secrets.TESTRAIL_USERNAME }}
78+
testrail_password: ${{ secrets.TESTRAIL_PASSWORD }}
79+
incident_pagerduty_api_key: ${{ secrets.INCIDENT_PAGERDUTY_API_KEY }}
80+
incident_pagerduty_reporter_email: ${{ secrets.INCIDENT_PAGERDUTY_REPORTER_EMAIL }}
81+
incident_pagerduty_reporter_id: ${{ secrets.INCIDENT_PAGERDUTY_REPORTER_ID }}
82+
incident_google_spreadsheet_id: ${{ secrets.INCIDENT_GOOGLE_SPREADSHEET_ID }}
83+
incident_google_client_email: ${{ secrets.INCIDENT_GOOGLE_CLIENT_EMAIL }}
84+
incident_google_api_key_base64: ${{ secrets.INCIDENT_GOOGLE_API_KEY_BASE64 }}
85+
zencrepes_secret: ${{ secrets.ZENCREPES_WEBHOOK_SECRET }}
86+
- name: Test Report
87+
uses: dorny/test-reporter@v1
88+
if: success() || failure()
89+
with:
90+
name: Tests Report (Standalone)
91+
path: tests/artifacts/results/xml_reports/**/*.xml
92+
reporter: java-junit
93+
fail-on-error: 'false'
94+
3795
sonar-analysis:
3896
name: Sonar Analysis
3997
needs: build
4098
runs-on: ubuntu-latest
4199
steps:
42-
- uses: actions/checkout@v2
100+
- uses: actions/checkout@v4
43101
- uses: jahia/jahia-modules-action/sonar-analysis@v2
44102
with:
45103
# If the primary release branch is other than "main", specify it here
46104
# primary_release_branch: master
47105
github_pr_id: ${{github.event.number}}
48106
sonar_url: ${{ secrets.SONAR_URL }}
49-
sonar_token: ${{ secrets.SONAR_TOKEN }}
50-
51-
# integration-tests:
52-
# name: Integration Tests
53-
# needs: build
54-
# # Use self-hosted if you want to run on our own runners
55-
# # you would typically want to use self-hosted runners for integration tests
56-
# runs-on: self-hosted
57-
# # Timeout is important as it forces the job to fail if it hangs for any reason,
58-
# # If not specified it will be left running until workflow run limit is reached (72h)
59-
# timeout-minutes: 45
60-
# steps:
61-
# # The helper is used to print instructions, such as how to connect to the runner.
62-
# # It should be defined as a workflow step (vs a step in an action itself) since some
63-
# # annotations are only posted upon completion of the step (i.e. you'd only see
64-
# # the connection instructions annotation posted once the integration tests are done)
65-
# - uses: jahia/jahia-modules-action/helper@v2
66-
# - uses: actions/checkout@v2
67-
# - uses: KengoTODA/actions-setup-docker-compose@main
68-
# with:
69-
# version: '1.29.2'
70-
# - uses: actions/setup-node@v2
71-
# with:
72-
# node-version: 'lts/*'
73-
# - uses: jahia/jahia-modules-action/integration-tests@v2
74-
# with:
75-
# module_id: richtext-configuration
76-
# testrail_project: Richtext Configuration Module
77-
# artifact_name: Integration-Tests-Standalone
78-
# tests_manifest: provisioning-manifest-build.yml
79-
# jahia_image: jahia/jahia-discovery-dev:8-SNAPSHOT
80-
# should_use_build_artifacts: true
81-
# github_artifact_name: jexp-standalone-artifacts-${{ github.run_number }}
82-
# bastion_ssh_private_key: ${{ secrets.BASTION_SSH_PRIVATE_KEY_JAHIACI }}
83-
# jahia_license: ${{ secrets.JAHIA_LICENSE_8X_FULL }}
84-
# docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
85-
# docker_password: ${{ secrets.DOCKERHUB_PASSWORD }}
86-
# nexus_username: ${{ secrets.NEXUS_USERNAME }}
87-
# nexus_password: ${{ secrets.NEXUS_PASSWORD }}
88-
# # Test report is useful when posting annotation if multiple similar jobs are performed
89-
# # For example, there could be one report for standalone and one report for cluster test
90-
# # It is not needed if there is only one type of integration tests within the workflow
91-
# tests_report_name: Test report (Standalone)
92-
# testrail_username: ${{ secrets.TESTRAIL_USERNAME }}
93-
# testrail_password: ${{ secrets.TESTRAIL_PASSWORD }}
94-
# incident_pagerduty_api_key: ${{ secrets.INCIDENT_PAGERDUTY_API_KEY }}
95-
# incident_pagerduty_reporter_email: ${{ secrets.INCIDENT_PAGERDUTY_REPORTER_EMAIL }}
96-
# incident_pagerduty_reporter_id: ${{ secrets.INCIDENT_PAGERDUTY_REPORTER_ID }}
97-
# incident_google_spreadsheet_id: ${{ secrets.INCIDENT_GOOGLE_SPREADSHEET_ID }}
98-
# incident_google_client_email: ${{ secrets.INCIDENT_GOOGLE_CLIENT_EMAIL }}
99-
# incident_google_api_key_base64: ${{ secrets.INCIDENT_GOOGLE_API_KEY_BASE64 }}
100-
# zencrepes_secret: ${{ secrets.ZENCREPES_WEBHOOK_SECRET }}
101-
# - name: Test Report
102-
# uses: dorny/test-reporter@v1
103-
# if: success() || failure()
104-
# with:
105-
# name: Tests Report (Standalone)
106-
# path: tests/artifacts/results/xml_reports/*.xml
107-
# reporter: java-junit
108-
# fail-on-error: 'false'
109-
#
110-
# # Using cluster tests might require a particular setup (i.e. with the use of a reverse proxy)
111-
# # Such configuration is handled directly by the repo executing the tests, the commented snippet
112-
# # below is only there to highlight differences with the standalone tests
113-
# # integration-tests-cluster:
114-
# # name: Integration Tests (Cluster)
115-
# # needs: build
116-
# # runs-on: self-hosted
117-
# # timeout-minutes: 45
118-
# # steps:
119-
# # - uses: jahia/jahia-modules-action/helper@v2
120-
# # - uses: actions/checkout@v2
121-
# # - uses: jahia/jahia-modules-action/integration-tests@v2
122-
# # with:
123-
# # module_id: sitmap
124-
# # testrail_project: Sitemap Module
125-
# # artifact_name: Integration-Tests-Cluster
126-
# # tests_manifest: provisioning-manifest-build.yml
127-
# # jahia_image: jahia/jahia-ee:8
128-
# # jahia_cluster_enabled: true
129-
# # should_use_build_artifacts: true
130-
# # jahia_license: ${{ secrets.JAHIA_LICENSE_8X_FULL }}
131-
# # docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
132-
# # docker_password: ${{ secrets.DOCKERHUB_PASSWORD }}
133-
# # nexus_username: ${{ secrets.NEXUS_USERNAME }}
134-
# # nexus_password: ${{ secrets.NEXUS_PASSWORD }}
135-
# # tests_report_name: Test report (Cluster)
136-
# # testrail_username: ${{ secrets.TESTRAIL_USERNAME }}
137-
# # testrail_password: ${{ secrets.TESTRAIL_PASSWORD }}
138-
# # incident_pagerduty_api_key: ${{ secrets.INCIDENT_PAGERDUTY_API_KEY }}
139-
# # incident_pagerduty_reporter_email: ${{ secrets.INCIDENT_PAGERDUTY_REPORTER_EMAIL }}
140-
# # incident_pagerduty_reporter_id: ${{ secrets.INCIDENT_PAGERDUTY_REPORTER_ID }}
141-
# # incident_google_spreadsheet_id: ${{ secrets.INCIDENT_GOOGLE_SPREADSHEET_ID }}
142-
# # incident_google_client_email: ${{ secrets.INCIDENT_GOOGLE_CLIENT_EMAIL }}
143-
# # incident_google_api_key_base64: ${{ secrets.INCIDENT_GOOGLE_API_KEY_BASE64 }}
144-
# # zencrepes_secret: ${{ secrets.ZENCREPES_WEBHOOK_SECRET }}
145-
#
146-
# # Tmate only starts if any of the previous steps fails.
147-
# # Be careful since it also means that if a step fails the workflow will
148-
# # keep running until it reaches the timeout.
149-
# # Tmate is only useful with github-hosted runners. With self-hosted runners
150-
# # you can SSH directly into the running using instructions provided by the helper
151-
# # - name: Setup tmate session
152-
# # if: ${{ failure() }}
153-
# # uses: mxschmitt/action-tmate@v3
154-
# # timeout-minutes: 15
107+
sonar_token: ${{ secrets.SONAR_TOKEN }}

.github/workflows/on-merge.yml

Lines changed: 59 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
name: Update module signature
1818
runs-on: ubuntu-latest
1919
steps:
20-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v4
2121
- uses: jahia/jahia-modules-action/update-signature@v2
2222
with:
2323
nexus_username: ${{ secrets.NEXUS_USERNAME }}
@@ -34,7 +34,7 @@ jobs:
3434
username: ${{ secrets.DOCKERHUB_USERNAME }}
3535
password: ${{ secrets.DOCKERHUB_PASSWORD }}
3636
steps:
37-
- uses: actions/checkout@v2
37+
- uses: actions/checkout@v4
3838
- uses: jahia/jahia-modules-action/build@v2
3939
with:
4040
module_id: richtext-configuration
@@ -52,53 +52,63 @@ jobs:
5252
# dependencytrack_apikey: ${{ secrets.DEPENDENCYTRACK_APIKEY }}
5353
# sbom_artifacts: 'build-artifacts'
5454

55-
# Please see "on-code-change.yml" for instructions on integration-tests
56-
# integration-tests-standalone:
57-
# name: Integration Tests (Standalone)
58-
# needs: build
59-
# runs-on: ubuntu-latest
60-
# timeout-minutes: 45
61-
# steps:
62-
# - uses: jahia/jahia-modules-action/helper@v2
63-
# - uses: actions/checkout@v2
64-
# - uses: KengoTODA/actions-setup-docker-compose@main
65-
# with:
66-
# version: '1.29.2'
67-
# - uses: actions/setup-node@v2
68-
# with:
69-
# node-version: 'lts/*'
70-
# - uses: jahia/jahia-modules-action/integration-tests@v2
71-
# with:
72-
# module_id: richtext-configuration
73-
# testrail_project: Richtext Configuration Module
74-
# tests_manifest: provisioning-manifest-build.yml
75-
# jahia_image: jahia/jahia-discovery-dev:8-SNAPSHOT
76-
# should_use_build_artifacts: true
77-
# github_artifact_name: richtext-configuration-standalone-artifacts-${{ github.run_number }}
78-
# bastion_ssh_private_key: ${{ secrets.BASTION_SSH_PRIVATE_KEY_JAHIACI }}
79-
# jahia_license: ${{ secrets.JAHIA_LICENSE_8X_FULL }}
80-
# docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
81-
# docker_password: ${{ secrets.DOCKERHUB_PASSWORD }}
82-
# nexus_username: ${{ secrets.NEXUS_USERNAME }}
83-
# nexus_password: ${{ secrets.NEXUS_PASSWORD }}
84-
# tests_report_name: Test report (Standalone)
85-
# testrail_username: ${{ secrets.TESTRAIL_USERNAME }}
86-
# testrail_password: ${{ secrets.TESTRAIL_PASSWORD }}
87-
# incident_pagerduty_api_key: ${{ secrets.INCIDENT_PAGERDUTY_API_KEY }}
88-
# incident_pagerduty_reporter_email: ${{ secrets.INCIDENT_PAGERDUTY_REPORTER_EMAIL }}
89-
# incident_pagerduty_reporter_id: ${{ secrets.INCIDENT_PAGERDUTY_REPORTER_ID }}
90-
# incident_google_spreadsheet_id: ${{ secrets.INCIDENT_GOOGLE_SPREADSHEET_ID }}
91-
# incident_google_client_email: ${{ secrets.INCIDENT_GOOGLE_CLIENT_EMAIL }}
92-
# incident_google_api_key_base64: ${{ secrets.INCIDENT_GOOGLE_API_KEY_BASE64 }}
93-
# zencrepes_secret: ${{ secrets.ZENCREPES_WEBHOOK_SECRET }}
94-
# - name: Test Report
95-
# uses: dorny/test-reporter@v1
96-
# if: success() || failure()
97-
# with:
98-
# name: Tests Report (Standalone)
99-
# path: tests/artifacts/results/xml_reports/*.xml
100-
# reporter: java-junit
101-
# fail-on-error: 'false'
55+
integration-tests:
56+
name: Integration Tests
57+
needs: build
58+
# Use self-hosted if you want to run on our own runners
59+
# you would typically want to use self-hosted runners for integration tests
60+
runs-on: self-hosted
61+
# Timeout is important as it forces the job to fail if it hangs for any reason,
62+
# If not specified it will be left running until workflow run limit is reached (72h)
63+
timeout-minutes: 45
64+
steps:
65+
# The helper is used to print instructions, such as how to connect to the runner.
66+
# It should be defined as a workflow step (vs a step in an action itself) since some
67+
# annotations are only posted upon completion of the step (i.e. you'd only see
68+
# the connection instructions annotation posted once the integration tests are done)
69+
- uses: jahia/jahia-modules-action/helper@v2
70+
- uses: actions/checkout@v4
71+
- uses: KengoTODA/actions-setup-docker-compose@main
72+
with:
73+
version: '2.23.0'
74+
- uses: actions/setup-node@v4
75+
with:
76+
node-version: 'lts/*'
77+
- uses: jahia/jahia-modules-action/integration-tests@v2
78+
with:
79+
module_id: richtext-configuration
80+
testrail_project: Richtext Configuration Module
81+
tests_manifest: provisioning-manifest-build.yml
82+
jahia_image: jahia/jahia-discovery-dev:8-SNAPSHOT
83+
should_use_build_artifacts: true
84+
github_artifact_name: richtext-configuration-artifacts-${{ github.run_number }}
85+
bastion_ssh_private_key: ${{ secrets.BASTION_SSH_PRIVATE_KEY_JAHIACI }}
86+
jahia_license: ${{ secrets.JAHIA_LICENSE_8X_FULL }}
87+
docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
88+
docker_password: ${{ secrets.DOCKERHUB_PASSWORD }}
89+
nexus_username: ${{ secrets.NEXUS_USERNAME }}
90+
nexus_password: ${{ secrets.NEXUS_PASSWORD }}
91+
# Test report is useful when posting annotation if multiple similar jobs are performed
92+
# For example, there could be one report for standalone and one report for cluster test
93+
# It is not needed if there is only one type of integration tests within the workflow
94+
tests_report_name: Test report (Standalone)
95+
testrail_username: ${{ secrets.TESTRAIL_USERNAME }}
96+
testrail_password: ${{ secrets.TESTRAIL_PASSWORD }}
97+
incident_pagerduty_api_key: ${{ secrets.INCIDENT_PAGERDUTY_API_KEY }}
98+
incident_pagerduty_reporter_email: ${{ secrets.INCIDENT_PAGERDUTY_REPORTER_EMAIL }}
99+
incident_pagerduty_reporter_id: ${{ secrets.INCIDENT_PAGERDUTY_REPORTER_ID }}
100+
incident_google_spreadsheet_id: ${{ secrets.INCIDENT_GOOGLE_SPREADSHEET_ID }}
101+
incident_google_client_email: ${{ secrets.INCIDENT_GOOGLE_CLIENT_EMAIL }}
102+
incident_google_api_key_base64: ${{ secrets.INCIDENT_GOOGLE_API_KEY_BASE64 }}
103+
zencrepes_secret: ${{ secrets.ZENCREPES_WEBHOOK_SECRET }}
104+
- name: Test Report
105+
uses: dorny/test-reporter@v1
106+
if: success() || failure()
107+
with:
108+
name: Tests Report (Standalone)
109+
path: tests/artifacts/results/xml_reports/**/*.xml
110+
reporter: java-junit
111+
fail-on-error: 'false'
102112

103113
publish:
104114
name: Publish module

.github/workflows/on-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
steps:
2424
# Providing the SSH PRIVATE of a user part of an admin group
2525
# is necessary to bypass PR checks
26-
- uses: actions/checkout@v2
26+
- uses: actions/checkout@v4
2727
with:
2828
ssh-key: ${{ secrets.GH_SSH_PRIVATE_KEY_JAHIACI }}
2929

.github/workflows/on-rollback.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
steps:
1212
# Providing the SSH PRIVATE of a user part of an admin group
1313
# is necessary to bypass PR checks
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
1515
with:
1616
ssh-key: ${{ secrets.GH_SSH_PRIVATE_KEY_JAHIACI }}
1717

tests/.env.example

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
JAHIA_VERSION=${JAHIA_VERSION:-LATEST}
2+
JAHIA_IMAGE=${JAHIA_IMAGE:-jahia/jahia-discovery-dev:8-SNAPSHOT}
3+
TESTS_IMAGE=${TESTS_IMAGE:-jahia/richtext-configuration:latest}
4+
MODULE_ID=${MODULE_ID:-richtext-configuration}
5+
MANIFEST=${MANIFEST:-provisioning-manifest-snapshot.yml}
6+
JAHIA_URL=${JAHIA_URL:-http://jahia:8080}
7+
SUPER_USER_PASSWORD=${SUPER_USER_PASSWORD:-root1234}
8+
NEXUS_USERNAME=${NEXUS_USERNAME:-NEXUS_USERNAME}
9+
NEXUS_PASSWORD=${NEXUS_PASSWORD:-NEXUS_PASSWORD}
10+
JAHIA_LICENSE=${JAHIA_LICENSE:-""}
11+
TIMEZONE=${TIMEZONE:-America/Toronto}
12+
SKIP_TESTS=${SKIP_TESTS:-false}
13+
CATALINA_OPTS="-Xmx3G -Xms3G -XshowSettings:vm"

tests/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

tests/.eslintrc.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"extends": [
3+
"@jahia",
4+
"plugin:cypress/recommended",
5+
"plugin:@typescript-eslint/recommended",
6+
"plugin:chai-friendly/recommended"
7+
],
8+
"plugins": [
9+
"cypress",
10+
"chai-friendly"
11+
],
12+
"parser": "@typescript-eslint/parser",
13+
"rules": {
14+
"react/boolean-prop-naming": ["error", { "rule": "^((is|has)[A-Z]([A-Za-z0-9]?)+|disabled|readOnly|autoFocus)"}],
15+
"@typescript-eslint/no-shadow": ["error"]
16+
},
17+
"root": true
18+
}

0 commit comments

Comments
 (0)