mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-04-25 19:49:02 +00:00
tests/ui: rename test-screen to ui
This commit is contained in:
parent
362dbce606
commit
8796ca96b9
@ -80,10 +80,10 @@ test_emu_click: ## run click tests
|
|||||||
cd tests ; ./run_tests_click_emu.sh $(TESTOPTS)
|
cd tests ; ./run_tests_click_emu.sh $(TESTOPTS)
|
||||||
|
|
||||||
test_emu_ui: ## run ui integration tests
|
test_emu_ui: ## run ui integration tests
|
||||||
cd tests ; ./run_tests_device_emu.sh --test-screen=test -m "not skip_ui" $(TESTOPTS)
|
cd tests ; ./run_tests_device_emu.sh --ui=test -m "not skip_ui" $(TESTOPTS)
|
||||||
|
|
||||||
test_emu_ui_record: ## record and hash screens for ui integration tests
|
test_emu_ui_record: ## record and hash screens for ui integration tests
|
||||||
cd tests ; ./run_tests_device_emu.sh --test-screen=record -m "not skip_ui" $(TESTOPTS)
|
cd tests ; ./run_tests_device_emu.sh --ui=record -m "not skip_ui" $(TESTOPTS)
|
||||||
|
|
||||||
pylint: ## run pylint on application sources and tests
|
pylint: ## run pylint on application sources and tests
|
||||||
pylint -E $(shell find src tests -name *.py)
|
pylint -E $(shell find src tests -name *.py)
|
||||||
|
@ -140,7 +140,7 @@ def client(request):
|
|||||||
|
|
||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
parser.addoption(
|
parser.addoption(
|
||||||
"--test-screen",
|
"--ui",
|
||||||
action="store",
|
action="store",
|
||||||
default="",
|
default="",
|
||||||
help="Enable UI intergration tests: 'record' or 'test'",
|
help="Enable UI intergration tests: 'record' or 'test'",
|
||||||
|
@ -86,20 +86,20 @@ def _process_tested(fixture_test_path, test_name):
|
|||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def screen_recording(client, request):
|
def screen_recording(client, request):
|
||||||
test_screen = request.config.getoption("test_screen")
|
test_ui = request.config.getoption("ui")
|
||||||
if request.node.get_closest_marker("skip_ui") or not test_screen:
|
if request.node.get_closest_marker("skip_ui") or not test_ui:
|
||||||
yield
|
yield
|
||||||
return
|
return
|
||||||
|
|
||||||
test_name = _get_test_dirname(request.node)
|
test_name = _get_test_dirname(request.node)
|
||||||
fixture_test_path = Path(__file__).parent.resolve() / "fixtures" / test_name
|
fixture_test_path = Path(__file__).parent.resolve() / "fixtures" / test_name
|
||||||
|
|
||||||
if test_screen == "record":
|
if test_ui == "record":
|
||||||
screen_path = fixture_test_path / "recorded"
|
screen_path = fixture_test_path / "recorded"
|
||||||
elif test_screen == "test":
|
elif test_ui == "test":
|
||||||
screen_path = fixture_test_path / "actual"
|
screen_path = fixture_test_path / "actual"
|
||||||
else:
|
else:
|
||||||
raise ValueError("Invalid test_screen option.")
|
raise ValueError("Invalid 'ui' option.")
|
||||||
|
|
||||||
_check_fixture_directory(fixture_test_path, screen_path)
|
_check_fixture_directory(fixture_test_path, screen_path)
|
||||||
|
|
||||||
@ -108,9 +108,9 @@ def screen_recording(client, request):
|
|||||||
yield
|
yield
|
||||||
finally:
|
finally:
|
||||||
client.debug.stop_recording()
|
client.debug.stop_recording()
|
||||||
if test_screen == "record":
|
if test_ui == "record":
|
||||||
_process_recorded(screen_path)
|
_process_recorded(screen_path)
|
||||||
elif test_screen == "test":
|
elif test_ui == "test":
|
||||||
_process_tested(fixture_test_path, test_name)
|
_process_tested(fixture_test_path, test_name)
|
||||||
else:
|
else:
|
||||||
raise ValueError("Invalid test_screen option.")
|
raise ValueError("Invalid 'ui' option.")
|
||||||
|
Loading…
Reference in New Issue
Block a user