浏览代码

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 年前
父节点
当前提交
6931b8f2fb

+ 6
- 0
react/features/base/testing/components/AbstractTestHint.js 查看文件

@@ -25,6 +25,12 @@ export type TestHintProps = {
25 25
      */
26 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 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 查看文件

@@ -37,7 +37,9 @@ class TestHint extends Component<TestHintProps> {
37 37
         }
38 38
 
39 39
         return (
40
-            <Text accessibilityLabel = { this.props.id } >
40
+            <Text
41
+                accessibilityLabel = { this.props.id }
42
+                onPress = { this.props.onPress } >
41 43
                 { this.props.value }
42 44
             </Text>
43 45
         );

+ 1
- 0
react/features/base/testing/components/TestHint.ios.js 查看文件

@@ -28,6 +28,7 @@ class TestHint extends Component<TestHintProps> {
28 28
         return (
29 29
             <Text
30 30
                 accessibilityLabel = { this.props.value }
31
+                onPress = { this.props.onPress }
31 32
                 testID = { this.props.id } />
32 33
         );
33 34
     }

正在加载...
取消
保存