How to use the @wordpress/e2e-test-utils.switchUserToTest 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 / deactivate-all-other-plugins.js View on Github external
return;
	}

	// Select all plugins
	await page.click( '#cb-select-all-1' );

	// Uncheck Site Kit
	await page.click( 'input[type="checkbox"][value="google-site-kit/google-site-kit.php"]' );

	// Bulk deactivate
	await page.select( 'select#bulk-action-selector-bottom', 'deactivate-selected' );
	await Promise.all( [
		page.click( '#doaction2' ),
		page.waitForNavigation(),
	] );
	await switchUserToTest();
}
github getblocklab / block-lab / tests / e2e / config / setup-test-framework.js View on Github external
const bulkSelector = await page.$( '#bulk-action-selector-top' );
	if ( ! bulkSelector ) {
		return;
	}

	// Select all posts.
	await page.waitForSelector( '[id^=cb-select-all-]' );
	await page.click( '[id^=cb-select-all-]' );
	// Select the "bulk actions" > "trash" option.
	await page.select( '#bulk-action-selector-bottom', 'trash' );
	// Submit the form to send all draft/scheduled/published posts to the trash.
	await page.click( '#doaction2' );
	await page.waitForXPath(
		'//*[contains(@class, "updated notice")]/p[contains(text(), "moved to the Trash.")]'
	);
	await switchUserToTest();
}
github WordPress / gutenberg / packages / e2e-tests / config / setup-test-framework.js View on Github external
const bulkSelector = await page.$( '#bulk-action-selector-top' );
	if ( ! bulkSelector ) {
		return;
	}

	// Select all posts.
	await page.waitForSelector( '#cb-select-all-1' );
	await page.click( '#cb-select-all-1' );
	// Select the "bulk actions" > "trash" option.
	await page.select( '#bulk-action-selector-top', 'trash' );
	// Submit the form to send all draft/scheduled/published posts to the trash.
	await page.click( '#doaction' );
	await page.waitForXPath(
		'//*[contains(@class, "updated notice")]/p[contains(text(), "moved to the Trash.")]'
	);
	await switchUserToTest();
}
github Automattic / Edit-Flow / tests / e2e / config / setup-test-framework.js View on Github external
if ( ! bulkSelector ) {
		return;
	}

	// Select all posts.
	await page.waitForSelector( '#cb-select-all-1' );
	await page.click( '#cb-select-all-1' );
	// Select the "bulk actions" > "trash" option.
	await page.select( '#bulk-action-selector-top', 'trash' );
	// Submit the form to send all draft/scheduled/published posts to the trash.
	await page.click( '#doaction' );
	await page.waitForXPath(
		'//*[contains(@class, "updated notice")]/p[contains(text(), "moved to the Trash.")]'
	);
	await switchUserToTest();
}
github ampproject / amp-wp / tests / e2e / utils / delete-theme.js View on Github external
return;
	}

	await page.click( `[data-slug="${ slug }"]` );
	await page.waitForSelector( '.theme-actions .delete-theme' );
	await page.click( '.theme-actions .delete-theme' );

	// Wait for the theme to be removed from the page.
	// eslint-disable-next-line no-restricted-syntax
	await page.waitFor(
		( themeSlug ) =>
			! document.querySelector( `[data-slug="${ themeSlug }"]` ),
		slug,
	);

	await switchUserToTest();
}