Is it possible to “toggle software keyboard” via the code in UI test?

前端 未结 7 616
时光取名叫无心
时光取名叫无心 2020-12-24 03:25

I have UI tests which testing login functionality (and uses it to test other stuff), but sometimes when focus is changed from one field to another - the keyboard hides, and

7条回答
  •  执念已碎
    2020-12-24 03:57

    Tested in Xcode 10.3 & Xcode 11. The snippet below needs to be located in the app target (not the test bundle) — for instance, in AppDelegate.swift. It will disable any hardware keyboards from automatically connecting by setting any UIKeyboardInputMode's automaticHardwareLayout properties to nil.

提交回复
热议问题