From c3b202122c234ed4bd3c4cebdf7e1e9e3e2777ba Mon Sep 17 00:00:00 2001 From: David Date: Tue, 14 Oct 2025 16:28:55 -0500 Subject: [PATCH 01/12] test onboarding and screenshot final step --- selfdrive/ui/tests/test_ui/raylib_screenshots.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/selfdrive/ui/tests/test_ui/raylib_screenshots.py b/selfdrive/ui/tests/test_ui/raylib_screenshots.py index a65f198ad6822d..a9f74ba9d42af7 100755 --- a/selfdrive/ui/tests/test_ui/raylib_screenshots.py +++ b/selfdrive/ui/tests/test_ui/raylib_screenshots.py @@ -124,6 +124,16 @@ def setup_experimental_mode_description(click, pm: PubMaster): click(1200, 280) # expand description for experimental mode +def setup_onboarding(click, pm: PubMaster): + setup_settings(click, pm) + click(2000, 960) # review training guide + # Go through the entire training guide and take a screenshot on the last page to ensure everything works + clicks = [(390, 880), (2010, 550), (2010, 560), (1760, 730), (1750, 580), (2000, 560), (1900, 700), (1630, 390), (1780, 570), + (360, 890), (1740, 390), (2010, 670), (1980, 640), (1980, 640), (1760, 330), (1670, 650), (1960, 570), (1960, 580)] + for x, y in clicks: + click(x, y) + + CASES = { "homescreen": setup_homescreen, "settings_device": setup_settings, @@ -140,6 +150,7 @@ def setup_experimental_mode_description(click, pm: PubMaster): "homescreen_update_available": setup_homescreen_update_available, "confirmation_dialog": setup_confirmation_dialog, "experimental_mode_description": setup_experimental_mode_description, + "onboarding": setup_onboarding, } From eeff09d7848f205e5343d26f9d5fb5b8fd1dddd9 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 14 Oct 2025 16:32:02 -0500 Subject: [PATCH 02/12] update comment --- selfdrive/ui/tests/test_ui/raylib_screenshots.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/ui/tests/test_ui/raylib_screenshots.py b/selfdrive/ui/tests/test_ui/raylib_screenshots.py index a9f74ba9d42af7..4a2c2885487643 100755 --- a/selfdrive/ui/tests/test_ui/raylib_screenshots.py +++ b/selfdrive/ui/tests/test_ui/raylib_screenshots.py @@ -127,7 +127,7 @@ def setup_experimental_mode_description(click, pm: PubMaster): def setup_onboarding(click, pm: PubMaster): setup_settings(click, pm) click(2000, 960) # review training guide - # Go through the entire training guide and take a screenshot on the last page to ensure everything works + # Go through the entire training guide and stop on the final step clicks = [(390, 880), (2010, 550), (2010, 560), (1760, 730), (1750, 580), (2000, 560), (1900, 700), (1630, 390), (1780, 570), (360, 890), (1740, 390), (2010, 670), (1980, 640), (1980, 640), (1760, 330), (1670, 650), (1960, 570), (1960, 580)] for x, y in clicks: From db28595c9dcee601ac1030e51f947dffdaacc2d9 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 14 Oct 2025 16:35:18 -0500 Subject: [PATCH 03/12] rename to onboarding_completion --- selfdrive/ui/tests/test_ui/raylib_screenshots.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/ui/tests/test_ui/raylib_screenshots.py b/selfdrive/ui/tests/test_ui/raylib_screenshots.py index 4a2c2885487643..a7438567fea221 100755 --- a/selfdrive/ui/tests/test_ui/raylib_screenshots.py +++ b/selfdrive/ui/tests/test_ui/raylib_screenshots.py @@ -150,7 +150,7 @@ def setup_onboarding(click, pm: PubMaster): "homescreen_update_available": setup_homescreen_update_available, "confirmation_dialog": setup_confirmation_dialog, "experimental_mode_description": setup_experimental_mode_description, - "onboarding": setup_onboarding, + "onboarding_completion": setup_onboarding, } From ef9bfc852f79b5a74549263b6a215adbb8f2c95e Mon Sep 17 00:00:00 2001 From: David Date: Wed, 15 Oct 2025 00:06:31 -0500 Subject: [PATCH 04/12] use STEP_RECTS from onboarding instead --- .../ui/tests/test_ui/raylib_screenshots.py | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/selfdrive/ui/tests/test_ui/raylib_screenshots.py b/selfdrive/ui/tests/test_ui/raylib_screenshots.py index a7438567fea221..36d64bfe6b5fdc 100755 --- a/selfdrive/ui/tests/test_ui/raylib_screenshots.py +++ b/selfdrive/ui/tests/test_ui/raylib_screenshots.py @@ -17,6 +17,7 @@ from openpilot.common.prefix import OpenpilotPrefix from openpilot.selfdrive.test.helpers import with_processes from openpilot.selfdrive.selfdrived.alertmanager import set_offroad_alert +from openpilot.selfdrive.ui.layouts.onboarding import STEP_RECTS, DM_RECORD_STEP, DM_RECORD_YES_RECT from openpilot.system.updated.updated import parse_release_notes TEST_DIR = pathlib.Path(__file__).parent @@ -127,11 +128,21 @@ def setup_experimental_mode_description(click, pm: PubMaster): def setup_onboarding(click, pm: PubMaster): setup_settings(click, pm) click(2000, 960) # review training guide - # Go through the entire training guide and stop on the final step - clicks = [(390, 880), (2010, 550), (2010, 560), (1760, 730), (1750, 580), (2000, 560), (1900, 700), (1630, 390), (1780, 570), - (360, 890), (1740, 390), (2010, 670), (1980, 640), (1980, 640), (1760, 330), (1670, 650), (1960, 570), (1960, 580)] - for x, y in clicks: - click(x, y) + + # Click the center of each onboarding step rect + def click_center(rect): + cx = int(rect.x + rect.width / 2) + cy = int(rect.y + rect.height / 2) + click(cx, cy) + time.sleep(0.05) + + for i, rect in enumerate(STEP_RECTS): + if i == len(STEP_RECTS) - 1: + break # we want to take a screenshot of the last step + if i == DM_RECORD_STEP: + click_center(DM_RECORD_YES_RECT) # click "yes" for driver monitoring upload + else: + click_center(rect) CASES = { From 3542143cc28fefea042bb1362f5cff06de076c1c Mon Sep 17 00:00:00 2001 From: David Date: Wed, 15 Oct 2025 00:07:31 -0500 Subject: [PATCH 05/12] remove sleep --- selfdrive/ui/tests/test_ui/raylib_screenshots.py | 1 - 1 file changed, 1 deletion(-) diff --git a/selfdrive/ui/tests/test_ui/raylib_screenshots.py b/selfdrive/ui/tests/test_ui/raylib_screenshots.py index 36d64bfe6b5fdc..8f8aab6b65109c 100755 --- a/selfdrive/ui/tests/test_ui/raylib_screenshots.py +++ b/selfdrive/ui/tests/test_ui/raylib_screenshots.py @@ -134,7 +134,6 @@ def click_center(rect): cx = int(rect.x + rect.width / 2) cy = int(rect.y + rect.height / 2) click(cx, cy) - time.sleep(0.05) for i, rect in enumerate(STEP_RECTS): if i == len(STEP_RECTS) - 1: From 5671532fbdfa9b1223f83ec770abddbc0dbeee40 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 15 Oct 2025 00:08:02 -0500 Subject: [PATCH 06/12] less lines --- selfdrive/ui/tests/test_ui/raylib_screenshots.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/selfdrive/ui/tests/test_ui/raylib_screenshots.py b/selfdrive/ui/tests/test_ui/raylib_screenshots.py index 8f8aab6b65109c..c6e08c9dfbb3c5 100755 --- a/selfdrive/ui/tests/test_ui/raylib_screenshots.py +++ b/selfdrive/ui/tests/test_ui/raylib_screenshots.py @@ -131,9 +131,7 @@ def setup_onboarding(click, pm: PubMaster): # Click the center of each onboarding step rect def click_center(rect): - cx = int(rect.x + rect.width / 2) - cy = int(rect.y + rect.height / 2) - click(cx, cy) + click(int(rect.x + rect.width / 2), int(rect.y + rect.height / 2)) for i, rect in enumerate(STEP_RECTS): if i == len(STEP_RECTS) - 1: From ac29800ac7ad8f84f4119514d2037921f93549d1 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 15 Oct 2025 00:11:26 -0500 Subject: [PATCH 07/12] much better --- selfdrive/ui/tests/test_ui/raylib_screenshots.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/selfdrive/ui/tests/test_ui/raylib_screenshots.py b/selfdrive/ui/tests/test_ui/raylib_screenshots.py index c6e08c9dfbb3c5..7b994990ac7afd 100755 --- a/selfdrive/ui/tests/test_ui/raylib_screenshots.py +++ b/selfdrive/ui/tests/test_ui/raylib_screenshots.py @@ -17,7 +17,7 @@ from openpilot.common.prefix import OpenpilotPrefix from openpilot.selfdrive.test.helpers import with_processes from openpilot.selfdrive.selfdrived.alertmanager import set_offroad_alert -from openpilot.selfdrive.ui.layouts.onboarding import STEP_RECTS, DM_RECORD_STEP, DM_RECORD_YES_RECT +from openpilot.selfdrive.ui.layouts.onboarding import STEP_RECTS from openpilot.system.updated.updated import parse_release_notes TEST_DIR = pathlib.Path(__file__).parent @@ -133,13 +133,8 @@ def setup_onboarding(click, pm: PubMaster): def click_center(rect): click(int(rect.x + rect.width / 2), int(rect.y + rect.height / 2)) - for i, rect in enumerate(STEP_RECTS): - if i == len(STEP_RECTS) - 1: - break # we want to take a screenshot of the last step - if i == DM_RECORD_STEP: - click_center(DM_RECORD_YES_RECT) # click "yes" for driver monitoring upload - else: - click_center(rect) + for _, rect in enumerate(STEP_RECTS[:-1]): + click_center(rect) CASES = { From fb45f59d3addd0a5cbf8c2a1e176973a95c74dd6 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 15 Oct 2025 10:01:30 -0500 Subject: [PATCH 08/12] cleanup --- selfdrive/ui/tests/test_ui/raylib_screenshots.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/selfdrive/ui/tests/test_ui/raylib_screenshots.py b/selfdrive/ui/tests/test_ui/raylib_screenshots.py index c8936ea9df7023..89b304ee8e391b 100755 --- a/selfdrive/ui/tests/test_ui/raylib_screenshots.py +++ b/selfdrive/ui/tests/test_ui/raylib_screenshots.py @@ -130,13 +130,9 @@ def setup_experimental_mode_description(click, pm: PubMaster): def setup_onboarding(click, pm: PubMaster): setup_settings(click, pm) click(2000, 960) # review training guide - # Click the center of each onboarding step rect - def click_center(rect): - click(int(rect.x + rect.width / 2), int(rect.y + rect.height / 2)) - for _, rect in enumerate(STEP_RECTS[:-1]): - click_center(rect) + click(int(rect.x + rect.width / 2), int(rect.y + rect.height / 2)) CASES = { From 4bb324dbfe470bb5e2d5bc9e01e381633b80127d Mon Sep 17 00:00:00 2001 From: David Date: Wed, 15 Oct 2025 14:06:45 -0500 Subject: [PATCH 09/12] fix (why though) --- selfdrive/ui/tests/test_ui/raylib_screenshots.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/ui/tests/test_ui/raylib_screenshots.py b/selfdrive/ui/tests/test_ui/raylib_screenshots.py index 89b304ee8e391b..e125304347b006 100755 --- a/selfdrive/ui/tests/test_ui/raylib_screenshots.py +++ b/selfdrive/ui/tests/test_ui/raylib_screenshots.py @@ -17,7 +17,6 @@ from openpilot.common.prefix import OpenpilotPrefix from openpilot.selfdrive.test.helpers import with_processes from openpilot.selfdrive.selfdrived.alertmanager import set_offroad_alert -from openpilot.selfdrive.ui.layouts.onboarding import STEP_RECTS from openpilot.system.updated.updated import parse_release_notes TEST_DIR = pathlib.Path(__file__).parent @@ -131,6 +130,7 @@ def setup_onboarding(click, pm: PubMaster): setup_settings(click, pm) click(2000, 960) # review training guide # Click the center of each onboarding step rect + from openpilot.selfdrive.ui.layouts.onboarding import STEP_RECTS for _, rect in enumerate(STEP_RECTS[:-1]): click(int(rect.x + rect.width / 2), int(rect.y + rect.height / 2)) From 6ec95c50e0df98155473a9d0ee0103331d79fa2b Mon Sep 17 00:00:00 2001 From: David Date: Thu, 16 Oct 2025 12:11:07 -0500 Subject: [PATCH 10/12] seprate onboarding steps into separate module so importing from onboarding works in tests --- selfdrive/ui/layouts/onboarding.py | 9 +------- selfdrive/ui/layouts/onboarding_steps.py | 23 +++++++++++++++++++ .../ui/tests/test_ui/raylib_screenshots.py | 4 ++-- 3 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 selfdrive/ui/layouts/onboarding_steps.py diff --git a/selfdrive/ui/layouts/onboarding.py b/selfdrive/ui/layouts/onboarding.py index a817fc53adc953..18acb99fec1634 100644 --- a/selfdrive/ui/layouts/onboarding.py +++ b/selfdrive/ui/layouts/onboarding.py @@ -9,18 +9,11 @@ from openpilot.system.ui.widgets import Widget from openpilot.system.ui.widgets.button import Button, ButtonStyle from openpilot.system.ui.widgets.label import Label +from openpilot.selfdrive.ui.layouts.onboarding_steps import STEP_RECTS from openpilot.selfdrive.ui.ui_state import ui_state DEBUG = False -STEP_RECTS = [rl.Rectangle(104, 800, 633, 175), rl.Rectangle(1835, 0, 2159, 1080), rl.Rectangle(1835, 0, 2156, 1080), - rl.Rectangle(1526, 473, 427, 472), rl.Rectangle(1643, 441, 217, 223), rl.Rectangle(1835, 0, 2155, 1080), - rl.Rectangle(1786, 591, 267, 236), rl.Rectangle(1353, 0, 804, 1080), rl.Rectangle(1458, 485, 633, 211), - rl.Rectangle(95, 794, 1158, 187), rl.Rectangle(1560, 170, 392, 397), rl.Rectangle(1835, 0, 2159, 1080), - rl.Rectangle(1351, 0, 807, 1080), rl.Rectangle(1835, 0, 2158, 1080), rl.Rectangle(1531, 82, 441, 920), - rl.Rectangle(1336, 438, 490, 393), rl.Rectangle(1835, 0, 2159, 1080), rl.Rectangle(1835, 0, 2159, 1080), - rl.Rectangle(87, 795, 1187, 186)] - DM_RECORD_STEP = 9 DM_RECORD_YES_RECT = rl.Rectangle(695, 794, 558, 187) diff --git a/selfdrive/ui/layouts/onboarding_steps.py b/selfdrive/ui/layouts/onboarding_steps.py new file mode 100644 index 00000000000000..889ae3a30da3d1 --- /dev/null +++ b/selfdrive/ui/layouts/onboarding_steps.py @@ -0,0 +1,23 @@ +from pyray import Rectangle + +STEP_RECTS = [ + Rectangle(104, 800, 633, 175), + Rectangle(1835, 0, 2159, 1080), + Rectangle(1835, 0, 2156, 1080), + Rectangle(1526, 473, 427, 472), + Rectangle(1643, 441, 217, 223), + Rectangle(1835, 0, 2155, 1080), + Rectangle(1786, 591, 267, 236), + Rectangle(1353, 0, 804, 1080), + Rectangle(1458, 485, 633, 211), + Rectangle(95, 794, 1158, 187), + Rectangle(1560, 170, 392, 397), + Rectangle(1835, 0, 2159, 1080), + Rectangle(1351, 0, 807, 1080), + Rectangle(1835, 0, 2158, 1080), + Rectangle(1531, 82, 441, 920), + Rectangle(1336, 438, 490, 393), + Rectangle(1835, 0, 2159, 1080), + Rectangle(1835, 0, 2159, 1080), + Rectangle(87, 795, 1187, 186), +] diff --git a/selfdrive/ui/tests/test_ui/raylib_screenshots.py b/selfdrive/ui/tests/test_ui/raylib_screenshots.py index edf9aab639970b..851249e1807caa 100755 --- a/selfdrive/ui/tests/test_ui/raylib_screenshots.py +++ b/selfdrive/ui/tests/test_ui/raylib_screenshots.py @@ -15,8 +15,9 @@ from openpilot.common.basedir import BASEDIR from openpilot.common.params import Params from openpilot.common.prefix import OpenpilotPrefix -from openpilot.selfdrive.test.helpers import with_processes from openpilot.selfdrive.selfdrived.alertmanager import set_offroad_alert +from openpilot.selfdrive.test.helpers import with_processes +from openpilot.selfdrive.ui.layouts.onboarding_steps import STEP_RECTS from openpilot.system.updated.updated import parse_release_notes AlertSize = log.SelfdriveState.AlertSize @@ -133,7 +134,6 @@ def setup_onboarding(click, pm: PubMaster): setup_settings(click, pm) click(2000, 960) # review training guide # Click the center of each onboarding step rect - from openpilot.selfdrive.ui.layouts.onboarding import STEP_RECTS for _, rect in enumerate(STEP_RECTS[:-1]): click(int(rect.x + rect.width / 2), int(rect.y + rect.height / 2)) From 460165a8c9dcece3e26ebceb938b19999499b73e Mon Sep 17 00:00:00 2001 From: David Date: Thu, 16 Oct 2025 14:47:31 -0500 Subject: [PATCH 11/12] move onboarding_steps to lib --- selfdrive/ui/layouts/onboarding.py | 2 +- selfdrive/ui/{layouts => lib}/onboarding_steps.py | 0 selfdrive/ui/tests/test_ui/raylib_screenshots.py | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename selfdrive/ui/{layouts => lib}/onboarding_steps.py (100%) diff --git a/selfdrive/ui/layouts/onboarding.py b/selfdrive/ui/layouts/onboarding.py index 18acb99fec1634..d86ba58ff6a3df 100644 --- a/selfdrive/ui/layouts/onboarding.py +++ b/selfdrive/ui/layouts/onboarding.py @@ -9,7 +9,7 @@ from openpilot.system.ui.widgets import Widget from openpilot.system.ui.widgets.button import Button, ButtonStyle from openpilot.system.ui.widgets.label import Label -from openpilot.selfdrive.ui.layouts.onboarding_steps import STEP_RECTS +from openpilot.selfdrive.ui.lib.onboarding_steps import STEP_RECTS from openpilot.selfdrive.ui.ui_state import ui_state DEBUG = False diff --git a/selfdrive/ui/layouts/onboarding_steps.py b/selfdrive/ui/lib/onboarding_steps.py similarity index 100% rename from selfdrive/ui/layouts/onboarding_steps.py rename to selfdrive/ui/lib/onboarding_steps.py diff --git a/selfdrive/ui/tests/test_ui/raylib_screenshots.py b/selfdrive/ui/tests/test_ui/raylib_screenshots.py index 851249e1807caa..041a51a1be751d 100755 --- a/selfdrive/ui/tests/test_ui/raylib_screenshots.py +++ b/selfdrive/ui/tests/test_ui/raylib_screenshots.py @@ -17,7 +17,7 @@ from openpilot.common.prefix import OpenpilotPrefix from openpilot.selfdrive.selfdrived.alertmanager import set_offroad_alert from openpilot.selfdrive.test.helpers import with_processes -from openpilot.selfdrive.ui.layouts.onboarding_steps import STEP_RECTS +from openpilot.selfdrive.ui.lib.onboarding_steps import STEP_RECTS from openpilot.system.updated.updated import parse_release_notes AlertSize = log.SelfdriveState.AlertSize From 2927df6a0ec8b1a413bd5bd2d2bca1e05b0d7269 Mon Sep 17 00:00:00 2001 From: David <49467229+TheSecurityDev@users.noreply.github.com> Date: Sat, 18 Oct 2025 19:38:33 -0500 Subject: [PATCH 12/12] Remove extra blank line in raylib_screenshots.py --- selfdrive/ui/tests/test_ui/raylib_screenshots.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/ui/tests/test_ui/raylib_screenshots.py b/selfdrive/ui/tests/test_ui/raylib_screenshots.py index 409d09fae689df..35877ffde7e9a1 100755 --- a/selfdrive/ui/tests/test_ui/raylib_screenshots.py +++ b/selfdrive/ui/tests/test_ui/raylib_screenshots.py @@ -141,7 +141,7 @@ def setup_onboarding(click, pm: PubMaster): for _, rect in enumerate(STEP_RECTS[:-1]): click(int(rect.x + rect.width / 2), int(rect.y + rect.height / 2)) - + def setup_openpilot_long_confirmation_dialog(click, pm: PubMaster): setup_settings_developer(click, pm) click(2000, 960) # toggle openpilot longitudinal control