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

Run tests with different locales on each run #683

Closed
galfisher opened this issue Apr 23, 2018 · 8 comments
Closed

Run tests with different locales on each run #683

galfisher opened this issue Apr 23, 2018 · 8 comments

Comments

@galfisher
Copy link

galfisher commented Apr 23, 2018

No description provided.

@LeoNatan LeoNatan changed the title [Feature request] Run tests with different locales on each run Run tests with different locales on each run Apr 23, 2018
@LeoNatan
Copy link
Contributor

@galfisher Both locale and language can be achieved in JavaScript alone, by adding support for the following launch arguments: -AppleLanguages (<lang>) and -AppleLocale <lang>

@rotemmiz
Copy link
Contributor

rotemmiz commented Apr 23, 2018

Exactly, we should support this on both platforms though.

@luisnaranjo733
Copy link
Contributor

Is there an ETA on this? I need to be able to change the language of the app between detox tests for my use case.

It would be cool if this could be achieved by calling device.launchApp(language) in beforeEach(). It seems like this would be a pretty straightforward change to enable this on iOS at least (a great starting point).

Since I'm only running my tests on an iOS simulator, I think it's possible to hack this in for the meantime by somehow awaiting xcrun simctl launch booted <appid> -AppleLanguages "(en-GB)" in beforeEach like @LeoNatan alluded to. Please warn me if this is a bad idea or if I'm missing something :)

Just curious - is there already a public detox API for awaiting custom xcrum commands I can use in the meantime? I feel like I saw something like that somewhere while browsing through the GH issues.

@luisnaranjo733
Copy link
Contributor

I have a fork of Detox where I just passed a language parameter all the way down to AppleSimUtils where the app is magically launched with xcrun (haven't implemented on Android).

I haven't opened a PR because this issue doesn't have the help wanted tag. Do you want me to open a PR?

@rotemmiz
Copy link
Contributor

rotemmiz commented Aug 2, 2018

Yes please!!!

@rotemmiz
Copy link
Contributor

rotemmiz commented Aug 2, 2018

BTW, seems like the Android solution is pretty straight forward as well, something like adb shell setprop persist.sys.language en;setprop persist.sys.country US;stop;start

@luisnaranjo733
Copy link
Contributor

Cool! I went ahead and opened the PR.

@luisnaranjo733
Copy link
Contributor

This issue can be closed :)

@lock lock bot locked as resolved and limited conversation to collaborators Oct 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants