Skip to content

fix: Missmatch between screenshotBasedTap and hierarchyBasedTap #2326

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

MarcellDr
Copy link

Proposed changes

Assign tab-based function with its correct implementation.
Previous PR reference: #787

Testing

Tested both on Android and IOS.
IOS now using screenshot-based and Android is using hierarchy-based.
Both are still working as expected.

The performance has improved for Android, with the time per tap reducing by about one-third (previously 3 seconds, now 2 seconds).
While IOS remains the same.

Issues fixed

@MarcellDr MarcellDr force-pushed the fix/missmatch-tap-implementation branch from 7ef7e69 to ed8257f Compare February 19, 2025 15:02
@Fishbowler
Copy link
Contributor

I hope this pans out - this is gonna save a lot of people a lot of execution time!

There's a couple of failing tests here - are you able to take a look?

@MarcellDr
Copy link
Author

Hi,
I resolved the issues by removing FAST_HIERARCHY from the FakeDriver. I checked that FakeDriver.deviceInfo is set to iOS, ensuring that it should not use FAST_HIERARCHY.

@amanjeetsingh150
Copy link
Collaborator

Hi,
I resolved the issues by removing FAST_HIERARCHY from the FakeDriver. I checked that FakeDriver.deviceInfo is set to iOS, ensuring that it should not use FAST_HIERARCHY.

FakeDriver, is not used on the production CLI code. Its just for tests. I'm not sure what exactly has changed for the android or iOS driver with this? Can you help elaborating the changes this means for android and iOS driver.

@MarcellDr
Copy link
Author

Sure, I'll start by providing some background.

I have an app that performs some e-commerce validations (PIN, amount, etc).
None of these validations use the soft keyboard; instead, they rely on custom on-screen keyboard.

I tested the app on both Android and iOS and found that Android was lagging behind in performance.

Upon investigation inside Maestro repo, I discovered that Android is using additional screenshot checks, while iOS only checks its hierarchy. Furthermore, I also noticed a mismatch between the screenshot and hierarchy implementations. It seems that the current approach doesn't align with the intended design (from this PR #787).

@MarcellDr
Copy link
Author

In maestro-client/src/main/java/maestro/Maestro.kt, within the performTap function.

We see that FAST_HIERARCHY is using an additional screenshot comparison, even though its function name is hierarchyBasedTap. On the other hand, screenshotBasedTap only checks the hierarchy.

So what I did change to address this inconsistency,
I just swapped the function names for screenshotBasedTap and hierarchyBasedTap.

As a result, my Android app's performance improved by approximately one-third, without the need for the screenshot check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants