Skip to content

Commit

Permalink
Add e2e util addBlockUsingAppender
Browse files Browse the repository at this point in the history
Fix query for Android
  • Loading branch information
fluiddot committed Jul 18, 2023
1 parent 5894190 commit 91138d6
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions packages/react-native-editor/__device-tests__/pages/editor-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,29 @@ class EditorPage {
} while ( navigateUpElements.length > 0 );
}

// Adds a block by tapping on the appender button of blocks with inner blocks (e.g. Group block)
async addBlockUsingAppender( block, blockName ) {
const appenderButton = isAndroid()
? await this.waitForElementToBeDisplayedByXPath(
`//android.widget.Button[@resource-id="appender-button"]`
)
: await this.waitForElementToBeDisplayedById( 'appender-button' );
await appenderButton.click();

// Click on block of choice.
const blockButton = await this.findBlockButton( blockName );

if ( isAndroid() ) {
await blockButton.click();
} else {
await this.driver.execute( 'mobile: tap', {
element: blockButton,
x: 10,
y: 10,
} );
}
}

// =========================
// Inline toolbar functions
// =========================
Expand Down

0 comments on commit 91138d6

Please sign in to comment.