Page(s)
https://playwright.dev/java/docs/next/api/class-locatorassertions#locator-assertions-to-contain-text
Description
The example in the 'containsText' assertion documention appers to be incorrect.
Current Documentation
For the HTML:
<ul>
<li>Item Text 1</li>
<li>Item Text 2</li>
<li>Item Text 3</li>
</ul>
The documentation shows:
// Contains the right items in the right order
assertThat(page.locator("ul > li")).containsText(new String[] {"Text 1", "Text 3", "Text 4"});
Expected Behavior
The example should fail because:
- The third element in the array ("Text 4") does not exist in any of the list items
- The second list item contains "Item Text 2", not "Text 3"
Therefore, this should not be labeled as "Contains the right items in the right order"
Suggested Fix
Either correct the example or clarify the intended behavior of the array matching algorithm.