UIATarget.localTarget()。model()は、テストが実行されているデバイスに関する情報を保持します。
私はAlex Vollmer's tuneup_js libraryを発見しました。これは、デバイスの独立したコードをある程度まで可能にします。
例えば)
test("my test", function(target, app) {
assertWindow({
"navigationBar~iphone": {
leftButton: { name: "Back" },
rightButton: { name: "Done" }
},
"navigationBar~ipad": {
leftButton: null,
rightButton: { name: "Cancel" }
},
});
});
編集tuneup_jsに、次の発見
:私は、デバイス固有のコードを書くことができるでしょうこれらにより
/**
* A convenience method for detecting that you're running on an iPad
*/
isDeviceiPad: function() {
return this.model().match(/^iPad/) !== null;
},
/**
* A convenience method for detecting that you're running on an
* iPhone or iPod touch
*/
isDeviceiPhone: function() {
return this.model().match(/^iPhone/) !== null;
}
。
ファイルでありますコードがあればそれをどのように呼び出すのですか? –
インターフェイスはおそらく私が探しているものです。私はXcodeのオートメーションツールを使用して、Appleが指示したとおりにスクリプトファイルをロードしています。私の知る限り、これはあなたのアプリをテストする正式にサポートされている方法です。 http://developer.apple.com/library/ios/#documentation/ToolsLanguages/Reference/UIAElementClassReference/UIAElement/UIAElement.html#//apple_ref/doc/uid/TP40009903 – MdaG