Skip to content
Prev Previous commit
Next Next commit
deleteUser: Delete content owned by the user, if any
  • Loading branch information
ockham committed Jun 29, 2021
commit 8eb02f9d07bf159b507bf2770f6a33db2102a5c8
8 changes: 8 additions & 0 deletions packages/e2e-test-utils/src/delete-user.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ export async function deleteUser( username ) {
page.waitForNavigation( { waitUntil: 'networkidle0' } ),
] );

// If there's content owned by this user, delete it.
const deleteContentRadioButton = await page.$(
'input[type="radio"][name="delete_option"][value="delete"]'
);
if ( deleteContentRadioButton ) {
await deleteContentRadioButton.click();
}

// Confirm
await Promise.all( [
page.click( 'input#submit' ),
Expand Down