E2E Update #34
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: Playwright Tests | |
on: | |
push: | |
branches: [ main, master ] | |
pull_request: | |
branches: [ main, master ] | |
jobs: | |
test: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Enable Corepack | |
run: corepack enable | |
- name: Prepare Yarn | |
run: corepack prepare [email protected] --activate | |
- name: Install dependencies | |
run: yarn install | |
- name: Install Playwright Browsers | |
run: yarn playwright install --with-deps | |
- name: Verify GraphQL API availability | |
run: | | |
curl -X POST -H "Content-Type: application/json" \ | |
--data '{"query":"query { categories { id name } }"}' \ | |
https://api.kwekmarket.com/v1/kwekql || exit 1 | |
- name: Update Browserslist DB | |
run: npx update-browserslist-db@latest | |
- name: Install Sharp | |
run: yarn add sharp | |
- name: Build the application | |
run: yarn build | |
env: | |
NEXT_PUBLIC_PUSHER_KEY: ${{ secrets.NEXT_PUBLIC_PUSHER_KEY }} | |
- name: Start the application | |
run: yarn start & | |
env: | |
PORT: 3100 | |
NEXT_PUBLIC_PUSHER_KEY: ${{ secrets.NEXT_PUBLIC_PUSHER_KEY }} | |
- name: Wait for the application to be ready | |
run: npx wait-on http://localhost:3100 | |
- name: Run Playwright tests | |
env: | |
GRAPHQL_API_URL: https://api.kwekmarket.com/v1/kwekql | |
PORT: 3100 | |
run: yarn run test | |
- uses: actions/upload-artifact@v4 | |
if: ${{ !cancelled() }} | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 |