Skip to content
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

Setup and migrate Discover tests to playwright #2807

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
4a068ca
setup and migrate some discover tests to playwright
cesarvarela May 29, 2024
3014c31
Add request and date mock utils
cesarvarela May 30, 2024
c279885
Add the rest of discover tests
cesarvarela May 30, 2024
d212e01
Add playwright workflow
cesarvarela May 30, 2024
e3abf9e
Trigger Build
cesarvarela May 30, 2024
9265283
Add server command
cesarvarela May 30, 2024
5a2e9a8
Trigger Build
cesarvarela May 30, 2024
eaf5514
run server in the background
cesarvarela May 31, 2024
07b30fb
Trigger Build
cesarvarela May 31, 2024
cd555d1
let playwright start local server
cesarvarela May 31, 2024
6192ab5
Trigger Build
cesarvarela May 31, 2024
ee0fab3
increase timeout
cesarvarela May 31, 2024
75790d0
upload test reports
cesarvarela May 31, 2024
daae243
Trigger Build
cesarvarela May 31, 2024
2ae60a2
Fix report path
cesarvarela May 31, 2024
def4f09
Trigger Build
cesarvarela May 31, 2024
2376fad
Fix wrong timeout
cesarvarela May 31, 2024
2fb46e1
Trigger Build
cesarvarela May 31, 2024
368f9c1
Increase timeouts on CI
cesarvarela May 31, 2024
2c9904c
Trigger Build
cesarvarela May 31, 2024
837e832
Refactor intercept functions to closely resemble old cypress api
cesarvarela May 31, 2024
467efd7
Add doc link
cesarvarela May 31, 2024
796d112
Merge remote-tracking branch 'upstream/staging' into feature-playwright
cesarvarela Jun 3, 2024
d494245
Move tests to e2e folder
cesarvarela Jun 3, 2024
11a73f0
Add cite page tests
cesarvarela Jun 5, 2024
bfd7326
update lockfile
cesarvarela Jun 5, 2024
03d4eac
Add missing env vars
cesarvarela Jun 5, 2024
7f94c3d
Trigger Build
cesarvarela Jun 5, 2024
3b5905c
fix tests
cesarvarela Jun 5, 2024
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
10 changes: 10 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ jobs:
environment: staging
runner-label: ${{ vars.PREVIEW_RUNNER_LABEL }}

call-test-playwright:
if: ${{ !failure() && !cancelled() }}
uses: ./.github/workflows/test-playwright.yml
needs: call-test-build
secrets: inherit
with:
sha: ${{ github.event.pull_request.head.sha }}
environment: staging
runner-label: ${{ vars.PREVIEW_RUNNER_LABEL }}

call-deploy:
if: ${{ !failure() && !cancelled() }}
uses: ./.github/workflows/deploy.yml
Expand Down
80 changes: 80 additions & 0 deletions .github/workflows/test-playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Run playwright tests
on:
workflow_call:
inputs:
environment:
description: The Github environment to load secrets from
type: string
required: true
sha:
description: The commit SHA to run the tests against
type: string
required: true
runner-label:
description: The label of the runner to use
type: string
cache-modifier:
description: A modifier for the cache key used to bypass existing cache
type: string
required: false
default: ""

jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.sha }}

- uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Read node modules from cache
id: cache-nodemodules
uses: actions/cache/restore@v4
env:
cache-name: cache-install-folder
with:
path: |
site/gatsby-site/node_modules
~/.cache/Cypress
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}-${{ inputs.cache-modifier }}

- name: Install NPM dependencies
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
run: npm ci
working-directory: site/gatsby-site

- name: Restore build cache
uses: actions/cache/restore@v4
env:
cache-name: cache-build-folder
with:
path: |
site/gatsby-site/public
site/gatsby-site/.cache/functions
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ inputs.sha }}-${{ inputs.cache-modifier }}

- name: Install playwright browsers
run: npx playwright install --with-deps
working-directory: site/gatsby-site

- name: Run playwright tests
run: npx playwright test
working-directory: site/gatsby-site
env:
E2E_ADMIN_PASSWORD: ${{ secrets.E2E_ADMIN_PASSWORD }}
E2E_ADMIN_USERNAME: ${{ secrets.E2E_ADMIN_USERNAME }}
IS_EMPTY_ENVIRONMENT: ${{ vars.IS_EMPTY_ENVIRONMENT }}

- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: site/gatsby-site/playwright-report/
retention-days: 1

6 changes: 5 additions & 1 deletion site/gatsby-site/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ node_modules
.idea/

# Local Netlify folder
.netlify
.netlify
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
Loading
Loading