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

iOS: Ability to set simulator's locale before tests #906

Open
Nemorokr opened this issue Mar 7, 2024 · 5 comments
Open

iOS: Ability to set simulator's locale before tests #906

Nemorokr opened this issue Mar 7, 2024 · 5 comments
Labels
enhancement New feature or request ios

Comments

@Nemorokr
Copy link

Nemorokr commented Mar 7, 2024

Is your feature request related to a problem? Please describe.
Need to be able to set simulator's locale before starting tests

Describe the solution you'd like
Maybe some sort of config inside Vendor's block of Marathonfile

Describe alternatives you've considered
N/A

Additional context
N/A

@Nemorokr Nemorokr added the enhancement New feature or request label Mar 7, 2024
@Malinskiy Malinskiy added the ios label Mar 7, 2024
@matzuk
Copy link
Collaborator

matzuk commented Mar 12, 2024

You can use xcodebuild test-without-building arguments.

For example, your marathonfile may look like:

name: "My application"
outputDir: "derived-data/Marathon"
vendorConfiguration:
  type: "iOS"
  xcodebuildTestArgs:
    "-testLanguage": "fr"
    "-testRegion": "FR"
  bundle:
    application: "sample.zip"
    testApplication: "sampleUITests-Runner.zip"
    testType: xcuitest

@matzuk matzuk closed this as completed Mar 12, 2024
@Nemorokr
Copy link
Author

These settings are for app's language. My request was about simulator's language

@Malinskiy Malinskiy reopened this Mar 13, 2024
@matzuk
Copy link
Collaborator

matzuk commented Mar 14, 2024

@Nemorokr, could you provide an example of where these settings may be used and which cases may be covered? I mean real cases from your current experience, not theoretical cases.

@danmir
Copy link
Contributor

danmir commented Apr 2, 2024

Hello
Our cases with simulator's language

  • Permission alerts. For example in a ui test we should click on "Allow" button on a system dialog that allows access to contacts list or click on default search engine selection dialog (There is an issue with setting all possible permission cases with marathon permissions setting)
  • We have cases with comparing localized a11y titles of elements (instead of ids). Here we use same localized assets in main app and in tests. When we use Bundle.localizedString(forKey:value:table:) in the main app we get "title_ru". When we use in test app we get "title_en". As a result we are trying to compare "title_ru" with "title_en". Xcodebuild arguments like -testLanguage and -testRegion do not set lang for test runner app

@Malinskiy
Copy link
Member

I'm pretty sure you can hardcode your language in the test app, get bundle resources for that language andget the appropriate title for the language. You essentially hardcode via environment setup, but your code should be flexible and detect which language it's using and use appropriate ones, i.e. for interacting with the app use one language and for the rest of interaction with the system - device's locale. That said, we're going to look into this issue

Also, can you please create issue(s) with additional permissions needed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ios
Projects
None yet
Development

No branches or pull requests

4 participants