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]+` );