Skip to content

Setting Simulator up#

Classified settings#

Emcee can configure some simulator settings prior running your tests. Lets consider following exhaustive emceeplan configuration:

tests:
  configurations:
    - platform: ios
      # ...
      simulatorSettings:
        simulatorLocalizationSettings:
          localeIdentifier: ru_US
          languages: ["ru-US", "en", "ru-RU"]
          keyboards: ["ru_RU@sw=Russian;hw=Automatic", "en_US@sw=QWERTY;hw=Automatic"]
          passcodeKeyboards: ["ru_RU@sw=Russian;hw=Automatic", "en_US@sw=QWERTY;hw=Automatic"]
          addingEmojiKeybordHandled: false
          enableKeyboardExpansion: false
          didShowInternationalInfoAlert: false
          didShowContinuousPathIntroduction: false
          didShowGestureKeyboardIntroduction: false
        simulatorKeychainSettings:
          rootCerts: ["/path/to/root.cer"]
        watchdogSettings:
          bundleIds: ["your.bundle.id.here"]
          timeout: 20
        simulatorAccessibilitySettings:
          enableQuickSpeak: false

Every setting record is optional

simulatorLocalizationSettings#

  • localeIdentifier: defines UI locale
  • keyboards: defines what keyboards are enabled and disabled
  • passcodeKeyboards: defines what passcode keyboards are enabled and disabled
  • languages: defines UI language and fallback languages order
  • addingEmojiKeybordHandled: defines if emoji UI alert will appear or not
  • enableKeyboardExpansion: defines if keyboard is available
  • didShowInternationalInfoAlert: defines if international info alert will appear or not
  • didShowContinuousPathIntroduction: defines if a keyboard banner describing gesture based text input will appear or not
  • didShowGestureKeyboardIntroduction: defines if a yet another keyboard banner describing gesture based text input will appear or not

simulatorKeychainSettings#

This object describes the settings to be applied to the keychain.

  • rootCerts: these are the locations of the certificates which will be added to the trusted root store of the simulator keychain

watchdogSettings#

This object controls iOS watchdog settings. Watchdog service monitors your app behavior and terminates it if it does not start in time.

  • bundleIds: array of bundle IDs which timeout should be overriden
  • timeout: timeout value in seconds

simulatorAccessibilitySettings#

  • enableQuickSpeak: enables QuickSpeak universal access on simulator that may be useful for UI tests to expose some accessibilityElements

Unclassified settings#

Emcee can run arbitrary shell script prior running your tests. In order to run script, specify beforeTestScript like you usually do in CI systems:

tests:
  configurations:
    - platform: ios
      # ...
      simulatorSettings:
        beforeTestScript:
          - echo "Created simulator: $EMCEE_SIMULATOR_UDID"

If you need files on worker host to setup simulator, you may explicitly list them in configuration:

tests:
  configurations:
    - platform: ios
      # ...
      simulatorSettings:
        files:
          - TEST_LOGO_FILE: EmceeSample/Assets.xcassets/emcee_logo.imageset/emcee_logo.png

Emcee injects following env variables when runs scripts:

  • EMCEE_SIMULATOR_UDID: udid of simulator created for a tests bucket. To be in consistent environment, keep in mind that Emcee is responsible for managing simulators and may create, clone and delete simulators.
  • keys from files option in emceeplan with values of file paths on a worker host that runs tests bucket.

Broadly used shell variables will be injected automatically: USER, HOME, PATH, SHELL, TMPDIR (subject to how you deploy emcee workers)

Setting Simulator runbook#

Below is a list of scripts for unclassified settings approach you want to use to solve different needs.

Disable hardware keyboard#

tests:
  configurations:
    - platform: ios
      # ...
      simulatorSettings:
        beforeTestScript:
          - plutil -replace DevicePreferences.$EMCEE_SIMULATOR_UDID.ConnectHardwareKeyboard -bool false $HOME/Library/Preferences/com.apple.iphonesimulator.plist

Import media#

tests:
  configurations:
    - platform: ios
      # ...
      simulatorSettings:
        files:
          TEST_LOGO_FILE: EmceeSample/Assets.xcassets/emcee_logo.imageset/emcee_logo.png
        beforeTestScript:
          - xcrun simctl addmedia $EMCEE_SIMULATOR_UDID $TEST_LOGO_FILE