iOS UI Automation for different languages
Asked Answered
S

3

5

my iOS application has localization for 10+ languages. I'd like to check that all screens looks ok (labels aren't too long/short etc).

I know I can go through my app and make screenshots using UI Automation. Is there any way do switch simulator's language in UI Automation? Is there any way to generate screenshots for my app just by launching 1 command?

Thanks!

Summary answered 13/11, 2012 at 16:33 Comment(2)
did you try changing the language of simulator?Machinegun
I want to launch automation tests and make screenshots for all languages I have. I know how to do it manuallySummary
B
5

Yes there is. I just wrote it myself as a matter of fact. :)

Use this project: https://github.com/jonathanpenn/ui-screen-shooter

It's a demonstration of how to run UI Automation from the command line, swap simulator languages with a plist changing command, and choose simulator device types with an AppleScript. It's documented heavily with comments, but if you're confused about something, feel free to open an issue or a pull request on the project and we can improve it.

Brooking answered 14/11, 2012 at 4:11 Comment(1)
You might want to check out snapshot, which does something very similar to ui-screen-shooter, but is actively being maintained.Ranita
D
3

There is another github project called Snapshot, for exactly what you want.

It provides the same (and more) features that UI Screen Shooter has, and I found it to be a bit more fleshed out and documented.

The most challenging part of getting up and running is learning the Javascript API for performing actions in the simulator, but you can find many useful tutorials for that online.

Here are some useful references:

Dactyl answered 15/1, 2015 at 22:0 Comment(0)
C
1

I took the screenshots below during my tests for a osx app. It also works fine for ios app.

You can generate a unlimted number of scheme for your xcode project. If you do so, you can test your app in any language and get screenshots within your simulator. Ok, let's start by an example: Add a german language scheme to your project

After you have finished your localization, you have to add a new scheme for each language.

Step 1: Click on your current scheme (scheme panel in your tab bar). The scheme at the image below is JHDTestLayout:

scheme

Step 2: Now, you can manage your scheme. At first we have to add a new one:

add a new scheme

Step 3: Type in a name for your new scheme:

enter image description here

Step 4: Afterwards, click again on the scheme panel in your tab bar (Step 1), choose your new scheme and select "Edit scheme"

enter image description here

Step 5: Add two arguments to "Arguments Passed On Launch" section (by using +) and press OK:

enter image description here

Arguments Passed On Launch: You can also use other languages for different schemes, for example:

German

-AppleLanguages (de)
-AppleLocale de_DE

Espanol

-AppleLanguages (es)
-AppleLocale es_ES
Creamery answered 27/1, 2014 at 0:49 Comment(1)
I'm looking for a way to do this via the command line. For some reason, the following doesn't work: open /Applications/Xcode.app/Contents/Developer/Applications/iOS\ Simulator.app --args -AppleLocale es_ES I wish it did!!!!Notus

© 2022 - 2024 — McMap. All rights reserved.