Skip to content

Commit d545ffc

Browse files
authored
Add pressImeAction to compose text field steps, fix typo (#36)
1 parent a2e784a commit d545ffc

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

compose/src/main/java/com/progressive/kherkin/compose/steps/actions/ScrollSteps.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import androidx.compose.ui.test.performScrollToNode
88
import com.progressive.kherkin.common.testcore.Gherkin
99

1010
/** Scrolls a scrollable container [tagOfScrollableContainer] to the matching [tag]. */
11-
fun Gherkin.IScrollOnNodeUntillISee(tagOfScrollableContainer: String, tag: String, composeTestRule: ComposeTestRule) {
11+
fun Gherkin.IScrollOnNodeUntilISee(tagOfScrollableContainer: String, tag: String, composeTestRule: ComposeTestRule) {
1212
composeTestRule.onNodeWithTag(tagOfScrollableContainer).performScrollToNode(hasTestTag(tag))
1313
}
1414

1515
/** Scrolls a scrollable container [tagOfScrollableContainer] to the matching [text]. */
16-
fun Gherkin.IScrollOnNodeUntillISeeText(tagOfScrollableContainer: String, text: String, composeTestRule: ComposeTestRule) {
16+
fun Gherkin.IScrollOnNodeUntilISeeText(tagOfScrollableContainer: String, text: String, composeTestRule: ComposeTestRule) {
1717
composeTestRule.onNodeWithTag(tagOfScrollableContainer).performScrollToNode(hasText(text))
1818
}

compose/src/main/java/com/progressive/kherkin/compose/steps/actions/TextFieldSteps.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import com.progressive.kherkin.common.testcore.Gherkin
1212
/** Finds a node with [tag] and inputs [text] into the text field. */
1313
fun Gherkin.IEnterTextIntoField(tag: String, text: String, composeTestRule: ComposeTestRule) {
1414
composeTestRule.onNodeWithTag(tag).assert(hasSetTextAction()).performTextInput(text)
15+
composeTestRule.onNodeWithTag(tag).assert(hasSetTextAction()).performImeAction()
1516
}
1617

1718
/** Finds a node with [tag] and leaves the text field empty. */
@@ -22,4 +23,5 @@ fun Gherkin.ILeaveFieldEmpty(tag: String, composeTestRule: ComposeTestRule) {
2223
/** Finds a node with [tag] and clears the text field. */
2324
fun Gherkin.IClearField(tag: String, composeTestRule: ComposeTestRule) {
2425
composeTestRule.onNodeWithTag(tag).assert(hasSetTextAction()).performTextClearance()
26+
composeTestRule.onNodeWithTag(tag).assert(hasSetTextAction()).performImeAction()
2527
}

sampleapp/src/androidTest/java/com/progressive/sampleapp/tests/compose/TestScrollSteps.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package com.progressive.sampleapp.tests.compose
33
import com.progressive.kherkin.common.testcore.Given
44
import com.progressive.kherkin.common.testcore.Then
55
import com.progressive.kherkin.common.testcore.When
6-
import com.progressive.kherkin.compose.steps.actions.IScrollOnNodeUntillISee
7-
import com.progressive.kherkin.compose.steps.actions.IScrollOnNodeUntillISeeText
6+
import com.progressive.kherkin.compose.steps.actions.IScrollOnNodeUntilISee
7+
import com.progressive.kherkin.compose.steps.actions.IScrollOnNodeUntilISeeText
88
import com.progressive.kherkin.compose.steps.assertion.IShouldSeeNodeWithText
99
import com.progressive.kherkin.compose.steps.setup.IRenderScreen
1010
import com.progressive.sampleapp.screens.compose.BasicComposeScreen
@@ -16,14 +16,14 @@ class TestScrollSteps : SampleBaseIntegrationTestCase() {
1616
@Test
1717
fun testScrollOnNode() {
1818
Given.IRenderScreen(BasicComposeScreen(), composeTestRule)
19-
When.IScrollOnNodeUntillISee("Scroll Box", "Scroll Item 9", composeTestRule)
19+
When.IScrollOnNodeUntilISee("Scroll Box", "Scroll Item 9", composeTestRule)
2020
Then.IShouldSeeNodeWithText("Scroll Item 9", "Scroll item 9", composeTestRule)
2121
}
2222

2323
@Test
2424
fun testScrollOnNodeWithText() {
2525
Given.IRenderScreen(BasicComposeScreen(), composeTestRule)
26-
When.IScrollOnNodeUntillISeeText("Scroll Box", "Scroll item 9", composeTestRule)
26+
When.IScrollOnNodeUntilISeeText("Scroll Box", "Scroll item 9", composeTestRule)
2727
Then.IShouldSeeNodeWithText("Scroll Item 9", "Scroll item 9", composeTestRule)
2828
}
2929
}

0 commit comments

Comments
 (0)