MarathonLabs / marathon

Cross-platform test runner

Home Page:https://docs.marathonlabs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

iOS: Ability to set simulator's locale before tests

Nemorokr opened this issue · comments

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

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

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

@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.

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

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?