[英]Espresso: how to kill an app fully without test stop/crash?
我正在結合 Espresso 和 UiAutomator 進行應用程序測試自動化。
一些功能隱藏在登錄時更新的功能標志后面。應用程序從服務器獲取初始數據包后,功能標志被打開,我必須終止應用程序並重新啟動它。
我試過這個:
Intents.release()
scenarioRule.scenario.close()
Intents.init()
ActivityScenario.launch<MyActivity>(intent)
但是該應用程序仍然在最近的應用程序中找到,該應用程序仍然在最近的應用程序中找到我也嘗試添加 UiAutomator 的:
val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
device.pressRecentApps()
device.findObject(UiSelector().descriptionContains("my app's name")).swipeUp(100)
但它仍然表現為未關閉。
當我手動執行時:
只需使用 ActivityScenario 的recreate
方法
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.