diff --git a/app/src/androidTest/java/com/ivy/wallet/compose/helpers/TransactionFlow.kt b/app/src/androidTest/java/com/ivy/wallet/compose/helpers/TransactionFlow.kt index 494456715d..6a104d833c 100644 --- a/app/src/androidTest/java/com/ivy/wallet/compose/helpers/TransactionFlow.kt +++ b/app/src/androidTest/java/com/ivy/wallet/compose/helpers/TransactionFlow.kt @@ -4,6 +4,7 @@ import androidx.activity.ComponentActivity import androidx.compose.ui.test.* import androidx.compose.ui.test.junit4.AndroidComposeTestRule import androidx.test.ext.junit.rules.ActivityScenarioRule +import com.ivy.wallet.compose.hideKeyboard import com.ivy.wallet.utils.format class TransactionFlow( @@ -17,7 +18,8 @@ class TransactionFlow( amount: Double, title: String? = null, category: String? = null, - account: String = "Cash" + account: String = "Cash", + description: String? = null, ) { mainBottomBar.clickAddFAB() mainBottomBar.clickAddIncome() @@ -26,7 +28,8 @@ class TransactionFlow( amount = amount, title = title, category = category, - account = account + account = account, + description = description, ) } @@ -34,7 +37,8 @@ class TransactionFlow( amount: Double, title: String? = null, category: String? = null, - account: String = "Cash" + account: String = "Cash", + description: String? = null, ) { mainBottomBar.clickAddFAB() mainBottomBar.clickAddExpense() @@ -43,7 +47,8 @@ class TransactionFlow( amount = amount, title = title, category = category, - account = account + account = account, + description = description ) } @@ -51,6 +56,7 @@ class TransactionFlow( amount: Double, title: String?, category: String?, + description: String?, account: String = "Cash" ) { composeTestRule.onNode( @@ -71,6 +77,21 @@ class TransactionFlow( .performTextInput(title) } + if (description != null) { + composeTestRule.hideKeyboard() + + composeTestRule.onNodeWithText("Add description") + .performClick() + + composeTestRule.onNode( + hasTestTag("modal_desc_input"), + useUnmergedTree = true + ).performTextReplacement(description) + + composeTestRule.onNodeWithTag("modal_desc_save") + .performClick() + } + composeTestRule.onNodeWithText("Add") .performClick() } diff --git a/app/src/androidTest/java/com/ivy/wallet/compose/helpers/TransactionScreen.kt b/app/src/androidTest/java/com/ivy/wallet/compose/helpers/TransactionScreen.kt index 7b2da68e23..928d83739c 100644 --- a/app/src/androidTest/java/com/ivy/wallet/compose/helpers/TransactionScreen.kt +++ b/app/src/androidTest/java/com/ivy/wallet/compose/helpers/TransactionScreen.kt @@ -4,6 +4,7 @@ import androidx.activity.ComponentActivity import androidx.compose.ui.test.* import androidx.compose.ui.test.junit4.AndroidComposeTestRule import androidx.test.ext.junit.rules.ActivityScenarioRule +import com.ivy.wallet.compose.hideKeyboard class TransactionScreen( private val composeTestRule: AndroidComposeTestRule, A> @@ -46,6 +47,26 @@ class TransactionScreen( .performTextReplacement(newTitle) } + fun removeDescription() { + composeTestRule.hideKeyboard() + + composeTestRule.onNodeWithTag("trn_description") + .performClick() + + composeTestRule.onNodeWithTag("modal_desc_delete") + .performClick() + } + + fun assertDescription(desc: String) { + composeTestRule.onNodeWithTag("trn_description", useUnmergedTree = true) + .assertTextEquals(desc) + } + + fun assertAddDescriptionButtonVisible() { + composeTestRule.onNodeWithText("Add description") + .assertIsDisplayed() + } + fun clickClose() { composeTestRule.onNodeWithContentDescription("close") .performClick() diff --git a/app/src/androidTest/java/com/ivy/wallet/compose/scenario/OperationsCoreTest.kt b/app/src/androidTest/java/com/ivy/wallet/compose/scenario/OperationsCoreTest.kt index de300cbc56..526d92f267 100644 --- a/app/src/androidTest/java/com/ivy/wallet/compose/scenario/OperationsCoreTest.kt +++ b/app/src/androidTest/java/com/ivy/wallet/compose/scenario/OperationsCoreTest.kt @@ -224,4 +224,66 @@ class OperationsCoreTest : IvyComposeTest() { amountDecimal = ".00" ) } + + @Test + fun AddTransaction_withDescription() = testWithRetry { + onboarding.quickOnboarding() + + transactionFlow.addExpense( + amount = 2178.0, + title = "Samsung Galaxy Tab S8+", + category = "Groceries", + description = "Tablet for learning purposes." + ) + + homeTab.assertBalance( + "-2,178", + amountDecimal = ".00" + ) + + homeTab.dismissPrompt() + + homeTab.clickTransaction( + amount = "2,178.00", + title = "Samsung Galaxy Tab S8+", + category = "Groceries" + ) + + editTransactionScreen.assertDescription("Tablet for learning purposes.") + } + + @Test + fun AddTransaction_thenRemoveDescription() = testWithRetry { + onboarding.quickOnboarding() + + transactionFlow.addIncome( + amount = 123.0, + title = "Income", + description = "-a\n-b\n-c\n-d" + ) + + homeTab.assertBalance( + "123", + amountDecimal = ".00" + ) + + homeTab.dismissPrompt() + + homeTab.clickTransaction( + amount = "123.00", + title = "Income", + ) + + editTransactionScreen.assertDescription("-a\n-b\n-c\n-d") + + // No remove desc --------------------------------------------------------------- + editTransactionScreen.removeDescription() + editTransactionScreen.save() + + homeTab.clickTransaction( + amount = "123.00", + title = "Income", + ) + editTransactionScreen.assertAddDescriptionButtonVisible() + } } \ No newline at end of file diff --git a/app/src/main/java/com/ivy/wallet/ui/edit/core/Description.kt b/app/src/main/java/com/ivy/wallet/ui/edit/core/Description.kt index 66d939c7d6..45c7d68226 100644 --- a/app/src/main/java/com/ivy/wallet/ui/edit/core/Description.kt +++ b/app/src/main/java/com/ivy/wallet/ui/edit/core/Description.kt @@ -4,19 +4,21 @@ import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding +import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.testTag import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.ivy.design.l0_system.UI +import com.ivy.design.l0_system.style import com.ivy.wallet.R import com.ivy.wallet.ui.IvyWalletComponentPreview import com.ivy.wallet.ui.edit.PrimaryAttributeColumn import com.ivy.wallet.ui.theme.components.AddPrimaryAttributeButton import com.ivy.wallet.utils.isNotNullOrBlank -import dev.jeziellago.compose.markdowntext.MarkdownText @Composable fun Description( @@ -52,17 +54,17 @@ private fun DescriptionText( ) { Spacer(Modifier.height(12.dp)) - MarkdownText( + Text( modifier = Modifier .clickable { onClick() } - .padding(horizontal = 24.dp), - markdown = description, - textAlign = TextAlign.Left, - color = UI.colors.pureInverse, - fontSize = UI.typo.b2.fontSize, - fontResource = R.font.raleway_medium + .padding(horizontal = 24.dp) + .testTag("trn_description"), + text = description, + style = UI.typo.nB2.style( + textAlign = TextAlign.Left + ), ) Spacer(Modifier.height(20.dp)) diff --git a/app/src/main/java/com/ivy/wallet/ui/theme/components/IvyDescriptionTextField.kt b/app/src/main/java/com/ivy/wallet/ui/theme/components/IvyDescriptionTextField.kt index 17cce29ccd..466f5b0c0d 100644 --- a/app/src/main/java/com/ivy/wallet/ui/theme/components/IvyDescriptionTextField.kt +++ b/app/src/main/java/com/ivy/wallet/ui/theme/components/IvyDescriptionTextField.kt @@ -13,6 +13,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.SolidColor import androidx.compose.ui.platform.LocalView +import androidx.compose.ui.platform.testTag import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.input.* import androidx.compose.ui.text.style.TextAlign @@ -29,6 +30,7 @@ import com.ivy.wallet.utils.isNotNullOrBlank fun IvyDescriptionTextField( modifier: Modifier = Modifier, textModifier: Modifier = Modifier, + testTag: String = "desc_input", value: TextFieldValue, hint: String?, fontWeight: FontWeight = FontWeight.Medium, @@ -60,7 +62,7 @@ fun IvyDescriptionTextField( val view = LocalView.current BasicTextField( - modifier = textModifier, + modifier = textModifier.testTag(testTag), value = value, onValueChange = onValueChanged, textStyle = UI.typo.nB2.style( diff --git a/app/src/main/java/com/ivy/wallet/ui/theme/modal/IvyModalComponents.kt b/app/src/main/java/com/ivy/wallet/ui/theme/modal/IvyModalComponents.kt index bca8ef7609..5e1f18d2bf 100644 --- a/app/src/main/java/com/ivy/wallet/ui/theme/modal/IvyModalComponents.kt +++ b/app/src/main/java/com/ivy/wallet/ui/theme/modal/IvyModalComponents.kt @@ -26,25 +26,34 @@ fun ModalDynamicPrimaryAction( initialEmpty: Boolean, initialChanged: Boolean, + testTagSave: String = "tag_save", + testTagDelete: String = "tag_delete", + onDelete: () -> Unit, dismiss: () -> Unit, onSave: () -> Unit ) { when { initialEmpty -> { - ModalAdd { + ModalAdd( + testTag = testTagSave + ) { onSave() dismiss() } } else -> { if (!initialChanged) { - ModalDelete { + ModalDelete( + testTag = testTagDelete + ) { onDelete() dismiss() } } else { - ModalSave { + ModalSave( + modifier = Modifier.testTag(testTagSave) + ) { onSave() dismiss() } @@ -121,9 +130,11 @@ fun ModalSave( @Composable fun ModalAdd( enabled: Boolean = true, + testTag: String = "modal_add", onClick: () -> Unit ) { ModalPositiveButton( + modifier = Modifier.testTag(testTag), text = stringResource(R.string.add), iconStart = R.drawable.ic_plus, enabled = enabled, @@ -197,12 +208,13 @@ fun ModalPrimaryButton( @Composable fun ModalDelete( enabled: Boolean = true, + testTag: String = "modal_delete", onClick: () -> Unit ) { IvyCircleButton( modifier = Modifier .size(40.dp) - .testTag("modal_delete"), + .testTag(testTag), icon = R.drawable.ic_delete, backgroundGradient = GradientRed, enabled = enabled, diff --git a/app/src/main/java/com/ivy/wallet/ui/theme/modal/edit/DescriptionModal.kt b/app/src/main/java/com/ivy/wallet/ui/theme/modal/edit/DescriptionModal.kt index fd7f6cedbd..d1429f14f2 100644 --- a/app/src/main/java/com/ivy/wallet/ui/theme/modal/edit/DescriptionModal.kt +++ b/app/src/main/java/com/ivy/wallet/ui/theme/modal/edit/DescriptionModal.kt @@ -52,6 +52,10 @@ fun BoxWithConstraintsScope.DescriptionModal( ModalDynamicPrimaryAction( initialEmpty = description.isNullOrBlank(), initialChanged = description != descTextFieldValue.text, + + testTagSave = "modal_desc_save", + testTagDelete = "modal_desc_delete", + onSave = { onDescriptionChanged(descTextFieldValue.text) view.hideKeyboard() @@ -88,6 +92,7 @@ fun BoxWithConstraintsScope.DescriptionModal( .padding(horizontal = 32.dp) .fillMaxWidth() .focusRequester(focus), + testTag = "modal_desc_input", keyboardOptions = KeyboardOptions( autoCorrect = true, capitalization = KeyboardCapitalization.Sentences, diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 9c40c67397..a77c70a3dc 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -211,7 +211,7 @@ انشاء فئى اسم الفئة اتر الفئة - (Markdown تدعم صيغة) ادخل اي تفاصيل هنا + ادخل اي تفاصيل هنا إزالة التصفيات تصفية تطبيق التصفيات diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index 632dfb69be..089730c204 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -211,7 +211,7 @@ Създай категория Име на категория Избери категория - Добави детайли (поддържа Markdown) + Добави детайли Изчисти филтър Филтър Задай филтър diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 39917cc843..5f7078d9bf 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -211,7 +211,7 @@ Crear categoría Nombre de la categoría Elegir la categoría - Ingrese cualquier detalle aquí (admite Markdown) + Ingrese cualquier detalle aquí Borrar filtros Filtrar Aplicar filtros diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 2c0eea97bc..e509a31e90 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -211,7 +211,7 @@ Crea una categoria Nome della categoria Scegli la categoria - Inserisci qui ogni dettaglio (supporta il Markdown) + Inserisci qui ogni dettaglio Cancella filtro Filtro Applica il filtro diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index dba550b460..5e7ec9cdb0 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -211,7 +211,7 @@ Создать категорию Название категории Выбрать категорию - Добавьте детали (поддерживается Markdown) + Добавьте детали Очистить фильтр Фильтр Применить фильтр diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0bc6711f58..78b5fcca51 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -211,7 +211,7 @@ Create category Category name Choose category - Enter any details here (supports Markdown) + Enter any details here Clear filter Filter Apply filter diff --git a/buildSrc/src/main/java/com/ivy/wallet/buildsrc/dependencies.kt b/buildSrc/src/main/java/com/ivy/wallet/buildsrc/dependencies.kt index 99c419a96c..2c6809ac19 100644 --- a/buildSrc/src/main/java/com/ivy/wallet/buildsrc/dependencies.kt +++ b/buildSrc/src/main/java/com/ivy/wallet/buildsrc/dependencies.kt @@ -22,8 +22,8 @@ import org.gradle.kotlin.dsl.project object Project { //Version - const val versionName = "4.1.4" - const val versionCode = 110 + const val versionName = "4.1.5" + const val versionCode = 111 //Compile SDK & Build Tools const val compileSdkVersion = 31