From cffff5e2aacb90e399181332f9b9ed48ca521ca0 Mon Sep 17 00:00:00 2001 From: AnasNaouchi Date: Wed, 1 Nov 2023 16:39:08 +0700 Subject: [PATCH] Revert "Test adding delay to UI tests" This reverts commit 2e15d2d422657b736e9351a12db9f1aed7586431. --- .../android/ui/CreditCardActivityTest.kt | 31 +++---------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/sdk/src/sharedTest/java/co/omise/android/ui/CreditCardActivityTest.kt b/sdk/src/sharedTest/java/co/omise/android/ui/CreditCardActivityTest.kt index 62357edd1..e0d610116 100644 --- a/sdk/src/sharedTest/java/co/omise/android/ui/CreditCardActivityTest.kt +++ b/sdk/src/sharedTest/java/co/omise/android/ui/CreditCardActivityTest.kt @@ -80,14 +80,6 @@ class CreditCardActivityTest { override fun onActivityDestroyed(activity: Activity) {} } private val mockClient: Client = mock() - private fun waitMilliseconds(delay: Long) { - try { - Thread.sleep(delay) - } catch (e: InterruptedException) { - // Handle the exception if needed - Thread.currentThread().interrupt() - } - } @Before fun setUp() { @@ -129,8 +121,7 @@ class CreditCardActivityTest { onView(withId(R.id.edit_expiry_date)).perform(typeNumberText("1234")) onView(withId(R.id.edit_security_code)).perform(typeNumberText("123")) onView(withId(R.id.edit_country)).perform(scrollTo(), click()) - // Add a delay before interacting with the dialog - waitMilliseconds(2000) + onView(withId(R.id.country_list)) .inRoot(isDialog()) .perform( @@ -174,8 +165,7 @@ class CreditCardActivityTest { onView(withId(R.id.edit_expiry_date)).perform(typeText("1234")) onView(withId(R.id.edit_security_code)).perform(typeNumberText("123")) onView(withId(R.id.edit_country)).perform(scrollTo(), click()) - // Add a delay before interacting with the dialog - waitMilliseconds(2000) + onView(withId(R.id.country_list)) .inRoot(isDialog()) .perform( @@ -192,8 +182,7 @@ class CreditCardActivityTest { onView(withId(R.id.edit_expiry_date)).perform(typeText("1234")) onView(withId(R.id.edit_security_code)).perform(typeNumberText("123")) onView(withId(R.id.edit_country)).perform(scrollTo(), click()) - // Add a delay before interacting with the dialog - waitMilliseconds(2000) + onView(withId(R.id.country_list)) .inRoot(isDialog()) .perform( @@ -213,8 +202,7 @@ class CreditCardActivityTest { onView(withId(R.id.edit_expiry_date)).perform(typeText("1234")) onView(withId(R.id.edit_security_code)).perform(typeNumberText("123")) onView(withId(R.id.edit_country)).perform(scrollTo(), click()) - // Add a delay before interacting with the dialog - waitMilliseconds(2000) + onView(withId(R.id.country_list)) .inRoot(isDialog()) .perform( @@ -234,8 +222,7 @@ class CreditCardActivityTest { onView(withId(R.id.edit_expiry_date)).perform(typeText("1234")) onView(withId(R.id.edit_security_code)).perform(typeNumberText("123")) onView(withId(R.id.edit_country)).perform(scrollTo(), click()) - // Add a delay before interacting with the dialog - waitMilliseconds(2000) + onView(withId(R.id.country_list)) .inRoot(isDialog()) .perform( @@ -250,8 +237,6 @@ class CreditCardActivityTest { @Test fun postTalCode_canTypeAlphabet() { onView(withId(R.id.edit_country)).perform(scrollTo(), click()) - // Add a delay before interacting with the dialog - waitMilliseconds(2000) onView(withId(R.id.country_list)) .inRoot(isDialog()) .perform( @@ -266,8 +251,6 @@ class CreditCardActivityTest { @Test fun postTalCode_canTypeStartWithZero() { onView(withId(R.id.edit_country)).perform(scrollTo(), click()) - // Add a delay before interacting with the dialog - waitMilliseconds(2000) onView(withId(R.id.country_list)) .inRoot(isDialog()) .perform( @@ -282,8 +265,6 @@ class CreditCardActivityTest { @Test fun state_canTypeWhitespacesApostrophesPeriod() { onView(withId(R.id.edit_country)).perform(scrollTo(), click()) - // Add a delay before interacting with the dialog - waitMilliseconds(2000) onView(withId(R.id.country_list)) .inRoot(isDialog()) .perform( @@ -368,8 +349,6 @@ class CreditCardActivityTest { onView(withId(R.id.edit_expiry_date)).perform(typeNumberText("1234")) onView(withId(R.id.edit_security_code)).perform(typeNumberText("123"), closeSoftKeyboard()) onView(withId(R.id.edit_country)).perform(scrollTo(), click()) - // Add a delay before interacting with the dialog - waitMilliseconds(2000) onView(withId(R.id.country_list)) .inRoot(isDialog()) .perform(