Skip to content

Commit fee0181

Browse files
cortinicofacebook-github-bot
authored andcommitted
Add deep-link Maestro flows for RNTester lists
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 af69868 commit fee0181

6 files changed

Lines changed: 122 additions & 2 deletions

File tree

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

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)