Skip to content
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

Unclear how to set "splinter-screenshot-dir" to send failure screenshots to a particular directory #178

Open
jzohrab opened this issue Oct 31, 2023 · 3 comments

Comments

@jzohrab
Copy link

jzohrab commented Oct 31, 2023

Hello, thank you for the great project!

I'm trying to get failures to go to a specified ignored folder so they don't clutter up my project root, but I can't get it to work.

In my .pytest.ini, I've tried things like this:

-splinter-screenshot-dir = tests/acceptance/failure_screenshots

but this gives the error

.venv/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: -splinter-screenshot-dir
  
    self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

I've also tried passing it in command-line args, e.g:

pytest -splinter-screenshot-dir blah my_test.py
pytest -splinter-screenshot-dir=blah my_test.py
pytest splinter-screenshot-dir=blah my_test.py
pytest tests/acceptance -splinter-screenshot-dir=tests/acceptance/failure_screenshots

But still get

===========================
pytest-splinter screenshots
===========================
png:  /Users/jeff/Documents/Projects/lute_v3/tests.acceptance.test_smoke/test_hit_main_page-browser.png
html: /Users/jeff/Documents/Projects/lute_v3/tests.acceptance.test_smoke/test_hit_main_page-browser.html

The folder I'm using exists.

I've read the docs and searched, but can't see how to do it correctly. Advice appreciated. Thank you!

@jzohrab
Copy link
Author

jzohrab commented Oct 31, 2023

Ha, hilarious. The docs at https://pytest-splinter.readthedocs.io/en/3.3.2/#command-line-options have the options with a single dash due to rst formatting Copy-paste:

–splinter-screenshot-dir
pytest-splinter browser screenshot directory. Defaults to the current directory.

but the actual setting needs to be a double dash:

pytest tests/acceptance --splinter-screenshot-dir=tests/acceptance/failure_screenshots

So the docs need a fix. I'll check this repo.

@jzohrab
Copy link
Author

jzohrab commented Oct 31, 2023

It's just the readthedocs docs that need the fix. The docs in this repo at https://github.com/pytest-dev/pytest-splinter/blob/master/README.rst are correct. Well that was a waste of time.

ref sphinx-doc/sphinx#9871 - double dash shows up as single em dash.

If you'd like I can PR to this repo to add double-single-backticks around each of these items, which should fix it for readthedocs as well.

@jzohrab
Copy link
Author

jzohrab commented Oct 31, 2023

(and thanks again for the great project :-P )

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

No branches or pull requests

1 participant