From e74407a948b96d26954d3cefccb23df79b048a16 Mon Sep 17 00:00:00 2001 From: Ali Abdulmadzhidov Date: Wed, 18 Oct 2023 14:03:56 +0300 Subject: [PATCH] add ui locators --- .../presentation/compose/components/BasicBannerCard.kt | 2 ++ .../presentation/ReferralAvailableInvitations.kt | 8 +++++++- .../presentation/ReferralBondUnbondXor.kt | 7 ++++++- .../feature_referral_impl/presentation/ReferralButtons.kt | 2 ++ .../feature_referral_impl/presentation/ReferrerInput.kt | 3 +++ .../presentation/YourReferrerCard.kt | 2 ++ 6 files changed, 22 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/jp/co/soramitsu/common/presentation/compose/components/BasicBannerCard.kt b/common/src/main/java/jp/co/soramitsu/common/presentation/compose/components/BasicBannerCard.kt index d4a86bb45..eea45faa7 100644 --- a/common/src/main/java/jp/co/soramitsu/common/presentation/compose/components/BasicBannerCard.kt +++ b/common/src/main/java/jp/co/soramitsu/common/presentation/compose/components/BasicBannerCard.kt @@ -55,6 +55,7 @@ import androidx.compose.ui.unit.dp import androidx.constraintlayout.compose.ConstraintLayout import androidx.constraintlayout.compose.Dimension import jp.co.soramitsu.common.R +import jp.co.soramitsu.common.util.ext.testTagAsId import jp.co.soramitsu.ui_core.component.button.BleachedButton import jp.co.soramitsu.ui_core.component.button.FilledButton import jp.co.soramitsu.ui_core.component.button.properties.Order @@ -90,6 +91,7 @@ fun BasicBannerCard( val (card, image) = createRefs() CardContent( modifier = Modifier + .testTagAsId("StartInviting") .constrainAs(card) { top.linkTo(parent.top) start.linkTo(parent.start) diff --git a/feature_referral_impl/src/main/java/jp/co/soramitsu/feature_referral_impl/presentation/ReferralAvailableInvitations.kt b/feature_referral_impl/src/main/java/jp/co/soramitsu/feature_referral_impl/presentation/ReferralAvailableInvitations.kt index da4e4e46c..73d706310 100644 --- a/feature_referral_impl/src/main/java/jp/co/soramitsu/feature_referral_impl/presentation/ReferralAvailableInvitations.kt +++ b/feature_referral_impl/src/main/java/jp/co/soramitsu/feature_referral_impl/presentation/ReferralAvailableInvitations.kt @@ -47,6 +47,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import jp.co.soramitsu.common.R +import jp.co.soramitsu.common.util.ext.testTagAsId import jp.co.soramitsu.ui_core.component.button.FilledButton import jp.co.soramitsu.ui_core.component.button.TextButton import jp.co.soramitsu.ui_core.component.button.properties.Order @@ -136,6 +137,7 @@ fun ReferralAvailableInvitationsCard( FilledButton( modifier = Modifier + .testTagAsId("GetMoreInvitations") .padding(top = Dimens.x1) .fillMaxWidth(), text = stringResource(R.string.referral_get_more_invitation_button_title), @@ -147,6 +149,7 @@ fun ReferralAvailableInvitationsCard( if (state.invitationsCount > 0) { TextButton( modifier = Modifier + .testTagAsId("UnbondXor") .padding(top = Dimens.x1) .fillMaxWidth(), text = stringResource(id = R.string.referral_unbond_button_title), @@ -166,7 +169,10 @@ fun PreviewReferralAvailableInvitationsCard() { state = ReferralInvitationsCardState( "Available invitations", 5, - WrappedTextState(title = "Invitations Link", text = "polkaswap.io/#/referral/cnVyaue39dssBc2bReZycusLdys3vbeoz2irRF8BbwVcdCNmm"), + WrappedTextState( + title = "Invitations Link", + text = "polkaswap.io/#/referral/cnVyaue39dssBc2bReZycusLdys3vbeoz2irRF8BbwVcdCNmm" + ), "0.0008 XOR", referrals = ReferralsCardState() ), diff --git a/feature_referral_impl/src/main/java/jp/co/soramitsu/feature_referral_impl/presentation/ReferralBondUnbondXor.kt b/feature_referral_impl/src/main/java/jp/co/soramitsu/feature_referral_impl/presentation/ReferralBondUnbondXor.kt index b9b6b67f9..3c41b7e2f 100644 --- a/feature_referral_impl/src/main/java/jp/co/soramitsu/feature_referral_impl/presentation/ReferralBondUnbondXor.kt +++ b/feature_referral_impl/src/main/java/jp/co/soramitsu/feature_referral_impl/presentation/ReferralBondUnbondXor.kt @@ -64,6 +64,7 @@ import androidx.compose.ui.unit.dp import jp.co.soramitsu.common.R import jp.co.soramitsu.common.presentation.compose.components.DetailsItemNetworkFee import jp.co.soramitsu.common.presentation.compose.theme.SoraAppTheme +import jp.co.soramitsu.common.util.ext.testTagAsId import jp.co.soramitsu.common.view.WarningTextCard import jp.co.soramitsu.ui_core.component.button.FilledButton import jp.co.soramitsu.ui_core.component.button.LoaderWrapper @@ -152,6 +153,7 @@ fun ReferralBondXor( ) { modifier, elevation -> FilledButton( modifier = modifier + .testTagAsId("BondXor") .fillMaxWidth(), size = Size.Large, order = Order.PRIMARY, @@ -241,6 +243,7 @@ fun ReferralUnbondXor( ) { modifier, elevation -> FilledButton( modifier = modifier + .testTagAsId("UnbondXor") .fillMaxWidth(), size = Size.Large, order = Order.PRIMARY, @@ -289,7 +292,9 @@ fun InvitationsEnterField( tint = MaterialTheme.customColors.fgSecondary, ) TextField( - modifier = Modifier.weight(1f), + modifier = Modifier + .testTagAsId("InvitationsInput") + .weight(1f), value = count.toString(), onValueChange = { onCountChange.invoke(it.toIntOrNull() ?: 0) diff --git a/feature_referral_impl/src/main/java/jp/co/soramitsu/feature_referral_impl/presentation/ReferralButtons.kt b/feature_referral_impl/src/main/java/jp/co/soramitsu/feature_referral_impl/presentation/ReferralButtons.kt index 66b286c44..eb34fc1d9 100644 --- a/feature_referral_impl/src/main/java/jp/co/soramitsu/feature_referral_impl/presentation/ReferralButtons.kt +++ b/feature_referral_impl/src/main/java/jp/co/soramitsu/feature_referral_impl/presentation/ReferralButtons.kt @@ -40,6 +40,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource +import jp.co.soramitsu.common.util.ext.testTagAsId import jp.co.soramitsu.ui_core.component.button.FilledButton import jp.co.soramitsu.ui_core.component.button.TonalButton import jp.co.soramitsu.ui_core.component.button.properties.Order @@ -71,6 +72,7 @@ internal fun ReferralButtons( TonalButton( modifier = Modifier + .testTagAsId("BottomButton") .padding(top = Dimens.x1) .fillMaxWidth(), text = stringResource(bottomButtonText), diff --git a/feature_referral_impl/src/main/java/jp/co/soramitsu/feature_referral_impl/presentation/ReferrerInput.kt b/feature_referral_impl/src/main/java/jp/co/soramitsu/feature_referral_impl/presentation/ReferrerInput.kt index 17987ce77..83abeba04 100644 --- a/feature_referral_impl/src/main/java/jp/co/soramitsu/feature_referral_impl/presentation/ReferrerInput.kt +++ b/feature_referral_impl/src/main/java/jp/co/soramitsu/feature_referral_impl/presentation/ReferrerInput.kt @@ -49,6 +49,7 @@ import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.tooling.preview.Preview import jp.co.soramitsu.common.R +import jp.co.soramitsu.common.util.ext.testTagAsId import jp.co.soramitsu.ui_core.component.button.FilledButton import jp.co.soramitsu.ui_core.component.button.LoaderWrapper import jp.co.soramitsu.ui_core.component.button.properties.Order @@ -89,6 +90,7 @@ fun ReferrerInput( InputText( modifier = Modifier + .testTagAsId("LinkAddressInput") .background(MaterialTheme.customColors.bgSurface) .fillMaxWidth() .wrapContentHeight(), @@ -109,6 +111,7 @@ fun ReferrerInput( ) { modifier, elevation -> FilledButton( modifier = modifier + .testTagAsId("Activate") .fillMaxWidth() .padding(top = Dimens.x3), size = Size.Large, diff --git a/feature_referral_impl/src/main/java/jp/co/soramitsu/feature_referral_impl/presentation/YourReferrerCard.kt b/feature_referral_impl/src/main/java/jp/co/soramitsu/feature_referral_impl/presentation/YourReferrerCard.kt index 6768080f2..da61b4038 100644 --- a/feature_referral_impl/src/main/java/jp/co/soramitsu/feature_referral_impl/presentation/YourReferrerCard.kt +++ b/feature_referral_impl/src/main/java/jp/co/soramitsu/feature_referral_impl/presentation/YourReferrerCard.kt @@ -42,6 +42,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import jp.co.soramitsu.common.R +import jp.co.soramitsu.common.util.ext.testTagAsId import jp.co.soramitsu.ui_core.component.button.TonalButton import jp.co.soramitsu.ui_core.component.button.properties.Order import jp.co.soramitsu.ui_core.component.button.properties.Size @@ -81,6 +82,7 @@ fun YourReferrerCard( } else { TonalButton( modifier = Modifier + .testTagAsId("EnterReferrersLink") .fillMaxWidth(), text = stringResource(R.string.referral_enter_link_title), onClick = onEnterReferrersLink,