Skip to content

Commit

Permalink
Merge pull request #15 from wp-graphql/setup-tests
Browse files Browse the repository at this point in the history
Scaffold playwright tests
  • Loading branch information
jasonbahl committed Feb 26, 2024
2 parents 7111f06 + be69cdb commit 264659f
Show file tree
Hide file tree
Showing 21 changed files with 24,696 additions and 19,907 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: E2E Tests

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
e2e-tests:
name: E2E tests on Node ${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['18']
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm ci

- name: Build Assets
run: npm run build

- name: Install Playwright dependencies
run: |
npx playwright install chromium firefox webkit --with-deps
- name: Start WordPress Environment
run: npm run wp-env -- start

- name: Run E2E tests
run: npm run test:e2e

- name: Stop WordPress Environment
run: npm run wp-env -- stop
4 changes: 2 additions & 2 deletions .github/workflows/release-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
node-version: [20]
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Unit Tests

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
unit-tests:
name: Unit tests on Node ${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['18', '20']
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm ci

- name: Run Unit tests
run: npm run test:unit
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,7 @@ artifacts
build/
wpgraphql-ide/
wpgraphql-ide.zip
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
12 changes: 12 additions & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"core": "WordPress/WordPress",
"plugins": [
".",
"https://downloads.wordpress.org/plugin/wp-graphql.zip"
],
"themes": [],
"port": 8888,
"config": {
"WP_DEBUG": true
}
}
Loading

0 comments on commit 264659f

Please sign in to comment.