Skip to content

CI(test): improve stability and speed of PW tests #1096

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

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
75 changes: 32 additions & 43 deletions .github/workflows/playwright-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
playwright-tests:
runs-on:
- codebuild-content-services-be-repo-${{ github.run_id }}-${{ github.run_attempt }}
- instance-size:medium
- instance-size:large
- buildspec-override:true

steps:
Expand Down Expand Up @@ -188,9 +188,15 @@ jobs:
with:
go-version: "${{ steps.get-go-version.outputs.go-version }}"

- name: Set up Make
- name: Install Make
run: sudo apt-get install make

- name: Install Parallel
run: sudo apt-get install -y parallel

- name: Install Xvfb
run: sudo apt-get install -y xvfb

- name: Copy the example config
run: cp ./configs/config.yaml.example ./configs/config.yaml

Expand Down Expand Up @@ -218,8 +224,28 @@ jobs:
echo "CI=true" >> .env
echo 'DB_CONNECTION_STRING="postgresql://content:content@localhost:5433/content"' >> .env

- name: Backend compose-up
run: make compose-down compose-clean compose-up
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: "_playwright-tests/.nvmrc"

- name: Install API playwright and dependencies
working-directory: _playwright-tests
run: yarn install

- name: Install Playwright Browsers
working-directory: _playwright-tests
run: yarn playwright install --with-deps

- name: Increase file watchers limit
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

- name: Update /etc/hosts
working-directory: content-sources-frontend
run: sudo npm run patch:hosts

- name: Run front-end and back-end setup in parallel
run: 'parallel --line-buffer --tagstring "[{#}]:" ::: "cd content-sources-frontend && yarn install && yarn build && yarn playwright install --with-deps && (BACKEND_PORT=8000 yarn start:stage & npx wait-on https://localhost:1337)" "make compose-down compose-clean compose-up"'

- name: Import the smallest Redhat repos
run: OPTIONS_REPOSITORY_IMPORT_FILTER=small make repos-import
Expand All @@ -235,22 +261,9 @@ jobs:
chmod +x .github/workflowScripts/waitForBackend.sh
.github/workflowScripts/waitForBackend.sh

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: "_playwright-tests/.nvmrc"

- name: Install API playwright and dependencies
working-directory: _playwright-tests
run: yarn install

- name: Install Playwright Browsers
working-directory: _playwright-tests
run: yarn playwright install --with-deps

- name: Run API Playwright tests
working-directory: _playwright-tests
run: CURRENTS_PROJECT_ID=V4Ri3k CURRENTS_RECORD_KEY=$CURRENTS_RECORD_KEY yarn playwright test
run: CURRENTS_PROJECT_ID=V4Ri3k CURRENTS_RECORD_KEY=$CURRENTS_RECORD_KEY CURRENTS_CI_BUILD_ID="${{ github.repository }}-${{ github.run_id }}-${{ github.run_attempt }}" yarn playwright test

- name: Publish API Test Report
uses: ctrf-io/github-test-reporter@v1
Expand All @@ -266,33 +279,9 @@ jobs:
path: ./_playwright-tests/playwright-ctrf
retention-days: 10

- name: Install front-end dependencies
working-directory: content-sources-frontend
run: yarn install

- name: Install front-end Playwright Browsers
working-directory: content-sources-frontend
run: yarn playwright install --with-deps
- name: Increase file watchers limit
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

- name: Update /etc/hosts
working-directory: content-sources-frontend
run: sudo npm run patch:hosts

- name: Build front-end FEC container
working-directory: content-sources-frontend
run: yarn build

- name: Start front-end server
working-directory: content-sources-frontend
run: |
BACKEND_PORT=8000 yarn start:stage &
npx wait-on https://localhost:1337

- name: Run front-end Playwright tests
working-directory: content-sources-frontend
run: CURRENTS_PROJECT_ID=V4Ri3k CURRENTS_RECORD_KEY=$CURRENTS_RECORD_KEY yarn playwright test
run: CURRENTS_PROJECT_ID=V4Ri3k CURRENTS_RECORD_KEY=$CURRENTS_RECORD_KEY CURRENTS_CI_BUILD_ID="${{ github.repository }}-${{ github.run_id }}-${{ github.run_attempt }}" xvfb-run yarn playwright test --workers 2

