Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/e2e-tests/config/setup-test-framework.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
setBrowserViewport,
visitAdminPage,
activatePlugin,
switchUserToAdmin,
switchUserToTest,
} from '@wordpress/e2e-test-utils';

/**
Expand Down Expand Up @@ -54,6 +56,7 @@ async function setupBrowser() {
* @return {Promise} Promise resolving once posts have been trashed.
*/
async function trashExistingPosts() {
await switchUserToAdmin();
// Visit `/wp-admin/edit.php` so we can see a list of posts and delete them.
await visitAdminPage( 'edit.php' );

Expand All @@ -70,9 +73,10 @@ async function trashExistingPosts() {
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' );
return page.waitForXPath(
await page.waitForXPath(
'//*[contains(@class, "updated notice")]/p[contains(text(), "moved to the Trash.")]'
);
await switchUserToTest();
}

/**
Expand Down