Skip to content
Merged
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
44 changes: 42 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ jobs:
- name: Install pnpm dependencies
run: pnpm install

- name: Restore Playwright browsers cache
id: playwright-cache
uses: actions/cache/restore@v5
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-playwright-

- name: Set WordPress and PHP version override
run: |
echo '{
Expand All @@ -71,8 +80,39 @@ jobs:
- name: Start wp-env
run: pnpm exec wp-env start

- name: Install Playwright browsers
run: pnpm run tests:install
- name: Verify WordPress login page
run: |
for attempt in {1..10}; do
if curl -fsS http://localhost:8888/wp-login.php | grep -q 'id="user_login"'; then
exit 0
fi
sleep 3
done

curl -fsS http://localhost:8888/wp-login.php || true
exit 1

- name: Use Ubuntu archive mirror
run: |
if [ -f /etc/apt/apt-mirrors.txt ]; then
sudo sed -i 's|http://azure.archive.ubuntu.com/ubuntu|http://archive.ubuntu.com/ubuntu|g' /etc/apt/apt-mirrors.txt
fi
if [ -f /etc/apt/sources.list.d/ubuntu.sources ]; then
sudo sed -i 's|http://azure.archive.ubuntu.com/ubuntu|http://archive.ubuntu.com/ubuntu|g' /etc/apt/sources.list.d/ubuntu.sources
fi
sudo apt-get update

- name: Install Playwright
timeout-minutes: 5
run: pnpm exec playwright install --with-deps chromium

- name: Save Playwright browsers cache
if: steps.playwright-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v5
continue-on-error: true
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}

- name: Run Playwright tests
run: pnpm exec playwright test
Expand Down
Loading