-
Notifications
You must be signed in to change notification settings - Fork 57
106 lines (86 loc) · 3.68 KB
/
Copy pathui-tests.yml
File metadata and controls
106 lines (86 loc) · 3.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: 'UI: Playwright Tests'
on:
pull_request:
types: [ opened, reopened, synchronize, labeled, unlabeled ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}
cancel-in-progress: true
jobs:
playwright-ui-tests:
runs-on:
- codebuild-patch-frontend-${{ github.run_id }}-${{ github.run_attempt }}
- instance-size:large
- buildspec-override:true
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.head.sha }}
submodules: recursive
- name: Create front-end .env file
run: |
# Check if the secrets are set
if [ -z "$ADMIN_USERNAME" ]; then
echo "Error: ADMIN_USERNAME secret is not set."
exit 1
fi
if [ -z "$ADMIN_PASSWORD" ]; then
echo "Error: ADMIN_PASSWORD secret is not set."
exit 1
fi
if [ -z "$ADVISORY_REMEDIATION_USERNAME" ]; then
echo "Error: ADVISORY_REMEDIATION_USERNAME secret is not set."
exit 1
fi
if [ -z "$ADVISORY_REMEDIATION_PASSWORD" ]; then
echo "Error: ADVISORY_REMEDIATION_PASSWORD secret is not set."
exit 1
fi
# Create the .env file and write the secrets and other variables to it
{
echo "ADMIN_USERNAME=$ADMIN_USERNAME"
echo "ADMIN_PASSWORD=$ADMIN_PASSWORD"
echo "ADVISORY_REMEDIATION_USERNAME=$ADVISORY_REMEDIATION_USERNAME"
echo "ADVISORY_REMEDIATION_PASSWORD=$ADVISORY_REMEDIATION_PASSWORD"
echo "BASE_URL=https://stage.foo.redhat.com:1337"
echo "CI=true"
} >> .env
echo ".env file created successfully."
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
- name: Cache - node_modules
uses: actions/cache@v6
with:
path: |
node_modules
dist
key: ${{ runner.os }}-frontend-node-modules-${{ hashFiles('package-lock.json') }}
restore-keys: ${{ runner.os }}-frontend-node-modules-
# This prevents an error related to minimum watchers when running the front-end and playwright
- name: Increase file watchers limit
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
- name: Install dependencies
run: 'npm ci && npm run build && npx playwright install chromium --only-shell'
- name: Update /etc/hosts
run: sudo npx fec patch-etc-hosts
- name: Frontend run (static)
run: npx fec static --port 8003 &
- name: Wait for frontend to be ready
run: npx wait-on http://localhost:8003/apps/patch/
- name: Run testing proxy
run: docker run -d --network=host -e HTTPS_PROXY=$RH_PROXY_URL -e ROUTES_JSON_PATH=/config/routes-ci.json -v "$(pwd)/config:/config:ro,Z" --name frontend-development-proxy quay.io/redhat-user-workloads/hcc-platex-services-tenant/frontend-development-proxy:latest
- name: Run front-end Playwright tests
run: CURRENTS_PROJECT_ID=nKL5NV CURRENTS_RECORD_KEY=$CURRENTS_RECORD_KEY CURRENTS_CI_BUILD_ID="${{ github.repository }}-${{ github.run_id }}-${{ github.run_attempt }}" npx playwright test
- name: Publish front-end Test Report
uses: ctrf-io/github-test-reporter@v1
with:
report-path: './playwright-ctrf/playwright-ctrf.json'
- name: Store front-end Test report
uses: actions/upload-artifact@v7
with:
name: playwright-report
path: playwright-report/
retention-days: 10