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

Allow for testing BroadcastReceivers on Android #1142

Open
andre-artus opened this issue Jun 9, 2023 · 6 comments
Open

Allow for testing BroadcastReceivers on Android #1142

andre-artus opened this issue Jun 9, 2023 · 6 comments
Labels
enhancement New feature request or improvement of an existing feature platform: android Testing Android apps is affected

Comments

@andre-artus
Copy link

Is your feature request related to a problem? Please describe.
Some of my use cases are initiated from a broadcast (i.e. implements a BroadcastReceiver). I would like to automate the tests for these receivers.

Describe the solution you'd like
Some mechanism to initiate or simulate a broadcast (Local or System), or call adb to do it and check the result.
I would like to test when the following are sent:

  • correct broadcast (data/params)
  • incorrect broadcast ,
  • multiple concurrent broadcast (attempt to overload)
    Also
  • no ANR
  • What happens when app is in non-interrupt state (e.g. user filling in a form) and intent is broadcast
  • Behaviour under Doze, standby or process death.
  • Test order of broadcast receipt (if dependent on order).

I'm sure I'm leaving something out, but that should cover a lot of it.

Describe alternatives you've considered
I'm currently just using scripts calling into ADB with a variety of known values and logging the interactions.

@andre-artus andre-artus added the enhancement New feature request or improvement of an existing feature label Jun 9, 2023
@amanjeetsingh150
Copy link
Collaborator

Hey @andre-artus can you explain the detailed use case you are looking at? What type of behavior do you want to verify in the maestro test?

@MaaxGr
Copy link

MaaxGr commented Oct 24, 2023

We use broadcast Intents to simulate the behaviour of the physical scan engine on enterprise devices (as Zebra TC58) on emulators:
image

Example: Send Barcode "test" to our application:
adb shell am broadcast -a de.guettlerlogistik.hallenapp.scan --es barcode "test" de.guettlerlogistik.hallenapp

That should also be supported with maestro. :)

Have a great week.

Max

@andre-artus
Copy link
Author

Sorry, @amanjeetsingh150 , I failed to respond to you (I don;t know if I missed the notification) but Max's examples is very similar to ours (scanner or other accessories on enterprise devices).

@MaaxGr
Copy link

MaaxGr commented Nov 6, 2023

@andre-artus How did you solved it with scripts calling into ADB. Can you share an example?

@bartekpacia
Copy link
Contributor

bartekpacia commented Jul 18, 2024

Hey all,

This seems to a bit of a more niche use case, and we're a small team busy with other work streams rn, so I cannot share any timeline on when we will implement it. That said if anyone decided to contribute this feature, we're always happy to review PRs.

Notes:

  • this would be Android-only. Normally we try to avoid such features in Maestro, but I'm not aware of any iOS equivalent. I think it'd be fine, it's a very valid feature request.

@bartekpacia bartekpacia added the platform: android Testing Android apps is affected label Jul 18, 2024
@bartekpacia bartekpacia changed the title [Feature Request] broadcast an intent during a flow Allow for testing BroadcastReceivers on Android Jul 18, 2024
@LukStankovic
Copy link

Yes, this feature would be extremely useful for my workflow too, as I need to test an application on a Zebra scanner 🙏🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature request or improvement of an existing feature platform: android Testing Android apps is affected
Projects
None yet
Development

No branches or pull requests

5 participants