-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option --output not working with a manually launched context #111
Comments
I was trying it out locally and it works for me. How do you specify the command to pytest? Do you have a small repro repository which you can share? |
For example : |
Same here with something like:
even if adding or changing the tracing with screenshots or video or completely omitting the |
how does your test_playwright.py look like? |
I created a couple of fixtures like that:
where the test.py is irrelevant, it just take looking at the code here I'd say that the params related to the artifacts (video, screenshot, tracing) are set only if the does it make sense to you? |
It's intended that the --output only works with the given context and page fixture. If you manually launch a browser or create a browser context, --output will have no effect. |
I also modified browser context with
Removing this fixtures enables --output option, indeed. Thank you ! |
ok. we could add few documentation lines about it. in theory it would be possibile to get artifacts even if the called fixture is |
Yeah, I think upstream we also support it. In what artifacts are you exactly interested in? (video, screenshot, trace)? |
I'd say everything is feasible 😄 |
I do not understand why --output option is not compatible with a modified browser_context_args fixture. Is it possible to make them compatible ? |
Finally I just used pytest --junit-xml instead of --output, it works like a charm |
Yeh this is quite annoying tbh. It would be nice if it was fixed. |
Suggested this fix for it #118 |
I'm not sure about what you mean but |
Yes, sorry, --output and --junit-xml are completely different things. Is there any update on this issue ? Modifying context and outputing artifacts should be possible no ? |
Our use case: I need to define context. We are trying to move from Selenium to playwright. Not being able to take screenshot when tests fail is the only step that blocking us from moving(#139). In our Selenium framework, the screenshot is taken when test fails. The screenshot then being added to Allure report. It is very convenient to look at the screenshot on the Allure report page especially for team members who are not that familiar with certain tests. I am currently using pytest-bdd and Allure report. Everything works but this. |
Hi, |
Hello! Is there any progress on this issue? When is it planned to release adding screenshots with new_context? |
I stumbled upon this issue but was able to solve it for me by modifying the browser_context_args: you can configure the creation of screenshots ( Documenting this here as there seem to be some open questions about it. |
It is worth noting that nothing in the documentation at https://playwright.dev/python/docs/test-runners#cli-arguments even hints that any of the CLI flags are dependent on using the default (ETA: at some point last week I came across the browser context args documentation at https://playwright.dev/python/docs/api/class-browser#browser-new-context, but without any mention or cross-reference of the Worse, the |
This should be fixed in v0.5.0: https://pypi.org/project/pytest-playwright/ |
The issue is still there |
test_results folder is not getting created with context. This issue still exists |
Please re-file with more details, thank you. Make sure to use the from playwright.sync_api import BrowserContext
from pytest_playwright.pytest_playwright import CreateContextCallback
def test_foo(new_context: CreateContextCallback) -> None:
context = new_context() We should probably improve the docs around it, I think the misconception is that you are using |
I am trying to output test results in another directory with the --output option. But it seems to not be working : the default directory (test-results) contains test results at each run, even if I delete the folder.
Using pytest-playwright 0.3.0 .
The text was updated successfully, but these errors were encountered: