import pytest
import uiautomator2 as u2
d=u2.connect()
def test_precondition():
d.press(“home”)
def test_procedure():
d(text=“Settings”).click()
d.screenshot(“Settings.png”)
d(text=“Bluetooth”).click()
d.screenshot(“Bluetooth.png”)
def test_expectedResult():
assert d(text=“Bluetooth”).exists
running above script as : py.test --html=report.html --self-contained-html Bluetooth settings.py
I am new to python When I am running the above script with pytest and generating HTML report I am unable to see screenshot image in HTML report requesting to please provide solution
By default pytest-html captures and attaches screenshot for only failed test cases, If you want it to capture for passed test cases too. You can refer the following thread Here