Skip to content

Commit

Permalink
E2E: Refactor global inserter utility (#46366)
Browse files Browse the repository at this point in the history
  • Loading branch information
WunderBart authored Dec 16, 2022
1 parent a10e7eb commit ec33dae
Show file tree
Hide file tree
Showing 4 changed files with 279 additions and 152 deletions.
64 changes: 42 additions & 22 deletions packages/e2e-test-utils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ _Parameters_

### closeGlobalBlockInserter

Undocumented declaration.
Closes the global inserter.

### closeListView

Expand Down Expand Up @@ -455,41 +455,37 @@ _Returns_

### insertBlock

Opens the inserter, searches for the given term, then selects the first
result that appears. It then waits briefly for the block list to update.
Inserts a block matching a given search term via the global inserter.

_Parameters_

- _searchTerm_ `string`: The text to search the inserter for.
- _searchTerm_ `string`: The term by which to find the block to insert.

### insertBlockDirectoryBlock

Opens the inserter, searches for the given block, then selects the
first result that appears from the block directory. It then waits briefly for the block list to
update.
Inserts a Block Directory block matching a given search term via the global
inserter.

_Parameters_

- _searchTerm_ `string`: The text to search the inserter for.
- _searchTerm_ `string`: The term by which to find the Block Directory block to insert.

### insertPattern

Opens the inserter, searches for the given pattern, then selects the first
result that appears. It then waits briefly for the block list to update.
Inserts a pattern matching a given search term via the global inserter.

_Parameters_

- _searchTerm_ `string`: The text to search the inserter for.
- _searchTerm_ `string`: The term by which to find the pattern to insert.

### insertReusableBlock

Opens the inserter, searches for the given reusable block, then selects the
first result that appears. It then waits briefly for the block list to
update.
Inserts a reusable block matching a given search term via the global
inserter.

_Parameters_

- _searchTerm_ `string`: The text to search the inserter for.
- _searchTerm_ `string`: The term by which to find the reusable block to insert.

### installPlugin

Expand Down Expand Up @@ -577,7 +573,7 @@ Clicks on the button in the header which opens Document Settings sidebar when it

### openGlobalBlockInserter

Opens the global block inserter.
Opens the global inserter.

### openGlobalStylesPanel

Expand Down Expand Up @@ -667,27 +663,51 @@ _Returns_

### searchForBlock

Search for block in the global inserter
Searches for a block via the global inserter.

_Parameters_

- _searchTerm_ `string`: The term to search the inserter for.

_Returns_

- `Promise<ElementHandle|null>`: The handle of block to be inserted or null if nothing was found.

### searchForBlockDirectoryBlock

Searches for a Block Directory block via the global inserter.

_Parameters_

- _searchTerm_ `string`: The text to search the inserter for.
- _searchTerm_ `string`: The term to search the inserter for.

_Returns_

- `Promise<ElementHandle|null>`: The handle of the Block Directory block to be inserted or null if nothing was found.

### searchForPattern

Search for pattern in the global inserter
Searches for a pattern via the global inserter.

_Parameters_

- _searchTerm_ `string`: The text to search the inserter for.
- _searchTerm_ `string`: The term to search the inserter for.

_Returns_

- `Promise<ElementHandle|null>`: The handle of the pattern to be inserted or null if nothing was found.

### searchForReusableBlock

Search for reusable block in the global inserter.
Searches for a reusable block via the global inserter.

_Parameters_

- _searchTerm_ `string`: The text to search the inserter for.
- _searchTerm_ `string`: The term to search the inserter for.

_Returns_

- `Promise<ElementHandle|null>`: The handle of the reusable block to be inserted or null if nothing was found.

### selectBlockByClientId

Expand Down
13 changes: 7 additions & 6 deletions packages/e2e-test-utils/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,17 @@ export { hasBlockSwitcher } from './has-block-switcher';
export { getPageError } from './get-page-error';
export { getOption } from './get-option';
export {
insertBlock,
insertPattern,
insertReusableBlock,
openGlobalBlockInserter,
closeGlobalBlockInserter,
toggleGlobalBlockInserter,
searchForBlock,
searchForPattern,
searchForReusableBlock,
searchForBlockDirectoryBlock,
insertBlock,
insertPattern,
insertReusableBlock,
insertBlockDirectoryBlock,
openGlobalBlockInserter,
closeGlobalBlockInserter,
toggleGlobalBlockInserter,
} from './inserter';
export { installPlugin } from './install-plugin';
export { installTheme } from './install-theme';
Expand Down
Loading

1 comment on commit ec33dae

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3716488111
📝 Reported issues:

Please sign in to comment.