Click basic button & scroll down until item 600 is visible (#46804)

Summary:
This pr is part of issue https://github.com/facebook/react-native/issues/46757 solving a task - [ME2E0008] [ME2E0009]

- Set up a test
  - Starts the app
  - Scrolls until flatlist is visilbe and clicks on flatlist
  - Click basic button
  - Scroll down until item 600 is visible

## Changelog:

[Internal] [Added] - Add e2e-test logic that click button & scroll down until specific item is visible

Pull Request resolved: https://github.com/facebook/react-native/pull/46804

Test Plan:
### Test Locally

- iOS

```bash
yarn install
cd packages/rn-tester
yarn e2e-build-ios
```

- Android

```bash
yarn install
cd packages/rn-tester
yarn e2e-build-android
```

### Start Maestro

- iOS

```bash
 cd packages/rn-tester
 yarn e2e-test-ios
```

- Android

```
cd packages/rn-tester
yarn e2e-test-android
```

### Test in CI

To test in CI, just add a comment on your PR with the text:

```
/test-e2e
```

Reviewed By: cortinico

Differential Revision: D63829274

Pulled By: cipolleschi

fbshipit-source-id: f7b4342ed353a48123f87dcfd8d503009f65637c
This commit is contained in:
HyunWoo Lee authored and Facebook GitHub Bot committed 2024-10-31 04:33:13 -07:00
1 parent 9a3958a619
commit 667ba76aef
3 files changed
+30

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
appId: ${APP_ID} # iOS: com.meta.RNTester.localDevelopment | Android: com.facebook.react.uiapp
---
- launchApp
- assertVisible: "Components"
- scrollUntilVisible:
element:
id: "Flatlist"
direction: DOWN
speed: 40
- tapOn:
id: "Flatlist"
- tapOn:
id: "Basic"
- assertVisible:
id: "item_550"
- repeat:
while:
notVisible:
id: "item_600" # should trigger a reload
commands:
- swipe:
start: 50%, 85%
end: 50%, 50%
- waitForAnimationToEnd: # wait for the reload to happen
timeout: 1000
- assertVisible:
id: "item_600"
@@ -71,6 +71,7 @@ class ItemComponent extends React.PureComponent<{
onShowUnderlay?: () => void,
onHideUnderlay?: () => void,
textSelectable?: ?boolean,
testID?: ?string,
...
}> {
_onPress = () => {
@@ -94,6 +95,7 @@ class ItemComponent extends React.PureComponent<{
]}>
{!item.noImage && <Image style={styles.thumb} source={imgSource} />}
<Text
testID={this.props.testID}
style={styles.text}
selectable={textSelectable}
numberOfLines={horizontal || fixedHeight ? 3 : undefined}>
@@ -363,6 +363,7 @@ class FlatListExample extends React.PureComponent<Props, State> {
const renderProp = ({item, separators}: RenderItemProps<Item>) => {
return (
<ItemComponent
testID={`item_${item.key}`}
item={item}
horizontal={this.state.horizontal}
fixedHeight={this.state.fixedHeight}