Skip to content

Commit 692393c

Browse files
committed
Acceptance testing tweaks.
1 parent ddda4f3 commit 692393c

5 files changed

Lines changed: 18 additions & 2 deletions

File tree

‎docker-compose.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
include:
22
-
3-
path: vendor/johnbillion/plugin-infrastructure/tests/docker-compose.yml
3+
path:
4+
- vendor/johnbillion/plugin-infrastructure/tests/docker-compose.yml
5+
- tests/mu-plugins/acceptance.yml
46
project_directory: .

‎tests/acceptance/playwright.config.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export default defineConfig({
1010
outputDir: '../test-results',
1111
fullyParallel: false,
1212
forbidOnly: !!process.env.CI,
13+
retries: process.env.CI ? 1 : 0,
1314
workers: 1,
1415
reporter: 'list',
1516
use: {

‎tests/acceptance/utils/user-switching.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,12 @@ export class UserSwitchingUtils {
6262
await this.page.fill( 'input[name="pwd"]', password );
6363
await this.page.locator( '#wp-submit' ).click();
6464

65-
// @todo verify we're logged in (can't use HTTP status code as WP returns 200 even on failed login)
65+
// Wait for the redirect to complete before returning, otherwise a subsequent
66+
// navigation can race the login request and land without the auth cookie.
67+
await this.page.waitForURL( /\/wp-admin\// );
68+
69+
// WP returns a 200 for a failed login, so assert on the logged-in state instead.
70+
await expect( this.page.locator( '#wpadminbar' ) ).toBeVisible();
6671
}
6772

6873
/**

‎tests/mu-plugins/acceptance.php‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?php
2+
3+
// The autofocus timer on wp-login.php races Playwright filling in the login form.
4+
add_filter( 'enable_login_autofocus', '__return_false' );

‎tests/mu-plugins/acceptance.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
services:
2+
php:
3+
volumes:
4+
- ./tests/mu-plugins/acceptance.php:/var/www/html/wp-content/mu-plugins/acceptance.php

0 commit comments

Comments
 (0)