Skip to content

Commit 48b6f2d

Browse files
NickGerlemanmeta-codesync[bot]
authored andcommitted
Add E2E tests for Image visual examples (facebook#55964)
Summary: Pull Request resolved: facebook#55964 Add screenshot E2E tests for 7 Image examples that previously lacked E2E coverage: static-image, tint-color, opacity, nesting-content, nesting-image-background, blur-radius, and base64-image. - Added `name` and `testID` to each example in ImageExample.js - 6 tests are cross-platform (excludedPlatforms: ['mac']) - 1 test is iOS-only (base64-image) - animated-gif test was removed due to persistent infra failure preventing screenshot capture; name and testID were still added to the source Reviewed By: cortinico Differential Revision: D95371702 fbshipit-source-id: c839e26425914f9b18722f313d19c20b50d7fe84
1 parent d5a271d commit 48b6f2d

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

packages/rn-tester/js/examples/Image/ImageExample.js

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -959,12 +959,13 @@ exports.examples = [
959959
},
960960
{
961961
title: 'Plain Static Image',
962+
name: 'static-image',
962963
description:
963964
('Static assets should be placed in the source code tree, and ' +
964965
'required in the same way as JavaScript modules.': string),
965966
render: function (): React.Node {
966967
return (
967-
<View style={styles.horizontal}>
968+
<View testID="image-static" style={styles.horizontal}>
968969
<Image
969970
source={require('../../assets/uie_thumb_normal.png')}
970971
style={styles.icon}
@@ -1173,9 +1174,10 @@ exports.examples = [
11731174
},
11741175
{
11751176
title: 'Opacity',
1177+
name: 'opacity',
11761178
render: function (): React.Node {
11771179
return (
1178-
<View style={styles.horizontal}>
1180+
<View testID="image-opacity" style={styles.horizontal}>
11791181
<Image style={[styles.base, styles.opacity1]} source={fullImage} />
11801182
<Image style={[styles.base, styles.opacity2]} source={fullImage} />
11811183
<Image style={[styles.base, styles.opacity3]} source={fullImage} />
@@ -1188,9 +1190,10 @@ exports.examples = [
11881190
},
11891191
{
11901192
title: 'Nesting content inside <Image> component',
1193+
name: 'nesting-content',
11911194
render: function (): React.Node {
11921195
return (
1193-
<View style={styles.base}>
1196+
<View testID="image-nesting-content" style={styles.base}>
11941197
<Image style={{...StyleSheet.absoluteFill}} source={fullImage} />
11951198
<Text style={styles.nestedText}>React</Text>
11961199
</View>
@@ -1199,9 +1202,11 @@ exports.examples = [
11991202
},
12001203
{
12011204
title: 'Nesting content inside <ImageBackground> component',
1205+
name: 'nesting-image-background',
12021206
render: function (): React.Node {
12031207
return (
12041208
<ImageBackground
1209+
testID="image-nesting-background"
12051210
style={styles.transparentImageBackground}
12061211
source={fullImage}>
12071212
<Text style={styles.nestedText}>React</Text>
@@ -1211,11 +1216,12 @@ exports.examples = [
12111216
},
12121217
{
12131218
title: 'Tint Color',
1219+
name: 'tint-color',
12141220
description: ('The `tintColor` prop changes all the non-alpha ' +
12151221
'pixels to the tint color.': string),
12161222
render: function (): React.Node {
12171223
return (
1218-
<View>
1224+
<View testID="image-tint-color">
12191225
<View style={styles.horizontal}>
12201226
<Image
12211227
source={require('../../assets/uie_thumb_normal.png')}
@@ -1514,9 +1520,11 @@ exports.examples = [
15141520
},
15151521
{
15161522
title: 'Animated GIF',
1523+
name: 'animated-gif',
15171524
render: function (): React.Node {
15181525
return (
15191526
<Image
1527+
testID="image-animated-gif"
15201528
style={styles.gif}
15211529
source={require('../../assets/tumblr_mfqekpMktw1rn90umo1_500.gif')}
15221530
/>
@@ -1526,9 +1534,14 @@ exports.examples = [
15261534
},
15271535
{
15281536
title: 'Base64 image',
1537+
name: 'base64-image',
15291538
render: function (): React.Node {
15301539
return (
1531-
<Image style={styles.base64} source={{uri: base64Icon, scale: 3}} />
1540+
<Image
1541+
testID="image-base64"
1542+
style={styles.base64}
1543+
source={{uri: base64Icon, scale: 3}}
1544+
/>
15321545
);
15331546
},
15341547
platform: 'ios',
@@ -1599,9 +1612,10 @@ exports.examples = [
15991612
},
16001613
{
16011614
title: 'Blur Radius',
1615+
name: 'blur-radius',
16021616
render: function (): React.Node {
16031617
return (
1604-
<View style={styles.horizontal}>
1618+
<View testID="image-blur-radius" style={styles.horizontal}>
16051619
<Image style={styles.base} source={fullImage} blurRadius={0} />
16061620
<Image style={styles.base} source={fullImage} blurRadius={5} />
16071621
<Image style={styles.base} source={fullImage} blurRadius={10} />

0 commit comments

Comments
 (0)