Bug 1880064 - Add logs to PwaRobot

fenix/124.1.0
AndiAJ 4 months ago committed by mergify[bot]
parent d14cbc72f6
commit 1ee892eb4c

@ -4,24 +4,32 @@
package org.mozilla.fenix.ui.robots
import android.util.Log
import androidx.test.uiautomator.UiSelector
import org.junit.Assert.assertTrue
import org.mozilla.fenix.helpers.AppAndSystemHelper.isExternalAppBrowserActivityInCurrentTask
import org.mozilla.fenix.helpers.Constants
import org.mozilla.fenix.helpers.Constants.TAG
import org.mozilla.fenix.helpers.MatcherHelper.assertUIObjectExists
import org.mozilla.fenix.helpers.MatcherHelper.itemWithResId
import org.mozilla.fenix.helpers.TestHelper.mDevice
import org.mozilla.fenix.helpers.TestHelper.packageName
class PwaRobot {
fun verifyCustomTabToolbarIsNotDisplayed() = assertUIObjectExists(customTabToolbar(), exists = false)
fun verifyPwaActivityInCurrentTask() = assertTrue(isExternalAppBrowserActivityInCurrentTask())
fun verifyCustomTabToolbarIsNotDisplayed() = assertUIObjectExists(itemWithResId("$packageName:id/toolbar"), exists = false)
fun verifyPwaActivityInCurrentTask() {
Log.i(TAG, "Trying to verify that the latest activity of the application is used for custom tabs or PWAs")
assertTrue(isExternalAppBrowserActivityInCurrentTask())
Log.i(TAG, "Verified that the latest activity of the application is used for custom tabs or PWAs")
}
class Transition
}
fun pwaScreen(interact: PwaRobot.() -> Unit): PwaRobot.Transition {
Log.i(TAG, "pwaScreen: Trying to find the engine view")
mDevice.findObject(UiSelector().resourceId("$packageName:id/engineView"))
Log.i(Constants.TAG, "pwaScreen: Found the engine view")
PwaRobot().interact()
return PwaRobot.Transition()
}
private fun customTabToolbar() = mDevice.findObject(UiSelector().resourceId("$packageName:id/toolbar"))

Loading…
Cancel
Save