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

[RNMobile] Add e2e util addBlockUsingAppender #52736

Merged
merged 4 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
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
30 changes: 30 additions & 0 deletions packages/react-native-editor/__device-tests__/helpers/test-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,33 @@ exports.galleryBlock = `<!-- wp:gallery {"columns":8,"linkTo":"none","className"
<!-- /wp:image -->
</figure>
<!-- /wp:gallery -->`;

exports.groupNestedStructure = `<!-- wp:group {"layout":{"type":"constrained"}} -->
<div class="wp-block-group"><!-- wp:paragraph {"style":{"color":{"background":"#f9d0d0"}}} -->
<p class="has-background" style="background-color:#f9d0d0">Level 1</p>
<!-- /wp:paragraph -->

<!-- wp:spacer {"height":"50px"} -->
<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- wp:group {"layout":{"type":"constrained"}} -->
<div class="wp-block-group"><!-- wp:paragraph {"style":{"color":{"background":"#d5f0ab"}}} -->
<p class="has-background" style="background-color:#d5f0ab">Level 2</p>
<!-- /wp:paragraph -->

<!-- wp:spacer {"height":"50px"} -->
<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- wp:group {"layout":{"type":"constrained"}} -->
<div class="wp-block-group"><!-- wp:paragraph {"style":{"color":{"background":"#c3e5ff"}}} -->
<p class="has-background" style="background-color:#c3e5ff">Level 3</p>
<!-- /wp:paragraph -->

<!-- wp:spacer {"height":"50px"} -->
<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer --></div>
<!-- /wp:group --></div>
<!-- /wp:group --></div>
<!-- /wp:group -->`;
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 @@ -554,6 +554,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 ) {
dcalhoun marked this conversation as resolved.
Show resolved Hide resolved
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