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] Look for newly available blocks too during E2E tests #35948

Merged
merged 2 commits into from
Oct 26, 2021
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
27 changes: 24 additions & 3 deletions packages/react-native-editor/__device-tests__/pages/editor-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ class EditorPage {
// Attempts to find the given block button in the block inserter control.
async findBlockButton( blockName ) {
const blockAccessibilityLabel = `${ blockName } block`;
const blockAccessibilityLabelNewBlock = `${ blockAccessibilityLabel }, newly available`;

if ( isAndroid() ) {
const size = await this.driver.getWindowSize();
Expand All @@ -308,6 +309,9 @@ class EditorPage {
while (
! ( await this.driver.hasElementByAccessibilityId(
blockAccessibilityLabel
) ) &&
! ( await this.driver.hasElementByAccessibilityId(
blockAccessibilityLabelNewBlock
) )
) {
swipeFromTo(
Expand All @@ -317,14 +321,31 @@ class EditorPage {
);
}

if (
await this.driver.hasElementByAccessibilityId(
blockAccessibilityLabelNewBlock
)
) {
return await this.driver.elementByAccessibilityId(
blockAccessibilityLabelNewBlock
);
}

return await this.driver.elementByAccessibilityId(
blockAccessibilityLabel
);
}

const blockButton = await this.driver.elementByAccessibilityId(
blockAccessibilityLabel
);
const blockButton = ( await this.driver.hasElementByAccessibilityId(
blockAccessibilityLabelNewBlock
) )
? await this.driver.elementByAccessibilityId(
blockAccessibilityLabelNewBlock
)
: await this.driver.elementByAccessibilityId(
blockAccessibilityLabel
);

const size = await this.driver.getWindowSize();
// The virtual home button covers the bottom 34 in portrait and 21 on landscape on iOS.
// We start dragging a bit above it to not trigger home button.
Expand Down