Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing: Trash existing posts as admin user #14244

Merged
merged 1 commit into from
Mar 6, 2019
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