How to use the @wordpress/e2e-test-utils.createURL function in @wordpress/e2e-test-utils

To help you get started, we’ve selected a few @wordpress/e2e-test-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github google / site-kit-wp / tests / e2e / utils / logout-user.js View on Github external
export async function logoutUser() {
	if ( ! isCurrentURL( 'wp-login.php' ) ) {
		await page.goto(
			createURL( 'wp-login.php', 'action=logout' )
		);
	}

	// Since we're directly navigating to the logout URL,
	// WP will ask for confirmation due to the missing nonce.

	await Promise.all( [
		page.waitForNavigation(),
		expect( page ).toClick( 'a', { text: /log out/i } ),
	] );
}
github gocodebox / lifterlms / packages / llms-e2e-test-utils / src / logout-user.js View on Github external
export async function logoutUser() {
	await page.goto( createURL( 'wp-login.php', 'action=logout' ) );
	await clickAndWait( 'a' );
}
github gocodebox / lifterlms / packages / llms-e2e-test-utils / src / visit-page.js View on Github external
export async function visitPage( path, query ) {
	await page.goto( createURL( path, query ) );
}
github Automattic / jetpack / tests / e2e / lib / pages / wp-admin / login.js View on Github external
constructor( page ) {
		const expectedSelector = '.login';
		const url = createURL( 'wp-login.php' );
		super( page, { expectedSelector, url } );
	}
github google / site-kit-wp / tests / e2e / matchers / to-have-adsense-tag.js View on Github external
export async function toHaveAdSenseTag( path ) {
	const result = {};

	const page = await browser.newPage();
	await page.goto( createURL( path ) );

	try {
		await expect( page ).toMatchElement( 'script[src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"]' );
		result.pass = true;
		result.message = () => `Expected ${ path } not to contain an Adsense tag.`;
	} catch {
		result.pass = false;
		result.message = () => `Expected ${ path } to contain an Adsense tag.`;
	}

	await page.close();

	return result;
}