Skip to content

Commit

Permalink
Update LandingPage.kt
Browse files Browse the repository at this point in the history
Update instrumentation test
  • Loading branch information
ravishanker committed Mar 14, 2024
1 parent 8b7f182 commit 2cbee98
Showing 1 changed file with 8 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,27 @@ import androidx.compose.ui.test.junit4.ComposeTestRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import org.wordpress.android.BuildConfig
import org.wordpress.android.R
import org.wordpress.android.support.ComposeEspressoLink
import org.wordpress.android.support.WPSupportUtils.clickOn
import org.wordpress.android.support.WPSupportUtils.getTranslatedString
import org.wordpress.android.ui.compose.TestTags

object LandingPage {
private const val isNewUiEnabled = BuildConfig.IS_JETPACK_APP || BuildConfig.LANDING_SCREEN_REVAMP

@JvmStatic
fun tapContinueWithWpCom(composeTestRule: ComposeTestRule) {
if (isNewUiEnabled) {
// New UI - See LoginPrologueRevampedFragment
composeTestRule
.onNodeWithTag(TestTags.BUTTON_WPCOM_AUTH)
.performClick()
} else {
// Old UI - See LoginPrologueFragment
clickOn(R.id.continue_with_wpcom_button)
}
// New UI - See LoginPrologueRevampedFragment
composeTestRule
.onNodeWithTag(TestTags.BUTTON_WPCOM_AUTH)
.performClick()

ComposeEspressoLink().unregister()
}

@JvmStatic
fun tapEnterYourSiteAddress(composeTestRule: ComposeTestRule) {
if (isNewUiEnabled) {
// New UI - See LoginPrologueRevampedFragment
composeTestRule
.onNodeWithText(getTranslatedString(R.string.enter_your_site_address))
.performClick()
} else {
// Old UI - See LoginPrologueFragment
clickOn(R.id.enter_your_site_address_button)
}
// New UI - See LoginPrologueRevampedFragment
composeTestRule
.onNodeWithText(getTranslatedString(R.string.enter_your_site_address))
.performClick()
}
}

0 comments on commit 2cbee98

Please sign in to comment.