fix/202: make "You're connected to Square" page entire UI to be visible #515
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run E2E tests | |
on: | |
push: | |
branches: | |
- smoke-testing | |
pull_request: | |
types: [opened, synchronize, reopened] | |
branches: | |
- trunk | |
jobs: | |
e2e: | |
if: "${{ ( github.event_name == 'pull_request' ) || github.event_name == 'push' }}" | |
runs-on: ubuntu-latest | |
env: | |
WP_ADMIN_USERNAME: ${{ secrets.WP_ADMIN_USERNAME }} | |
WP_ADMIN_PASSWORD: ${{ secrets.WP_ADMIN_PASSWORD }} | |
SQUARE_APPLICATION_ID: ${{ secrets.SQUARE_APPLICATION_ID }} | |
SQUARE_ACCESS_TOKEN: ${{ secrets.SQUARE_ACCESS_TOKEN }} | |
SQUARE_LOCATION_ID: ${{ secrets.SQUARE_LOCATION_ID }} | |
GH_TOKEN: ${{ secrets.BOT_GH_TOKEN }} | |
permissions: | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '7.4' | |
tools: composer:v2 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
- name: Intall Node dependencies | |
run: npm ci && npm run build | |
- name: Install playwright | |
run: npx playwright install | |
# Use compiled versions to avoid need for npm and composer installation and build step. | |
- name: Install required WP plugins | |
run: | | |
gh release download --repo woocommerce/woocommerce-pre-orders --pattern woocommerce-pre-orders.zip --dir ./test-plugins | |
gh release download --repo woocommerce/woocommerce-subscriptions --pattern woocommerce-subscriptions.zip --dir ./test-plugins | |
cd ./test-plugins | |
unzip -o woocommerce-pre-orders.zip | |
unzip -o woocommerce-subscriptions.zip | |
cd .. | |
- name: Set the core version | |
if: "${{ contains(github.event.pull_request.labels.*.name, 'needs: WP RC test') }}" | |
id: run-rc-test | |
run: ./tests/bin/set-core-version.js WordPress/WordPress#master | |
- name: Setup E2E environment | |
run: npm run env:start | |
- name: Run E2E tests | |
id: square_e2e_tests | |
if: ${{ github.event_name == 'pull_request' }} | |
run: npm run test:e2e | |
- name: Remove existing labels | |
uses: actions/github-script@v6 | |
continue-on-error: true | |
with: | |
script: | | |
github.rest.issues.removeLabel({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
name: ['status: e2e tests passing'] | |
}) | |
github.rest.issues.removeLabel({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
name: ['status: e2e tests failing'] | |
}) | |
- name: Update Success Label | |
if: | | |
always() && | |
steps.square_e2e_tests.conclusion == 'success' | |
uses: actions/github-script@v6 | |
continue-on-error: true | |
with: | |
script: | | |
github.rest.issues.addLabels({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: ['status: e2e tests passing'] | |
}) | |
- name: Update Failure Label | |
if: | | |
always() && | |
steps.square_e2e_tests.conclusion == 'failure' | |
uses: actions/github-script@v6 | |
continue-on-error: true | |
with: | |
script: | | |
github.rest.issues.addLabels({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: ['status: e2e tests failing'] | |
}) | |
- name: Run E2E Smoke Test | |
if: ${{ github.event_name == 'push' }} | |
run: npm run test:e2e | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: playwright-report | |
path: tests/e2e/test-results/report | |
retention-days: 2 |