第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

通過單擊視圖檢查 Espresso 是否啟動了新活動

通過單擊視圖檢查 Espresso 是否啟動了新活動

喵喵時光機 2022-12-28 14:02:07
單擊此按鈕時,我有一個按鈕,開始活動 A。 startActivityForResult(Intent(this, A::class.java)我需要在單擊按鈕時檢查 esspresso 測試,是否開始活動 A?onView(withId(R.id.button))       .check(matches(isDisplayed()))       .check(matches(isEnabled()))       .perform(click())        // check is this A Activity start or not?
查看完整描述

1 回答

?
函數(shù)式編程

TA貢獻1807條經(jīng)驗 獲得超9個贊

你可以使用espresso-intents包。


首先,嘗試將最新版本添加到您的build.gradle:


   androidTestImplementation "androidx.test.espresso:espresso-intents:3.1.1"

然后,使用IntentsTestRule檢查您的意圖是否已啟動:


    @get:Rule

    val intentRule = IntentsTestRule(MainActivity::class.java)


    @Test

    fun verify_FakeActivity_is_started() {

        onView(withId(R.id.button))

            .check(matches(isDisplayed()))

            .check(matches(isEnabled()))

            .perform(click())


        intended(hasComponent(FakeActivity::class.java.name))

    }


查看完整回答
反對 回復 2022-12-28
  • 1 回答
  • 0 關注
  • 85 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號