Skip to content

Commit

Permalink
Merge pull request #129 from liip/feat/migrate-e2etest-to-playwright
Browse files Browse the repository at this point in the history
feat(): Migrate e2e tests to playwright
  • Loading branch information
tschortsch authored Nov 19, 2023
2 parents ec7b7d9 + e56f693 commit 0718f46
Show file tree
Hide file tree
Showing 134 changed files with 17,058 additions and 12,060 deletions.
11 changes: 1 addition & 10 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
> 1%
ie >= 11
last 1 Android versions
last 1 ChromeAndroid versions
last 2 Chrome versions
last 2 Firefox versions
last 2 Safari versions
last 2 iOS versions
last 2 Edge versions
last 2 Opera versions
extends @wordpress/browserslist-config
9 changes: 6 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ trim_trailing_whitespace = true
indent_style = tab
indent_size = 4

[*.yml]
[*.{yml,yaml}]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false
[*.{gradle,java,kt}]
indent_style = space

[packages/react-native-*/**.xml]
indent_style = space
2 changes: 0 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@ node_modules
vendor
build
!.*.js
snapshots.js
cypress/index.d.ts
release/
13 changes: 0 additions & 13 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
module.exports = {
root: true,
extends: [ 'plugin:@wordpress/eslint-plugin/recommended' ],
parserOptions: {
requireConfigFile: false,
babelOptions: {
presets: [ require.resolve( '@wordpress/babel-preset-default' ) ],
},
},
overrides: [
{
// Use cypress/recommended plugin for cypress tests.
files: [ 'cypress/**/*.js' ],
extends: [ 'plugin:cypress/recommended' ],
},
],
};
16 changes: 13 additions & 3 deletions .github/workflows/lint-test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Run PHP linter
run: |
npm run wp-env start
npm run lint:php
npm run lint:php:ci
tests:
name: Tests
Expand All @@ -36,7 +36,7 @@ jobs:

strategy:
matrix:
wp: [ '5.7', '5.8', '5.9', '6.0', '6.1' ]
wp: [ '6.2', '6.3', '6.4' ]

steps:
- uses: actions/checkout@v3
Expand All @@ -51,13 +51,16 @@ jobs:
npm ci
composer install
- name: Install Playwright dependencies
run: |
npx playwright install chromium firefox webkit --with-deps
- name: "Configure environment with WP ${{ matrix.wp }}"
run: |
echo -e '{\n\t"core": "WordPress/WordPress#${{ matrix.wp }}"\n}' > ./.wp-env.override.json
- name: Install WordPress
run: |
chmod -R 767 ./ # TODO: Possibly integrate in wp-env
npm run wp-env start
- name: Running JavaScript E2E tests
Expand All @@ -66,6 +69,13 @@ jobs:
- name: Running PHP unit tests
run: npm run test:unit:php:ci

- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: artifacts/
retention-days: 7

deploy-dry-run:
name: '[DRY RUN] Deploy'

Expand Down
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ build/*
!build/settings.css
composer.phar
/release
cypress/videos
cypress/screenshots
.DS_Store
/test-results/
/artifacts/
/blob-report/
/playwright/.cache/
.phpunit.result.cache
3 changes: 3 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Import the default config file and expose it in the project root.
// Useful for editor integrations.
module.exports = require( '@wordpress/prettier-config' );
2 changes: 1 addition & 1 deletion .wp-env.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"core": "WordPress/WordPress#6.1",
"core": "WordPress/WordPress#6.4.1",
"plugins": [ "." ],
"themes": [
"./test-themes/bootstrap"
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ The support is still experimental since it's also marked as experimental in the

## Bootstrap library

Please be aware that this plugin does not include the Bootstrap library in your website. You need to do this by yourself.
Please be aware that this plugin does not include the Bootstrap library in your website. You need to do this by yourself.
We decided not to include the library so that you can modify Bootstrap to your own needs before loading it.

The easiest way to do this is to add the following to your theme's `functions.php`:
Expand Down Expand Up @@ -864,7 +864,7 @@ The following commands can be used to set up a local dev environment. See the of
There are two types of tests for this plugin:

* PHPUnit Tests: Used to validate generated block output. Since this plugin uses dynamic blocks which are rendered on the server side we need to test them with PHPUnit tests.
* Cypress E2E Tests: Used to validate block behaviour in the editor.
* Playwright E2E Tests: Used to validate block behaviour in the editor.

#### PHPUnitTests

Expand All @@ -890,9 +890,9 @@ or the following command to run a specific test:
npm run test:unit:php -- --filter 'my_test'
```

#### Cypress E2E Tests
#### Playwright E2E Tests

The Cypress E2E Tests are stored in the `cypress` directory.
The Playwright E2E Tests are stored in the `playwright` directory.

To run the tests use the following command:

Expand Down
2 changes: 1 addition & 1 deletion build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => 'd3457b9a3c8cbcffa04f');
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-hooks', 'wp-i18n'), 'version' => '711b66ceb1a605b9118c');
6 changes: 3 additions & 3 deletions build/index.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/index.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.7",
"wp-coding-standards/wpcs": "dev-develop",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.2",
"wp-phpunit/wp-phpunit": "^6.0",
"yoast/phpunit-polyfills": "^1.0"
"wp-coding-standards/wpcs": "^3.0",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"wp-phpunit/wp-phpunit": "^6.3",
"yoast/phpunit-polyfills": "^2.0"
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand Down
Loading

0 comments on commit 0718f46

Please sign in to comment.