-
Notifications
You must be signed in to change notification settings - Fork 76
Description
I noticed in my tests, we are no longer getting screenshots when tests complete using the --screenshot
cli arg with on
or only-on-failure
after upgrading to Playwright 1.55.0.
This PR in the playwright-python package I think introduced this: microsoft/playwright-python#2951
This introduced this if statement to determine the file type based on path if a type isn't provided.
if "type" not in params:
params["type"] = determine_screenshot_type(params["path"])
The on_will_close_browser_context
function in playwright-pytest does not provide a type
arg to page.screenshot
, nor is there a file extension in the screenshot_path
. This function then catches all Errors and passes, so this silently fails.
def on_will_close_browser_context(self, context: BrowserContext) -> None: |
I can submit a pull request to fix this, but I can see a couple of ways to fix this and I don't know which would be preferred by the maintainers:
- Add a ".png" to the end of the
screenshot_path
variable. - Add a default "type" arg to the screenshot method in the
playwright-python
package