diff --git a/app/src/uiTest/kotlin/ch/protonmail/android/uitest/models/mailbox/MailboxListItemEntryModel.kt b/app/src/uiTest/kotlin/ch/protonmail/android/uitest/models/mailbox/MailboxListItemEntryModel.kt
index 80c6723017..006fefb4c0 100644
--- a/app/src/uiTest/kotlin/ch/protonmail/android/uitest/models/mailbox/MailboxListItemEntryModel.kt
+++ b/app/src/uiTest/kotlin/ch/protonmail/android/uitest/models/mailbox/MailboxListItemEntryModel.kt
@@ -28,9 +28,9 @@ import androidx.compose.ui.test.performClick
import ch.protonmail.android.mailcommon.presentation.compose.AvatarTestTags
import ch.protonmail.android.mailmailbox.presentation.mailbox.MailboxItemTestTags
import ch.protonmail.android.uitest.util.ComposeTestRuleHolder
-import ch.protonmail.android.uitest.util.assertTextColor
+import ch.protonmail.android.uitest.util.assertions.assertTextColor
import ch.protonmail.android.uitest.util.child
-import ch.protonmail.android.uitest.util.peek
+import ch.protonmail.android.uitest.util.extensions.peek
class MailboxListItemEntryModel(
position: Int,
@@ -124,7 +124,7 @@ class MailboxListItemEntryModel(
private companion object {
- const val MessageReadTextColorHex = 0xFF706D6B // Equivalent to ProtonPalette.Cinder
+ const val MessageReadTextColorHex = 0xFF706D6B // Equivalent to ProtonPalette.Cinder
const val MessageUnreadTextColorHex = 0xFF0C0C14 // Equivalent to ProtonPalette.DoveGray
}
}
diff --git a/app/src/uiTest/kotlin/ch/protonmail/android/uitest/robot/settings/account/ConversationModeRobot.kt b/app/src/uiTest/kotlin/ch/protonmail/android/uitest/robot/settings/account/ConversationModeRobot.kt
index 14706b18ab..dfd3882f02 100644
--- a/app/src/uiTest/kotlin/ch/protonmail/android/uitest/robot/settings/account/ConversationModeRobot.kt
+++ b/app/src/uiTest/kotlin/ch/protonmail/android/uitest/robot/settings/account/ConversationModeRobot.kt
@@ -23,7 +23,7 @@ import androidx.compose.ui.test.junit4.ComposeContentTestRule
import androidx.compose.ui.test.onFirst
import ch.protonmail.android.mailsettings.presentation.R
import ch.protonmail.android.mailsettings.presentation.R.string
-import ch.protonmail.android.uitest.util.assertTextContains
+import ch.protonmail.android.uitest.util.assertions.assertTextContains
import ch.protonmail.android.uitest.util.onAllNodesWithText
/**
diff --git a/app/src/uiTest/kotlin/ch/protonmail/android/uitest/robot/settings/swipeactions/SwipeActionsRobot.kt b/app/src/uiTest/kotlin/ch/protonmail/android/uitest/robot/settings/swipeactions/SwipeActionsRobot.kt
index 2f0a2637a0..dfe3cabc1a 100644
--- a/app/src/uiTest/kotlin/ch/protonmail/android/uitest/robot/settings/swipeactions/SwipeActionsRobot.kt
+++ b/app/src/uiTest/kotlin/ch/protonmail/android/uitest/robot/settings/swipeactions/SwipeActionsRobot.kt
@@ -24,7 +24,7 @@ import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.junit4.ComposeContentTestRule
import androidx.compose.ui.test.performClick
import ch.protonmail.android.mailsettings.presentation.R.string
-import ch.protonmail.android.uitest.util.assertTextContains
+import ch.protonmail.android.uitest.util.assertions.assertTextContains
import ch.protonmail.android.uitest.util.awaitDisplayed
import ch.protonmail.android.uitest.util.onNodeWithText
diff --git a/app/src/uiTest/kotlin/ch/protonmail/android/uitest/screen/settings/account/AccountSettingsScreenTest.kt b/app/src/uiTest/kotlin/ch/protonmail/android/uitest/screen/settings/account/AccountSettingsScreenTest.kt
index 9bab4cf2f0..73045aed34 100644
--- a/app/src/uiTest/kotlin/ch/protonmail/android/uitest/screen/settings/account/AccountSettingsScreenTest.kt
+++ b/app/src/uiTest/kotlin/ch/protonmail/android/uitest/screen/settings/account/AccountSettingsScreenTest.kt
@@ -29,7 +29,7 @@ import ch.protonmail.android.mailsettings.presentation.accountsettings.AccountSe
import ch.protonmail.android.mailsettings.presentation.accountsettings.AccountSettingsState.Data
import ch.protonmail.android.mailsettings.presentation.accountsettings.TEST_TAG_ACCOUNT_SETTINGS_LIST
import ch.protonmail.android.test.annotations.suite.RegressionTest
-import ch.protonmail.android.uitest.util.assertTextContains
+import ch.protonmail.android.uitest.util.assertions.assertTextContains
import ch.protonmail.android.uitest.util.hasText
import ch.protonmail.android.uitest.util.onNodeWithText
import me.proton.core.compose.theme.ProtonTheme
@@ -157,5 +157,4 @@ internal class AccountSettingsScreenTest {
.performScrollToNode(hasText(string.mail_settings_snooze_notifications))
.assertIsDisplayed()
}
-
}
diff --git a/app/src/uiTest/kotlin/ch/protonmail/android/uitest/screen/settings/appsettings/SettingsScreenTest.kt b/app/src/uiTest/kotlin/ch/protonmail/android/uitest/screen/settings/appsettings/SettingsScreenTest.kt
index 395dd0c02f..b1a2a25296 100644
--- a/app/src/uiTest/kotlin/ch/protonmail/android/uitest/screen/settings/appsettings/SettingsScreenTest.kt
+++ b/app/src/uiTest/kotlin/ch/protonmail/android/uitest/screen/settings/appsettings/SettingsScreenTest.kt
@@ -34,7 +34,7 @@ import ch.protonmail.android.mailsettings.presentation.settings.MainSettingsScre
import ch.protonmail.android.mailsettings.presentation.settings.SettingsState.Data
import ch.protonmail.android.mailsettings.presentation.settings.TEST_TAG_SETTINGS_LIST
import ch.protonmail.android.test.annotations.suite.RegressionTest
-import ch.protonmail.android.uitest.util.assertTextContains
+import ch.protonmail.android.uitest.util.assertions.assertTextContains
import ch.protonmail.android.uitest.util.hasText
import ch.protonmail.android.uitest.util.onNodeWithText
import me.proton.core.compose.theme.ProtonTheme
diff --git a/app/src/uiTest/kotlin/ch/protonmail/android/uitest/util/assertions/CustomSemanticsPropertyKeyNames.kt b/app/src/uiTest/kotlin/ch/protonmail/android/uitest/util/assertions/CustomSemanticsPropertyKeyNames.kt
new file mode 100644
index 0000000000..0d83044400
--- /dev/null
+++ b/app/src/uiTest/kotlin/ch/protonmail/android/uitest/util/assertions/CustomSemanticsPropertyKeyNames.kt
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2022 Proton Technologies AG
+ * This file is part of Proton Technologies AG and Proton Mail.
+ *
+ * Proton Mail is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Proton Mail is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Proton Mail. If not, see .
+ */
+
+package ch.protonmail.android.uitest.util.assertions
+
+internal object CustomSemanticsPropertyKeyNames {
+
+ const val TintColorKey = "TintColorKey"
+}
diff --git a/app/src/uiTest/kotlin/ch/protonmail/android/uitest/util/Assertions.kt b/app/src/uiTest/kotlin/ch/protonmail/android/uitest/util/assertions/TextAssertions.kt
similarity index 85%
rename from app/src/uiTest/kotlin/ch/protonmail/android/uitest/util/Assertions.kt
rename to app/src/uiTest/kotlin/ch/protonmail/android/uitest/util/assertions/TextAssertions.kt
index 289f5ddf21..31ce25ad12 100644
--- a/app/src/uiTest/kotlin/ch/protonmail/android/uitest/util/Assertions.kt
+++ b/app/src/uiTest/kotlin/ch/protonmail/android/uitest/util/assertions/TextAssertions.kt
@@ -16,13 +16,15 @@
* along with Proton Mail. If not, see .
*/
-package ch.protonmail.android.uitest.util
+package ch.protonmail.android.uitest.util.assertions
import androidx.annotation.StringRes
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.test.SemanticsNodeInteraction
import androidx.compose.ui.test.assert
import androidx.compose.ui.test.assertTextContains
+import ch.protonmail.android.uitest.util.getString
+import ch.protonmail.android.uitest.util.hasTextColor
fun SemanticsNodeInteraction.assertTextColor(
color: Long
@@ -37,10 +39,3 @@ fun SemanticsNodeInteraction.assertTextContains(
substring: Boolean = false,
ignoreCase: Boolean = false
): SemanticsNodeInteraction = assertTextContains(getString(valueRes), substring, ignoreCase)
-
-/**
- * Returns a [Boolean] indicating whether the item exists or not, without throwing an exception.
- */
-fun SemanticsNodeInteraction.peek(): Boolean {
- return runCatching { assertExists() }.isSuccess
-}
diff --git a/app/src/uiTest/kotlin/ch/protonmail/android/uitest/util/assertions/TintColorAssertions.kt b/app/src/uiTest/kotlin/ch/protonmail/android/uitest/util/assertions/TintColorAssertions.kt
new file mode 100644
index 0000000000..1e71897341
--- /dev/null
+++ b/app/src/uiTest/kotlin/ch/protonmail/android/uitest/util/assertions/TintColorAssertions.kt
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2022 Proton Technologies AG
+ * This file is part of Proton Technologies AG and Proton Mail.
+ *
+ * Proton Mail is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Proton Mail is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Proton Mail. If not, see .
+ */
+
+package ch.protonmail.android.uitest.util.assertions
+
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.test.SemanticsNodeInteraction
+import ch.protonmail.android.uitest.util.extensions.getKeyValueByName
+import org.junit.Assert.assertEquals
+import kotlin.test.assertNull
+
+fun SemanticsNodeInteraction.assertTintColor(tintColor: Color) = apply {
+ val tintColorProperty = getKeyValueByName(CustomSemanticsPropertyKeyNames.TintColorKey)
+ ?: throw AssertionError("Expected TintColorKey property was not found on this node.")
+
+ assertEquals(tintColor, tintColorProperty.value)
+}
+
+fun SemanticsNodeInteraction.assertNoTintColor() = apply {
+ val tintColorProperty = getKeyValueByName(CustomSemanticsPropertyKeyNames.TintColorKey)
+ ?: throw AssertionError("Expected TintColorKey property was not found on this node.")
+
+ assertNull(tintColorProperty.value)
+}
diff --git a/app/src/uiTest/kotlin/ch/protonmail/android/uitest/util/extensions/SemanticsNodeInteractionExtensions.kt b/app/src/uiTest/kotlin/ch/protonmail/android/uitest/util/extensions/SemanticsNodeInteractionExtensions.kt
new file mode 100644
index 0000000000..0e624409b9
--- /dev/null
+++ b/app/src/uiTest/kotlin/ch/protonmail/android/uitest/util/extensions/SemanticsNodeInteractionExtensions.kt
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2022 Proton Technologies AG
+ * This file is part of Proton Technologies AG and Proton Mail.
+ *
+ * Proton Mail is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Proton Mail is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Proton Mail. If not, see .
+ */
+
+package ch.protonmail.android.uitest.util.extensions
+
+import androidx.compose.ui.test.SemanticsNodeInteraction
+
+/**
+ * Returns a [Map.Entry] instance for the provided key, null if no entry exists.
+ */
+fun SemanticsNodeInteraction.getKeyValueByName(key: String): Map.Entry<*, *>? {
+ return fetchSemanticsNode().config.firstOrNull {
+ it.key.name == key
+ }
+}
+
+/**
+ * Returns a [Boolean] indicating whether the item exists or not, without throwing an exception.
+ */
+fun SemanticsNodeInteraction.peek(): Boolean {
+ return runCatching { assertExists() }.isSuccess
+}