From 7d6e87a70e3b8270f476aada003e1789c01e37a3 Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Mon, 2 Nov 2026 16:31:15 +0100 Subject: [PATCH] Wait for target robot mode when switching modes This should reduce flakiness of tests. AFAIK that behavior has been fixed on newer PolyScope versions, such that setting a robot mode blocks until the robot mode is actually reached. In that case, checking should not harm. --- tests/test_dashboard_client_x.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_dashboard_client_x.cpp b/tests/test_dashboard_client_x.cpp index 798f25147..7227f54b5 100644 --- a/tests/test_dashboard_client_x.cpp +++ b/tests/test_dashboard_client_x.cpp @@ -214,6 +214,7 @@ TEST_F(DashboardClientTestX, program_interaction) } ASSERT_TRUE(dashboard_client_->connect()); dashboard_client_->commandPowerOff(); + ASSERT_NO_THROW(waitForRobotMode(RobotMode::POWER_OFF)); DashboardResponse response; response = dashboard_client_->commandLoadProgram("wait_program"); ASSERT_TRUE(response.ok); @@ -228,9 +229,10 @@ TEST_F(DashboardClientTestX, program_interaction) } response = dashboard_client_->commandPowerOn(); ASSERT_TRUE(response.ok); + ASSERT_NO_THROW(waitForRobotMode(RobotMode::IDLE)); response = dashboard_client_->commandBrakeRelease(); ASSERT_TRUE(response.ok); - std::this_thread::sleep_for(std::chrono::milliseconds(800)); + ASSERT_NO_THROW(waitForRobotMode(RobotMode::RUNNING)); response = dashboard_client_->commandPlay(); ASSERT_TRUE(response.ok); response = dashboard_client_->commandProgramState();