Skip to content
Merged
334 changes: 15 additions & 319 deletions app/detekt-baseline.xml

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions app/src/androidTest/java/to/bitkit/ui/components/KeyboardTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,34 +28,34 @@ class KeyboardTest {
Keyboard(onClick = {}, onClickBackspace = {})
}

composeTestRule.onNodeWithTag("KeyboardButton_1").assertIsDisplayed()
composeTestRule.onNodeWithTag("KeyboardButton_2").assertIsDisplayed()
composeTestRule.onNodeWithTag("KeyboardButton_3").assertIsDisplayed()
composeTestRule.onNodeWithTag("KeyboardButton_4").assertIsDisplayed()
composeTestRule.onNodeWithTag("KeyboardButton_5").assertIsDisplayed()
composeTestRule.onNodeWithTag("KeyboardButton_6").assertIsDisplayed()
composeTestRule.onNodeWithTag("KeyboardButton_7").assertIsDisplayed()
composeTestRule.onNodeWithTag("KeyboardButton_8").assertIsDisplayed()
composeTestRule.onNodeWithTag("KeyboardButton_9").assertIsDisplayed()
composeTestRule.onNodeWithTag("KeyboardButton_.").assertIsDisplayed()
composeTestRule.onNodeWithTag("KeyboardButton_0").assertIsDisplayed()
composeTestRule.onNodeWithTag("KeyboardButton_backspace").assertIsDisplayed()
composeTestRule.onNodeWithTag("N1").assertIsDisplayed()
composeTestRule.onNodeWithTag("N2").assertIsDisplayed()
composeTestRule.onNodeWithTag("N3").assertIsDisplayed()
composeTestRule.onNodeWithTag("N4").assertIsDisplayed()
composeTestRule.onNodeWithTag("N5").assertIsDisplayed()
composeTestRule.onNodeWithTag("N6").assertIsDisplayed()
composeTestRule.onNodeWithTag("N7").assertIsDisplayed()
composeTestRule.onNodeWithTag("N8").assertIsDisplayed()
composeTestRule.onNodeWithTag("N9").assertIsDisplayed()
composeTestRule.onNodeWithTag("N.").assertIsDisplayed()
composeTestRule.onNodeWithTag("N0").assertIsDisplayed()
composeTestRule.onNodeWithTag("NRemove").assertIsDisplayed()
}

@Test
fun keyboard_tripleZero_when_not_decimal() {
composeTestRule.setContent {
Keyboard(onClick = {}, isDecimal = false, onClickBackspace = {})
}
composeTestRule.onNodeWithTag("KeyboardButton_000").assertIsDisplayed()
composeTestRule.onNodeWithTag("N000").assertIsDisplayed()
}

@Test
fun keyboard_decimal_when_decimal() {
composeTestRule.setContent {
Keyboard(onClick = {}, isDecimal = true, onClickBackspace = {})
}
composeTestRule.onNodeWithTag("KeyboardButton_.").assertIsDisplayed()
composeTestRule.onNodeWithTag("N.").assertIsDisplayed()
}

@Test
Expand All @@ -65,13 +65,13 @@ class KeyboardTest {
Keyboard(onClick = { clickedValue = it }, onClickBackspace = {})
}

composeTestRule.onNodeWithTag("KeyboardButton_5").performClick()
composeTestRule.onNodeWithTag("N5").performClick()
assert(clickedValue == "5")

composeTestRule.onNodeWithTag("KeyboardButton_.").performClick()
composeTestRule.onNodeWithTag("N.").performClick()
assert(clickedValue == ".")

composeTestRule.onNodeWithTag("KeyboardButton_0").performClick()
composeTestRule.onNodeWithTag("N0").performClick()
assert(clickedValue == "0")

}
Expand All @@ -83,7 +83,7 @@ class KeyboardTest {
Keyboard(onClick = { clickedValue = it }, onClickBackspace = {}, isDecimal = false)
}

composeTestRule.onNodeWithTag("KeyboardButton_000").performClick()
composeTestRule.onNodeWithTag("N000").performClick()
assert(clickedValue == "000")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class SendAmountContentTest {
composeTestRule.onNodeWithTag("send_amount_screen").assertExists()
// composeTestRule.onNodeWithTag("amount_input_field").assertExists() doesn't displayed because of viewmodel injection
composeTestRule.onNodeWithTag("available_balance").assertExists()
composeTestRule.onNodeWithTag("payment_method_button").assertExists()
composeTestRule.onNodeWithTag("AssetButton-switch").assertExists()
composeTestRule.onNodeWithTag("continue_button").assertExists()
composeTestRule.onNodeWithTag("amount_keyboard").assertExists()
}
Expand Down Expand Up @@ -98,7 +98,7 @@ class SendAmountContentTest {
)
}

