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.
This commit is contained in:
parent
adec8e6438
commit
6931b8f2fb
|
@ -25,6 +25,12 @@ export type TestHintProps = {
|
|||
*/
|
||||
id: string,
|
||||
|
||||
/**
|
||||
* The optional "on press" handler which can be used to bind a click handler
|
||||
* to a {@link TestHint}.
|
||||
*/
|
||||
onPress: ?Function,
|
||||
|
||||
/**
|
||||
* The test hint's (text) value which is to be consumed by the tests.
|
||||
*/
|
||||
|
|
|
@ -37,7 +37,9 @@ class TestHint extends Component<TestHintProps> {
|
|||
}
|
||||
|
||||
return (
|
||||
<Text accessibilityLabel = { this.props.id } >
|
||||
<Text
|
||||
accessibilityLabel = { this.props.id }
|
||||
onPress = { this.props.onPress } >
|
||||
{ this.props.value }
|
||||
</Text>
|
||||
);
|
||||
|
|
|
@ -28,6 +28,7 @@ class TestHint extends Component<TestHintProps> {
|
|||
return (
|
||||
<Text
|
||||
accessibilityLabel = { this.props.value }
|
||||
onPress = { this.props.onPress }
|
||||
testID = { this.props.id } />
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue