久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

XCUITest 類拆解不會刪除應用程序.但是如果它的實

XCUITest Class teardown isnt deleting the app. But works if its instance teardown. What am I doing wrong?(XCUITest 類拆解不會刪除應用程序.但是如果它的實例拆解就可以了.我究竟做錯了什么?) - IT屋-程序員軟件開
本文介紹了XCUITest 類拆解不會刪除應用程序.但是如果它的實例拆解就可以了.我究竟做錯了什么?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我有一個試圖刪除應用程序的類拆解,但它無法識別 app.terminate().

I have a class teardown which is trying to remove the app, but it doesn't recognize app.terminate().

class DeviceSettingsUtilities : UITestUtilities {
func removeApp(productName:String){
        print("in teardown")
        let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
        XCUIApplication().terminate() // this does nothing
        XCUIApplication(bundleIdentifier: "com.xxx.xxxx").terminate()//this does nothing too, but this works when called as an instance teardown
        sleep(5)
        springboard.activate()
        let icon = springboard.icons.matching(identifier: productName).firstMatch
// icon.exists is false when called as a class teardown
// icon.exists is true when called as an instance teardown
        if icon.exists {
            let iconFrame = icon.frame
            let springboardFrame = springboard.frame
            icon.press(forDuration:1.3)
            springboard.coordinate(withNormalizedOffset: CGVector(dx: ((iconFrame.minX + 3) / springboardFrame.maxX), dy:((iconFrame.minY + 3) / springboardFrame.maxY))).tap()
            sleep(5)
            springboard.buttons["Delete"].firstMatch.tap()
            sleep(5)
        }
        XCUIApplication().terminate()
    }

}

這是在測試用例類拆解方法中調用的,如下所示

This is being called in the test case class teardown method as shown below

override class func tearDown() {
    super.tearDown()
    let deviceSettings = DeviceSettingsUtilities()
    deviceSettings.removeApp(productName: ProductName.rawValue)
}

這只是不會刪除應用程序,但是如果我將類 func tearDown() 更改為 func tearDown() ,它會毫無問題地刪除應用程序.不知道我錯過了什么.有什么建議嗎?

This just doesnt delete the app, But if i change class func tearDown() to func tearDown() , it deletes the app with no problem. Not sure what i am missing. Any suggestions ?

推薦答案

這似乎是最新 Xcode 10 中的一個錯誤.當聲明為 class 時,XCUIApplication.terminate() 似乎在 tearDown() 中不起作用.

This seems like a bug in latest Xcode 10. XCUIApplication.terminate() doesn't seem to work in tearDown() when declared as class.

這可以通過兩種方式解決:

This can be solved in two ways:

第一個選項是使用:

override func tearDown() {
    XCUIApplication().terminate()
    super.tearDown()
}

代替:

override class func tearDown() {…} 

或者,以不同的方式終止應用程序(按主頁按鈕,打開不同的應用程序...).但是,我會使用第一種方式.

Or, terminate the app differently (press home button, open different app...). However, I would use the first way.

還可以考慮向 Apple 報告此問題,以便他們解決.

Also consider reporting this to Apple, so they can fix it.

這與應用程序狀態(XCUIApplication().state.rawValue)無關,因為它在測試和 tearDown() 中是相同的(4 = 運行前臺).另外 - 官方文檔說 .terminate() 將終止應用程序,該應用程序與 Xcode 有一個調試會話,但調試會話在 tearDown() 中也處于活動狀態.所以這很可能是 Xcode 中的一個錯誤.

This has nothing to do with app state (XCUIApplication().state.rawValue), since it is same in test and in tearDown() (4 = running foreground). Also - official documentation says that .terminate() will terminate app, which has a debug session with Xcode, but the debug session is active in tearDown() as well. So it is really probably a bug in Xcode.

這篇關于XCUITest 類拆解不會刪除應用程序.但是如果它的實例拆解就可以了.我究竟做錯了什么?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Using Instruments to test an iOS app without having source code to the application(在沒有應用程序源代碼的情況下使用 Instruments 測試 iOS 應用程序)
How to provide login credentials to an automated android test?(如何為自動化的 android 測試提供登錄憑據?)
How to fix error quot;Could not detect Mac OS X Version from sw_vers output: #39;10.12 #39;quot; from Appium(如何修復錯誤“無法從 sw_vers 輸出檢測 Mac OS X 版本:10.12來自Appium)
How do you test an Android application across multiple Activities?(如何跨多個活動測試 Android 應用程序?)
How to get root view controller?(如何獲取根視圖控制器?)
How to order test cases for Spoon Automated Testing in Android?(如何在 Android 中為 Spoon 自動化測試訂購測試用例?)
主站蜘蛛池模板: 久久欧美精品 | 国产精品视频 | 午夜激情视频在线 | 日韩一区二区三区视频 | 国产精品亚洲视频 | 国产欧美一区二区三区在线看蜜臀 | 日本中文字幕日韩精品免费 | 精品国产第一区二区三区 | 在线观看av网站 | 欧美二三区| 久久久91精品国产一区二区三区 | 色综合久| 一区二区手机在线 | 99精品热视频 | 中文字幕1区| 国产婷婷在线视频 | 久久久.com | 久久成人免费观看 | 欧美在线成人影院 | 色久伊人 | 91久久| 亚洲精品中文字幕在线 | 国产精品日韩高清伦字幕搜索 | 自拍偷拍第一页 | 国产精品18久久久 | 久久久女 | 国产精品美女www爽爽爽 | 青青草av在线播放 | 色婷婷综合在线观看 | 欧美一区二区三区免费电影 | 国产一区二区在线播放 | 国产激情在线 | 日韩精品成人 | 免费观看黄a一级视频 | 久草视频在线看 | 日屁网站 | 国产精品精品视频一区二区三区 | 一级二级三级黄色 | 国产精品视频播放 | 午夜日韩精品 | 在线成人www免费观看视频 |