diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputFileResource.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputFileResource.kt index 62aaf78c7..438d64a96 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputFileResource.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputFileResource.kt @@ -33,7 +33,8 @@ const val CLEAR_BUTTON_TEST_TAG = "CLEAR_BUTTON" const val UPLOAD_BUTTON_TEST_TAG = "UPLOAD_BUTTON" const val ADD_BUTTON_TEST_TAG = "ADD_BUTTON" const val PROGRESS_INDICATOR_TEST_TAG = "PROGRESS_INDICATOR" -const val UPLOAD_HELPER_TEST_TAG = "UPLOAD_HELPER" +const val UPLOAD_TEXT_FILE_NAME_TEST_TAG = "UPLOAD_TEXT_FILE_NAME" +const val UPLOAD_TEXT_FILE_WEIGHT_TEST_TAG = "UPLOAD_TEXT_FILE_WEIGHT" const val SUPPORTING_TEXT_TEST_TAG = "SUPPORTING_TEXT" @Composable @@ -158,6 +159,7 @@ fun InputFileResource( text = it, style = MaterialTheme.typography.bodyLarge.copy(color = if (inputShellState != InputShellState.DISABLED) TextColor.OnSurface else TextColor.OnDisabledSurface), maxLines = 1, + modifier = Modifier.testTag(INPUT_FILE_TEST_TAG + UPLOAD_TEXT_FILE_NAME_TEST_TAG), ) } fileWeight.value?.let { @@ -165,6 +167,7 @@ fun InputFileResource( text = " $it", style = MaterialTheme.typography.bodyLarge.copy(TextColor.OnDisabledSurface), maxLines = 1, + modifier = Modifier.testTag(INPUT_FILE_TEST_TAG + UPLOAD_TEXT_FILE_WEIGHT_TEST_TAG), ) } } diff --git a/designsystem/src/desktopTest/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputFileResourceTest.kt b/designsystem/src/desktopTest/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputFileResourceTest.kt index e73e22586..b073af65b 100644 --- a/designsystem/src/desktopTest/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputFileResourceTest.kt +++ b/designsystem/src/desktopTest/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputFileResourceTest.kt @@ -52,8 +52,10 @@ class InputFileResourceTest { rule.onNodeWithTag(INPUT_FILE_TEST_TAG + ADD_BUTTON_TEST_TAG).performClick() rule.onNodeWithTag(INPUT_FILE_TEST_TAG + UPLOAD_BUTTON_TEST_TAG).assertExists() - rule.onNodeWithTag(INPUT_FILE_TEST_TAG + UPLOAD_HELPER_TEST_TAG).assertExists() - rule.onNodeWithTag(INPUT_FILE_TEST_TAG + UPLOAD_HELPER_TEST_TAG).assert(hasText(testFileName.value.toString() + " " + testFileWeight.value.toString())) + rule.onNodeWithTag(INPUT_FILE_TEST_TAG + UPLOAD_TEXT_FILE_NAME_TEST_TAG).assertExists() + rule.onNodeWithTag(INPUT_FILE_TEST_TAG + UPLOAD_TEXT_FILE_WEIGHT_TEST_TAG).assertExists() + rule.onNodeWithTag(INPUT_FILE_TEST_TAG + UPLOAD_TEXT_FILE_NAME_TEST_TAG).assert(hasText(testFileName.value.toString())) + rule.onNodeWithTag(INPUT_FILE_TEST_TAG + UPLOAD_TEXT_FILE_WEIGHT_TEST_TAG).assert(hasText(" " + testFileWeight.value.toString())) } @Test @@ -94,12 +96,14 @@ class InputFileResourceTest { onUploadFile = {}, ) } - rule.onNodeWithTag(INPUT_FILE_TEST_TAG + UPLOAD_HELPER_TEST_TAG).assert(hasText("test.filename.extension 256kb")) + rule.onNodeWithTag(INPUT_FILE_TEST_TAG + UPLOAD_TEXT_FILE_NAME_TEST_TAG).assert(hasText("test.filename.extension")) + rule.onNodeWithTag(INPUT_FILE_TEST_TAG + UPLOAD_TEXT_FILE_WEIGHT_TEST_TAG).assert(hasText(" 256kb")) rule.onNodeWithTag(INPUT_FILE_TEST_TAG + CLEAR_BUTTON_TEST_TAG).performClick() newFileName = "test_file" newFileWeight = "512gb" rule.onNodeWithTag(INPUT_FILE_TEST_TAG + ADD_BUTTON_TEST_TAG).performClick() - rule.onNodeWithTag(INPUT_FILE_TEST_TAG + UPLOAD_HELPER_TEST_TAG).assert(hasText("test_file 512gb")) + rule.onNodeWithTag(INPUT_FILE_TEST_TAG + UPLOAD_TEXT_FILE_NAME_TEST_TAG).assert(hasText("test_file")) + rule.onNodeWithTag(INPUT_FILE_TEST_TAG + UPLOAD_TEXT_FILE_WEIGHT_TEST_TAG).assert(hasText(" 512gb")) } @Test