@@ -62,25 +62,19 @@ void openContactPage() {
6262        @ DisplayName ("By id" )
6363        @ Test 
6464        void  locateTheFirstNameFieldByID () {
65-             page .locator ("#first_name" ).fill ("Sarah-Jane" );
66-             assertThat (page .locator ("#first_name" )).hasValue ("Sarah-Jane" );
65+             // TODO: Make it so 
6766        }
6867
6968        @ DisplayName ("By CSS class" )
7069        @ Test 
7170        void  locateTheSendButtonByCssClass () {
72-             page .locator ("#first_name" ).fill ("Sarah-Jane" );
73-             page .locator (".btnSubmit" ).click ();
74-             List <String > alertMessages  = page .locator (".alert" ).allTextContents ();
75-             Assertions .assertTrue (!alertMessages .isEmpty ());
76- 
71+             // TODO: Make it so 
7772        }
7873
7974        @ DisplayName ("By attribute" )
8075        @ Test 
8176        void  locateTheSendButtonByAttribute () {
82-             page .locator ("input[placeholder='Your last name *']" ).fill ("Smith" );
83-             assertThat (page .locator ("#last_name" )).hasValue ("Smith" );
77+             // TODO: Make it so 
8478        }
8579    }
8680
@@ -97,36 +91,28 @@ void openContactPage() {
9791        @ DisplayName ("Using :has-text" )
9892        @ Test 
9993        void  locateTheSendButtonByText () {
100-             page .locator ("#first_name" ).fill ("Sarah-Jane" );
101-             page .locator ("#last_name" ).fill ("Smith" );
102-             page .locator ("input:has-text('Send')" ).click ();
94+             // TODO: Make it so 
10395        }
10496
10597        // :text matches the smallest element containing specified text. 
10698        @ DisplayName ("Using :text" )
10799        @ Test 
108100        void  locateAProductItemByText () {
109-             page .locator (".navbar :text('Home')" ).click ();
110-             page .locator (".card :text('Bolt')" ).click ();
111-             assertThat (page .locator ("[data-test=product-name]" )).hasText ("Bolt Cutters" );
101+             // TODO: Make it so 
112102        }
113103
114104        // Exact matches 
115105        @ DisplayName ("Using :text-is" )
116106        @ Test 
117107        void  locateAProductItemByTextIs () {
118-             page .locator (".navbar :text('Home')" ).click ();
119-             page .locator (".card :text-is('Bolt Cutters')" ).click ();
120-             assertThat (page .locator ("[data-test=product-name]" )).hasText ("Bolt Cutters" );
108+             // TODO: Make it so 
121109        }
122110
123111        // matching with regular expressions 
124112        @ DisplayName ("Using :text-matches" )
125113        @ Test 
126114        void  locateAProductItemByTextMatches () {
127-             page .locator (".navbar :text('Home')" ).click ();
128-             page .locator (".card :text-matches('Bolt \\ \\ w+')" ).click ();
129-             assertThat (page .locator ("[data-test=product-name]" )).hasText ("Bolt Cutters" );
115+             // TODO: Make it so 
130116        }
131117    }
132118
@@ -141,15 +127,13 @@ void openContactPage() {
141127        @ DisplayName ("Finding visible and invisible elements" )
142128        @ Test 
143129        void  locateVisibleAndInvisibleItems () {
144-             int  dropdownItems  = page .locator (".dropdown-item" ).count ();
145-             Assertions .assertTrue (dropdownItems  > 0 );
130+             // TODO: Make it so 
146131        }
147132
148133        @ DisplayName ("Finding only visible elements" )
149134        @ Test 
150135        void  locateVisibleItems () {
151-             int  dropdownItems  = page .locator (".dropdown-item:visible" ).count ();
152-             Assertions .assertTrue (dropdownItems  == 0 );
136+             // TODO: Make it so 
153137        }
154138    }
155139
@@ -160,78 +144,25 @@ class LocatingElementsByRole {
160144        @ DisplayName ("Using the BUTTON role" )
161145        @ Test 
162146        void  byButton () {
163-             page .navigate ("https://practicesoftwaretesting.com/contact" );
164- 
165- 
166-             page .getByRole (AriaRole .BUTTON ,
167-                             new  Page .GetByRoleOptions ().setName ("Send" ))
168-                     .click ();
169- 
170-             List <String > errorMessages  = page .getByRole (AriaRole .ALERT ).allTextContents ();
171-             Assertions .assertTrue (!errorMessages .isEmpty ());
147+             // TODO: Make it so 
172148        }
173149
174150        @ DisplayName ("Using the HEADING role" )
175151        @ Test 
176152        void  byHeaderRole () {
177-             openPage ();
178- 
179-             page .locator ("#search-query" ).fill ("Pliers" );
180- 
181-             page .getByRole (AriaRole .BUTTON ,
182-                             new  Page .GetByRoleOptions ().setName ("Search" ))
183-                     .click ();
184- 
185-             Locator  searchHeading  = page .getByRole (AriaRole .HEADING ,
186-                     new  Page .GetByRoleOptions ().setName (Pattern .compile ("Searched for:.*" )));
187- 
188-             assertThat (searchHeading ).isVisible ();
189-             assertThat (searchHeading ).hasText ("Searched for: Pliers" );
153+             // TODO: Make it so 
190154        }
191155
192156        @ DisplayName ("Using the HEADING role and level" )
193157        @ Test 
194158        void  byHeaderRoleLevel () {
195-             openPage ();
196- 
197-             List <String > level4Headings 
198-                     = page .getByRole (AriaRole .HEADING ,
199-                             new  Page .GetByRoleOptions ()
200-                                     .setName ("Pliers" )
201-                                     .setLevel (5 ))
202-                     .allTextContents ();
203- 
204-             org .assertj .core .api .Assertions .assertThat (level4Headings ).isNotEmpty ();
159+             // TODO: Make it so 
205160        }
206161
207162        @ DisplayName ("Identifying checkboxes" )
208163        @ Test 
209164        void  byCheckboxes () {
210-             playwright .selectors ().setTestIdAttribute ("data-test" );
211- 
212-             openPage ();
213-             page .getByLabel ("Hammer" ).click ();
214-             page .getByLabel ("Chisels" ).click ();
215-             page .getByLabel ("Wrench" ).click ();
216- 
217-             int  selectedCount  =
218-                     page .getByTestId ("filters" ).
219-                             getByRole (AriaRole .CHECKBOX ,
220-                                     new  Locator .GetByRoleOptions ().setChecked (true ))
221-                             .count ();
222- 
223-             org .assertj .core .api .Assertions .assertThat (selectedCount ).isEqualTo (3 );
224- 
225-             List <String > selectedOptions  =
226-                     page .getByTestId ("filters" ).
227-                             getByRole (AriaRole .CHECKBOX ,
228-                                     new  Locator .GetByRoleOptions ().setChecked (true ))
229-                             .all ()
230-                             .stream ()
231-                             .map (Locator ::inputValue )
232-                             .toList ();
233- 
234-             org .assertj .core .api .Assertions .assertThat (selectedOptions ).hasSize (3 );
165+             // TODO: Make it so 
235166        }
236167    }
237168
@@ -242,28 +173,13 @@ class LocatingElementsByPlaceholdersAndLabels {
242173        @ DisplayName ("Using a label" )
243174        @ Test 
244175        void  byLabel () {
245-             page .navigate ("https://practicesoftwaretesting.com/contact" );
246- 
247-             page .getByLabel ("First name" ).fill ("Obi-Wan" );
248-             page .getByLabel ("Last name" ).fill ("Kenobi" );
249-             page .
getByLabel (
"Email address" ).
fill (
"[email protected] " );
 250-             page .getByLabel ("Subject" ).selectOption (new  SelectOption ().setLabel ("Customer service" ));
251-             page .getByLabel ("Message *" ).fill ("Hello there" );
252-             page .getByRole (AriaRole .BUTTON , new  Page .GetByRoleOptions ().setName ("Send" ));
176+             // TODO: Make it so 
253177        }
254178
255179        @ DisplayName ("Using a placeholder text" )
256180        @ Test 
257181        void  byPlaceholder () {
258-             page .navigate ("https://practicesoftwaretesting.com/contact" );
259- 
260-             page .getByPlaceholder ("Your first name" ).fill ("Obi-Wan" );
261- 
262-             page .getByPlaceholder ("Your last name" ).fill ("Kenobi" );
263-             page .
getByPlaceholder (
"Your email" ).
fill (
"[email protected] " );
 264-             page .getByLabel ("Subject" ).selectOption (new  SelectOption ().setLabel ("Customer service" ));
265-             page .getByLabel ("Message *" ).fill ("Hello there" );
266-             page .getByRole (AriaRole .BUTTON , new  Page .GetByRoleOptions ().setName ("Send" ));
182+             // TODO: Make it so 
267183        }
268184    }
269185
@@ -279,25 +195,19 @@ void openTheCatalogPage() {
279195        @ DisplayName ("Locating an element by text contents" )
280196        @ Test 
281197        void  byText () {
282-             page .getByText ("Bolt Cutters" ).click ();
283- 
284-             PlaywrightAssertions .assertThat (page .getByText ("MightyCraft Hardware" )).isVisible ();
198+             // TODO: Make it so 
285199        }
286200
287201        @ DisplayName ("Using alt text" )
288202        @ Test 
289203        void  byAltText () {
290-             page .getByAltText ("Combination Pliers" ).click ();
291- 
292-             PlaywrightAssertions .assertThat (page .getByText ("ForgeFlex Tools" )).isVisible ();
204+             // TODO: Make it so 
293205        }
294206
295207        @ DisplayName ("Using title" )
296208        @ Test 
297209        void  byTitle () {
298-             page .getByAltText ("Combination Pliers" ).click ();
299- 
300-             page .getByTitle ("Practice Software Testing - Toolshop" ).click ();
210+             // TODO: Make it so 
301211        }
302212    }
303213
@@ -313,12 +223,7 @@ static void setTestId() {
313223        @ DisplayName ("Using a custom data-test field" )
314224        @ Test 
315225        void  byTestId () {
316-             openPage ();
317- 
318-             playwright .selectors ().setTestIdAttribute ("data-test" );
319- 
320-             page .getByTestId ("search-query" ).fill ("Pliers" );
321-             page .getByTestId ("search-submit" ).click ();
226+             // TODO: Make it so 
322227        }
323228
324229    }
@@ -335,57 +240,25 @@ static void setTestId() {
335240        @ DisplayName ("Using roles" )
336241        @ Test 
337242        void  locatingAMenuItemUsingRoles () {
338-             openPage ();
339- 
340-             page .getByRole (AriaRole .MENUBAR , new  Page .GetByRoleOptions ().setName ("Main Menu" ))
341-                     .getByRole (AriaRole .MENUITEM , new  Locator .GetByRoleOptions ().setName ("Home" ))
342-                     .click ();
243+             // TODO: Make it so 
343244        }
344245
345246        @ DisplayName ("Using roles with other strategies" )
346247        @ Test 
347248        void  locatingAMenuItemUsingRolesAndOtherStrategies () {
348-             openPage ();
349- 
350-             page .getByRole (AriaRole .MENUBAR , new  Page .GetByRoleOptions ().setName ("Main Menu" ))
351-                     .getByText ("Home" )
352-                     .click ();
249+             // TODO: Make it so 
353250        }
354251
355252        @ DisplayName ("filtering locators by text" )
356253        @ Test 
357254        void  filteringMenuItems () {
358-             openPage ();
359- 
360-             page .getByRole (AriaRole .MENUBAR , new  Page .GetByRoleOptions ().setName ("Main Menu" ))
361-                     .getByText ("Categories" )
362-                     .click ();
363- 
364-             page .getByRole (AriaRole .MENUBAR , new  Page .GetByRoleOptions ().setName ("Main Menu" ))
365-                     .getByText ("Power Tools" )
366-                     .click ();
367- 
368-             page .waitForCondition (() -> page .getByTestId ("product-name" ).count () > 0 );
369- 
370-             List <String > allProducts  = page .getByTestId ("product-name" )
371-                     .filter (new  Locator .FilterOptions ().setHasText ("Sander" ))
372-                     .allTextContents ();
373- 
374-             org .assertj .core .api .Assertions .assertThat (allProducts ).allMatch (name  -> name .contains ("Sander" ));
255+             // TODO: Make it so 
375256        }
376257
377258        @ DisplayName ("filtering locators by locator" )
378259        @ Test 
379260        void  filteringMenuItemsByLocator () {
380-             openPage ();;
381- 
382-             List <String > allProducts  = page .locator (".card" )
383-                     .filter (new  Locator .FilterOptions ().setHas (page .getByText ("Out of stock" )))
384-                     .getByTestId ("product-name" )
385-                     .allTextContents ();
386- 
387-             org .assertj .core .api .Assertions .assertThat (allProducts ).hasSize (1 )
388-                     .allMatch (name  -> name .contains ("Long Nose Pliers" ));
261+             // TODO: Make it so 
389262        }
390263    }
391264
0 commit comments