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

Add UI Automation Flag to Not Suppress Accessibility Services (Android) #2319

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sypannapis
Copy link

@sypannapis sypannapis commented Feb 18, 2025

Proposed Changes

This PR introduces a modification to the MaestroDriverService.kt file to add a UI automation flag that prevents the suppression of accessibility services during testing on Android devices. This change allows for more comprehensive testing scenarios where accessibility services need to remain active.

Background

While Maestro supports both iOS and Android, this change specifically targets the Android implementation. By default, UiAutomation suppresses accessibility services on Android. However, in some testing scenarios, it's crucial to have these services running to accurately simulate real-world conditions or test accessibility features.

Implementation

The change is implemented in the grpcServer() function of the MaestroDriverService class:

@Test
fun grpcServer() {
    Configurator.getInstance()
        .setActionAcknowledgmentTimeout(0L)
        .setWaitForIdleTimeout(0L)
        .setWaitForSelectorTimeout(0L)
        .setUiAutomationFlags(UiAutomation.FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES)

    // ... rest of the function
}

This modification sets the UI automation flags to include FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES using the setUiAutomationFlags() method of the Configurator instance.

Usage

For more information about the FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES flag and its usage, please refer to the Android Developer Documentation.

Testing

After testing with my own app, I have confirmed that the Accessibility service will not be disabled when using a local Maestro build with the specified flag and setting stopApp=false under launchApp.

…ervices


Set UiAutomation flag FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES in grpcServer function
@sypannapis sypannapis changed the title # Add UI Automation Flag to Not Suppress Accessibility Services (Android) Add UI Automation Flag to Not Suppress Accessibility Services (Android) Feb 18, 2025
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.

1 participant