Browse Source

feat(TestHint): add 'onPress' property

Allows to bind a click handler to a TestHint.

When a mobile test wants to click an UI element it must be able to
locate it through the accessibility layer. Now the problem with that is
that there is currently no uniform way for finding element on both iOS
and Android. This problem is solved by TestHint component which takes
an id parameter which then can be specified in the corresponding java
TestHint class in jitsi-meet-torture to easily find it. By being able to
add a click handler to a TestHint, it's possible to duplicate original
handler under nested TestHint and then find it easily on the torture
side.
master
paweldomas 7 years ago
parent
commit
6931b8f2fb

+ 6
- 0
react/features/base/testing/components/AbstractTestHint.js View File

25
      */
25
      */
26
     id: string,
26
     id: string,
27
 
27
 
28
+    /**
29
+     * The optional "on press" handler which can be used to bind a click handler
30
+     * to a {@link TestHint}.
31
+     */
32
+    onPress: ?Function,
33
+
28
     /**
34
     /**
29
      * The test hint's (text) value which is to be consumed by the tests.
35
      * The test hint's (text) value which is to be consumed by the tests.
30
      */
36
      */

+ 3
- 1
react/features/base/testing/components/TestHint.android.js View File

37
         }
37
         }
38
 
38
 
39
         return (
39
         return (
40
-            <Text accessibilityLabel = { this.props.id } >
40
+            <Text
41
+                accessibilityLabel = { this.props.id }
42
+                onPress = { this.props.onPress } >
41
                 { this.props.value }
43
                 { this.props.value }
42
             </Text>
44
             </Text>
43
         );
45
         );

+ 1
- 0
react/features/base/testing/components/TestHint.ios.js View File

28
         return (
28
         return (
29
             <Text
29
             <Text
30
                 accessibilityLabel = { this.props.value }
30
                 accessibilityLabel = { this.props.value }
31
+                onPress = { this.props.onPress }
31
                 testID = { this.props.id } />
32
                 testID = { this.props.id } />
32
         );
33
         );
33
     }
34
     }

Loading…
Cancel
Save