composeTestRule.onNodeWithTag("payment_method_button")
composeTestRule.onNodeWithTag("AssetButton-switch")
.performClick()

assert(eventTriggered)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class BlocksEditScreenTest {

// Assert main elements exist
composeTestRule.onNodeWithTag("blocks_edit_screen").assertExists()
composeTestRule.onNodeWithTag("main_content").assertExists()
composeTestRule.onNodeWithTag("WidgetEditScrollView").assertExists()

// Verify description
composeTestRule.onNodeWithTag("edit_description").assertExists()
Expand All @@ -82,18 +82,18 @@ class BlocksEditScreenTest {

// Verify buttons
composeTestRule.onNodeWithTag("buttons_row").assertExists()
composeTestRule.onNodeWithTag("reset_button").assertExists()
composeTestRule.onNodeWithTag("preview_button").assertExists()
composeTestRule.onNodeWithTag("WidgetEditReset").assertExists()
composeTestRule.onNodeWithTag("WidgetEditPreview").assertExists()

// Test button clicks
composeTestRule.onNodeWithTag("block_toggle_button").performClick()
assert(blockClicked)

composeTestRule.onNodeWithTag("preview_button").performClick()
composeTestRule.onNodeWithTag("WidgetEditPreview").performClick()
assert(previewClicked)

// Reset button should be disabled with default preferences
composeTestRule.onNodeWithTag("reset_button").assertIsNotEnabled()
composeTestRule.onNodeWithTag("WidgetEditReset").assertIsNotEnabled()
}

@Test
Expand Down Expand Up @@ -128,10 +128,10 @@ class BlocksEditScreenTest {
}

// Assert reset button should be enabled when preferences are customized
composeTestRule.onNodeWithTag("reset_button").assertIsEnabled()
composeTestRule.onNodeWithTag("WidgetEditReset").assertIsEnabled()

// Test reset button click
composeTestRule.onNodeWithTag("reset_button").performClick()
composeTestRule.onNodeWithTag("WidgetEditReset").performClick()
assert(resetClicked)
}

Expand Down Expand Up @@ -159,7 +159,7 @@ class BlocksEditScreenTest {
}
}

composeTestRule.onNodeWithTag("preview_button").assertIsEnabled()
composeTestRule.onNodeWithTag("WidgetEditPreview").assertIsEnabled()
}

@Test
Expand Down Expand Up @@ -193,7 +193,7 @@ class BlocksEditScreenTest {
}
}

composeTestRule.onNodeWithTag("preview_button").assertIsNotEnabled()
composeTestRule.onNodeWithTag("WidgetEditPreview").assertIsNotEnabled()
}

@Test
Expand Down Expand Up @@ -255,10 +255,10 @@ class BlocksEditScreenTest {
composeTestRule.onNodeWithTag("source_toggle_button").performClick()
assert(sourceClicked)

composeTestRule.onNodeWithTag("preview_button").performClick()
composeTestRule.onNodeWithTag("WidgetEditPreview").performClick()
assert(previewClicked)

composeTestRule.onNodeWithTag("reset_button").performClick()
composeTestRule.onNodeWithTag("WidgetEditReset").performClick()
assert(resetClicked)
}

