Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
54 changes: 53 additions & 1 deletion .github/workflows/build-zip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,62 @@ jobs:
release-notes.md
if-no-files-found: error

# the end-to-end tests run beside "build". A release is only published if both succeeded.
playwright:
name: Playwright tests
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Setup Node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
# the Playground packages in package-lock.json need Node 24.
node-version: 24

# --- install and compile, as in "build" -----------------------------------------------------------

- name: Install PHP packages
# also runs Mozart, which copies easy-transients-for-wordpress to app/Dependencies.
run: composer install --no-interaction --no-progress

- name: Build blocks, commands and copy driver.js
run: |
npm ci
npm run build
npm run global-styles

- name: Generate the URL constants
# the placeholders are enough for the tests, they never contact these URLs.
run: cp inc/constants_urls.php.dist inc/constants_urls.php

# --- run the tests --------------------------------------------------------------------------------

- name: Install the browser for Playwright
run: npx --no -- playwright install --with-deps chromium

- name: Run the Playwright tests
run: npx --no -- playwright test

- name: Hand over the report
if: ${{ !cancelled() }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: playwright-report
path: |
playwright-report/
test-results/
retention-days: 14
if-no-files-found: ignore

# the only job which may write to the repository - and it runs no code from the repository or from npm.
release:
name: Publish the release
needs: [build]
needs: [build, playwright]
# only for a pushed tag, never for a manual run.
if: github.event_name == 'push'
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@
languages/*.json
/vendor/
*.min.css
/node_modules/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
2 changes: 1 addition & 1 deletion app/Plugin/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ public function add_the_settings(): void {
$setting = $settings_obj->add_setting( 'personio_integration_light_setting_view' );
$setting->set_section( $advanced );
$setting->set_type( 'string' );
$setting->set_default( 'classic' );
$setting->set_default( 'dataview' );
$field = new Select( $settings_obj );
$field->set_title( __( 'Settings view', 'personio-integration-light' ) );
$field->set_description( __( 'Choose the view for the settings of this plugin. DataView is only available for WordPress 7 or newer.', 'personio-integration-light' ) );
Expand Down
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Added abilities to run and cancel the import of positions, to delete all positions and to read the log with AI, and extended the import state ability with the progress
- Added a link to edit a single position in your Personio account in the list of all positions in backend
- Added setting to chose, which API to use for import of positions
- Added Playwright for automated visual tests before each release
- Added new hooks

### Changed
Expand All @@ -34,6 +35,7 @@
- The license key is not part of URLs anymore and is not loaded on every request
- Log cleanup runs at most once per hour, the log table is paginated in the database
- Release ZIP from GitHub does not contain development files anymore
- Settings default view is now DataView for all new installations (old stay unchanged)
- Updated the settings library
- Updated the setup library
- Updated dependencies
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@
"start:commands": "wp-scripts start blocks/commands.js --output-path=blocks/commands",
"build:commands": "wp-scripts build blocks/commands.js --output-path=blocks/commands",
"global-styles": "cat blocks/*/build/style-index.css > css/blocks.css",
"test:e2e": "playwright test",
"copy:driver": "mkdir -p admin/driver && cp node_modules/driver.js/dist/driver.js.iife.js node_modules/driver.js/dist/driver.css admin/driver/ && cp node_modules/driver.js/license admin/driver/"
},
"devDependencies": {
"@babel/core": "^7.28.5",
"@wordpress/scripts": "~36.0",
"@wp-playground/cli": "^3.1.57",
"concurrently": "^9.2.3"
"concurrently": "^9.2.3",
"@playwright/test": "^1.62.1"
},
"dependencies": {
"@babel/runtime": "^7.28.4",
Expand Down
63 changes: 63 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { defineConfig, devices } from '@playwright/test';

/**
* Playwright configuration for the end-to-end tests of Personio Integration Light.
*
* Every test worker starts its own WordPress Playground with this plugin mounted
* (see tests/Playwright/fixtures.ts). Starting Playground takes a while and uses a
* lot of memory, therefore the tests run in one worker, one after another.
*
* Run them with: npx playwright test
*/
// @ts-ignore
const isCI = !! process.env.CI;

export default defineConfig( {
testDir: './tests/Playwright',
testMatch: '**/*.spec.ts',

// one Playground for all tests: they share the website, see helpers.ts.
fullyParallel: false,
workers: 1,

// test.only must never end up in the repository.
forbidOnly: isCI,

// a failed test gets one more try in CI. Playwright starts a fresh website for it.
retries: isCI ? 1 : 0,

// a single test. Starting Playground is not part of it, see "cli" in fixtures.ts.
// Playground is a lot slower than a real WordPress, especially on a shared server,
// and some tests load several pages of the backend.
timeout: 120_000,
expect: { timeout: 20_000 },

reporter: isCI
? [ [ 'github' ], [ 'list' ], [ 'html', { open: 'never', outputFolder: 'playwright-report' } ] ]
: [ [ 'list' ] ],

outputDir: 'test-results',

use: {
trace: 'retain-on-failure',
screenshot: 'only-on-failure',
locale: 'en-US',
timezoneId: 'Europe/Berlin',
navigationTimeout: 60_000,
actionTimeout: 30_000,
},

projects: [
{
name: 'chromium',
use: {
...devices[ 'Desktop Chrome' ],
launchOptions: {
// optional: use an already installed Chromium instead of the one of "npx playwright install".
// @ts-ignore
executablePath: process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE || undefined,
},
},
},
],
} );
39 changes: 38 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,29 @@ After checkout go through the following steps:
### On GitHub

1. Create a new tag with the new version number.
2. The release zip will be created by a GitHub action.
2. The release zip will be created by a GitHub action. It is only published if the Playwright tests (see below) succeed.

## End-to-end tests with Playwright

The tests in `tests/Playwright` start a WordPress Playground with this plugin and check setup, settings, import and frontend. They need no database and no Personio account: requests to the test Personio URL are answered with `tests/Data/positions.xml`.

### Preparations

1. `composer install`
2. `npm ci && npm run build && npm run global-styles`
3. `npx playwright install chromium` (once)

### Run

`npx playwright test` (or `npm run test:e2e`)

Optional environment variables:

* `PLAYGROUND_WP`: WordPress version, e.g. `6.8`, or the URL of a WordPress zip (default: `latest`)
* `PLAYGROUND_PHP`: PHP version (default: `8.3`)
* `PLAYGROUND_HOME`: where Playground keeps the downloaded WordPress (default: `node_modules/.cache/playground-home`)

Each test fails if the plugin causes a PHP error, warning, notice or deprecation.

## Translations

Expand Down Expand Up @@ -167,3 +189,18 @@ Then: `composer test-install`
### Run

`composer test`

## Playwright

See: https://wordpress.github.io/wordpress-playground/guides/e2e-testing-with-playwright/

### Prepare

```
npm install
npx playwright install chromium
```

### Run

`npx playwright test`
4 changes: 2 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ The output of the positions as a list is limited to a maximum of 10. Only in [Pe

#### the Pro license includes:

➕ Native support for following PageBuilders: Avada, Beaver Builder, Breakdance, Bricks, Brizy, Divi 4 & 5, Elementor, Elements in GeneratePress Premium, SiteOrigin (SiteOrigin Widgets Bundle necessary), WPBakery
➕ Also compatible with Avia (from Enfold) and Kubio AI
➕ Native support for following PageBuilders: Avada, Beaver Builder, Bold Page Builder, Breakdance, Bricks, Brizy, Divi 4 & 5, Elementor, Elements in GeneratePress Premium, Fusion, LiveComposer, Oxygen, PageLayer, SiteOrigin (SiteOrigin Widgets Bundle necessary), Themify, WPBakery und ZionBuilder
➕ Also compatible with Avia (from Enfold), Colibri, Kubio, Nimble Builder, SeedProd Pro, Visual Composer
➕ Multiple and customizable application forms incl. export of them via Personio API
➕ Support for multiple form handler like Avada Forms, Contact Form 7, Elementor Forms, Everest Forms, Fluent Forms, Forminator, Ninja Forms and WPForms
➕ Customization of slugs (URLs) for list and detailed views of positions
Expand Down
Loading
Loading