Skip to content

Commit

Permalink
Testing: Trash existing posts as admin user (#14244)
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth authored and youknowriad committed Mar 20, 2019
1 parent 744fdb8 commit 227d339
Showing 1 changed file with 5 additions and 1 deletion.
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

0 comments on commit 227d339

Please sign in to comment.