Skip to content

Commit 349220a

Browse files
PMM-7 Playwright Portal - PMM Upgrade (#509)
* POC for the pmm upgrade * playwright and codecept upgrade * Refactors * PMM-T398 PMM-T809 tests * Refactors and add test PMM-T1097 * Adds inheritance for the page objects * More tests * refectors * refactors * add call to invite user to the org * PMM-T1098 * Tests 1132, 1147, 1148 * PMM-T1152 * PMM-T1224 * Adds tests T1222, T1170, T1112 * skeleton of the portal pipeline, rest of the test and refactoring * Fixes the workfow name * adds permissions for the pmm client setup * adds secrets refactors and debugs * removes duplicate secret * debug pipeline * debug pipeline * debugs pipeline * Use new integration setup in the pipeline * Smaller fixes for the tests * adds ci flag to the pipeline * set address for the pmm ui tests pipeline * debug api calls * Debugs api call * Adds missing env variable * Lower amount of workers * removes debug commands * debug commands * Debug commands * debug commands * Debug commands * Adds missing env variable * removes debug commands * change public address and teardown * Fixes for the tests * Fixes * fixes order of the tests * Different endpoint to find version of pmm * Ability to select toast type * fixes for SAAS-T1098 * removes double click * upgrade pipeline skeleton * Fixes the name of the upgrade pipeline * move test from upgrade to post upgrade * Adds command line reporting * removes debug command * Changes reporter in command line * Changes version for the token link * use github exporter in ci * changes reporters * refactors * Refactors of the code * Refactors getting elements from the common page * Adds lint support * Fixes for the tsconfig * package and tsconfig * Fixes the casing issue * Fixes for the testing repository in the pipeline * fixes locator for the modal version 2.30 and lower. * Fixes for the new percona platform page
1 parent 754e2fc commit 349220a

40 files changed

+3308
-298
lines changed
+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
---
2+
name: pmm-portal-tests
3+
4+
on:
5+
# run with default inputs
6+
schedule:
7+
- cron: '0 0 * * *'
8+
push:
9+
branches:
10+
- main
11+
pull_request:
12+
13+
workflow_dispatch:
14+
inputs:
15+
pmm_ui_tests_branch:
16+
description: 'Target branch for pmm-ui-tests repository'
17+
default: 'main'
18+
required: true
19+
pmm_server_version:
20+
description: 'Version of the pmm server used for testing'
21+
default: 'dev-latest'
22+
required: true
23+
pmm_client_version:
24+
description: 'Version of the pmm client used for testing'
25+
default: 'dev-latest'
26+
required: true
27+
pmm_clients:
28+
description: 'Clients for pmm-server'
29+
default: '--addclient=ps,1'
30+
required: true
31+
pmm_qa_branch:
32+
description: 'Branch for the pmm-qa repository.'
33+
default: 'main'
34+
required: true
35+
36+
jobs:
37+
tests:
38+
name: Tests
39+
runs-on: ubuntu-latest
40+
timeout-minutes: 60
41+
env:
42+
SHA: ${{ github.event.inputs.sha || 'null' }}
43+
PMM_BASE_URL: https://127.0.0.1
44+
ADMIN_PASSWORD: admin
45+
46+
UI_TESTS_BRANCH: ${{ github.event.inputs.pmm_ui_tests_branch }}
47+
PMM_CLIENTS: ${{ github.event.inputs.pmm_clients }}
48+
49+
PMM_SERVER_VERSION: ${{ github.event.inputs.pmm_server_version }}
50+
PMM_CLIENT_VERSION: ${{ github.event.inputs.pmm_client_version }}
51+
PMM_QA_BRANCH: ${{ github.event.inputs.pmm_qa_branch }}
52+
53+
54+
OKTA_TOKEN: ${{ secrets.OKTA_TOKEN }}
55+
OAUTH_ISSUER_URL: "https://id-dev.percona.com/oauth2/aus15pi5rjdtfrcH51d7"
56+
OAUTH_CLIENT_ID: ${{ secrets.OKTA_OAUTH_CLIENT_ID }}
57+
OAUTH_CLIENT_SECRET: ${{ secrets.OKTA_OAUTH_CLIENT_SECRET }}
58+
OAUTH_PMM_CLIENT_ID: ${{ secrets.OKTA_OAUTH_PMM_CLIENT_ID }}
59+
OAUTH_PMM_CLIENT_SECRET: ${{ secrets.OKTA_OAUTH_PMM_CLIENT_SECRET }}
60+
OAUTH_DEV_HOST: ${{ secrets.OAUTH_DEV_HOST }}
61+
OAUTH_SCOPES: percona
62+
63+
# Variables for E2E tests
64+
MAILOSAUR_API_KEY: ${{ secrets.MAILOSAUR_API_KEY }}
65+
MAILOSAUR_UI_TESTS_SERVER_ID: ${{ secrets.MAILOSAUR_UI_TESTS_SERVER_ID }}
66+
MAILOSAUR_API_TESTS_SERVER_ID: ${{ secrets.MAILOSAUR_API_TESTS_SERVER_ID }}
67+
68+
SERVICENOW_LOGIN: percona_platform
69+
SERVICENOW_PASSWORD: ${{ secrets.SERVICENOW_PASSWORD }}
70+
SERVICENOW_DEV_URL: "https://perconadev.service-now.com/api/x_pellc_percona_pl/platform/settest"
71+
72+
steps:
73+
- name: PMM server version ${{ github.event.inputs.pmm_server_version }} and Portal connections tests for pmm-ui-tests branch ${{ github.event.inputs.pmm_ui_tests_branch }}
74+
if: ${{ github.event_name == 'workflow_dispatch' && env.SHA != 'null' }}
75+
uses: percona-platform/github-status-action@v1
76+
with:
77+
context: 'pmm2-ui-tests'
78+
description: 'Tests execution has been started'
79+
state: 'pending'
80+
repository: ${{ github.event.inputs.repo }}
81+
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
82+
sha: ${{ env.SHA }}
83+
84+
- name: Install NodeJS v16
85+
uses: percona-platform/setup-node@v2
86+
with:
87+
node-version: 16.14.1
88+
89+
- name: Checkout UI tests
90+
uses: percona-platform/checkout@v2
91+
with:
92+
ref: ${{ env.UI_TESTS_BRANCH }}
93+
repository: percona/pmm-ui-tests
94+
path: ./pmm-ui-tests
95+
96+
- name: Checkout pmm-qa Repo
97+
uses: percona-platform/checkout@v2
98+
with:
99+
# token: ${{ secrets.ROBOT_TOKEN }}
100+
repository: percona/pmm-qa
101+
path: ./pmm-qa
102+
ref: ${{ env.PMM_QA_BRANCH }}
103+
104+
- name: Compose PMM-Sever
105+
working-directory: pmm-qa/pmm-integration
106+
run: |
107+
npm install
108+
sudo npx ts-node ./integration-setup.ts --ci --setup-docker-pmm-server --pmm-server-version=${{ env.PMM_SERVER_VERSION }} --pmm-client-version=${{ env.PMM_CLIENT_VERSION }}
109+
110+
- name: Setup Client for PMM-Server
111+
run: |
112+
sudo bash ./pmm-qa/pmm-tests/pmm2-client-setup.sh --pmm_server_ip 127.0.0.1 --client_version ${{ env.PMM_CLIENT_VERSION }} --admin_password admin --use_metrics_mode no
113+
sudo bash ./pmm-qa/pmm-tests/pmm-framework.sh \
114+
--download \
115+
${{ env.PMM_CLIENTS }} \
116+
--pmm2 \
117+
--pmm2-server-ip=127.0.0.1
118+
sleep 30
119+
sudo pmm-admin list
120+
shell: bash
121+
122+
- name: Execute UI tests
123+
id: ui-tests
124+
working-directory: pmm-ui-tests
125+
run: |
126+
npm install
127+
npx playwright install
128+
touch portalCredentials
129+
npx playwright test --config="playwright-tests/playwright.config.ts" --grep="@portal"
130+
env:
131+
NODE_TLS_REJECT_UNAUTHORIZED: 0
132+
133+
- name: Generate and Attach the report
134+
if: ${{ always() && steps.ui-tests.outcome != 'skipped' }}
135+
uses: percona-platform/upload-artifact@v3
136+
with:
137+
name: ui-tests-report
138+
path: pmm-ui-tests/playwright-report
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
---
2+
name: pmm-portal-upgrade-tests
3+
4+
on:
5+
# run with default inputs
6+
schedule:
7+
- cron: '0 0 * * *'
8+
push:
9+
branches:
10+
- main
11+
pull_request:
12+
13+
workflow_dispatch:
14+
inputs:
15+
pmm_ui_tests_branch:
16+
description: 'Target branch for pmm-ui-tests repository'
17+
default: 'main'
18+
required: true
19+
pmm_server_version:
20+
description: 'Version of the pmm server used for testing'
21+
default: 'dev-latest'
22+
required: true
23+
pmm_client_version:
24+
description: 'Version of the pmm client used for testing'
25+
default: 'dev-latest'
26+
required: true
27+
pmm_clients:
28+
description: 'Clients for pmm-server'
29+
default: '--addclient=ps,1'
30+
required: true
31+
pmm_qa_branch:
32+
description: 'Branch for the pmm-qa repository.'
33+
default: 'main'
34+
required: true
35+
testing_repository:
36+
description: 'Branch for the pmm-qa repository.'
37+
default: 'no'
38+
required: true
39+
experimental_repository:
40+
description: 'Branch for the pmm-qa repository.'
41+
default: 'no'
42+
required: true
43+
44+
jobs:
45+
tests:
46+
name: Tests
47+
runs-on: ubuntu-latest
48+
timeout-minutes: 60
49+
env:
50+
SHA: ${{ github.event.inputs.sha || 'null' }}
51+
PMM_BASE_URL: https://127.0.0.1
52+
ADMIN_PASSWORD: admin
53+
54+
UI_TESTS_BRANCH: ${{ github.event.inputs.pmm_ui_tests_branch }}
55+
PMM_CLIENTS: ${{ github.event.inputs.pmm_clients }}
56+
57+
PMM_SERVER_VERSION: ${{ github.event.inputs.pmm_server_version }}
58+
PMM_CLIENT_VERSION: ${{ github.event.inputs.pmm_client_version }}
59+
PMM_QA_BRANCH: ${{ github.event.inputs.pmm_qa_branch }}
60+
61+
62+
OKTA_TOKEN: ${{ secrets.OKTA_TOKEN }}
63+
OAUTH_ISSUER_URL: "https://id-dev.percona.com/oauth2/aus15pi5rjdtfrcH51d7"
64+
OAUTH_CLIENT_ID: ${{ secrets.OKTA_OAUTH_CLIENT_ID }}
65+
OAUTH_CLIENT_SECRET: ${{ secrets.OKTA_OAUTH_CLIENT_SECRET }}
66+
OAUTH_PMM_CLIENT_ID: ${{ secrets.OKTA_OAUTH_PMM_CLIENT_ID }}
67+
OAUTH_PMM_CLIENT_SECRET: ${{ secrets.OKTA_OAUTH_PMM_CLIENT_SECRET }}
68+
OAUTH_DEV_HOST: ${{ secrets.OAUTH_DEV_HOST }}
69+
OAUTH_SCOPES: percona
70+
71+
# Variables for E2E tests
72+
MAILOSAUR_API_KEY: ${{ secrets.MAILOSAUR_API_KEY }}
73+
MAILOSAUR_UI_TESTS_SERVER_ID: ${{ secrets.MAILOSAUR_UI_TESTS_SERVER_ID }}
74+
MAILOSAUR_API_TESTS_SERVER_ID: ${{ secrets.MAILOSAUR_API_TESTS_SERVER_ID }}
75+
76+
SERVICENOW_LOGIN: percona_platform
77+
SERVICENOW_PASSWORD: ${{ secrets.SERVICENOW_PASSWORD }}
78+
SERVICENOW_DEV_URL: "https://perconadev.service-now.com/api/x_pellc_percona_pl/platform/settest"
79+
80+
steps:
81+
- name: PMM server version ${{ github.event.inputs.pmm_server_version }} and Portal connections tests for pmm-ui-tests branch ${{ github.event.inputs.pmm_ui_tests_branch }}
82+
if: ${{ github.event_name == 'workflow_dispatch' && env.SHA != 'null' }}
83+
uses: percona-platform/github-status-action@v1
84+
with:
85+
context: 'pmm2-ui-tests'
86+
description: 'Tests execution has been started'
87+
state: 'pending'
88+
repository: ${{ github.event.inputs.repo }}
89+
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
90+
sha: ${{ env.SHA }}
91+
92+
- name: Install NodeJS v16
93+
uses: percona-platform/setup-node@v2
94+
with:
95+
node-version: 16.14.1
96+
97+
- name: Checkout UI tests
98+
uses: percona-platform/checkout@v2
99+
with:
100+
ref: ${{ env.UI_TESTS_BRANCH }}
101+
repository: percona/pmm-ui-tests
102+
path: ./pmm-ui-tests
103+
104+
- name: Checkout pmm-qa Repo
105+
uses: percona-platform/checkout@v2
106+
with:
107+
# token: ${{ secrets.ROBOT_TOKEN }}
108+
repository: percona/pmm-qa
109+
path: ./pmm-qa
110+
ref: ${{ env.PMM_QA_BRANCH }}
111+
112+
- name: Compose PMM-Sever
113+
working-directory: pmm-qa/pmm-integration
114+
run: |
115+
npm install
116+
sudo npx ts-node ./integration-setup.ts --ci --setup-docker-pmm-server --pmm-server-version=${{ env.PMM_SERVER_VERSION }} --pmm-client-version=${{ env.PMM_CLIENT_VERSION }}
117+
118+
- name: Setup Client for PMM-Server
119+
run: |
120+
sudo bash ./pmm-qa/pmm-tests/pmm2-client-setup.sh --pmm_server_ip 127.0.0.1 --client_version ${{ env.PMM_CLIENT_VERSION }} --admin_password admin --use_metrics_mode no
121+
sudo bash ./pmm-qa/pmm-tests/pmm-framework.sh \
122+
--download \
123+
${{ env.PMM_CLIENTS }} \
124+
--pmm2 \
125+
--pmm2-server-ip=127.0.0.1
126+
sleep 30
127+
sudo pmm-admin list
128+
shell: bash
129+
130+
- name: Enable Test Repository.
131+
if: ${{ github.event.inputs.testing_repository == 'yes'}}
132+
run: |
133+
set -o errexit
134+
set -o xtrace
135+
docker exec pmm-integration-server bash -c "echo exclude=mirror.es.its.nyu.edu | tee -a /etc/yum/pluginconf.d/fastestmirror.conf"
136+
docker exec pmm-integration-server yum update -y percona-release
137+
docker exec pmm-integration-server sed -i'' -e 's^/release/^/testing/^' /etc/yum.repos.d/pmm2-server.repo
138+
docker exec pmm-integration-server percona-release enable percona testing
139+
docker exec pmm-integration-server yum clean all
140+
141+
- name: Enable Experimental Repository.
142+
if: ${{ github.event.inputs.experimental_repository == 'yes'}}
143+
run: |
144+
set -o errexit
145+
set -o xtrace
146+
docker exec pmm-integration-server bash -c "echo exclude=mirror.es.its.nyu.edu | tee -a /etc/yum/pluginconf.d/fastestmirror.conf"
147+
docker exec pmm-integration-server yum update -y percona-release
148+
docker exec pmm-integration-server sed -i'' -e 's^/release/^/experimental/^' /etc/yum.repos.d/pmm2-server.repo
149+
docker exec pmm-integration-server percona-release enable percona experimental
150+
docker exec pmm-integration-server yum clean all
151+
152+
- name: Execute pre upgrade UI tests
153+
id: pre-upgrade-ui-tests
154+
working-directory: pmm-ui-tests
155+
run: |
156+
npm install
157+
npx playwright install
158+
touch portalCredentials
159+
npx playwright test --config="playwright-tests/playwright.config.ts" --grep="@pre-pmm-portal-upgrade"
160+
env:
161+
NODE_TLS_REJECT_UNAUTHORIZED: 0
162+
163+
- name: Execute upgrade UI tests
164+
id: upgrade-ui-tests
165+
working-directory: pmm-ui-tests
166+
run: |
167+
npx playwright test --config="playwright-tests/playwright.config.ts" --grep="@pmm-portal-upgrade"
168+
env:
169+
NODE_TLS_REJECT_UNAUTHORIZED: 0
170+
171+
- name: Execute post upgrade UI tests
172+
id: post-upgrade-ui-tests
173+
working-directory: pmm-ui-tests
174+
run: |
175+
npx playwright test --config="playwright-tests/playwright.config.ts" --grep="@post-pmm-portal-upgrade"
176+
env:
177+
NODE_TLS_REJECT_UNAUTHORIZED: 0
178+
179+
- name: Generate and Attach the report
180+
if: ${{ always() && steps.ui-tests.outcome != 'skipped' }}
181+
uses: percona-platform/upload-artifact@v3
182+
with:
183+
name: ui-tests-report
184+
path: pmm-ui-tests/playwright-report

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ typings/
7777

7878
# UI tests output
7979
output
80+
playwright-report
81+
test-results
8082

8183
# parcel-bundler cache (https://parceljs.org/)
8284
.cache

0 commit comments

Comments
 (0)