Skip to content

Commit 391432a

Browse files
cortinicometa-codesync[bot]
authored andcommitted
Add Switch visual regression tests (#59346)
Summary: Pull Request resolved: #59346 Add a Maestro visual suite for `Switch` using existing RNTester examples. Capture stable cropped checkpoints after opening each example and settling animations. See `packages/rn-tester/visual-tests/suites/switch.md` for the example and checkpoint inventory. Changelog: [Internal] Reviewed By: Abbondanzo Differential Revision: D126723206 fbshipit-source-id: 949167abee74f74f983a1531879def6ebc867eaf
1 parent b21269a commit 391432a

2 files changed

Lines changed: 97 additions & 0 deletions

File tree

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
appId: ${APP_ID}
2+
---
3+
- runFlow:
4+
file: ../helpers/open-example.yml
5+
env:
6+
EXAMPLE_URL: rntester://example/SwitchExample/basic
7+
- extendedWaitUntil:
8+
visible:
9+
id: 'on-off-initial-off'
10+
timeout: 15000
11+
- extendedWaitUntil:
12+
visible:
13+
id: 'on-off-initial-on'
14+
timeout: 15000
15+
- waitForAnimationToEnd:
16+
timeout: 5000
17+
- takeScreenshot:
18+
path: ${VISUAL_OUTPUT_DIR}/switch/basic/default
19+
cropOn:
20+
id: 'example-container'
21+
- tapOn:
22+
id: 'on-off-initial-off'
23+
- tapOn:
24+
id: 'on-off-initial-on'
25+
- assertVisible:
26+
id: 'on-off-initial-off-indicator'
27+
text: 'On'
28+
- assertVisible:
29+
id: 'on-off-initial-on-indicator'
30+
text: 'Off'
31+
- waitForAnimationToEnd:
32+
timeout: 5000
33+
- takeScreenshot:
34+
path: ${VISUAL_OUTPUT_DIR}/switch/basic/toggled
35+
cropOn:
36+
id: 'example-container'
37+
- runFlow:
38+
file: ../helpers/open-example.yml
39+
env:
40+
EXAMPLE_URL: rntester://example/SwitchExample/disabled
41+
- extendedWaitUntil:
42+
visible:
43+
id: 'example-container'
44+
timeout: 15000
45+
- assertVisible:
46+
id: 'disabled-initial-off'
47+
- assertVisible:
48+
id: 'disabled-initial-on'
49+
- assertVisible:
50+
id: 'disabled-initial-off-indicator'
51+
text: 'Off'
52+
- assertVisible:
53+
id: 'disabled-initial-on-indicator'
54+
text: 'On'
55+
- waitForAnimationToEnd:
56+
timeout: 5000
57+
- takeScreenshot:
58+
path: ${VISUAL_OUTPUT_DIR}/switch/disabled/default
59+
cropOn:
60+
id: 'example-container'
61+
- runFlow:
62+
file: ../helpers/open-example.yml
63+
env:
64+
EXAMPLE_URL: rntester://example/SwitchExample/custom-colors
65+
- extendedWaitUntil:
66+
visible:
67+
id: 'initial-false-switch'
68+
timeout: 15000
69+
- extendedWaitUntil:
70+
visible:
71+
id: 'initial-true-switch'
72+
timeout: 15000
73+
- waitForAnimationToEnd:
74+
timeout: 5000
75+
- takeScreenshot:
76+
path: ${VISUAL_OUTPUT_DIR}/switch/custom-colors/default
77+
cropOn:
78+
id: 'example-container'
79+
- tapOn:
80+
id: 'initial-false-switch'
81+
- tapOn:
82+
id: 'initial-true-switch'
83+
- waitForAnimationToEnd:
84+
timeout: 5000
85+
- takeScreenshot:
86+
path: ${VISUAL_OUTPUT_DIR}/switch/custom-colors/toggled
87+
cropOn:
88+
id: 'example-container'
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Switch visual tests
2+
3+
| Example | Checkpoints |
4+
| --- | --- |
5+
| `basic` | Initial values and both switches toggled |
6+
| `disabled` | Initial rendering |
7+
| `custom-colors` | Initial values and both switches toggled |
8+
9+
Screenshots use the existing RNTester example crops. Each example starts from a fresh app launch; captures wait for the target and for animations to settle.

0 commit comments

Comments
 (0)