wix / Detox

Gray box end-to-end testing and automation framework for mobile apps
https://wix.github.io/Detox/
MIT License
11.2k stars 1.92k forks source link

Change timezone of simulator #4355

Open puelocesar opened 8 months ago

puelocesar commented 8 months ago

Description

On Xcode, I can change the TimeZone of the simulator by going to "Edit Scheme -> Run configuration -> Arguments Tab -> Add Environment Variables" and add TZ as the iOS env. But I could not find a way of doing that on Detox, the only thing I found on the documentation was launch args, which is a different thing.

Is there a way to achieve this with Detox? I tried several ways of passing TZ, but none worked

Your environment

Detox version: React Native version: Node version: Device model: OS: Test-runner (select one): jest / other

noomorph commented 8 months ago

@asafkorem any idea?

asafkorem commented 8 months ago

Hey @puelocesar, If you refer to the user's current local (NSLocale.currentLocale) we don't currently have such a feature, but I believe it won't be very complicated to implement, if we'll swizzle the current locale within Detox. Not sure how it can be implemented on Android (@gosha212 / @d4vidi ?)

Anyhow, it's very likely that we won't do that, since that's something that can be mocked within your app easily. Just make a date/time provider (which can be a soft wrapper for your current provider) in your code and mock it. You can use launch-arg as a parameter for the mocking.

stale[bot] commented 7 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back.

Thank you for your contributions!

For more information on bots in this repository, read this discussion.

luke92 commented 1 month ago

In Bitrise and my local machine works fine compare Dates with iOS So for iOS i don't need change the timezone.

But using Android in my Local machine is in UTC Should i use something like this? adb shell setprop persist.sys.timezone "America/New_York"

Thanks