From e6f0da32ab32271adc5c605e6f183dd5bae7d066 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ella=20van=C2=A0Durpe?= Date: Fri, 17 Feb 2023 14:46:35 +0200 Subject: [PATCH] Playwright: fix request utils for non Docker envs --- .../e2e-test-utils-playwright/src/request-utils/themes.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/e2e-test-utils-playwright/src/request-utils/themes.ts b/packages/e2e-test-utils-playwright/src/request-utils/themes.ts index bb2fbd89781595..802530d947b0fc 100644 --- a/packages/e2e-test-utils-playwright/src/request-utils/themes.ts +++ b/packages/e2e-test-utils-playwright/src/request-utils/themes.ts @@ -4,7 +4,7 @@ import type { RequestUtils } from './index'; import { WP_BASE_URL } from '../config'; -const THEMES_URL = new URL( '/wp-admin/themes.php', WP_BASE_URL ).href; +const THEMES_URL = new URL( 'wp-admin/themes.php', WP_BASE_URL ).href; async function activateTheme( this: RequestUtils, @@ -12,8 +12,9 @@ async function activateTheme( ): Promise< void > { let response = await this.request.get( THEMES_URL ); const html = await response.text(); + const optionalFolder = '([a-z0-9-]+%2F)?'; const matchGroup = html.match( - `action=activate&stylesheet=${ encodeURIComponent( + `action=activate&stylesheet=${ optionalFolder }${ encodeURIComponent( themeSlug ) }&_wpnonce=[a-z0-9]+` );