2016-04-25 44 views
4

我是Calabash測試的新手,在嘗試製作多語言應用程序時遇到障礙。 這是我的測試場景: - 我選擇一個文本框。 - 輸入一種語言的字符串,然後用另一種語言輸入一些文本。葫蘆 - iOS模擬器無法選擇鍵盤語言

這裏出現障礙:當我嘗試通過測試切換語言 - 它失敗。我的意思是應用程序試圖找到下一種語言的符號,並無休止地循環,因爲當前的鍵盤佈局不包含它。

我發現的唯一解決方案是手動切換佈局,但這不是真正的測試選項。

我該如何解決?

回答

0

有兩個步驟:

  1. 葫蘆使用命令行工具來改變模擬器的語言和區域設置。
  2. 使用參數啓動應用程序以設置首選語言和區域設置。

完全可以參考這個葫蘆iOS版的維基頁面上找到:Change Locale and Language

# Set the simulator language to Swiss German and locale to Swiss French 
$ calabash-ios sim locale de-CH fr_CH 

# In your Before hook, tell Calabash to launch the app in the locale and language. 
options = { 

# Launch with Swiss German as the primary language and Swiss French as the locale. 
:args => ["-AppleLanguages", "(de-CH)", 
      "-AppleLocale", "fr_CH"] 

} 

launcher.relaunch(options)