Skip to content

Commit df6eff4

Browse files
mateoguzmanafacebook-github-bot
authored andcommitted
Improve e2e times and flakiness by using the search (#51590)
Summary: I'm writing some tests for some APIs/components, and I see some opportunity for improvement in the way how we can write e2e cases for the RNTester. This diff improves two things: 1. e2e execution times: right now as we are using the `scrollUntilVisible` functionality, it takes quite some time *for some cases*, as some of the items are not very up in the lists and getting to them it's not always very fast. 2. Flakiness: I ran the tests multiple times locally, and in multiple occasions, the `scrollUntilVisible ` did not find anything as the scroll was too fast so the test ended up failing. Instead of using `scrollUntilVisible` for all cases, we can simply use the search bar which we have in both Components and APIs tabs. This runs faster and we can also share the search flow across multiple test cases, so writing the tests becomes a bit simpler as well. Initially, I did this for all cases but not all cases benefit from this change as some of them are easier to find than others – the improvement was most notable in iOS (keyboard visibility seems to make a big difference), but I still think it is a good baseline to use the search as if more test cases are added, likely, many of them are not going to be so easy to find. ## Changelog: [INTERNAL] - Improve e2e times and flakiness by using the search Pull Request resolved: #51590 Test Plan: These are the differences in the time it takes to pass the tests locally. iOS: | Before | After | |--------|-------| | <img width="336" alt="image" src="https://github.com/user-attachments/assets/6bc80de6-5a10-4c0c-b6b0-f7850d746781" /> | <img width="329" alt="image" src="https://github.com/user-attachments/assets/de47a7ff-84cf-4916-abce-9b3df96a03e1" /> | <details> <summary>Android (no significant difference):</summary> | Before | After | |--------|-------| | <img width="328" alt="image" src="https://github.com/user-attachments/assets/73023669-af8e-410c-aee2-529d1cce7acf" /> | <img width="336" alt="image" src="https://github.com/user-attachments/assets/3fb868a9-36f5-43c3-9261-6f2753e28e5f" /> | </details> Reviewed By: cortinico Differential Revision: D75389138 Pulled By: cipolleschi fbshipit-source-id: cf9d11ab0f84c91eaa20ee5c4441766729925571
1 parent f2c9d74 commit df6eff4

6 files changed

Lines changed: 38 additions & 37 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
appId: ${APP_ID} # iOS: com.meta.RNTester.localDevelopment | Android: com.facebook.react.uiapp
2+
---
3+
- launchApp
4+
- assertVisible: "Components"
5+
- runFlow: ./search.yml
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
appId: ${APP_ID} # iOS: com.meta.RNTester.localDevelopment | Android: com.facebook.react.uiapp
2+
---
3+
- assertVisible:
4+
id: "explorer_search"
5+
- tapOn:
6+
id: "explorer_search"

packages/rn-tester/.maestro/legacy-native-module.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ appId: ${APP_ID} # iOS: com.meta.RNTester.localDevelopment | Android: com.facebo
55
text: "APIs"
66
- tapOn:
77
id: "apis-tab"
8-
- scrollUntilVisible:
9-
element:
10-
id: "Legacy Native Module"
11-
direction: DOWN
12-
speed: 40
8+
- runFlow: ./helpers/search.yml
9+
- inputText:
10+
text: "Legacy Native"
11+
- assertVisible:
12+
id: "Legacy Native Module"
1313
- tapOn:
1414
id: "Legacy Native Module"
1515
- tapOn:

packages/rn-tester/.maestro/new-arch-examples.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
appId: ${APP_ID} # iOS: com.meta.RNTester.localDevelopment | Android: com.facebook.react.uiapp
22
---
3-
- launchApp
4-
- assertVisible: "Components"
5-
- scrollUntilVisible:
6-
element:
7-
id: "New Architecture Examples"
8-
direction: DOWN
9-
speed: 60
10-
visibilityPercentage: 100
3+
- runFlow: ./helpers/launch-app-and-search.yml
4+
- inputText:
5+
text: "New Architecture"
6+
- assertVisible:
7+
id: "New Architecture Examples"
118
- tapOn:
129
id: "New Architecture Examples"
1310
- assertVisible: "HSBA: h: 0, s: 0, b: 0, a: 0"

packages/rn-tester/.maestro/pressable.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
appId: ${APP_ID} # iOS: com.meta.RNTester.localDevelopment | Android: com.facebook.react.uiapp
22
---
3-
- launchApp
4-
- assertVisible: "Components"
5-
- scrollUntilVisible:
6-
element:
7-
id: "Pressable"
8-
direction: DOWN
9-
speed: 40
3+
- runFlow: ./helpers/launch-app-and-search.yml
4+
- inputText:
5+
text: "Pressable"
6+
- assertVisible:
7+
id: "Pressable"
108
- tapOn:
119
id: "Pressable"
1210
- assertVisible:

packages/rn-tester/.maestro/text.yml

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
appId: ${APP_ID} # iOS: com.meta.RNTester.localDevelopment | Android: com.facebook.react.uiapp
22
---
3-
- launchApp
4-
- assertVisible: "Components"
5-
- scrollUntilVisible:
6-
element:
7-
id: "Text"
8-
direction: DOWN
9-
speed: 60
10-
timeout: 60000 #ms
11-
visibilityPercentage: 100
3+
- runFlow: ./helpers/launch-app-and-search.yml
4+
- inputText:
5+
text: "Text"
6+
- assertVisible:
7+
id: "Text"
128
- tapOn:
139
id: "Text"
14-
- assertVisible: "Text"
15-
- scrollUntilVisible:
16-
element:
17-
id: "background-border-width"
18-
direction: DOWN
19-
speed: 20
20-
timeout: 60000 #ms
21-
visibilityPercentage: 100
10+
- assertVisible:
11+
id: "example_search"
12+
- tapOn:
13+
id: "example_search"
14+
- inputText:
15+
text: "Background Color"
16+
- hideKeyboard
2217
- assertVisible: "Text with background color only"
2318
- assertVisible: "Text with background color and uniform borderRadii"
2419
- assertVisible: "Text with background color and non-uniform borders"

0 commit comments

Comments
 (0)