Skip to content

Commit

Permalink
Merge pull request #155 from erikyo/tests/e2e
Browse files Browse the repository at this point in the history
e2e testing + nodejs ci
  • Loading branch information
erikyo committed Mar 22, 2023
2 parents 6b42441 + b71e5d5 commit 5ea48ed
Show file tree
Hide file tree
Showing 7 changed files with 27,845 additions and 47,789 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/node-ci.yml
@@ -0,0 +1,47 @@
name: JS Continuous Integration

on:
pull_request:
branches: [ develop, trunk ]
workflow_dispatch:

jobs:
build:
name: Build plugin
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm install
- run: npm run build --if-present


tests:
name: E2E testing
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup environment to use the desired version of NodeJS
uses: actions/setup-node@v3

- name: Installing NPM dependencies
run: npm install

- name: Installing wp-env
run: npm -g i @wordpress/env

- name: Starting the WordPress Environment
run: wp-env start

- name: Running the tests
run: npm run test
16 changes: 0 additions & 16 deletions .github/workflows/php-ci.yml
Expand Up @@ -70,19 +70,3 @@ jobs:
enable_warnings: true
use_local_config: true

build:
name: Build plugin
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm install
- run: npm run build --if-present
18 changes: 18 additions & 0 deletions jest.config.js
@@ -0,0 +1,18 @@
const jestConfig = {
verbose: true,
preset: '@wordpress/jest-preset-default',
setupFilesAfterEnv: ['expect-puppeteer'],
projects: [
{
displayName: 'unit',
testMatch: ['<rootDir>/tests/jsunit/**/*.test.js'],
},
{
displayName: 'e2e',
preset: 'jest-puppeteer',
testMatch: ['<rootDir>/tests/jse2e/**/*.test.js'],
},
],
};

module.exports = jestConfig;

0 comments on commit 5ea48ed

Please sign in to comment.