Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flaky E2E: avoid using the sidebar to insert Paragraph and Image blocks in certain specs. #73561

Merged
merged 2 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions packages/calypso-e2e/src/lib/pages/editor-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,14 @@ export class EditorPage {
*/
async addBlockFromSidebar(
blockName: string,
blockEditorSelector: string
blockEditorSelector: string,
{ noSearch }: { noSearch?: boolean } = {}
): Promise< ElementHandle > {
await this.editorGutenbergComponent.resetSelectedBlock();
await this.editorToolbarComponent.openBlockInserter();
await this.addBlockFromInserter( blockName, this.editorSidebarBlockInserterComponent );
await this.addBlockFromInserter( blockName, this.editorSidebarBlockInserterComponent, {
noSearch: noSearch,
} );

const blockHandle = await this.editorGutenbergComponent.getSelectedBlockElementHandle(
blockEditorSelector
Expand Down Expand Up @@ -377,9 +380,12 @@ export class EditorPage {
*/
private async addBlockFromInserter(
blockName: string,
inserter: BlockInserter
inserter: BlockInserter,
{ noSearch }: { noSearch?: boolean } = {}
): Promise< void > {
await inserter.searchBlockInserter( blockName );
if ( ! noSearch ) {
await inserter.searchBlockInserter( blockName );
}
await inserter.selectBlockInserterResult( blockName );
}

Expand Down
6 changes: 4 additions & 2 deletions test/e2e/specs/editor/editor__post-advanced-flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ describe( DataHelper.createSuiteTitle( `Editor: Advanced Post Flow` ), function
it( 'Enter post content', async function () {
const blockHandle = await editorPage.addBlockFromSidebar(
ParagraphBlock.blockName,
ParagraphBlock.blockEditorSelector
ParagraphBlock.blockEditorSelector,
{ noSearch: true }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Paragraph block is only directly inserted with the Editor: Post Advanced Flow spec. Since searching for "Paragraph" returns slow loading patterns, the noSearch optional param is used to specify that Playwright is to select directly from the block listing that is shown when opening the sidebar.

);
paragraphBlock = new ParagraphBlock( blockHandle );
await paragraphBlock.enterParagraph( originalContent );
Expand Down Expand Up @@ -97,7 +98,8 @@ describe( DataHelper.createSuiteTitle( `Editor: Advanced Post Flow` ), function
it( 'Append additional content', async function () {
const blockHandle = await editorPage.addBlockFromSidebar(
ParagraphBlock.blockName,
ParagraphBlock.blockEditorSelector
ParagraphBlock.blockEditorSelector,
{ noSearch: true }
);
paragraphBlock = new ParagraphBlock( blockHandle );
await paragraphBlock.enterParagraph( additionalContent );
Expand Down