File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -67,13 +67,11 @@ def pytest_runtest_makereport(item, call):
6767 if not hasattr (report , 'extra' ):
6868 report .extra = []
6969
70- # Add screenshot as a file URL that will work when report is opened in browser
71- # Convert to absolute path and then to file URL
72- absolute_path = os .path .abspath (screenshot_path )
73- file_url = f"file:///{ absolute_path .replace (os .sep , '/' )} "
70+ # Use relative path for screenshots to work in the Test-Report folder structure
71+ relative_screenshot_path = f"../screenshots/{ screenshot_name } "
7472
7573 # pytest-html expects this format for extras
76- report .extra .append (extras .url (file_url , name = 'Screenshot' ))
74+ report .extra .append (extras .url (relative_screenshot_path , name = 'Screenshot' ))
7775
7876 logging .info ("Screenshot saved: %s" , screenshot_path )
7977 except Exception as exc : # pylint: disable=broad-exception-caught
You can’t perform that action at this time.
0 commit comments