-
Notifications
You must be signed in to change notification settings - Fork 50
Fix for screenshots with function scoped browsers #75
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
Conversation
I'm not sure why https://travis-ci.org/pytest-dev/pytest-splinter/jobs/165209264#L331-L346 happens, it only seems to happen when multiple tests run. I can run
|
tests are failing, please fix |
Can you give the diff/failure a quick look, maybe you could figure out why? I will try to dig deeper but it was not straightforward to reproduce. |
tests/test_plugin.py:198:0: C0301 Line too long (123/120) [pylint] :) |
This commit moves the screenshot handling from the `browser_screenshot` autouse fixture into `browser_instance_getter` which is the proper place for per-function teardown. This fixes issue #74.
@bubenkoff the line length is now fixed I am still puzzled about the failure which only happens when I run the full test suite and not just the xdist test. I think the take_screenshot finalizer sometimes ends up as a session finalizer (which is not desirable). Do you have any ideas on where to put the screenshot-taking code? |
pytest_splinter/plugin.py
Outdated
request.addfinalizer(browser.quit) | ||
elif not browser: | ||
browser = browser_pool[browser_key] = get_browser(splinter_webdriver) | ||
request.addfinalizer(functools.partial( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so for session scoped browsers, this fails due to the pytest_runtest_makereport
hook doing nothing useful (as it's session's request and not node's request)
Firefox sometimes adds a hidden <canvas id="fxdriver-screenshot-canvas" to screenshots which fails tests.
both function and session scoped browsers.
@bubenkoff please have another look. I've moved things around a bit to call the screenshot capture at the correct location for both session and function scoped browsers. I can cleanup the commit history a bit if you think this approach is good. |
Review status: 0 of 2 files reviewed at latest revision, 4 unresolved discussions. pytest_splinter/plugin.py, line 339 at r4 (raw file):
document the function pytest_splinter/plugin.py, line 349 at r4 (raw file):
move the condition to the fixture pytest_splinter/plugin.py, line 422 at r4 (raw file):
as commented, here should be the decision whether to make a screenshot Comments from Reviewable |
Review status: 0 of 2 files reviewed at latest revision, 4 unresolved discussions. pytest_splinter/plugin.py, line 455 at r2 (raw file):
|
Reviewed 1 of 2 files at r4, 1 of 1 files at r6. Comments from Reviewable |
thanks! |
See issue #74
This change is