Bug 1884918 - Add logs to MatcherHelper

fenix/125.0
AndiAJ 2 months ago committed by mergify[bot]
parent 71ea2a990e
commit 30c746ee99

@ -96,42 +96,48 @@ object MatcherHelper {
) { ) {
for (appItem in appItems) { for (appItem in appItems) {
if (exists) { if (exists) {
Log.i(TAG, "assertUIObjectExists: Trying to verify that ${appItem.selector} exists")
assertTrue("${appItem.selector} does not exist", appItem.waitForExists(waitingTime)) assertTrue("${appItem.selector} does not exist", appItem.waitForExists(waitingTime))
Log.i(TAG, "assertUIObjectExists: Verified ${appItem.selector} exists") Log.i(TAG, "assertUIObjectExists: Verified that ${appItem.selector} exists")
} else { } else {
Log.i(TAG, "assertUIObjectExists: Trying to verify that ${appItem.selector} does not exist")
assertFalse("${appItem.selector} exists", appItem.waitForExists(waitingTimeShort)) assertFalse("${appItem.selector} exists", appItem.waitForExists(waitingTimeShort))
Log.i(TAG, "assertUIObjectExists: Verified ${appItem.selector} does not exist") Log.i(TAG, "assertUIObjectExists: Verified that ${appItem.selector} does not exist")
} }
} }
} }
fun assertUIObjectIsGone(vararg appItems: UiObject) { fun assertUIObjectIsGone(vararg appItems: UiObject) {
for (appItem in appItems) { for (appItem in appItems) {
Log.i(TAG, "assertUIObjectIsGone: Trying to verify that ${appItem.selector} is gone")
assertTrue("${appItem.selector} is not gone", appItem.waitUntilGone(waitingTime)) assertTrue("${appItem.selector} is not gone", appItem.waitUntilGone(waitingTime))
Log.i(TAG, "assertUIObjectIsGone: Verified ${appItem.selector} is gone") Log.i(TAG, "assertUIObjectIsGone: Verified that ${appItem.selector} is gone")
} }
} }
fun assertItemTextEquals(vararg appItems: UiObject, expectedText: String, isEqual: Boolean = true) { fun assertItemTextEquals(vararg appItems: UiObject, expectedText: String, isEqual: Boolean = true) {
for (appItem in appItems) { for (appItem in appItems) {
if (isEqual) { if (isEqual) {
Log.i(TAG, "assertItemTextEquals: Trying to verify that ${appItem.selector} text equals to $expectedText")
assertTrue( assertTrue(
"${appItem.selector} text does not equal to $expectedText", "${appItem.selector} text does not equal to $expectedText",
appItem.text.equals(expectedText), appItem.text.equals(expectedText),
) )
Log.i(TAG, "assertItemTextEquals: Verified ${appItem.selector} text equals to $expectedText") Log.i(TAG, "assertItemTextEquals: Verified ${appItem.selector} text equals to $expectedText")
} else { } else {
Log.i(TAG, "assertItemTextEquals: Trying to verify that ${appItem.selector} text does not equal to $expectedText")
assertFalse( assertFalse(
"${appItem.selector} text equals to $expectedText", "${appItem.selector} text equals to $expectedText",
appItem.text.equals(expectedText), appItem.text.equals(expectedText),
) )
Log.i(TAG, "assertItemTextEquals: Verified ${appItem.selector} text does not equal to $expectedText") Log.i(TAG, "assertItemTextEquals: Verified that ${appItem.selector} text does not equal to $expectedText")
} }
} }
} }
fun assertItemTextContains(vararg appItems: UiObject, itemText: String) { fun assertItemTextContains(vararg appItems: UiObject, itemText: String) {
for (appItem in appItems) { for (appItem in appItems) {
Log.i(TAG, "assertItemTextContains: Trying to verify that ${appItem.selector} text contains $itemText")
assertTrue( assertTrue(
"${appItem.selector} text does not contain $itemText", "${appItem.selector} text does not contain $itemText",
appItem.text.contains(itemText), appItem.text.contains(itemText),
@ -142,6 +148,7 @@ object MatcherHelper {
fun assertItemIsEnabledAndVisible(vararg appItems: UiObject) { fun assertItemIsEnabledAndVisible(vararg appItems: UiObject) {
for (appItem in appItems) { for (appItem in appItems) {
Log.i(TAG, "assertItemIsEnabledAndVisible: Trying to verify that ${appItem.selector} is visible and enabled")
assertTrue(appItem.waitForExists(waitingTime) && appItem.isEnabled) assertTrue(appItem.waitForExists(waitingTime) && appItem.isEnabled)
Log.i(TAG, "assertItemIsEnabledAndVisible: Verified ${appItem.selector} is visible and enabled") Log.i(TAG, "assertItemIsEnabledAndVisible: Verified ${appItem.selector} is visible and enabled")
} }

Loading…
Cancel
Save