From 15b20c7ade827b80e3591d382f7ba233c23dca46 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Mon, 18 Mar 2019 08:37:00 +0000 Subject: [PATCH] Improve openAllBlockInserterCategories function; Fix intermittent failures in inner blocks allowed blocks test. (#14460) --- .../src/open-all-block-inserter-categories.js | 8 ++++---- .../specs/plugins/inner-blocks-allowed-blocks.test.js | 7 +------ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/packages/e2e-test-utils/src/open-all-block-inserter-categories.js b/packages/e2e-test-utils/src/open-all-block-inserter-categories.js index 3960cbe646c6ad..f022a0921ed1ad 100644 --- a/packages/e2e-test-utils/src/open-all-block-inserter-categories.js +++ b/packages/e2e-test-utils/src/open-all-block-inserter-categories.js @@ -2,10 +2,10 @@ * Opens all block inserter categories. */ export async function openAllBlockInserterCategories() { - const notOpenCategoryPanels = await page.$$( - '.block-editor-inserter__results .components-panel__body:not(.is-opened)' - ); - for ( const categoryPanel of notOpenCategoryPanels ) { + const notOppenedCategorySelector = '.block-editor-inserter__results .components-panel__body:not(.is-opened)'; + let categoryPanel = await page.$( notOppenedCategorySelector ); + while ( categoryPanel !== null ) { await categoryPanel.click(); + categoryPanel = await page.$( notOppenedCategorySelector ); } } diff --git a/packages/e2e-tests/specs/plugins/inner-blocks-allowed-blocks.test.js b/packages/e2e-tests/specs/plugins/inner-blocks-allowed-blocks.test.js index 78f08c0bb1279c..a25f9a81af95c9 100644 --- a/packages/e2e-tests/specs/plugins/inner-blocks-allowed-blocks.test.js +++ b/packages/e2e-tests/specs/plugins/inner-blocks-allowed-blocks.test.js @@ -11,12 +11,7 @@ import { openGlobalBlockInserter, } from '@wordpress/e2e-test-utils'; -// Todo: Understand why this test causing intermitent fails on travis. -// Error: ● Allowed Blocks Setting on InnerBlocks › allows all blocks if the allowed blocks setting was not set -// Node is detached from document -// at ElementHandle._scrollIntoViewIfNeeded (../../node_modules/puppeteer/lib/ElementHandle.js:75:13) -// eslint-disable-next-line jest/no-disabled-tests -describe.skip( 'Allowed Blocks Setting on InnerBlocks ', () => { +describe( 'Allowed Blocks Setting on InnerBlocks ', () => { const paragraphSelector = '.block-editor-rich-text__editable.wp-block-paragraph'; beforeAll( async () => { await activatePlugin( 'gutenberg-test-innerblocks-allowed-blocks' );