Open mikamikaWolt opened 1 month ago
Hey @mikamikaWolt 👋
Thanks for taking time to create this feature request.
I made a little googling and looks like it should be possible on Android:
adb shell 'date 042915292021.00 ; am broadcast -a android.intent.action.TIME_SET'
# set date to April 29th, 15:29, year 2021
On iOS simulator though it seems that it's impossible, and you have to change macOS system time and only then it's reflected by iOS simulator - but it's quite an ugly workaround.
Of course, we're always open to ideas and contributions.
adb command will work if one has direct access to devices (test runner and test device are connected with a cable). But in our setup test device is located on the remote server with a lot of devices, and we don't have direct access to them. We work through additional libraries.
So, a simple command, like to set device coordinates, called from a test would be the best option.
Maestro uses adb
(or rather our own client implementation, dadb
), so as long as we can do something with the vanilla adb
, we'll be able to add a Maestro command for that.
It would be great to have an api similar to Playwright's clock:
- setFixedTime: <ISO string>
- runFor: <milliseconds>
<-- this should trigger the timers
Also since dreaming is free, how about borrowing advanceTimersToNextTimer
and runAllTimers
from jest?
Is your feature request related to a problem? Please describe. I want to test how my app behaves over time. For instance, I make some request or action in the app, and then I would like to test that after N minutes it will show me a reminder (client-side logic). Real example: I have placed an order in the app and waiting for it to be delivered. If I get no updates from the backend about delivery in 2 hours, it should ask me if I received an order.
Describe the solution you'd like Simple command to set specific time:
- setTime: 15:00
: will set device time to 15:00or
Will add 15 hours to the current time.
or
Will set time for 1/5 hours before
Describe alternatives you've considered
Additional context A new command should be available from any test, the same as tapOn command: call it with the single argument and get the result.