@@ -117,3 +117,93 @@ describe('Touchable Tests', () => {
117117 await searchBox ( '' ) ;
118118 } ) ;
119119} ) ;
120+
121+ describe ( 'TouchableOpacity Tests' , ( ) => {
122+ test ( 'TouchableOpacity should register press in clicked within hitSlop range' , async ( ) => {
123+ const component = await app . findElementByTestID (
124+ 'touchable_hit_slop_button' ,
125+ ) ;
126+ await component . waitForDisplayed ( { timeout : 5000 } ) ;
127+ const dump = await dumpVisualTree ( 'touchable_hit_slop_button' ) ;
128+ expect ( dump ) . toMatchSnapshot ( ) ;
129+ } ) ;
130+
131+ test ( 'TouchableOpacity should not be interactable when disabled' , async ( ) => {
132+ await searchBox ( 'dis' ) ;
133+ const component = await app . findElementByTestID ( 'disabled_touchable' ) ;
134+ await component . waitForDisplayed ( { timeout : 5000 } ) ;
135+ const dump = await dumpVisualTree ( 'disabled_touchable' ) ;
136+ expect ( dump ) . toMatchSnapshot ( ) ;
137+ await component . click ( ) ;
138+ const dump2 = await dumpVisualTree ( 'disabled_touchable' ) ;
139+ expect ( dump2 ) . toMatchSnapshot ( ) ;
140+ await searchBox ( '' ) ;
141+ } ) ;
142+
143+ test ( 'TouchableOpacity should update style upon fast refresh' , async ( ) => {
144+ await searchBox ( 'dis' ) ;
145+ const component = await app . findElementByTestID ( 'disabled_touchable' ) ;
146+ await component . waitForDisplayed ( { timeout : 5000 } ) ;
147+ // Initial state - transparent background
148+ const initialDump = await dumpVisualTree ( 'disabled_touchable' ) ;
149+ expect ( initialDump ) . toMatchSnapshot ( ) ;
150+
151+ // Click to trigger style change (backgroundColor: 'blue')
152+ await component . click ( ) ;
153+
154+ // Verify style updated - background should now be blue
155+ const updatedDump = await dumpVisualTree ( 'disabled_touchable' ) ;
156+ expect ( updatedDump ) . toMatchSnapshot ( ) ;
157+ await searchBox ( '' ) ;
158+ } ) ;
159+
160+ test ( 'TouchableOpacity should fire action upon press' , async ( ) => {
161+ await searchBox ( 'fee' ) ;
162+ const component = await app . findElementByTestID (
163+ 'touchable_feedback_events_button' ,
164+ ) ;
165+ await component . waitForDisplayed ( { timeout : 5000 } ) ;
166+ const dump = await dumpVisualTree ( 'touchable_feedback_events_button' ) ;
167+ expect ( dump ) . toMatchSnapshot ( ) ;
168+ await component . click ( ) ;
169+ const dump2 = await dumpVisualTree ( 'touchable_feedback_events_console' ) ;
170+ expect ( dump2 ) . toMatchSnapshot ( ) ;
171+ await searchBox ( '' ) ;
172+ } ) ;
173+
174+ test ( 'TouchableOpacity should fire action upon onPressIn' , async ( ) => {
175+ await searchBox ( 'fee' ) ;
176+ const component = await app . findElementByTestID (
177+ 'touchable_feedback_events_button' ,
178+ ) ;
179+ await component . waitForDisplayed ( { timeout : 5000 } ) ;
180+ await component . click ( ) ;
181+ const dump = await dumpVisualTree ( 'touchable_feedback_events_console' ) ;
182+ expect ( dump ) . toMatchSnapshot ( ) ;
183+ await searchBox ( '' ) ;
184+ } ) ;
185+
186+ test ( 'TouchableOpacity should fire action upon onPressOut' , async ( ) => {
187+ await searchBox ( 'fee' ) ;
188+ const component = await app . findElementByTestID (
189+ 'touchable_feedback_events_button' ,
190+ ) ;
191+ await component . waitForDisplayed ( { timeout : 5000 } ) ;
192+ await component . click ( ) ;
193+ const dump = await dumpVisualTree ( 'touchable_feedback_events_console' ) ;
194+ expect ( dump ) . toMatchSnapshot ( ) ;
195+ await searchBox ( '' ) ;
196+ } ) ;
197+
198+ test ( 'TouchableOpacity should fire action upon onLongPress' , async ( ) => {
199+ await searchBox ( 'fee' ) ;
200+ const component = await app . findElementByTestID (
201+ 'touchable_feedback_events_button' ,
202+ ) ;
203+ await component . waitForDisplayed ( { timeout : 5000 } ) ;
204+ await component . click ( ) ;
205+ const dump = await dumpVisualTree ( 'touchable_feedback_events_console' ) ;
206+ expect ( dump ) . toMatchSnapshot ( ) ;
207+ await searchBox ( '' ) ;
208+ } ) ;
209+ } ) ;
0 commit comments