Skip to content

Commit

Permalink
Fix flaky block hierarchy navigation test by better inserter selection (
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnajdr authored Mar 8, 2023
1 parent c1447f3 commit 63479e0
Showing 1 changed file with 20 additions and 12 deletions.
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

0 comments on commit 63479e0

Please sign in to comment.