Skip to content

Commit 8c7ebb2

Browse files
authored
Merge pull request #75 from yml-org/feature/CM-1518
Updated test cases.
2 parents 2b5eb8f + 97b5c44 commit 8c7ebb2

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The project includes a shell script file `YTemplate.sh` which renames and restru
1010
- `<application_name>` Optional input.
1111
- `./YTemplate.sh <package_name> <application_name>`.
1212

13-
Note: To run the shell script on Windows, one can run bash on ubuntu in Windows(starting from Windows 10).
13+
Note: To run the shell script on Windows, one can run bash on ubuntu in Windows(starting from Windows 10) or GitWindows(https://git-scm.com/download/win).
1414
Type ` bash YTemplate.sh <package_name> <application_name>`. It will execute the script.
1515

1616

feature/post/src/androidTest/java/ytemplate/android/feature/post/ui/TestNewLocalPostScreen.kt

+18
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import androidx.compose.ui.test.assertIsDisplayed
55
import androidx.compose.ui.test.junit4.createComposeRule
66
import androidx.compose.ui.test.onNodeWithTag
77
import androidx.compose.ui.test.performClick
8+
import androidx.compose.ui.test.performTextInput
89
import org.junit.Rule
910
import org.junit.Test
1011
import ytemplate.android.core.ui.theme.YTemplateTheme
@@ -28,4 +29,21 @@ class TestNewLocalPostScreen {
2829
composeTestRule.onNodeWithTag("show_new_post_button").performClick()
2930
composeTestRule.onNodeWithTag("title_tag").assertIsDisplayed()
3031
}
32+
33+
@Test
34+
fun testCreateNewPost() {
35+
composeTestRule.setContent {
36+
YTemplateTheme {
37+
ShowCreatePostOption(Modifier) {
38+
}
39+
}
40+
}
41+
42+
composeTestRule.onNodeWithTag("show_new_post_button").assertIsDisplayed()
43+
composeTestRule.onNodeWithTag("show_new_post_button").performClick()
44+
composeTestRule.onNodeWithTag("new_post_title").assertIsDisplayed()
45+
composeTestRule.onNodeWithTag("title_tag").performTextInput("TestTitle")
46+
composeTestRule.onNodeWithTag("details_tag").performTextInput("TestDetails")
47+
composeTestRule.onNodeWithTag("add_button").performClick()
48+
}
3149
}

feature/post/src/main/java/ytemplate/android/feature/post/ui/NewLocalPostScreen.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ fun ShowNewPostScreen(
9494
var title by remember { mutableStateOf("") }
9595
var details by remember { mutableStateOf("") }
9696
Column(modifier = modifier) {
97-
Box(modifier = Modifier.fillMaxWidth().padding(dimensions.paddingSmall)) {
97+
Box(modifier = Modifier.fillMaxWidth().padding(dimensions.paddingSmall).testTag("new_post_title")) {
9898
Text(
9999
modifier = Modifier.align(Alignment.CenterStart),
100100
text = stringResource(R.string.new_post),

0 commit comments

Comments
 (0)