55 * @format
66 */
77
8- import { dumpVisualTree } from '@react-native-windows/automation-commands' ;
9- import { goToComponentExample } from './RNTesterNavigation' ;
10- import { app } from '@react-native-windows/automation' ;
11- import { verifyNoErrorLogs } from './Helpers' ;
8+ import { dumpVisualTree } from '@react-native-windows/automation-commands' ;
9+ import { goToComponentExample } from './RNTesterNavigation' ;
10+ import { app } from '@react-native-windows/automation' ;
11+ import { verifyNoErrorLogs , verifyElementVisualSnapshot } from './Helpers' ;
1212
1313beforeAll ( async ( ) => {
1414 // If window is partially offscreen, tests will fail to click on certain elements
@@ -40,14 +40,23 @@ describe('View Tests', () => {
4040 test ( 'Views can have shadows' , async ( ) => {
4141 await searchBox ( 'sha' ) ;
4242 const component = await app . findElementByTestID ( 'shadow' ) ;
43- await component . waitForDisplayed ( { timeout : 5000 } ) ;
43+ await component . waitForDisplayed ( { timeout : 5000 } ) ;
4444 const dump = await dumpVisualTree ( 'shadow' ) ;
4545 expect ( dump ) . toMatchSnapshot ( ) ;
4646 } ) ;
47+ test ( 'Visual Snapshot of Views with shadows' , async ( ) => {
48+ await searchBox ( 'box shadow' ) ;
49+ const component = await app . findElementByTestID ( 'view-test-box-shadow' ) ;
50+ await component . waitForDisplayed ( { timeout : 5000 } ) ;
51+ const dump = await dumpVisualTree ( 'view-test-box-shadow' ) ;
52+ expect ( dump ) . toMatchSnapshot ( ) ;
53+
54+ await verifyElementVisualSnapshot ( component ) ;
55+ } )
4756 test ( 'Views can have border styles' , async ( ) => {
4857 await searchBox ( 'sty' ) ;
4958 const componentsTab = await app . findElementByTestID ( 'border-style-button' ) ;
50- await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
59+ await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
5160 const dump = await dumpVisualTree ( 'border-style-button' ) ;
5261 expect ( dump ) . toMatchSnapshot ( ) ;
5362 } ) ;
@@ -56,21 +65,21 @@ describe('View Tests', () => {
5665 const componentsTab = await app . findElementByTestID (
5766 'offscreen-alpha-compositing-button' ,
5867 ) ;
59- await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
68+ await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
6069 const dump = await dumpVisualTree ( 'offscreen-alpha-compositing-button' ) ;
6170 expect ( dump ) . toMatchSnapshot ( ) ;
6271 } ) ;
6372 test ( 'Views can have a z-index' , async ( ) => {
6473 await searchBox ( 'z' ) ;
6574 const componentsTab = await app . findElementByTestID ( 'z-index-button' ) ;
66- await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
75+ await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
6776 const dump = await dumpVisualTree ( 'z-index-button' ) ;
6877 expect ( dump ) . toMatchSnapshot ( ) ;
6978 } ) ;
7079 test ( 'Views can have display: none' , async ( ) => {
7180 await searchBox ( 'dis' ) ;
7281 const componentsTab = await app . findElementByTestID ( 'display-none-button' ) ;
73- await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
82+ await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
7483 const dump = await dumpVisualTree ( 'display-none-button' ) ;
7584 expect ( dump ) . toMatchSnapshot ( ) ;
7685 } ) ;
@@ -80,14 +89,14 @@ describe('View Tests', () => {
8089 const componentsTab = await app . findElementByTestID (
8190 'view-test-background-color' ,
8291 ) ;
83- await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
92+ await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
8493 const dump = await dumpVisualTree ( 'view-test-background-color' ) ;
8594 expect ( dump ) . toMatchSnapshot ( ) ;
8695 } ) ;
8796 test ( 'Views can have borders' , async ( ) => {
8897 await searchBox ( 'bor' ) ;
8998 const componentsTab = await app . findElementByTestID ( 'view-test-border' ) ;
90- await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
99+ await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
91100 const dump = await dumpVisualTree ( 'view-test-border' ) ;
92101 expect ( dump ) . toMatchSnapshot ( ) ;
93102 } ) ;
@@ -96,7 +105,7 @@ describe('View Tests', () => {
96105 const componentsTab = await app . findElementByTestID (
97106 'view-test-padding-margin' ,
98107 ) ;
99- await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
108+ await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
100109 const dump = await dumpVisualTree ( 'view-test-padding-margin' ) ;
101110 expect ( dump ) . toMatchSnapshot ( ) ;
102111 } ) ;
@@ -105,14 +114,14 @@ describe('View Tests', () => {
105114 const componentsTab = await app . findElementByTestID (
106115 'view-test-rounded-borders' ,
107116 ) ;
108- await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
117+ await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
109118 const dump = await dumpVisualTree ( 'view-test-rounded-borders' ) ;
110119 expect ( dump ) . toMatchSnapshot ( ) ;
111120 } ) ;
112121 test ( 'Views can have overflow' , async ( ) => {
113122 await searchBox ( 'ove' ) ;
114123 const componentsTab = await app . findElementByTestID ( 'view-test-overflow' ) ;
115- await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
124+ await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
116125 const dump = await dumpVisualTree ( 'view-test-overflow' ) ;
117126 expect ( dump ) . toMatchSnapshot ( ) ;
118127 } ) ;
@@ -121,21 +130,21 @@ describe('View Tests', () => {
121130 const componentsTab = await app . findElementByTestID (
122131 'view-test-rounded-borders' ,
123132 ) ;
124- await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
133+ await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
125134 const dump = await dumpVisualTree ( 'view-test-rounded-borders' ) ;
126135 expect ( dump ) . toMatchSnapshot ( ) ;
127136 } ) ;
128137 test ( 'Views can have customized opacity' , async ( ) => {
129138 await searchBox ( 'opa' ) ;
130139 const componentsTab = await app . findElementByTestID ( 'view-test-opacity' ) ;
131- await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
140+ await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
132141 const dump = await dumpVisualTree ( 'view-test-opacity' ) ;
133142 expect ( dump ) . toMatchSnapshot ( ) ;
134143 } ) ;
135144 test ( 'Views can have tooltips' , async ( ) => {
136145 await searchBox ( 'too' ) ;
137146 const componentsTab = await app . findElementByTestID ( 'tool-tip' ) ;
138- await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
147+ await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
139148 const dump = await dumpVisualTree ( 'tool-tip' ) ;
140149 expect ( dump ) . toMatchSnapshot ( ) ;
141150 } ) ;
@@ -144,42 +153,42 @@ describe('View Tests', () => {
144153 const componentsTab = await app . findElementByTestID (
145154 'view-test-backface-visibility' ,
146155 ) ;
147- await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
156+ await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
148157 const dump = await dumpVisualTree ( 'view-test-backface-visibility' ) ;
149158 expect ( dump ) . toMatchSnapshot ( ) ;
150159 } ) ;
151160 test ( 'Views can have aria-labels' , async ( ) => {
152161 await searchBox ( 'ari' ) ;
153162 const componentsTab = await app . findElementByTestID ( 'view-test-aria-label' ) ;
154- await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
163+ await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
155164 const dump = await dumpVisualTree ( 'view-test-aria-label' ) ;
156165 expect ( dump ) . toMatchSnapshot ( ) ;
157166 } ) ;
158167 test ( 'Views can have flexgap' , async ( ) => {
159168 await searchBox ( 'fle' ) ;
160169 const componentsTab = await app . findElementByTestID ( 'view-test-flexgap' ) ;
161- await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
170+ await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
162171 const dump = await dumpVisualTree ( 'view-test-flexgap' ) ;
163172 expect ( dump ) . toMatchSnapshot ( ) ;
164173 } ) ;
165174 test ( 'Views can have insets' , async ( ) => {
166175 await searchBox ( 'ins' ) ;
167176 const componentsTab = await app . findElementByTestID ( 'view-test-insets' ) ;
168- await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
177+ await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
169178 const dump = await dumpVisualTree ( 'view-test-insets' ) ;
170179 expect ( dump ) . toMatchSnapshot ( ) ;
171180 } ) ;
172181 test ( 'Views can have customized accessibility' , async ( ) => {
173182 await searchBox ( 'acc' ) ;
174183 const componentsTab = await app . findElementByTestID ( 'accessibility' ) ;
175- await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
184+ await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
176185 const dump = await dumpVisualTree ( 'accessibility' ) ;
177186 expect ( dump ) . toMatchSnapshot ( ) ;
178187 } ) ;
179188 test ( 'Views can have a hitslop region' , async ( ) => {
180189 await searchBox ( 'hit' ) ;
181190 const componentsTab = await app . findElementByTestID ( 'hitslop' ) ;
182- await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
191+ await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
183192 const dump = await dumpVisualTree ( 'hitslop' ) ;
184193 expect ( dump ) . toMatchSnapshot ( ) ;
185194 } ) ;
@@ -188,14 +197,14 @@ describe('View Tests', () => {
188197 const componentsTab = await app . findElementByTestID (
189198 'view-test-logical-border-color' ,
190199 ) ;
191- await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
200+ await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
192201 const dump = await dumpVisualTree ( 'view-test-logical-border-color' ) ;
193202 expect ( dump ) . toMatchSnapshot ( ) ;
194203 } ) ;
195204 test ( 'Views can have a nativeid' , async ( ) => {
196205 await searchBox ( 'nat' ) ;
197206 const componentsTab = await app . findElementByTestID ( 'nativeid' ) ;
198- await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
207+ await componentsTab . waitForDisplayed ( { timeout : 5000 } ) ;
199208 const dump = await dumpVisualTree ( 'nativeid' ) ;
200209 expect ( dump ) . toMatchSnapshot ( ) ;
201210 } ) ;
0 commit comments