Closed
Description
Context:
- Playwright Version: Version 1.15.0-1631797286000
- Operating System:
ubuntu/bionic64
- Node.js version: v12.16.1
- Browser: All
- Extra: running inside virtualbox vm, host OS is Windows 10.
Code Snippet
@pytest.fixture(autouse=True)
def browser_context_args(browser_context_args: dict) -> dict:
browser_context_args = {
**browser_context_args,
"viewport": {
"width": 1920,
"height": 1080,
},
"device_scale_factor": 2,
"record_video_size": {
"width": 800,
"height": 600,
},
}
return browser_context_args
Describe the bug
I am running Playwright + Python + pytest-playwright with following arguments:
pytest --tracing retain-on-failure --screenshot only-on-failure --video retain-on-failure
On error, tracing and screenshots are saved fine, however videos come out as zero bytes .webm files.
Activity
paunovic commentedon Oct 3, 2021
Looks like a bug with
tempfile
library wheretempfile.Directory()
returns slightly incorrect path, resulting videos not to be moved from artifacts dir to output dir.JoelEinbinder commentedon Oct 8, 2021
Transferred to the playwright-pytest repo. Looks like a bug with our pytest fixtures. PRs welcome if you know how to fix it, otherwise @mxschmitt can you take a look?
mxschmitt commentedon Oct 8, 2021
@paunovic sorry for the late reply. Do you have a full example somewhere (e.g. GitHub repo)? I tried to confirm it and reproduce it locally, but for me it seems working as intended.
paunovic commentedon Oct 11, 2021
Hi, here is minimal reproducible example:
conftest.py:
test_bug.py:
Running on Python 3.8.1, ubuntu/bionic64. If I change following line:
to:
It starts working.
mxschmitt commentedon Oct 11, 2021
Ohhh good catch! Thats the fix for it: #83. Will release it shortly.
paunovic commentedon Oct 11, 2021
Just for posterity, the bug that I was encountering few weeks ago when I initially opened this issue was different -
TemporaryDirectory
was returning underscore instead of dash at one place in the string for some reason, compared tovideo.path()
. Looks like there are few buggy behaviours. Personally I refactored my fixtures away from TemporaryDirectory.Oh and there's also a typo in temp directory name,
playwight
.