Skip to content

Commit

Permalink
CI: integrate pairing device and prime user widgets into UI report (c…
Browse files Browse the repository at this point in the history
…ommaai#33486)

add prime widgets
  • Loading branch information
deanlee authored Sep 6, 2024
1 parent e80c27f commit c45e273
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ui_preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ jobs:
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/openpilot/pr-${{ github.event.number }}/offroad_alert.png"></td>
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/openpilot/pr-${{ github.event.number }}/update_available.png"></td>
</tr>
<tr>
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/openpilot/pr-${{ github.event.number }}/prime.png"></td>
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/openpilot/pr-${{ github.event.number }}/pair_device.png"></td>
</tr>
<tr>
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/openpilot/pr-${{ github.event.number }}/onroad.png"></td>
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/openpilot/pr-${{ github.event.number }}/onroad_sidebar.png"></td>
Expand Down
30 changes: 21 additions & 9 deletions selfdrive/ui/tests/test_ui/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from cereal import messaging, log
from msgq.visionipc import VisionIpcServer, VisionStreamType
from cereal.messaging import SubMaster, PubMaster
from cereal.messaging import PubMaster
from openpilot.common.basedir import BASEDIR
from openpilot.common.params import Params
from openpilot.common.prefix import OpenpilotPrefix
Expand Down Expand Up @@ -95,6 +95,7 @@ def setup_onroad_alert(click, pm: PubMaster, text1, text2, size, status=log.Self
cs.alertStatus = status
cs.alertType = "test_onroad_alert"
pm.send('selfdriveState', dat)
time.sleep(UI_DELAY)

def setup_onroad_alert_small(click, pm: PubMaster):
setup_onroad_alert(click, pm, 'This is a small alert message', '', log.SelfdriveState.AlertSize.small)
Expand Down Expand Up @@ -123,9 +124,14 @@ def setup_update_available(click, pm: PubMaster):
setup_settings_device(click, pm)
click(240, 216)

def setup_pair_device(click, pm: PubMaster):
click(1950, 435)
click(1800, 900)

CASES = {
"homescreen": setup_homescreen,
"prime": setup_homescreen,
"pair_device": setup_pair_device,
"settings_device": setup_settings_device,
"onroad": setup_onroad,
"onroad_sidebar": setup_onroad_sidebar,
Expand All @@ -152,13 +158,12 @@ def __init__(self):
sys.modules["mouseinfo"] = False

def setup(self):
Params().put("DongleId", "123456789012345")
self.sm = SubMaster(["uiDebug"])
self.pm = PubMaster(list(DATA.keys()))
while not self.sm.valid["uiDebug"]:
self.sm.update(1)
time.sleep(UI_DELAY) # wait a bit more for the UI to start rendering
self.pm.send('deviceState', DATA['deviceState'])
DATA['deviceState'].deviceState.networkType = log.DeviceState.NetworkType.wifi
for _ in range(10):
self.pm.send('deviceState', DATA['deviceState'])
DATA['deviceState'].clear_write_flag()
time.sleep(0.05)
try:
self.ui = pywinctl.getWindowsWithTitle("ui")[0]
except Exception as e:
Expand Down Expand Up @@ -231,8 +236,15 @@ def create_screenshots():

t = TestUI()

with OpenpilotPrefix():
for name, setup in CASES.items():
for name, setup in CASES.items():
with OpenpilotPrefix():
params = Params()
params.put("DongleId", "123456789012345")
if name == 'prime':
params.put('PrimeType', '1')
elif name == 'pair_device':
params.put('ApiCache_Device', '{"is_paired":0, "prime_type":-1}')

t.test_ui(name, setup)

if __name__ == "__main__":
Expand Down

0 comments on commit c45e273

Please sign in to comment.