Skip to content

Commit

Permalink
Fix a few e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Dec 5, 2019
1 parent 9d90c15 commit 0ddcb92
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions packages/e2e-tests/specs/editor/various/adding-blocks.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ describe( 'adding blocks', () => {
// Unselect blocks to avoid conflicts with the inbetween inserter
await page.click( '.editor-post-title__input' );

// Using the between inserter
const insertionPoint = await page.$( '[data-type="core/quote"] .block-editor-inserter__toggle' );
// Using the inserter between paragraph and quote
const insertionPoint = await page.$( '[data-type="core/paragraph"] ~ .block-editor-block-list__insertion-point .block-editor-inserter__toggle' );
const rect = await insertionPoint.boundingBox();
await page.mouse.move( rect.x + ( rect.width / 2 ), rect.y + ( rect.height / 2 ), { steps: 10 } );
await page.waitForSelector( '[data-type="core/quote"] .block-editor-inserter__toggle' );
await page.click( '[data-type="core/quote"] .block-editor-inserter__toggle' );
await page.waitForSelector( '[data-type="core/paragraph"] ~ .block-editor-block-list__insertion-point .block-editor-inserter__toggle' );
await page.click( '[data-type="core/paragraph"] ~ .block-editor-block-list__insertion-point .block-editor-inserter__toggle' );
// [TODO]: Search input should be focused immediately. It shouldn't be
// necessary to have `waitForFunction`.
await page.waitForFunction( () => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ const navigateToContentEditorTop = async () => {
};

const tabThroughParagraphBlock = async ( paragraphText ) => {
// Tab causes 'add block' button to receive focus
await page.keyboard.press( 'Tab' );
const isFocusedParagraphInserterToggle = await page.evaluate( () =>
document.activeElement.classList.contains( 'block-editor-inserter__toggle' )
);
await expect( isFocusedParagraphInserterToggle ).toBe( true );

// Tab to the next paragraph block
await page.keyboard.press( 'Tab' );

Expand All @@ -26,13 +33,6 @@ const tabThroughParagraphBlock = async ( paragraphText ) => {
);
await expect( isFocusedParagraphBlock ).toEqual( 'core/paragraph' );

// Tab causes 'add block' button to receive focus
await page.keyboard.press( 'Tab' );
const isFocusedParagraphInserterToggle = await page.evaluate( () =>
document.activeElement.classList.contains( 'block-editor-inserter__toggle' )
);
await expect( isFocusedParagraphInserterToggle ).toBe( true );

await tabThroughBlockMoverControl();
await tabThroughBlockToolbar();

Expand Down

0 comments on commit 0ddcb92

Please sign in to comment.