@@ -109,6 +109,26 @@ screen.debug(screen.getByText('test'))
109109screen .debug (screen .getAllByText (' multi-test' 
110110``` 
111111
112+ ### ` screen.logTestingPlaygroundURL `  
113+ 
114+ For debugging using [ testing-playground] ( https://testing-playground.com ) , screen
115+ exposes this convenient method which logs a URL that can be opened in a browser.
116+ 
117+ ``` javascript 
118+ import  { screen  } from  ' @testing-library/dom' 
119+ 
120+ document .body .innerHTML  =  ` 
121+  <button >test</button > 
122+  <span >multi-test</span > 
123+  <div >multi-test</div > 
124+ ` 
125+ 
126+ //  log entire document to testing-playground
127+ screen .logTestingPlaygroundURL ()
128+ //  log a single element
129+ screen .logTestingPlaygroundURL (screen .getByText (' test' 
130+ ``` 
131+ 
112132## Queries  
113133
114134>  ** Note** 
@@ -169,7 +189,6 @@ The example below will find the input node for the following DOM structures:
169189label: ' React' ' react' ' Cypress' ' cypress' } >
170190<TabItem  value = " native" 
171191
172- 
173192``` js 
174193import  { screen  } from  ' @testing-library/dom' 
175194
@@ -179,7 +198,6 @@ const inputNode = screen.getByLabelText('Username')
179198 </TabItem >
180199 <TabItem  value = " react" 
181200
182- 
183201``` jsx 
184202import  { render , screen  } from  ' @testing-library/react' 
185203
@@ -191,15 +209,13 @@ const inputNode = screen.getByLabelText('username')
191209 </TabItem >
192210 <TabItem  value = " cypress" 
193211
194- 
195212``` js 
196213cy .findByLabelText (' username' should (' exist' 
197214``` 
198215
199216 </TabItem >
200217 </Tabs >
201218
202- 
203219It will NOT find the input node for label text broken up by elements. You can
204220use ` getByRole('textbox', { name: 'Username' }) `  instead which is robust against
205221switching to ` aria-label `  or ` aria-labelledby ` .
@@ -267,7 +283,6 @@ matches the given [`TextMatch`](#textmatch).
267283label: ' React' ' react' ' Cypress' ' cypress' } >
268284<TabItem  value = " native" 
269285
270- 
271286``` js 
272287import  { screen  } from  ' @testing-library/dom' 
273288
@@ -277,7 +292,6 @@ const inputNode = screen.getByPlaceholderText('Username')
277292 </TabItem >
278293 <TabItem  value = " react" 
279294
280- 
281295``` jsx 
282296import  { render , screen  } from  ' @testing-library/react' 
283297
@@ -288,15 +302,13 @@ const inputNode = screen.getByPlaceholderText('Username')
288302 </TabItem >
289303 <TabItem  value = " cypress" 
290304
291- 
292305``` js 
293306cy .findByPlaceholderText (' Username' should (' exist' 
294307``` 
295308
296309 </TabItem >
297310 </Tabs >
298311
299- 
300312>  ** Note** 
301313> 
302314>  A placeholder is not a good substitute for a label so you should generally use
@@ -330,7 +342,6 @@ matching the given [`TextMatch`](#textmatch).
330342label: ' React' ' react' ' Cypress' ' cypress' } >
331343<TabItem  value = " native" 
332344
333- 
334345``` js 
335346import  { screen  } from  ' @testing-library/dom' 
336347
@@ -340,7 +351,6 @@ const aboutAnchorNode = screen.getByText(/about/i)
340351 </TabItem >
341352 <TabItem  value = " react" 
342353
343- 
344354``` jsx 
345355import  { render , screen  } from  ' @testing-library/react' 
346356
@@ -351,15 +361,13 @@ const aboutAnchorNode = screen.getByText(/about/i)
351361 </TabItem >
352362 <TabItem  value = " cypress" 
353363
354- 
355364``` js 
356365cy .findByText (/ about/ ishould (' exist' 
357366``` 
358367
359368 </TabItem >
360369 </Tabs >
361370
362- 
363371It also works with ` input ` s whose ` type `  attribute is either ` submit `  or
364372` button ` :
365373
@@ -412,7 +420,6 @@ as it's deprecated).
412420label: ' React' ' react' ' Cypress' ' cypress' } >
413421<TabItem  value = " native" 
414422
415- 
416423``` js 
417424import  { screen  } from  ' @testing-library/dom' 
418425
@@ -422,7 +429,6 @@ const incrediblesPosterImg = screen.getByAltText(/incredibles.*? poster/i)
422429 </TabItem >
423430 <TabItem  value = " react" 
424431
425- 
426432``` jsx 
427433import  { render , screen  } from  ' @testing-library/react' 
428434
@@ -433,15 +439,13 @@ const incrediblesPosterImg = screen.getByAltText(/incredibles.*? poster/i)
433439 </TabItem >
434440 <TabItem  value = " cypress" 
435441
436- 
437442``` js 
438443cy .findByAltText (/ incredibles. *?  poster/ ishould (' exist' 
439444``` 
440445
441446 </TabItem >
442447 </Tabs >
443448
444- 
445449### ` ByTitle `  
446450
447451>  getByTitle, queryByTitle, getAllByTitle, queryAllByTitle, findByTitle,
@@ -473,7 +477,6 @@ Will also find a `title` element within an SVG.
473477label: ' React' ' react' ' Cypress' ' cypress' } >
474478<TabItem  value = " native" 
475479
476- 
477480``` js 
478481import  { screen  } from  ' @testing-library/dom' 
479482
@@ -484,7 +487,6 @@ const closeElement = screen.getByTitle('Close')
484487 </TabItem >
485488 <TabItem  value = " react" 
486489
487- 
488490``` jsx 
489491import  { render , screen  } from  ' @testing-library/react' 
490492
@@ -496,7 +498,6 @@ const closeElement = screen.getByTitle('Close')
496498 </TabItem >
497499 <TabItem  value = " cypress" 
498500
499- 
500501``` js 
501502cy .findByTitle (' Delete' should (' exist' 
502503cy .findByTitle (' Close' should (' exist' 
@@ -505,7 +506,6 @@ cy.findByTitle('Close').should('exist')
505506 </TabItem >
506507 </Tabs >
507508
508- 
509509### ` ByDisplayValue `  
510510
511511>  getByDisplayValue, queryByDisplayValue, getAllByDisplayValue,
@@ -538,7 +538,6 @@ document.getElementById('lastName').value = 'Norris'
538538label: ' React' ' react' ' Cypress' ' cypress' } >
539539<TabItem  value = " native" 
540540
541- 
542541``` js 
543542import  { screen  } from  ' @testing-library/dom' 
544543
@@ -548,7 +547,6 @@ const lastNameInput = screen.getByDisplayValue('Norris')
548547 </TabItem >
549548 <TabItem  value = " react" 
550549
551- 
552550``` jsx 
553551import  { render , screen  } from  ' @testing-library/react' 
554552
@@ -559,15 +557,13 @@ const lastNameInput = screen.getByDisplayValue('Norris')
559557 </TabItem >
560558 <TabItem  value = " cypress" 
561559
562- 
563560``` js 
564561cy .findByDisplayValue (' Norris' should (' exist' 
565562``` 
566563
567564 </TabItem >
568565 </Tabs >
569566
570- 
571567#### ` textarea `  
572568
573569``` html 
@@ -582,7 +578,6 @@ document.getElementById('messageTextArea').value = 'Hello World'
582578label: ' React' ' react' ' Cypress' ' cypress' } >
583579<TabItem  value = " native" 
584580
585- 
586581``` js 
587582import  { screen  } from  ' @testing-library/dom' 
588583
@@ -592,7 +587,6 @@ const messageTextArea = screen.getByDisplayValue('Hello World')
592587 </TabItem >
593588 <TabItem  value = " react" 
594589
595- 
596590``` jsx 
597591import  { render , screen  } from  ' @testing-library/react' 
598592
@@ -603,15 +597,13 @@ const messageTextArea = screen.getByDisplayValue('Hello World')
603597 </TabItem >
604598 <TabItem  value = " cypress" 
605599
606- 
607600``` js 
608601cy .findByDisplayValue (' Hello World' should (' exist' 
609602``` 
610603
611604 </TabItem >
612605 </Tabs >
613606
614- 
615607#### ` select `  
616608
617609In case of ` select ` , this will search for a ` <select> `  whose selected ` <option> ` 
@@ -630,7 +622,6 @@ matches the given [`TextMatch`](#textmatch).
630622label: ' React' ' react' ' Cypress' ' cypress' } >
631623<TabItem  value = " native" 
632624
633- 
634625``` js 
635626import  { screen  } from  ' @testing-library/dom' 
636627
@@ -640,7 +631,6 @@ const selectElement = screen.getByDisplayValue('Alaska')
640631 </TabItem >
641632 <TabItem  value = " react" 
642633
643- 
644634``` jsx 
645635import  { render , screen  } from  ' @testing-library/react' 
646636
@@ -651,15 +641,13 @@ const selectElement = screen.getByDisplayValue('Alaska')
651641 </TabItem >
652642 <TabItem  value = " cypress" 
653643
654- 
655644``` js 
656645cy .findByDisplayValue (' Alaska' should (' exist' 
657646``` 
658647
659648 </TabItem >
660649 </Tabs >
661650
662- 
663651### ` ByRole `  
664652
665653>  getByRole, queryByRole, getAllByRole, queryAllByRole, findByRole,
@@ -850,7 +838,6 @@ and which elements can have this state see
850838label: ' React' ' react' ' Cypress' ' cypress' } >
851839<TabItem  value = " native" 
852840
853- 
854841``` js 
855842import  { screen  } from  ' @testing-library/dom' 
856843
@@ -860,7 +847,6 @@ const dialogContainer = screen.getByRole('dialog')
860847 </TabItem >
861848 <TabItem  value = " react" 
862849
863- 
864850``` jsx 
865851import  { render , screen  } from  ' @testing-library/react' 
866852
@@ -871,15 +857,13 @@ const dialogContainer = screen.getByRole('dialog')
871857 </TabItem >
872858 <TabItem  value = " cypress" 
873859
874- 
875860``` js 
876861cy .findByRole (' dialog' should (' exist' 
877862``` 
878863
879864 </TabItem >
880865 </Tabs >
881866
882- 
883867#### ` queryFallbacks `  
884868
885869By default, it's assumed that the first role of each element is supported, so
@@ -971,7 +955,6 @@ also accepts a [`TextMatch`](#textmatch)).
971955label: ' React' ' react' ' Cypress' ' cypress' } >
972956<TabItem  value = " native" 
973957
974- 
975958``` js 
976959import  { screen  } from  ' @testing-library/dom' 
977960
@@ -981,7 +964,6 @@ const element = screen.getByTestId('custom-element')
981964 </TabItem >
982965 <TabItem  value = " react" 
983966
984- 
985967``` jsx 
986968import  { render , screen  } from  ' @testing-library/react' 
987969
@@ -992,15 +974,13 @@ const element = screen.getByTestId('custom-element')
992974 </TabItem >
993975 <TabItem  value = " cypress" 
994976
995- 
996977``` js 
997978cy .findByTestId (' custom-element' should (' exist' 
998979``` 
999980
1000981 </TabItem >
1001982 </Tabs >
1002983
1003- 
1004984>  In the spirit of [ the guiding principles] ( guiding-principles.mdx ) , it is
1005985>  recommended to use this only after the other queries don't work for your use
1006986>  case. Using data-testid attributes do not resemble how your software is used
0 commit comments