Open
Description
The image link shown on the page is relative to localhost, which shows 404
http://localhost:63342/screenshots/my_screenshot.png
To Reproduce
keep a png file named my_screenshot.png in the root of project
contents of conftest.py
import os
@pytest.mark.hookwrapper
def pytest_runtest_makereport(item, call):
outcome = yield
report = outcome.get_result()
pytest_html = item.config.pluginmanager.getplugin('html')
extra = getattr(report, 'extra', [])
main_script_dir = os.path.dirname(__file__)
rel_path = "screenshots/my_screenshot.png" #hardcoded image file temporarily #TODO to get from driver
image = pytest_html.extras.image(os.path.join(main_script_dir, rel_path))
extra.append(image)
report.extra = extra
Run with
pytest --html=report.html
Also have tried with --self-contained-html