Skip to content

Commit

Permalink
Playwright: fix request utils for non Docker envs
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Feb 21, 2023
1 parent 08f65dc commit e6f0da3
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@
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,
themeSlug: string
): 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&amp;stylesheet=${ encodeURIComponent(
`action=activate&amp;stylesheet=${ optionalFolder }${ encodeURIComponent(
themeSlug
) }&amp;_wpnonce=[a-z0-9]+`
);
Expand Down

0 comments on commit e6f0da3

Please sign in to comment.