diff --git a/playwright/_impl/_assertions.py b/playwright/_impl/_assertions.py index fce405da7..b226e241f 100644 --- a/playwright/_impl/_assertions.py +++ b/playwright/_impl/_assertions.py @@ -874,7 +874,7 @@ def to_expected_text_values( ignoreCase: Optional[bool] = None, ) -> Sequence[ExpectedTextValue]: out: List[ExpectedTextValue] = [] - assert isinstance(items, list) + assert isinstance(items, (list, tuple)) for item in items: if isinstance(item, str): o = ExpectedTextValue( diff --git a/tests/async/test_assertions.py b/tests/async/test_assertions.py index 88b9c1b4f..dc0a1e615 100644 --- a/tests/async/test_assertions.py +++ b/tests/async/test_assertions.py @@ -274,6 +274,10 @@ async def test_assertions_locator_to_have_text(page: Page, server: Server) -> No await expect(page.locator("div")).to_have_text( ["Text 1", re.compile(r"Text \d+a")] ) + # Should work with a tuple + await expect(page.locator("div")).to_have_text( + ("Text 1", re.compile(r"Text \d+a")) + ) @pytest.mark.parametrize(