@@ -23,11 +23,10 @@ import androidx.ui.core.Modifier
23
23
import androidx.ui.foundation.Text
24
24
import androidx.ui.layout.Column
25
25
import androidx.ui.layout.size
26
- import androidx.ui.semantics.Semantics
27
26
import androidx.ui.test.assertIsDisplayed
28
27
import androidx.ui.test.assertIsNotDisplayed
29
28
import androidx.ui.test.createComposeRule
30
- import androidx.ui.test.findByText
29
+ import androidx.ui.test.onNodeWithText
31
30
import androidx.ui.tooling.preview.Preview
32
31
import androidx.ui.unit.dp
33
32
import com.squareup.workflow.ui.ViewEnvironmentKey
@@ -47,28 +46,28 @@ class PreviewViewFactoryTest {
47
46
ParentWithOneChildPreview ()
48
47
}
49
48
50
- findByText (" one" ).assertIsDisplayed()
51
- findByText (" two" ).assertIsDisplayed()
49
+ onNodeWithText (" one" ).assertIsDisplayed()
50
+ onNodeWithText (" two" ).assertIsDisplayed()
52
51
}
53
52
54
53
@Test fun twoChildren () {
55
54
composeRule.setContent {
56
55
ParentWithTwoChildrenPreview ()
57
56
}
58
57
59
- findByText (" one" ).assertIsDisplayed()
60
- findByText (" two" ).assertIsDisplayed()
61
- findByText (" three" ).assertIsDisplayed()
58
+ onNodeWithText (" one" ).assertIsDisplayed()
59
+ onNodeWithText (" two" ).assertIsDisplayed()
60
+ onNodeWithText (" three" ).assertIsDisplayed()
62
61
}
63
62
64
63
@Test fun recursive () {
65
64
composeRule.setContent {
66
65
ParentRecursivePreview ()
67
66
}
68
67
69
- findByText (" one" ).assertIsDisplayed()
70
- findByText (" two" ).assertIsDisplayed()
71
- findByText (" three" ).assertIsDisplayed()
68
+ onNodeWithText (" one" ).assertIsDisplayed()
69
+ onNodeWithText (" two" ).assertIsDisplayed()
70
+ onNodeWithText (" three" ).assertIsDisplayed()
72
71
}
73
72
74
73
@Test fun modifierIsApplied () {
@@ -77,8 +76,8 @@ class PreviewViewFactoryTest {
77
76
}
78
77
79
78
// The view factory will be rendered with size (0,0), so it should be reported as not displayed.
80
- findByText (" one" ).assertIsNotDisplayed()
81
- findByText (" two" ).assertIsNotDisplayed()
79
+ onNodeWithText (" one" ).assertIsNotDisplayed()
80
+ onNodeWithText (" two" ).assertIsNotDisplayed()
82
81
}
83
82
84
83
@Test fun placeholderModifierIsApplied () {
@@ -87,25 +86,23 @@ class PreviewViewFactoryTest {
87
86
}
88
87
89
88
// The child will be rendered with size (0,0), so it should be reported as not displayed.
90
- findByText (" one" ).assertIsDisplayed()
91
- findByText (" two" ).assertIsNotDisplayed()
89
+ onNodeWithText (" one" ).assertIsDisplayed()
90
+ onNodeWithText (" two" ).assertIsNotDisplayed()
92
91
}
93
92
94
93
@Test fun customViewEnvironment () {
95
94
composeRule.setContent {
96
95
ParentConsumesCustomKeyPreview ()
97
96
}
98
97
99
- findByText (" foo" ).assertIsDisplayed()
98
+ onNodeWithText (" foo" ).assertIsDisplayed()
100
99
}
101
100
102
101
private val ParentWithOneChild =
103
102
composedViewFactory<Pair <String , String >> { rendering, environment ->
104
103
Column {
105
104
Text (rendering.first)
106
- Semantics (container = true , mergeAllDescendants = true ) {
107
- WorkflowRendering (rendering.second, environment)
108
- }
105
+ WorkflowRendering (rendering.second, environment)
109
106
}
110
107
}
111
108
@@ -116,13 +113,9 @@ class PreviewViewFactoryTest {
116
113
private val ParentWithTwoChildren =
117
114
composedViewFactory<Triple <String , String , String >> { rendering, environment ->
118
115
Column {
119
- Semantics (container = true ) {
120
- WorkflowRendering (rendering.first, environment)
121
- }
116
+ WorkflowRendering (rendering.first, environment)
122
117
Text (rendering.second)
123
- Semantics (container = true ) {
124
- WorkflowRendering (rendering.third, environment)
125
- }
118
+ WorkflowRendering (rendering.third, environment)
126
119
}
127
120
}
128
121
@@ -139,9 +132,7 @@ class PreviewViewFactoryTest {
139
132
Column {
140
133
Text (rendering.text)
141
134
rendering.child?.let { child ->
142
- Semantics (container = true ) {
143
- WorkflowRendering (rendering = child, viewEnvironment = environment)
144
- }
135
+ WorkflowRendering (rendering = child, viewEnvironment = environment)
145
136
}
146
137
}
147
138
}
0 commit comments