Skip to content

Commit

Permalink
Don't do anything when no reusable block is registered.
Browse files Browse the repository at this point in the history
  • Loading branch information
sainthkh committed May 1, 2020
1 parent 6af3c8b commit 0f11258
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions packages/e2e-tests/specs/editor/various/reusable-blocks.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,23 @@ function waitForAndAcceptDialog() {
async function removeReusableBlocks() {
await visitAdminPage( 'edit.php', 'post_type=wp_block' );

// When no reusable block is registered, return
if ( ( await page.$x( '//td[text()="No blocks found."]' ) ) !== null ) {
return;
}

// select all reusable blocks
await page.waitForSelector( '#cb-select-all-1' );
const checkall = await page.$( '#cb-select-all-1' );
await checkall.click();

// bottom select and bottom apply button are used
// because top one is not visible in mobile ui.

// select "Move to trash" option
await page.waitForSelector( '#bulk-action-selector-top' );
await page.select( '#bulk-action-selector-top', 'trash' );
await page.select( '#bulk-action-selector-bottom', 'trash' );

// click apply button
await page.waitForSelector( '#doaction' );
const applyButton = await page.$( '#doaction' );
const applyButton = await page.$( '#doaction2' );
await applyButton.click();
}

Expand Down

0 comments on commit 0f11258

Please sign in to comment.