-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add: end to end test to InnerBlocks allowed block restriction (#14054)
- Loading branch information
1 parent
a06f931
commit cd456f6
Showing
13 changed files
with
323 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
## 1.1.0 (Unreleased) | ||
|
||
### New Features | ||
|
||
- New Function: `getAllBlockInserterItemTitles` - Returns an array of strings with all inserter item titles. | ||
- New Function: `openAllBlockInserterCategories` - Opens all block inserter categories. | ||
- New Function: `getAllBlockInserterItemTitles` - Opens the global block inserter. | ||
|
||
|
||
## 1.0.0 (2019-03-06) | ||
|
||
- Initial release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/e2e-test-utils/src/get-all-block-inserter-item-titles.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { sortBy, uniq } from 'lodash'; | ||
|
||
/** | ||
* Returns an array of strings with all inserter item titles. | ||
* | ||
* @return {Promise} Promise resolving with an array containing all inserter item titles. | ||
*/ | ||
export async function getAllBlockInserterItemTitles() { | ||
const inserterItemTitles = await page.evaluate( () => { | ||
return Array.from( | ||
document.querySelectorAll( | ||
'.editor-inserter__results .editor-block-types-list__item-title' | ||
) | ||
).map( | ||
( inserterItem ) => { | ||
return inserterItem.innerText; | ||
} | ||
); | ||
} ); | ||
return sortBy( uniq( inserterItemTitles ) ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/e2e-test-utils/src/open-all-block-inserter-categories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Opens all block inserter categories. | ||
*/ | ||
export async function openAllBlockInserterCategories() { | ||
const notOpenCategoryPanels = await page.$$( | ||
'.editor-inserter__results .components-panel__body:not(.is-opened)' | ||
); | ||
for ( const categoryPanel of notOpenCategoryPanels ) { | ||
await categoryPanel.click(); | ||
} | ||
} |
Oops, something went wrong.