- name: Publish front-end Test Report
uses: ctrf-io/github-test-reporter@v1
Expand Down
4 changes: 2 additions & 2 deletions _playwright-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"author": "",
"license": "ISC",
"devDependencies": {
"@playwright/test": "^1.49.1",
"@currents/playwright": "^1.9.4",
"@playwright/test": "^1.51.1",
"@currents/playwright": "^1.12.1",
"@types/node": "^22.10.2",
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.15.0",
Expand Down
49 changes: 35 additions & 14 deletions _playwright-tests/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,16 @@
lazy-ass "1.6.0"
ramda "0.26.1"

"@currents/playwright@^1.9.4":
version "1.11.3"
resolved "https://registry.yarnpkg.com/@currents/playwright/-/playwright-1.11.3.tgz#e666cd756ae062e0606fbff0fcb91b23d97fb693"
integrity sha512-HvymV8dJtBYBRiUGbDOrDpwxDH3Kd4N1uhJTVBkY0iB4TIyoNJgO8oHNOvnh440ptyBUHav9DH4swRrbZ4S1IA==
"@currents/playwright@^1.12.1":
version "1.12.1"
resolved "https://registry.yarnpkg.com/@currents/playwright/-/playwright-1.12.1.tgz#a6ec98c1b01213a3d6366611cb04e888770fe1e0"
integrity sha512-mNkcyRnbewsl0slWftscRvO/9RkVRL6OsDpyi0tQQY4xGwS++0ja5r1HBvrjPJgjtQGllKltpSR3uZliy0vpuA==
dependencies:
"@babel/code-frame" "^7.18.6"
"@commander-js/extra-typings" "^12.1.0"
"@currents/commit-info" "1.0.1-beta.0"
async-retry "^1.3.3"
axios "^1.8.2"
axios "^1.8.3"
axios-retry "^4.5.0"
c12 "^1.11.2"
chalk "^4.1.2"
Expand Down Expand Up @@ -108,7 +108,7 @@
stack-utils "^2.0.6"
tmp "^0.2.3"
tmp-promise "^3.0.3"
ts-pattern "^5.6.0"
ts-pattern "^5.7.0"
ws "^8.18.1"

"@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0":
Expand Down Expand Up @@ -438,6 +438,13 @@
dependencies:
playwright "1.49.1"

"@playwright/test@^1.51.1":
version "1.52.0"
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.52.0.tgz#267ec595b43a8f4fa5e444ea503689629e91a5b8"
integrity sha512-uh6W7sb55hl7D6vsAeA+V2p5JnlAqzhqFyF0VcJkKZXkgnFcVG9PziERRHQfPLfNGx1C292a4JqbWzhR8L4R1g==
dependencies:
playwright "1.52.0"

"@sec-ant/readable-stream@^0.4.1":
version "0.4.1"
resolved "https://registry.yarnpkg.com/@sec-ant/readable-stream/-/readable-stream-0.4.1.tgz#60de891bb126abfdc5410fdc6166aca065f10a0c"
Expand Down Expand Up @@ -681,10 +688,10 @@ axios-retry@^4.5.0:
dependencies:
is-retry-allowed "^2.2.0"

axios@^1.8.2:
version "1.8.2"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.8.2.tgz#fabe06e241dfe83071d4edfbcaa7b1c3a40f7979"
integrity sha512-ls4GYBm5aig9vWx8AWDSGLpnpDQRtWAfrjU+EuytuODrFBkqesN2RkOQCBzrA1RQNHw1SmRMSDDDSwzNAYQ6Rg==
axios@^1.8.3:
version "1.9.0"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.9.0.tgz#25534e3b72b54540077d33046f77e3b8d7081901"
integrity sha512-re4CqKTJaURpzbLHtIi6XpDv20/CnpXOtjRY5/CU32L8gU8ek9UIivcfvSWvmKEngmVbrUtPpdDwWDWL7DNHvg==
dependencies:
follow-redirects "^1.15.6"
form-data "^4.0.0"
Expand Down Expand Up @@ -2122,6 +2129,11 @@ [email protected]:
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.49.1.tgz#32c62f046e950f586ff9e35ed490a424f2248015"
integrity sha512-BzmpVcs4kE2CH15rWfzpjzVGhWERJfmnXmniSyKeRZUs9Ws65m+RGIi7mjJK/euCegfn3i7jvqWeWyHe9y3Vgg==

[email protected]:
version "1.52.0"
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.52.0.tgz#238f1f0c3edd4ebba0434ce3f4401900319a3dca"
integrity sha512-l2osTgLXSMeuLZOML9qYODUQoPPnUsKsb5/P6LJ2e6uPKXUdPK5WYhN4z03G+YNbWmGDY4YENauNu4ZKczreHg==

playwright-ctrf-json-reporter@^0.0.18:
version "0.0.18"
resolved "https://registry.yarnpkg.com/playwright-ctrf-json-reporter/-/playwright-ctrf-json-reporter-0.0.18.tgz#74b0d6cd53e3860148070db8cbecb789cac766e4"
Expand All @@ -2136,6 +2148,15 @@ [email protected]:
optionalDependencies:
fsevents "2.3.2"

[email protected]:
version "1.52.0"
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.52.0.tgz#26cb9a63346651e1c54c8805acfd85683173d4bd"
integrity sha512-JAwMNMBlxJ2oD1kce4KPtMkDeKGHQstdpFPcPH3maElAXon/QZeTvtsfXmTMRyO9TslfoYOXkSsvao2nE1ilTw==
dependencies:
playwright-core "1.52.0"
optionalDependencies:
fsevents "2.3.2"

pluralize@^8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-8.0.0.tgz#1a6fa16a38d12a1901e0320fa017051c539ce3b1"
Expand Down Expand Up @@ -2527,10 +2548,10 @@ ts-api-utils@^2.0.1:
resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-2.0.1.tgz#660729385b625b939aaa58054f45c058f33f10cd"
integrity sha512-dnlgjFSVetynI8nzgJ+qF62efpglpWRk8isUEWZGWlJYySCTD6aKvbUDu+zbPeDakk3bg5H4XpitHukgfL1m9w==

ts-pattern@^5.6.0:
version "5.6.2"
resolved "https://registry.yarnpkg.com/ts-pattern/-/ts-pattern-5.6.2.tgz#aad9b4fe3c3f485dfad46e472e1203b688cc9bb4"
integrity sha512-d4IxJUXROL5NCa3amvMg6VQW2HVtZYmUTPfvVtO7zJWGYLJ+mry9v2OmYm+z67aniQoQ8/yFNadiEwtNS9qQiw==
ts-pattern@^5.7.0:
version "5.7.0"
resolved "https://registry.yarnpkg.com/ts-pattern/-/ts-pattern-5.7.0.tgz#280abc5f31d3e20609ceacc3dffdbb041e3b2c10"
integrity sha512-0/FvIG4g3kNkYgbNwBBW5pZBkfpeYQnH+2AA3xmjkCAit/DSDPKmgwC3fKof4oYUq6gupClVOJlFl+939VRBMg==

tslib@^2.6.2:
version "2.8.1"
Expand Down
Loading