Skip to content

Commit

Permalink
Merge pull request #75 from yml-org/feature/CM-1518
Browse files Browse the repository at this point in the history
Updated test cases.
  • Loading branch information
dkk009 committed Jul 31, 2023
2 parents 2b5eb8f + 97b5c44 commit 8c7ebb2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The project includes a shell script file `YTemplate.sh` which renames and restru
- `<application_name>` Optional input.
- `./YTemplate.sh <package_name> <application_name>`.

Note: To run the shell script on Windows, one can run bash on ubuntu in Windows(starting from Windows 10).
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).
Type ` bash YTemplate.sh <package_name> <application_name>`. It will execute the script.


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.performClick
import androidx.compose.ui.test.performTextInput
import org.junit.Rule
import org.junit.Test
import ytemplate.android.core.ui.theme.YTemplateTheme
Expand All @@ -28,4 +29,21 @@ class TestNewLocalPostScreen {
composeTestRule.onNodeWithTag("show_new_post_button").performClick()
composeTestRule.onNodeWithTag("title_tag").assertIsDisplayed()
}

@Test
fun testCreateNewPost() {
composeTestRule.setContent {
YTemplateTheme {
ShowCreatePostOption(Modifier) {
}
}
}

composeTestRule.onNodeWithTag("show_new_post_button").assertIsDisplayed()
composeTestRule.onNodeWithTag("show_new_post_button").performClick()
composeTestRule.onNodeWithTag("new_post_title").assertIsDisplayed()
composeTestRule.onNodeWithTag("title_tag").performTextInput("TestTitle")
composeTestRule.onNodeWithTag("details_tag").performTextInput("TestDetails")
composeTestRule.onNodeWithTag("add_button").performClick()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fun ShowNewPostScreen(
var title by remember { mutableStateOf("") }
var details by remember { mutableStateOf("") }
Column(modifier = modifier) {
Box(modifier = Modifier.fillMaxWidth().padding(dimensions.paddingSmall)) {
Box(modifier = Modifier.fillMaxWidth().padding(dimensions.paddingSmall).testTag("new_post_title")) {
Text(
modifier = Modifier.align(Alignment.CenterStart),
text = stringResource(R.string.new_post),
Expand Down

0 comments on commit 8c7ebb2

Please sign in to comment.