https://github.com/WebKit/webkit/blob/master/Tools/Scripts/webkitpy/xcode/simulated_device.py#L413 Ah… It’s interesting. We can disable the sync to improve the launching performance. https://github.com/appium/appium-ios-simulator/pull/262 is for Appium. Below commands are system-wide preference.More
Tag Archives: appium
[iOS]Xcode 11.4 new interesting features for automation
This article is a note for me in Xcode 11.4 https://developer.apple.com/documentation/xcode_release_notes/xcode_11_4_beta_release_notes/ Simulate push notification xcrun simctl push com.example.my-app ExamplePush.apns Like Android’s adb command, finally, we can simulate push notification on the local!! The local execution helped me so much when I achieved automation. Handle privacy permissions xcrun simctl privacy grant photos com.example.app, xcrun simctl privacy…More
Appium/XCTest(UI)の実行性能差
この記事は「Selenium/Appium Advent Calendar 2019」1日目の記事です。今回は、Appiumの開発をしている中で問題の報告が多かったXcode 11、iOS 13における実行性能の劣化問題を調べていた時に知ったことです。内容はこのissueの一部です。 Appiumの実行形態とその実行性能 Appiumは基本的には中間サーバとしてテストケースとテスト対象の操作を仲介します。 ある利用者がテストケースを特定の開発言語なりで記述、実行するとします。そのテストケース実行系の中でAppiumサーバに対してHTTPリクエストを送出し、リクエストを受け取ったAppiumサーバーは自身が管理する実行端末上で動作するサーバーに対して操作を要求したり、自身で端末を直接操作します。その操作結果をテストケース実行系に対して返信します。この一連の流れが1つのセットとなり、Appiumのもつ個々の操作が行われます。 つまり、1つのAppiumのコマンド実行時間には、HTTP通信の往復時間が必ずオーバーヘッドとして存在することになります。実行系全体が同一端末に存在する場合、その時間はごく僅かであることが多いです。一方、物理的に異なる環境でテストケースの実行元と実行環境が離れている場合、そのHTTPリクエストにかかる時間は秒単位で大きくなる可能性もあります。(AppiumProにある例) iOSの実行系とXcode 11の変化 現在、AppiumにおけるiOSのテストとしてXCUITest Driverと表現する実行系があります。Appiumは中間サーバとして機能すると先ほど述べました。つまり、Appium自体はその実行端末を操作する側の実装があれば、様々な端末を対象に同様のコマンド実行を実現できます。iOSではXCUITest Driverが、AndroidではUIAutomator2やEspresso Driver、WindowではWinAppDriverなど存在します。 この中で、今回の話題の対象はXCUITest Driverです。この仕組みとして、WebDriverAgentと呼ぶAppleが提供するXCTest(UI)や周辺APIをラップする、iOS端末上で動作するサーバがあります。AppiumサーバはこのWebDriverAgentと独自のiOS端末との直接操作する手段を介してテスト対象となるアプリなどを操作します。 WebDriverAgentはXcode 9の頃から同様の機能を実現していました。Xcodeも11となり、XCTestが提供するUIテストむけ機能も安定、拡充してきました。古いXCTest(UI)などが提供するプライベートAPIもDeprecatedになり、Xcode 11ではXCTest(UI)が内部で利用しているであろうメソッドを利用することにしました。 Xcode 11とiOS 13環境下ではiOS 12環境では問題ない操作が遅くなるなどの報告が出るようになりました。この問題が性能計測の発端です。目的としては、Appiumが利用しているメソッドが問題なのか、XCTest(UI)自体がXcode 11とiOS 13環境において問題を抱えているかでした。 AppiumとXCTest(UI)との実行差分 原理的には、XCUITest DriverとXCTest(UI)は、実際にアプリを操作するためのメソッドは同一です(であるはず)。となると、その実行時間の差分は、AppiumがHTTPリクエストを介するぶんだけ遅延することが常であるはずです。 先に計測結果だけ述べます。 Xcode 11環境下において、iOS 13を対象にするとほぼ期待通りの結果であるいっぽう、iOS 12を対象とするとAppiumの方が高速であることがわかりました。少し前に記述した「Xcode 11ではXCTest(UI)が内部で利用しているであろうメソッドを利用することにしました。」と説明した箇所のメソッドの利用は、内部的には、selectorと呼ばれるあるメソッドが存在するとそれを利用するというロジックを利用しています。そのメソッドは実際にはXcode 9以降に存在するものであるため、実質的にはAppiumはiOS 12、13問わずそのメソッドを利用します。iOS 13の実行性能がAppiumとXCTest(UI)では大差ないこと、XTest(UI)はiOS 12と13では実行性能はほぼ同一なので、XCTest(UI)はiOS 12、13に関わらず同一のメソッドを経由して要素検索などを実行している可能性が高いです。 と考えると、AppiumのiOS 12以下に対する操作がiOS 13はもとより、XCTest(UI)より高速であることは驚きです。内部実装の詳細は知るすべがないのでこれ以上の言及はできませんが、iOS 13は実行性能がiOS 12よりは劣化している面はありつつも、AppiumのHTTPリクエストを除く実行遅延はXCTest(UI)とほぼ同様であることがわかります。Appiumが遅かった場合、XCTest(UI)でも遅い可能性があり、Appleさんの改善に期待したいところで。 計測値 ともあれ、行なった計測を提示します。 テスト対象 テスト対象は、新規作成したプロジェクトにButton要素を付与しただけのアプリです。至極単純なアプリです。 Appium 1.16-beta Xcode 11.2.1 Swift…More
[Appium][Android] background process restrictions
We recently got an issue about stopping background process, uiautomator2-server. I knew several limitations/restrictions for such background process on newer Android versions, but we had not got general issues by such features so far. The VIVO devices have customised OS based on Android OS. So, definitely, we can say the series is Android, but not…More
[iOS][XCTest][Appium]Slow type speed in iOS 13 under XCUIElementTypeWebView elements inside UIWebView
I found slow send keys happened on XCTest framework layer. https://github.com/appium/appium/issues/13455#issuecomment-544072750 It took 5 sec every key type. It happened only elements under XCUIElementTypeWebView type. This happened only on iOS 13. Quick workaround is typing keyboard directly. It means find keys by find element and tap it one by one. Then, it has no such…More
[Appium][iOS]handle dark mode via process arguments
Appium’s appium-ios-simulator has an ability to make simulator instance dark mode by issue. The ability affects entire system, but it works only on Simulator. We can handle the style in real devices, too, when the app has a logic to switch it in the code level. We also can control the configuration via process arguments…More
[Appium][iOS] Automate split screen by iPad OS
iPad OS has been released. On the OS, we can use split screen feature to handle multiple apps on the screen. In this case, there are multiple active apps on the screen. Appium 1.15.0 has defaultActiveApplication settings API to handle such case. You can handle on of them specifying the app as defaultActiveApplication. Below is…More
[iOS][XCTest][Appium]iOS13 returns different source structure
iOS 13 returns different source tree structure as the view hierarchy. Appium builds view hierarchy from accessibility snapshot. Users can search elements as XPath or class chain which find elements from the view hierarchy. They depend on the view hierarchy. Thus, if the hierarchy changes, we must re-struct the path for the view. We noticed…More
[iOS][Appium]A note topics I dropped from the book
I’m writing a test automation book in Japanese. Then, I dropped some kind of deep dive into XCTest items since the logic is not for beginners. The target is a bit differ from the topics. I picked some words from the dropped list here. testmanagerd usbmux XCUITest runs methods on the main thread, run some…More
[Android][ChromeDriver][Appium]chromeOptions to disable welcome screen
Chromedriver checked Appium can provide chromeOption like: or https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md Then, we can give disabling welcome screen on chrome with below. https://github.com/bayandin/chromedriver/blob/5ba09b3f3f184aa3448d167d4809a73eac46a155/chrome_launcher.cc#L100 https://chromium.googlesource.com/chromium/src/+/master/chrome/test/chromedriver/chrome_launcher.cc#100 BTW, we can see which capabilities are available as the chrome option in https://chromium.googlesource.com/chromium/src/+/master/chrome/test/chromedriver/capabilities.cc#541 . The args is there, but prefs is only in non Android. So, prefs is available PC chrome.More