pytest-dev/pytest-splinter

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

Opened this issue · 3 comments

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!

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.

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.

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