From 6404f200f8cc75d6638f7ae2e3581de6035163b7 Mon Sep 17 00:00:00 2001 From: Ali Abdulmadzhidov Date: Thu, 19 Oct 2023 23:16:33 +0300 Subject: [PATCH] ui test tags --- app/build.gradle | 1 - build.gradle | 2 +- .../presentation/compose/components/BasicBannerCard.kt | 2 ++ .../common/presentation/compose/components/Toolbar.kt | 5 +++++ .../main/java/jp/co/soramitsu/common/util/ext/Modifier.kt | 4 +++- .../presentation/profile/debugmenu/DebugMenuFragment.kt | 1 + .../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 ++ settings.gradle | 1 - 12 files changed, 32 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 199cef584..07bdfc7e8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -171,7 +171,6 @@ dependencies { implementation project(":feature_blockexplorer_impl") implementation project(":feature_sora_card_api") implementation project(":feature_sora_card_impl") - implementation project(":feature_ecosystem_api") implementation project(":feature_ecosystem_impl") implementation project(":sorasubstrate") implementation project(":soracrypro") diff --git a/build.gradle b/build.gradle index eb3153364..da0b554df 100644 --- a/build.gradle +++ b/build.gradle @@ -43,7 +43,7 @@ buildscript { compose : '1.5.3', composeCompiler : '1.5.3', composeConstraintLayout: '1.1.0-alpha05', - uiCore : '0.2.9', + uiCore : '0.2.10', soraCard : '0.1.57', lazySodium : '5.0.2', jna : '5.8.0', 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/common/src/main/java/jp/co/soramitsu/common/presentation/compose/components/Toolbar.kt b/common/src/main/java/jp/co/soramitsu/common/presentation/compose/components/Toolbar.kt index 865f1a9ed..e5403f104 100644 --- a/common/src/main/java/jp/co/soramitsu/common/presentation/compose/components/Toolbar.kt +++ b/common/src/main/java/jp/co/soramitsu/common/presentation/compose/components/Toolbar.kt @@ -40,6 +40,7 @@ import androidx.compose.runtime.remember import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import jp.co.soramitsu.common.R +import jp.co.soramitsu.common.util.ext.PACKAGE_ID import jp.co.soramitsu.ui_core.component.toolbar.Action import jp.co.soramitsu.ui_core.component.toolbar.BasicToolbarState import jp.co.soramitsu.ui_core.component.toolbar.SoramitsuToolbar @@ -110,9 +111,13 @@ fun Toolbar( backgroundColor = backgroundColor, tint = tintColor, onNavigate = onNavClick, + onNavigateTestTag = "$PACKAGE_ID:id/OnNavigate", onAction = onActionClick, + onActionTestTag = "$PACKAGE_ID:id/OnAction", onMenuItemClicked = onMenuItemClick, + onMenuItemClickedTestTag = "$PACKAGE_ID:id/OnMenuItem", onSearch = onSearch, + onSearchTestTag = "$PACKAGE_ID:id/OnSearch", ) } } diff --git a/common/src/main/java/jp/co/soramitsu/common/util/ext/Modifier.kt b/common/src/main/java/jp/co/soramitsu/common/util/ext/Modifier.kt index 7d61abb93..28ffd164a 100644 --- a/common/src/main/java/jp/co/soramitsu/common/util/ext/Modifier.kt +++ b/common/src/main/java/jp/co/soramitsu/common/util/ext/Modifier.kt @@ -51,6 +51,8 @@ import androidx.compose.ui.semantics.testTagsAsResourceId import jp.co.soramitsu.common.util.BuildUtils import jp.co.soramitsu.common.util.DebounceClickHandler +const val PACKAGE_ID = "jp.co.soramitsu.sora.develop" + @OptIn(ExperimentalComposeUiApi::class) @SuppressLint("ModifierFactoryUnreferencedReceiver") fun Modifier.testTagAsId(tag: String): Modifier { @@ -61,7 +63,7 @@ fun Modifier.testTagAsId(tag: String): Modifier { .semantics { testTagsAsResourceId = true } - .testTag("jp.co.soramitsu.sora.develop:id/$tag") + .testTag("$PACKAGE_ID:id/$tag") } } diff --git a/feature_main_impl/src/main/java/jp/co/soramitsu/feature_main_impl/presentation/profile/debugmenu/DebugMenuFragment.kt b/feature_main_impl/src/main/java/jp/co/soramitsu/feature_main_impl/presentation/profile/debugmenu/DebugMenuFragment.kt index 88ff412f1..fa4be50e9 100644 --- a/feature_main_impl/src/main/java/jp/co/soramitsu/feature_main_impl/presentation/profile/debugmenu/DebugMenuFragment.kt +++ b/feature_main_impl/src/main/java/jp/co/soramitsu/feature_main_impl/presentation/profile/debugmenu/DebugMenuFragment.kt @@ -101,6 +101,7 @@ class DebugMenuFragment : SoraBaseFragment() { val dm = remember { activity?.getSize() } + val pushState = NewHistoryEventsWorker.getInfo(requireContext()).observeAsState().value val pushEnabled = (pushState != null) && (pushState.size > 0) && ((pushState[0].state == WorkInfo.State.RUNNING) || (pushState[0].state == WorkInfo.State.ENQUEUED)) 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, diff --git a/settings.gradle b/settings.gradle index a109df7d2..f9a39f519 100644 --- a/settings.gradle +++ b/settings.gradle @@ -25,7 +25,6 @@ include ':feature_polkaswap_impl' include ':feature_assets_api' include ':feature_assets_impl' -include ':feature_ecosystem_api' include ':feature_ecosystem_impl' include ':android-foundation'