Expand Down Expand Up @@ -330,7 +330,7 @@ class BlocksEditScreenTest {

// Assert all tagged elements exist
composeTestRule.onNodeWithTag("blocks_edit_screen").assertExists()
composeTestRule.onNodeWithTag("main_content").assertExists()
composeTestRule.onNodeWithTag("WidgetEditScrollView").assertExists()
composeTestRule.onNodeWithTag("edit_description").assertExists()

listOf("block", "time", "date", "transactions", "size", "source").forEach { prefix ->
Expand All @@ -342,8 +342,8 @@ class BlocksEditScreenTest {
}

composeTestRule.onNodeWithTag("buttons_row").assertExists()
composeTestRule.onNodeWithTag("reset_button").assertExists()
composeTestRule.onNodeWithTag("preview_button").assertExists()
composeTestRule.onNodeWithTag("WidgetEditReset").assertExists()
composeTestRule.onNodeWithTag("WidgetEditPreview").assertExists()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,23 @@ class BlocksPreviewContentTest {
composeTestRule.onNodeWithTag("widget_description").assertExists()

// Verify settings and preview section
composeTestRule.onNodeWithTag("edit_settings_button").assertExists()
composeTestRule.onNodeWithTag("WidgetEdit").assertExists()
composeTestRule.onNodeWithTag("preview_label").assertExists()
composeTestRule.onNodeWithTag("block_card").assertExists()

// Verify buttons
composeTestRule.onNodeWithTag("buttons_row").assertExists()
composeTestRule.onNodeWithTag("delete_button").assertExists()
composeTestRule.onNodeWithTag("save_button").assertExists()
composeTestRule.onNodeWithTag("WidgetDelete").assertExists()
composeTestRule.onNodeWithTag("WidgetSave").assertExists()

// Test button clicks
composeTestRule.onNodeWithTag("edit_settings_button").performClick()
composeTestRule.onNodeWithTag("WidgetEdit").performClick()
assert(editClicked)

composeTestRule.onNodeWithTag("delete_button").performClick()
composeTestRule.onNodeWithTag("WidgetDelete").performClick()
assert(deleteClicked)

composeTestRule.onNodeWithTag("save_button").performClick()
composeTestRule.onNodeWithTag("WidgetSave").performClick()
assert(saveClicked)
}

Expand Down Expand Up @@ -113,11 +113,11 @@ class BlocksPreviewContentTest {
composeTestRule.onNodeWithTag("buttons_row").assertExists()

// Delete button should not exist when widget is disabled
composeTestRule.onNodeWithTag("delete_button").assertDoesNotExist()
composeTestRule.onNodeWithTag("save_button").assertExists()
composeTestRule.onNodeWithTag("WidgetDelete").assertDoesNotExist()
composeTestRule.onNodeWithTag("WidgetSave").assertExists()

// Test save button click
composeTestRule.onNodeWithTag("save_button").performClick()
composeTestRule.onNodeWithTag("WidgetSave").performClick()
assert(saveClicked)
}

Expand Down Expand Up @@ -152,7 +152,7 @@ class BlocksPreviewContentTest {

// Assert that all elements still exist with custom preferences
composeTestRule.onNodeWithTag("blocks_preview_screen").assertExists()
composeTestRule.onNodeWithTag("edit_settings_button").assertExists()
composeTestRule.onNodeWithTag("WidgetEdit").assertExists()
composeTestRule.onNodeWithTag("block_card").assertExists()
}

Expand Down Expand Up @@ -183,12 +183,12 @@ class BlocksPreviewContentTest {
composeTestRule.onNodeWithTag("widget_icon").assertExists()
composeTestRule.onNodeWithTag("widget_description").assertExists()
composeTestRule.onNodeWithTag("divider").assertExists()
composeTestRule.onNodeWithTag("edit_settings_button").assertExists()
composeTestRule.onNodeWithTag("WidgetEdit").assertExists()
composeTestRule.onNodeWithTag("preview_label").assertExists()
composeTestRule.onNodeWithTag("block_card").assertExists()
composeTestRule.onNodeWithTag("buttons_row").assertExists()
composeTestRule.onNodeWithTag("delete_button").assertExists()
composeTestRule.onNodeWithTag("save_button").assertExists()
composeTestRule.onNodeWithTag("WidgetDelete").assertExists()
composeTestRule.onNodeWithTag("WidgetSave").assertExists()
}

@Test
Expand Down Expand Up @@ -248,8 +248,8 @@ class BlocksPreviewContentTest {
// Assert core elements still exist
composeTestRule.onNodeWithTag("blocks_preview_screen").assertExists()
composeTestRule.onNodeWithTag("block_card").assertExists()
composeTestRule.onNodeWithTag("save_button").assertExists()
composeTestRule.onNodeWithTag("delete_button").assertDoesNotExist()
composeTestRule.onNodeWithTag("WidgetSave").assertExists()
composeTestRule.onNodeWithTag("WidgetDelete").assertDoesNotExist()
}

@Test
Expand Down Expand Up @@ -305,7 +305,7 @@ class BlocksPreviewContentTest {
}

// Assert edit button shows custom state
composeTestRule.onNodeWithTag("edit_settings_button").assertExists()
composeTestRule.onNodeWithTag("WidgetEdit").assertExists()
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class FactsEditContentTest {

// Assert main elements exist
composeTestRule.onNodeWithTag("facts_edit_screen").assertExists()
composeTestRule.onNodeWithTag("main_content").assertExists()
composeTestRule.onNodeWithTag("WidgetEditScrollView").assertExists()

// Verify description
composeTestRule.onNodeWithTag("edit_description").assertExists()
Expand All @@ -68,18 +68,18 @@ class FactsEditContentTest {

// Verify buttons
composeTestRule.onNodeWithTag("buttons_row").assertExists()
composeTestRule.onNodeWithTag("reset_button").assertExists()
composeTestRule.onNodeWithTag("preview_button").assertExists()
composeTestRule.onNodeWithTag("WidgetEditReset").assertExists()
composeTestRule.onNodeWithTag("WidgetEditPreview").assertExists()

// Test button clicks
composeTestRule.onNodeWithTag("source_toggle_button").performClick()
assert(sourceClicked)

composeTestRule.onNodeWithTag("preview_button").performClick()
composeTestRule.onNodeWithTag("WidgetEditPreview").performClick()
assert(previewClicked)

// Reset button should be disabled when source is enabled (default state)
composeTestRule.onNodeWithTag("reset_button").assertIsNotEnabled()
composeTestRule.onNodeWithTag("WidgetEditReset").assertIsNotEnabled()
}

@Test
Expand All @@ -105,10 +105,10 @@ class FactsEditContentTest {
}

// Assert reset button should be enabled when source is enabled
composeTestRule.onNodeWithTag("reset_button").assertIsEnabled()
composeTestRule.onNodeWithTag("WidgetEditReset").assertIsEnabled()

// Test reset button click
composeTestRule.onNodeWithTag("reset_button").performClick()
composeTestRule.onNodeWithTag("WidgetEditReset").performClick()
assert(resetClicked)
}

Expand Down Expand Up @@ -152,7 +152,7 @@ class FactsEditContentTest {

// Assert all tagged elements exist
composeTestRule.onNodeWithTag("facts_edit_screen").assertExists()
composeTestRule.onNodeWithTag("main_content").assertExists()
composeTestRule.onNodeWithTag("WidgetEditScrollView").assertExists()
composeTestRule.onNodeWithTag("edit_description").assertExists()
composeTestRule.onNodeWithTag("title_setting_row").assertExists()
composeTestRule.onNodeWithTag("title_text").assertExists()
Expand All @@ -166,8 +166,8 @@ class FactsEditContentTest {
composeTestRule.onNodeWithTag("source_toggle_icon", useUnmergedTree = true).assertExists()
composeTestRule.onNodeWithTag("source_divider").assertExists()
composeTestRule.onNodeWithTag("buttons_row").assertExists()
composeTestRule.onNodeWithTag("reset_button").assertExists()
composeTestRule.onNodeWithTag("preview_button").assertExists()
composeTestRule.onNodeWithTag("WidgetEditReset").assertExists()
composeTestRule.onNodeWithTag("WidgetEditPreview").assertExists()
}

@Test
Expand All @@ -189,7 +189,7 @@ class FactsEditContentTest {
}
}

composeTestRule.onNodeWithTag("reset_button").assertIsEnabled()
composeTestRule.onNodeWithTag("WidgetEditReset").assertIsEnabled()
}

@Test
Expand All @@ -211,7 +211,7 @@ class FactsEditContentTest {
}
}

composeTestRule.onNodeWithTag("reset_button").assertIsNotEnabled()
composeTestRule.onNodeWithTag("WidgetEditReset").assertIsNotEnabled()
}

@Test
Expand Down Expand Up @@ -243,10 +243,10 @@ class FactsEditContentTest {
composeTestRule.onNodeWithTag("source_toggle_button").performClick()
assert(sourceClicked)

composeTestRule.onNodeWithTag("reset_button").performClick()
composeTestRule.onNodeWithTag("WidgetEditReset").performClick()
assert(resetClicked)

composeTestRule.onNodeWithTag("preview_button").performClick()
composeTestRule.onNodeWithTag("WidgetEditPreview").performClick()
assert(previewClicked)
}
}
Loading