-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Implement the capability to change the language between tests #873
Conversation
This reverts commit 797a3dd.
Thanks for this PR. Locale is something different from language and it is incorrect to tie them together in all cases. I think it would be better to give an option for providing a different locale than the language, and if no locale is provided, use the system one (nothing passed, like it is now for language). |
detox/src/devices/AndroidDriver.js
Outdated
@@ -86,7 +86,7 @@ class AndroidDriver extends DeviceDriverBase { | |||
} | |||
} | |||
|
|||
async launch(deviceId, bundleId, launchArgs) { | |||
async launch(deviceId, bundleId, launchArgs, language) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a locale option as well.
Thanks for taking the time to submit this PR! There are a few things that need to be resolved before we can continue:
|
Testing on the test suite can be very easy to handle: Just put the app language and app locales to text fields and test that they are correct. |
@rotemmiz Regarding API, I am not sure I understand. In iOS settings, setting the country is really setting the locale. So en_GB, en_CA, en_US, de_DE, etc. Setting the language changes the interface language, but it's also given in the same notation, so en_GB, en_CA, en_US, de_DE, etc. It might also accept shorter notation ("de") and that is mapped to a default country. In Android, is there no way to define the locale different than device/app language? Seems like a big design flaw as the two are really unrelated. |
Hey, just thought I'd pop in and give an update - Basically I haven't had any bandwidth to work on this in a while. I'm hoping I'll have some time in 1-2 weeks. If anyone else is free to work on this, feel free to fork my fork or work directly in my fork (I'll grant anyone access that asks me). I still plan on doing my best to address all the requested changes and feedback, just haven't had any time :( |
Hi again everyone. Finally had some time to come work on this. I just pushed an update to address some of the previous feedback. A few things to note:
I propose that we go forward with implementing this on iOS, and file a separate issue to add Android support later. We can document this as an iOS only feature for the time being. |
BTW, I've tested that 3rd party app and can confirm that that technique works as advertised. Here is one approach we could take for implementing this on Android
I still think this should be done in a separate PR, but I just wanted to share how I think this could be achieved :) |
Looks like the CI results went from passing to failing when I closed and re-opened the PR. 22:21:21 ✕ should detect loops with final number of iterations (driver: Native) (481822ms) |
I am OK with this change. @luisnaranjo733 Could you please update documentation with the new API? Thanks |
Awesome! I just merged the latest from master into my branch, and confirmed that unit and e2e tests are still passing. I've also added some doc changes to the device API page. |
Thank you! |
This PR implements the capability to change the language between tests for iOS by adding flags to xcrun. It looks like this is straightforward for Android as well. I didn't make that change because I'm not set up to verify it works on Android at the moment. I'm hoping someone else can make a change in my branch, or can just make another PR later.
Basically I just added a new optional language field to the params object that gets passed to device.launchApp().
Example usage:
init.js
test.spec.js