@@ -46,107 +46,107 @@ class TestComposeActivity : TestSuite() {
46
46
@OptIn(ExperimentalTestApi ::class )
47
47
fun huePanelTest () {
48
48
49
- interaction = composeTestRule.onNodeWithTag(testTag = " hue" )
49
+ interaction = getNodeWithTag( " hue" )
50
50
interaction.assertExists().assertIsDisplayed()
51
51
52
52
/* Randomly tapping the huePanel for 5 seconds. */
53
53
for (i in 0 .. 99 ) {
54
54
randomlyClick(interaction)
55
- Thread . sleep(50 )
55
+ sleep(50 )
56
56
}
57
57
}
58
58
59
59
@Test
60
60
@OptIn(ExperimentalTestApi ::class )
61
61
fun satValPanelTest () {
62
62
63
- interaction = composeTestRule.onNodeWithTag(testTag = " sat_val" )
63
+ interaction = getNodeWithTag( " sat_val" )
64
64
interaction.assertExists().assertIsDisplayed()
65
65
66
66
/* Randomly tapping the satValPanel for 5 seconds. */
67
67
for (i in 0 .. 99 ) {
68
68
randomlyClick(interaction)
69
- Thread . sleep(50 )
69
+ sleep(50 )
70
70
}
71
71
}
72
72
73
73
@Test
74
74
@OptIn(ExperimentalTestApi ::class )
75
75
fun alphaPanelTest () {
76
76
77
- interaction = composeTestRule.onNodeWithTag(testTag = " alpha" )
77
+ interaction = getNodeWithTag( " alpha" )
78
78
interaction.assertExists().assertIsDisplayed()
79
79
80
80
/* Randomly tapping the alphaPanel for 5 seconds. */
81
81
for (i in 0 .. 99 ) {
82
82
randomlyClick(interaction)
83
- Thread . sleep(50 )
83
+ sleep(50 )
84
84
}
85
85
}
86
86
87
87
@Test
88
88
fun hexColorTest () {
89
- interaction = composeTestRule.onNodeWithTag(testTag = " hex" )
89
+ interaction = getNodeWithTag( " hex" )
90
90
interaction.assertExists().assertIsDisplayed()
91
91
}
92
92
93
93
@Test
94
94
fun oldColorTest () {
95
- interaction = composeTestRule.onNodeWithTag(testTag = " old_color" )
95
+ interaction = getNodeWithTag( " old_color" )
96
96
interaction.assertExists().assertIsDisplayed()
97
97
}
98
98
99
99
@Test
100
100
fun newColorTest () {
101
- interaction = composeTestRule.onNodeWithTag(testTag = " new_color" )
101
+ interaction = getNodeWithTag( " new_color" )
102
102
interaction.assertExists().assertIsDisplayed()
103
103
}
104
104
105
105
@Test
106
106
fun valueHueTest () {
107
- interaction = composeTestRule.onNodeWithTag(testTag = " value_hue" )
107
+ interaction = getNodeWithTag( " value_hue" )
108
108
interaction.assertExists().assertIsDisplayed()
109
109
}
110
110
111
111
@Test
112
112
fun valueSatTest () {
113
- interaction = composeTestRule.onNodeWithTag(testTag = " value_sat" )
113
+ interaction = getNodeWithTag( " value_sat" )
114
114
interaction.assertExists().assertIsDisplayed()
115
115
}
116
116
117
117
@Test
118
118
fun valueValTest () {
119
- interaction = composeTestRule.onNodeWithTag(testTag = " value_val" )
119
+ interaction = getNodeWithTag( " value_val" )
120
120
interaction.assertExists().assertIsDisplayed()
121
121
}
122
122
123
123
@Test
124
124
fun valueAlphaTest () {
125
- interaction = composeTestRule.onNodeWithTag(testTag = " value_alpha" )
125
+ interaction = getNodeWithTag( " value_alpha" )
126
126
interaction.assertExists().assertIsDisplayed()
127
127
}
128
128
129
129
@Test
130
130
fun valueBlueTest () {
131
- interaction = composeTestRule.onNodeWithTag(testTag = " value_blue" )
131
+ interaction = getNodeWithTag( " value_blue" )
132
132
interaction.assertExists().assertIsDisplayed()
133
133
}
134
134
135
135
@Test
136
136
fun valueRedTest () {
137
- interaction = composeTestRule.onNodeWithTag(testTag = " value_red" )
137
+ interaction = getNodeWithTag( " value_red" )
138
138
interaction.assertExists().assertIsDisplayed()
139
139
}
140
140
141
141
@Test
142
142
fun valueGreenTest () {
143
- interaction = composeTestRule.onNodeWithTag(testTag = " value_green" )
143
+ interaction = getNodeWithTag( " value_green" )
144
144
interaction.assertExists().assertIsDisplayed()
145
145
}
146
146
147
147
@Override
148
148
@ExperimentalTestApi
149
- fun randomlyClick (interaction : SemanticsNodeInteraction ) {
149
+ private fun randomlyClick (interaction : SemanticsNodeInteraction ) {
150
150
val rect = interaction.getBoundsInRoot()
151
151
val rnd = Random ()
152
152
val coordinate = longArrayOf(
@@ -158,4 +158,8 @@ class TestComposeActivity : TestSuite() {
158
158
click(position)
159
159
}
160
160
}
161
+
162
+ private fun getNodeWithTag (testTag : String ): SemanticsNodeInteraction {
163
+ return composeTestRule.onNodeWithTag(testTag = testTag)
164
+ }
161
165
}
0 commit comments