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

feat(): Migrate e2e tests to playwright #129

Merged
merged 28 commits into from
Nov 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
9390f2f
make phpunit tests compatible with php 8
tschortsch Nov 12, 2023
16fbede
update npm dependencies
tschortsch Nov 12, 2023
df0af86
fix insertRowBlock cypress command
tschortsch Nov 12, 2023
fbf7ee9
migrate button e2e tests to playwright
tschortsch Nov 12, 2023
8da3133
migrate button filters e2e tests to playwright
tschortsch Nov 12, 2023
8622627
use playwright in github action
tschortsch Nov 12, 2023
e326dcc
install playwright dependencies during github action
tschortsch Nov 12, 2023
4f8768f
upload artifacts
tschortsch Nov 12, 2023
c756fea
fix lint:php script
tschortsch Nov 12, 2023
55dab62
update composer dependencies
tschortsch Nov 12, 2023
ed5a5ff
fix phpcs issues
tschortsch Nov 12, 2023
09d4d5c
migrate settings e2e tests to playwright
tschortsch Nov 12, 2023
5aa9f34
fix flaky settings test
tschortsch Nov 13, 2023
fc8a8c8
migrate column block e2e tests to playwright
tschortsch Nov 18, 2023
5722585
migrate remaining column block e2e tests to playwright
tschortsch Nov 19, 2023
8a15284
migrate container block e2e tests to playwright
tschortsch Nov 19, 2023
09f7a2d
fix toBeVisible checks
tschortsch Nov 19, 2023
21d84ee
migrate first row block e2e tests to playwright
tschortsch Nov 19, 2023
7145fcd
migrate row block transforms e2e tests to playwright
tschortsch Nov 19, 2023
d6063ef
migrate row block css grid e2e tests to playwright
tschortsch Nov 19, 2023
78e382c
migrate row filters css grid e2e tests to playwright
tschortsch Nov 19, 2023
8db92c1
migrate row filters e2e tests to playwright
tschortsch Nov 19, 2023
925c34d
remove cypress specific code
tschortsch Nov 19, 2023
80130bf
update config files to match gutenberg repository
tschortsch Nov 19, 2023
5711941
allow global wp object
tschortsch Nov 19, 2023
3ed7e2e
add further wp versions to github action
tschortsch Nov 19, 2023
a42e90d
build assets
tschortsch Nov 19, 2023
e56f693
remove older wp versions
tschortsch Nov 19, 2023
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
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
Loading