Skip to content

Commit 56be22f

Browse files
Abbondanzometa-codesync[bot]
authored andcommitted
Add Android image smoke-test examples and Maestro flows to RNTester (#57306)
Summary: Pull Request resolved: #57306 Adds five Image examples to RNTester plus matching Maestro end-to-end flows, covering image-loading behaviors that previously had little or no RNTester coverage: - Progressive JPEG (`progressiveRenderingEnabled`) - `blurRadius` combined with `Image.prefetch` (blur postprocessor over a prefetched bitmap) - WebP (lossy/lossless/alpha) and AVIF format decoding - Image caching across a reload of the same URI (via `Image.queryCache`) - Wide-gamut (Display-P3) vs sRGB and alpha transparency Each example renders status text (load/error, cache status) with stable testIDs so the Maestro flows can assert behavior; the visual cases also capture screenshots. Examples that exercise Android-specific decoding (progressive JPEG, WebP/AVIF) are gated to Android; the rest run on both platforms. Format examples that lack a bundled asset (lossless/alpha WebP, AVIF, Display-P3) currently reference external sample URLs as a stopgap and render an onLoad/onError status so they degrade gracefully; these should be replaced with committed assets in a follow-up. Changelog: [Internal] Differential Revision: D109316705
1 parent dc4d5e8 commit 56be22f

11 files changed

Lines changed: 532 additions & 1 deletion
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
appId: ${APP_ID} # iOS: com.meta.RNTester.localDevelopment | Android: com.facebook.react.uiapp
2+
---
3+
# Prefetch an image, then render the same URI with blurRadius so the blur
4+
# postprocessor applies to the already-decoded bitmap. Cross-platform.
5+
- runFlow: ./helpers/launch-app-and-search.yml
6+
- inputText:
7+
text: 'Image'
8+
- assertVisible:
9+
id: 'Image'
10+
- tapOn:
11+
id: 'Image'
12+
- assertVisible:
13+
id: 'example_search'
14+
- tapOn:
15+
id: 'example_search'
16+
- inputText: 'Blur Radius with Prefetch'
17+
- hideKeyboard
18+
- scrollUntilVisible:
19+
element:
20+
id: 'image-blur-prefetch'
21+
direction: DOWN
22+
speed: 40
23+
timeout: 10000
24+
- extendedWaitUntil:
25+
visible: 'prefetch: ok'
26+
timeout: 20000
27+
- extendedWaitUntil:
28+
visible: 'blurred image: loaded'
29+
timeout: 20000
30+
# Change this to takeScreenshot when you want to update the screenshot
31+
- assertScreenshot:
32+
path: screenshots/image-blur-prefetch-${maestro.platform}
33+
cropOn:
34+
id: 'image-blur-prefetch'
35+
thresholdPercentage: 95
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
appId: ${APP_ID} # iOS: com.meta.RNTester.localDevelopment | Android: com.facebook.react.uiapp
2+
---
3+
# Load a URI twice; queryCache must report it cached after the first load,
4+
# confirming image caching works. Cross-platform: the URI is a CDN-cacheable
5+
# image so iOS's NSURLCache-backed queryCache also reports a hit. The regex
6+
# covers Android (memory|disk) and iOS (which can additionally return disk/memory).
7+
- runFlow: ./helpers/launch-app-and-search.yml
8+
- inputText:
9+
text: 'Image'
10+
- assertVisible:
11+
id: 'Image'
12+
- tapOn:
13+
id: 'Image'
14+
- assertVisible:
15+
id: 'example_search'
16+
- tapOn:
17+
id: 'example_search'
18+
- inputText: 'Image Cache'
19+
- hideKeyboard
20+
- scrollUntilVisible:
21+
element:
22+
id: 'image-cache'
23+
direction: DOWN
24+
speed: 40
25+
timeout: 10000
26+
- extendedWaitUntil:
27+
visible: 'first load: loaded'
28+
timeout: 20000
29+
- extendedWaitUntil:
30+
visible: 'queryCache: (disk/memory|disk|memory)'
31+
timeout: 15000
32+
- extendedWaitUntil:
33+
visible: 'second load: loaded'
34+
timeout: 20000
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
appId: ${APP_ID} # iOS: com.meta.RNTester.localDevelopment | Android: com.facebook.react.uiapp
2+
tags:
3+
- android-only
4+
---
5+
# Android-only: Fresco decode coverage for WebP (lossy/lossless/alpha) and AVIF.
6+
# These assets come from external sample URLs, so each format is asserted as
7+
# reaching a terminal state (loaded|error) rather than strictly loaded, to avoid
8+
# CI flakiness. Switch to 'loaded' once committed assets replace the URLs.
9+
- runFlow:
10+
when:
11+
platform: Android
12+
commands:
13+
- runFlow: ./helpers/launch-app-and-search.yml
14+
- inputText:
15+
text: 'Image'
16+
- assertVisible:
17+
id: 'Image'
18+
- tapOn:
19+
id: 'Image'
20+
- assertVisible:
21+
id: 'example_search'
22+
- tapOn:
23+
id: 'example_search'
24+
- inputText: 'WebP and AVIF'
25+
- hideKeyboard
26+
- scrollUntilVisible:
27+
element:
28+
id: 'image-webp-avif'
29+
direction: DOWN
30+
speed: 40
31+
timeout: 10000
32+
- scrollUntilVisible:
33+
element: 'WebP lossy: (loaded|error)'
34+
direction: DOWN
35+
speed: 40
36+
timeout: 20000
37+
- scrollUntilVisible:
38+
element: 'WebP lossless: (loaded|error)'
39+
direction: DOWN
40+
speed: 40
41+
timeout: 20000
42+
- scrollUntilVisible:
43+
element: 'WebP alpha: (loaded|error)'
44+
direction: DOWN
45+
speed: 40
46+
timeout: 20000
47+
- scrollUntilVisible:
48+
element: 'AVIF: (loaded|error)'
49+
direction: DOWN
50+
speed: 40
51+
timeout: 20000
52+
# Change this to takeScreenshot when you want to update the screenshot
53+
- assertScreenshot:
54+
path: screenshots/image-formats-${maestro.platform}
55+
cropOn:
56+
id: 'image-webp-avif'
57+
thresholdPercentage: 95
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
appId: ${APP_ID} # iOS: com.meta.RNTester.localDevelopment | Android: com.facebook.react.uiapp
2+
tags:
3+
- android-only
4+
---
5+
# Android-only: loads a JPEG with progressiveRenderingEnabled and logs load
6+
# events. iOS skips this flow (empty=pass).
7+
- runFlow:
8+
when:
9+
platform: Android
10+
commands:
11+
- runFlow: ./helpers/launch-app-and-search.yml
12+
- inputText:
13+
text: 'Image'
14+
- assertVisible:
15+
id: 'Image'
16+
- tapOn:
17+
id: 'Image'
18+
- assertVisible:
19+
id: 'example_search'
20+
- tapOn:
21+
id: 'example_search'
22+
- inputText: 'Progressive JPEG'
23+
- hideKeyboard
24+
- scrollUntilVisible:
25+
element:
26+
id: 'image-progressive-jpeg'
27+
direction: DOWN
28+
speed: 40
29+
timeout: 10000
30+
# loadStart fires on mount -> proves the progressive load path engaged.
31+
# Assert by id since each event is its own element (progress % is dynamic).
32+
- extendedWaitUntil:
33+
visible:
34+
id: 'progressive-jpeg-loadstart'
35+
timeout: 15000
36+
# Final load event (network image; relies on the same host as image.yml).
37+
- extendedWaitUntil:
38+
visible:
39+
id: 'progressive-jpeg-load'
40+
timeout: 20000
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
appId: ${APP_ID} # iOS: com.meta.RNTester.localDevelopment | Android: com.facebook.react.uiapp
2+
---
3+
# Alpha transparency + sRGB vs Display-P3 wide-gamut. Color fidelity needs a
4+
# screenshot, so we assert load status only. Cross-platform.
5+
- runFlow: ./helpers/launch-app-and-search.yml
6+
- inputText:
7+
text: 'Image'
8+
- assertVisible:
9+
id: 'Image'
10+
- tapOn:
11+
id: 'Image'
12+
- assertVisible:
13+
id: 'example_search'
14+
- tapOn:
15+
id: 'example_search'
16+
- inputText: 'Wide Gamut'
17+
- hideKeyboard
18+
- scrollUntilVisible:
19+
element:
20+
id: 'image-wide-gamut'
21+
direction: DOWN
22+
speed: 40
23+
timeout: 10000
24+
- extendedWaitUntil:
25+
visible: 'alpha: loaded'
26+
timeout: 15000
27+
- scrollUntilVisible:
28+
element: 'sRGB: loaded'
29+
direction: DOWN
30+
speed: 40
31+
timeout: 20000
32+
# External URL; accept loaded or error.
33+
- scrollUntilVisible:
34+
element: 'P3: (loaded|error)'
35+
direction: DOWN
36+
speed: 40
37+
timeout: 20000
38+
# Change this to takeScreenshot when you want to update the screenshot
39+
- assertScreenshot:
40+
path: screenshots/image-wide-gamut-${maestro.platform}
41+
cropOn:
42+
id: 'image-wide-gamut'
43+
thresholdPercentage: 95
44.1 KB
Loading
44.7 KB
Loading
168 KB
Loading
87.6 KB
Loading
118 KB
Loading

0 commit comments

Comments
 (0)