Skip to content
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
81 changes: 0 additions & 81 deletions .circleci/config.yml

This file was deleted.

82 changes: 82 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: E2E Tests

on:
push:
schedule:
- cron: "0 7 * * 1-5" # Weekdays at 7am UTC / 2am EST / 11pm PST

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Install Playwright Chromium
run: npx playwright install chromium --with-deps

- name: Create .env file from secrets
run: |
echo "BASE_URL=${{ secrets.BASE_URL }}" >> .env
echo "WP_USERNAME=${{ secrets.WP_USERNAME }}" >> .env
echo "WP_PASSWORD=${{ secrets.WP_PASSWORD }}" >> .env

- name: Install sshpass
run: sudo apt-get update && sudo apt-get install -y sshpass

- name: Update e2e-plugin.php on the site
run: |
echo "Resetting the test site"
mkdir -p ~/.ssh
echo "${{ secrets.SSH_KNOWN_HOST }}" > ~/.ssh/known_hosts
sshpass -p "${{ secrets.SSH_USER_PASS }}" scp ./e2e-plugin.php ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/htdocs/wp-content/plugins/

- name: Run tests
run: npm run test:snapshots

- name: Upload Playwright Report
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30

- name: Upload Test Results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: test-results/
retention-days: 30

- name: Deploy to GitHub Pages
if: always()
run: |
git config user.name "${{ secrets.GIT_COMMITTER_NAME }}"
git config user.email "${{ secrets.GITHUB_COMMITTER_EMAIL }}"
git checkout -b gh-pages
mv playwright-report docs
cd docs
sed -i "s|<title>.*</title>|<title>Newspack E2E Test Report</title>|" index.html
git add --all
git commit -m "Deploy Playwright Report [skip ci]"
git push "https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" gh-pages --force

- name: Notify about failure
if: failure() && github.ref == 'refs/heads/trunk'
run: |
curl \
--data '{"channel":"${{ secrets.SLACK_CHANNEL_ID }}","blocks":[{"type":"section","text":{"type":"mrkdwn","text":"⚠️ E2E tests have failed. Check <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|the artifacts> to verify."}}]}' \
-H "Content-type: application/json" \
-H "Authorization: Bearer ${{ secrets.SLACK_AUTH_TOKEN }}" \
-X POST https://slack.com/api/chat.postMessage
Loading