@@ -175,112 +175,6 @@ describe('driver/src/cy/snapshots', () => {
175
175
expect ( body . get ( ) . find ( 'iframe' ) . css ( 'height' ) ) . to . equal ( '70px' )
176
176
} )
177
177
} )
178
-
179
- context ( 'protocol' , ( ) => {
180
- beforeEach ( ( ) => {
181
- // set to 0 to ensure protocol snapshots are taken
182
- // since the driver support file sets the value to 1
183
- Cypress . config ( 'numTestsKeptInMemory' , 0 )
184
- } )
185
-
186
- it ( 'captures a protocol snapshot with highlight elements' , {
187
- protocolEnabled : true ,
188
- } , function ( ) {
189
- cy . window ( ) . then ( ( win ) => {
190
- win . __cypressProtocolMetadata = { frameId : 'test-frame-id' }
191
-
192
- const { elementsToHighlight, name, timestamp } = cy . createSnapshot ( 'snapshot' , cy . $$ ( 'a' ) )
193
-
194
- expect ( elementsToHighlight ?. length ) . to . equal ( 3 )
195
- expect ( elementsToHighlight ?. [ 0 ] . selector ) . to . equal ( 'a:nth-child(2)' )
196
- expect ( elementsToHighlight ?. [ 0 ] . frameId ) . to . equal ( 'test-frame-id' )
197
- expect ( elementsToHighlight ?. [ 1 ] . selector ) . to . equal ( '#hashchange' )
198
- expect ( elementsToHighlight ?. [ 1 ] . frameId ) . to . equal ( 'test-frame-id' )
199
- expect ( elementsToHighlight ?. [ 2 ] . selector ) . to . equal ( '#dimensions' )
200
- expect ( elementsToHighlight ?. [ 2 ] . frameId ) . to . equal ( 'test-frame-id' )
201
- expect ( name ) . to . equal ( 'snapshot' )
202
- expect ( timestamp ) . to . be . a ( 'number' )
203
- } )
204
- } )
205
-
206
- it ( 'captures a protocol snapshot with an embedded iframe highlight element' , {
207
- protocolEnabled : true ,
208
- } , function ( ) {
209
- const iframe = $ ( '<iframe src=\'iframe-inner.html\' />' )
210
-
211
- iframe . on ( 'load' , ( ) => {
212
- const ownerDoc = iframe [ 0 ] . contentDocument
213
- const elWindow = iframe [ 0 ] . contentWindow
214
- const element = $ ( ownerDoc . querySelector ( 'button' ) )
215
-
216
- elWindow . __cypressProtocolMetadata = { frameId : 'test-frame-id' }
217
-
218
- const { elementsToHighlight, name, timestamp } = cy . createSnapshot ( 'snapshot' , element )
219
-
220
- expect ( elementsToHighlight ?. length ) . to . equal ( 1 )
221
- expect ( elementsToHighlight ?. [ 0 ] . selector ) . to . equal ( 'button:nth-child(1)' )
222
- expect ( elementsToHighlight ?. [ 0 ] . frameId ) . to . equal ( 'test-frame-id' )
223
- expect ( name ) . to . equal ( 'snapshot' )
224
- expect ( timestamp ) . to . be . a ( 'number' )
225
- } )
226
-
227
- iframe . appendTo ( cy . $$ ( 'body' ) )
228
- } )
229
-
230
- it ( 'captures a protocol snapshot with a body highlight element' , {
231
- protocolEnabled : true ,
232
- } , function ( ) {
233
- cy . window ( ) . then ( ( win ) => {
234
- win . __cypressProtocolMetadata = { frameId : 'test-frame-id' }
235
-
236
- const { elementsToHighlight, name, timestamp } = cy . createSnapshot ( 'snapshot' , cy . $$ ( 'body' ) )
237
-
238
- expect ( elementsToHighlight ?. length ) . to . equal ( 1 )
239
- expect ( elementsToHighlight ?. [ 0 ] . selector ) . to . equal ( 'body:nth-child(2)' )
240
- expect ( elementsToHighlight ?. [ 0 ] . frameId ) . to . equal ( 'test-frame-id' )
241
- expect ( name ) . to . equal ( 'snapshot' )
242
- expect ( timestamp ) . to . be . a ( 'number' )
243
- } )
244
- } )
245
-
246
- it ( 'captures a protocol snapshot and excludes a null element' , {
247
- protocolEnabled : true ,
248
- } , function ( ) {
249
- // create an element but don't append it to the DOM
250
- const element = $ ( '<div id=\'foo\' />' )
251
-
252
- const { elementsToHighlight, name, timestamp } = cy . createSnapshot ( 'snapshot' , element )
253
-
254
- expect ( elementsToHighlight ?. length ) . to . equal ( 0 )
255
- expect ( name ) . to . equal ( 'snapshot' )
256
- expect ( timestamp ) . to . be . a ( 'number' )
257
- } )
258
-
259
- it ( 'captures shadow DOM selectors structure properly' , {
260
- protocolEnabled : true ,
261
- } , ( ) => {
262
- cy . visit ( '/fixtures/shadow-dom-type.html' )
263
- cy . window ( ) . then ( ( win ) => {
264
- win . __cypressProtocolMetadata = { frameId : 'test-frame-id' }
265
-
266
- cy . get ( '#shadow-dom-input' , {
267
- includeShadowDom : true ,
268
- } ) . then ( ( shadowDomSlot ) => {
269
- const { elementsToHighlight, name, timestamp } = cy . createSnapshot ( 'snapshot' , shadowDomSlot )
270
-
271
- expect ( elementsToHighlight ?. length ) . to . equal ( 1 )
272
- const elementToHighlight = elementsToHighlight [ 0 ]
273
-
274
- expect ( elementToHighlight . selector . length ) . to . equal ( 2 )
275
- expect ( elementToHighlight . selector [ 0 ] ) . to . equal ( '#element' )
276
- expect ( elementToHighlight . selector [ 1 ] ) . to . equal ( '#shadow-dom-input' )
277
- expect ( elementToHighlight . frameId ) . to . equal ( 'test-frame-id' )
278
- expect ( name ) . to . equal ( 'snapshot' )
279
- expect ( timestamp ) . to . be . a ( 'number' )
280
- } )
281
- } )
282
- } )
283
- } )
284
178
} )
285
179
286
180
context ( 'custom elements' , ( ) => {
0 commit comments