File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
src/test/java/com/serenitydojo/playwright Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 1212import org .junit .jupiter .api .parallel .ExecutionMode ;
1313
1414import java .util .Arrays ;
15+ import java .util .Comparator ;
1516import java .util .List ;
1617import java .util .regex .Pattern ;
1718
@@ -125,5 +126,27 @@ void allProductPricesShouldBeCorrectValues() {
125126 .isGreaterThan (0.0 )
126127 .isLessThan (1000.0 ));
127128 }
129+
130+
131+ @ Test
132+ void shouldSortInAlphabeticalOrder () {
133+ page .getByLabel ("Sort" ).selectOption ("Name (A - Z)" );
134+ page .waitForLoadState (LoadState .NETWORKIDLE );
135+
136+ List <String > productNames = page .getByTestId ("product-name" ).allTextContents ();
137+
138+ Assertions .assertThat (productNames ).isSortedAccordingTo (String .CASE_INSENSITIVE_ORDER );
139+ }
140+
141+ @ Test
142+ void shouldSortInReverseAlphabeticalOrder () {
143+ page .getByLabel ("Sort" ).selectOption ("Name (Z - A)" );
144+ page .waitForLoadState (LoadState .NETWORKIDLE );
145+
146+ List <String > productNames = page .getByTestId ("product-name" ).allTextContents ();
147+
148+ Assertions .assertThat (productNames ).isSortedAccordingTo (Comparator .reverseOrder ());
149+ }
150+
128151 }
129152}
You can’t perform that action at this time.
0 commit comments