Skip to content

Commit ac7a9bb

Browse files
cortinicofacebook-github-bot
authored andcommitted
Add deep-link Maestro flows for RNTester lists (#58481)
Summary: Add Maestro coverage for FlatList and SectionList viewability behavior using direct RNTester example deep links. Use explicit gestures inside the virtualized lists and wait for the callback output. Add nonvisual, route-specific readiness IDs so successive deep links cannot match the previously mounted list. Changelog: [Internal] Differential Revision: D119484760
1 parent eb40498 commit ac7a9bb

6 files changed

Lines changed: 129 additions & 2 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
appId: ${APP_ID} # iOS: com.meta.RNTester.localDevelopment | Android: com.facebook.react.uiapp
2+
---
3+
- launchApp
4+
- stopApp
5+
- openLink: rntester://example/FlatListExample/onViewableItemsChanged-horizontal-noWaitForInteraction
6+
- runFlow: ./helpers/confirm-open-link.yml
7+
- extendedWaitUntil:
8+
visible:
9+
id: 'flat-list-viewability-horizontal-no-wait'
10+
timeout: 120000
11+
- assertVisible:
12+
id: 'output'
13+
text: '.*Pizza, Burger.*'
14+
- openLink: rntester://example/FlatListExample/onViewableItemsChanged-horizontal-waitForInteraction
15+
- runFlow: ./helpers/confirm-open-link.yml
16+
- extendedWaitUntil:
17+
visible:
18+
id: 'flat-list-viewability-horizontal-wait'
19+
timeout: 30000
20+
- scrollUntilVisible:
21+
element:
22+
text: 'Cheesecake'
23+
direction: RIGHT
24+
speed: 60
25+
visibilityPercentage: 50
26+
centerElement: true
27+
timeout: 60000
28+
- extendedWaitUntil:
29+
visible:
30+
id: 'output'
31+
text: '.*Cheesecake.*'
32+
timeout: 30000
33+
- openLink: rntester://example/FlatListExample/onViewableItemsChanged-waitForInteraction
34+
- runFlow: ./helpers/confirm-open-link.yml
35+
- extendedWaitUntil:
36+
visible:
37+
id: 'flat-list-viewability-vertical-wait'
38+
timeout: 30000
39+
- scrollUntilVisible:
40+
element:
41+
text: 'Cheesecake'
42+
direction: DOWN
43+
speed: 60
44+
visibilityPercentage: 50
45+
centerElement: true
46+
timeout: 60000
47+
- extendedWaitUntil:
48+
visible:
49+
id: 'output'
50+
text: '.*Cheesecake, Brownie.*'
51+
timeout: 30000
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
appId: ${APP_ID} # iOS: com.meta.RNTester.localDevelopment | Android: com.facebook.react.uiapp
2+
---
3+
- launchApp
4+
- stopApp
5+
- openLink: rntester://example/SectionList/onEndReached
6+
- runFlow: ./helpers/confirm-open-link.yml
7+
- extendedWaitUntil:
8+
visible:
9+
id: 'start_test'
10+
timeout: 120000
11+
- tapOn:
12+
id: 'start_test'
13+
- assertVisible:
14+
id: 'output'
15+
text: 'onEndReached'
16+
- openLink: rntester://example/SectionList/onViewableItemsChanged-horizontal-noWaitForInteraction
17+
- runFlow: ./helpers/confirm-open-link.yml
18+
- extendedWaitUntil:
19+
visible:
20+
id: 'section-list-viewability-horizontal-no-wait'
21+
timeout: 30000
22+
- assertVisible:
23+
id: 'output'
24+
text: '.*Pizza.*'
25+
- openLink: rntester://example/SectionList/onViewableItemsChanged-horizontal-waitForInteraction
26+
- runFlow: ./helpers/confirm-open-link.yml
27+
- extendedWaitUntil:
28+
visible:
29+
id: 'section-list-viewability-horizontal-wait'
30+
timeout: 30000
31+
- scrollUntilVisible:
32+
element:
33+
text: 'Cheesecake'
34+
direction: RIGHT
35+
speed: 60
36+
visibilityPercentage: 50
37+
centerElement: true
38+
timeout: 60000
39+
- extendedWaitUntil:
40+
visible:
41+
id: 'output'
42+
text: '.*Cheesecake.*'
43+
timeout: 30000
44+
- runFlow:
45+
when:
46+
platform: Android
47+
commands:
48+
- openLink: rntester://example/SectionList/onViewableItemsChanged-waitForInteraction
49+
- runFlow: ./helpers/confirm-open-link.yml
50+
- extendedWaitUntil:
51+
visible:
52+
id: 'section-list-viewability-vertical-wait'
53+
timeout: 30000
54+
- scrollUntilVisible:
55+
element:
56+
text: 'Cheesecake'
57+
direction: DOWN
58+
speed: 60
59+
visibilityPercentage: 50
60+
centerElement: true
61+
timeout: 60000
62+
- extendedWaitUntil:
63+
visible:
64+
id: 'output'
65+
text: '.*Cheesecake.*'
66+
timeout: 30000

‎packages/rn-tester/js/examples/FlatList/BaseFlatListExample.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ const Item = ({item, separators}: ListRenderItemInfo<string>) => {
6161

6262
type Props = Readonly<{
6363
exampleProps: Partial<React.ElementConfig<typeof FlatList>>,
64+
exampleTestID?: ?string,
6465
onTest?: ?() => void,
6566
testLabel?: ?string,
6667
testOutput?: ?string,
@@ -72,7 +73,7 @@ const BaseFlatListExample: component(
7273
...props: Props
7374
) = ({ref, ...props}: {ref: React.RefSetter<FlatList<string>>, ...Props}) => {
7475
return (
75-
<View style={styles.container}>
76+
<View style={styles.container} testID={props.exampleTestID}>
7677
{props.testOutput != null ? (
7778
<View testID="test_container" style={styles.testContainer}>
7879
<Text style={styles.output} numberOfLines={1} testID="output">

‎packages/rn-tester/js/examples/FlatList/FlatList-BaseOnViewableItemsChanged.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ export function FlatList_BaseOnViewableItemsChanged(props: {
3232
waitForInteraction?: ?boolean,
3333
}): React.Node {
3434
const {offScreen, horizontal, useScrollRefScroll, waitForInteraction} = props;
35+
const exampleTestID = `flat-list-viewability-${
36+
horizontal === true ? 'horizontal' : 'vertical'
37+
}-${waitForInteraction === true ? 'wait' : 'no-wait'}`;
3538
const [output, setOutput] = useState('');
3639
const onViewableItemsChanged = useCallback(
3740
(info: {changed: Array<ViewToken>, viewableItems: Array<ViewToken>, ...}) =>
@@ -65,6 +68,7 @@ export function FlatList_BaseOnViewableItemsChanged(props: {
6568
<BaseFlatListExample
6669
ref={ref}
6770
exampleProps={exampleProps}
71+
exampleTestID={exampleTestID}
6872
onTest={onTest}
6973
testOutput={output}>
7074
{offScreen === true ? <View style={styles.offScreen} /> : null}

‎packages/rn-tester/js/examples/SectionList/SectionList-BaseOnViewableItemsChanged.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ export function SectionList_BaseOnViewableItemsChanged(props: {
3030
waitForInteraction?: ?boolean,
3131
}): React.Node {
3232
const {offScreen, horizontal, useScrollRefScroll, waitForInteraction} = props;
33+
const exampleTestID = `section-list-viewability-${
34+
horizontal === true ? 'horizontal' : 'vertical'
35+
}-${waitForInteraction === true ? 'wait' : 'no-wait'}`;
3336
const [output, setOutput] = useState('');
3437
const viewabilityConfig: ViewabilityConfig = {
3538
...BASE_VIEWABILITY_CONFIG,
@@ -62,6 +65,7 @@ export function SectionList_BaseOnViewableItemsChanged(props: {
6265
<SectionListBaseExample
6366
ref={ref}
6467
exampleProps={exampleProps}
68+
exampleTestID={exampleTestID}
6569
onTest={onTest}
6670
testOutput={output}>
6771
{offScreen === true ? <View style={styles.offScreen} /> : null}

‎packages/rn-tester/js/examples/SectionList/SectionListBaseExample.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ const Item = ({item, section, separators}) => {
6767
type Props = Readonly<{
6868
// $FlowFixMe[unclear-type]
6969
exampleProps: Partial<React.ElementConfig<typeof SectionList<any>>>,
70+
exampleTestID?: ?string,
7071
onTest?: ?() => void,
7172
testLabel?: ?string,
7273
testOutput?: ?string,
@@ -86,7 +87,7 @@ const SectionListBaseExample: component(
8687
...Props,
8788
}): React.Node => {
8889
return (
89-
<View style={styles.container}>
90+
<View style={styles.container} testID={props.exampleTestID}>
9091
{props.testOutput != null ? (
9192
<View testID="test_container" style={styles.testContainer}>
9293
<Text style={styles.output} numberOfLines={1} testID="output">

0 commit comments

Comments
 (0)