Skip to content

Conversation

mxschmitt
Copy link
Member

@mxschmitt mxschmitt commented Mar 4, 2022

This fixes the following failure:

================================== FAILURES ===================================
_________________ test_assertions_page_to_have_title[firefox] __________________

page = <Page url='http://localhost:49309/empty.html'>
server = http://localhost:49309

    def test_assertions_page_to_have_title(page: Page, server: Server) -> None:
        page.goto(server.EMPTY_PAGE)
        page.set_content(
            """
            <script>
                document.title = 'new title';
                setTimeout(() => {
                    document.title = 'great title';
                }, 2000);
            </script>
        """
        )
        expect(page).to_have_title("new title")
        expect(page).to_have_title(re.compile("new title"))
        with pytest.raises(AssertionError):
            expect(page).to_have_title("not the current title", timeout=100)
        with pytest.raises(AssertionError):
            expect(page).to_have_title(re.compile("not the current title"), timeout=100)
        with pytest.raises(AssertionError):
            expect(page).not_to_have_title(re.compile("new title"), timeout=100)
        with pytest.raises(AssertionError):
            expect(page).not_to_have_title("new title", timeout=100)
>       expect(page).not_to_have_title("great title", timeout=100)

tests/sync/test_assertions.py:46: 

@mxschmitt mxschmitt merged commit b6cda7d into microsoft:main Mar 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants