Hi,
I have the following test:
When I run this test with the npm or VS Code extension, I got the next result:
In the terminal:
In the html report, it looks like on the 1st snapshot In the VS Code extension it looks like on the 2nd snapshot
Does anybody have idea what it's such weird behavior? ๐
This thread is trying to answer question "Why is a failed test being logged as passed when run with npm or VS Code extension?"
Hmm that code is way over my head.
But just want to warn you that if you don't use/rely on the built-in fixtures to create and tear down the browser, context and page, some things like configuring trace files, recording and screenshots in the playwright.config may not always work as expected.
(And maybe the vscode extension might have trouble with this too)
And be aware that primitive matchers from Jest don't have the auto-retrying feature which is so great in Playwright. For example instead of expect(title).toContain
, you would ideally write await expect(page).toHaveTitle
These are the auto-retrying assertions which are best-practice to use, to make tests less flaky: https://playwright.dev/docs/test-assertions#auto-retrying-assertions
@refactoreric thank you,
but I know that, but it does not work as you can see from the first part of code. If I return the title with await page.title()
, then chaeck it as expect(title).toContain('Playwright')
it works. I have no idea why the await expect(page).toHaveTitle(/Playwright/)
does not work in the map(async (page) => expect(page).toHaveTitle(/Playwright/))
code
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.