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

Fix flaky block hierarchy navigation test by better inserter selection #48780

Merged
merged 1 commit into from
Mar 8, 2023
Merged
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ describe( 'Navigating the block hierarchy', () => {
// Add a paragraph in the first column.
await page.keyboard.press( 'ArrowDown' ); // Navigate to inserter.
await page.keyboard.press( 'Enter' ); // Activate inserter.
await page.keyboard.type( 'Paragraph' );
await pressKeyTimes( 'Tab', 2 ); // Tab to paragraph result.
await page.keyboard.press( 'Enter' ); // Insert paragraph.
// Wait for inserter results to appear and then insert a paragraph.
await page.waitForSelector(
'.block-editor-inserter__quick-inserter-results .editor-block-list-item-paragraph'
);
await page.click( '.editor-block-list-item-paragraph' );
await page.keyboard.type( 'First column' );

// Navigate to the columns blocks.
Expand Down Expand Up @@ -99,9 +101,11 @@ describe( 'Navigating the block hierarchy', () => {
// Insert text in the last column block.
await page.keyboard.press( 'ArrowDown' ); // Navigate to inserter.
await page.keyboard.press( 'Enter' ); // Activate inserter.
await page.keyboard.type( 'Paragraph' );
await pressKeyTimes( 'Tab', 2 ); // Tab to paragraph result.
await page.keyboard.press( 'Enter' ); // Insert paragraph.
// Wait for inserter results to appear and then insert a paragraph.
await page.waitForSelector(
'.block-editor-inserter__quick-inserter-results .editor-block-list-item-paragraph'
);
await page.click( '.editor-block-list-item-paragraph' );
await page.keyboard.type( 'Third column' );

expect( await getEditedPostContent() ).toMatchSnapshot();
Expand All @@ -115,9 +119,11 @@ describe( 'Navigating the block hierarchy', () => {
// Add a paragraph in the first column.
await page.keyboard.press( 'ArrowDown' ); // Navigate to inserter.
await page.keyboard.press( 'Enter' ); // Activate inserter.
await page.keyboard.type( 'Paragraph' );
await pressKeyTimes( 'Tab', 2 ); // Tab to paragraph result.
await page.keyboard.press( 'Enter' ); // Insert paragraph.
// Wait for inserter results to appear and then insert a paragraph.
await page.waitForSelector(
'.block-editor-inserter__quick-inserter-results .editor-block-list-item-paragraph'
);
await page.click( '.editor-block-list-item-paragraph' );
await page.keyboard.type( 'First column' );

// Navigate to the columns blocks using the keyboard.
Expand Down Expand Up @@ -146,9 +152,11 @@ describe( 'Navigating the block hierarchy', () => {
// Insert text in the last column block.
await page.keyboard.press( 'ArrowDown' ); // Navigate to inserter.
await page.keyboard.press( 'Enter' ); // Activate inserter.
await page.keyboard.type( 'Paragraph' );
await pressKeyTimes( 'Tab', 2 ); // Tab to paragraph result.
await page.keyboard.press( 'Enter' ); // Insert paragraph.
// Wait for inserter results to appear and then insert a paragraph.
await page.waitForSelector(
'.block-editor-inserter__quick-inserter-results .editor-block-list-item-paragraph'
);
await page.click( '.editor-block-list-item-paragraph' );
await page.keyboard.type( 'Third column' );

expect( await getEditedPostContent() ).toMatchSnapshot();
Expand Down