Skip to content

Commit bfc90fd

Browse files
committed
Match gyro and accel stream types exactly and expand sensor modules in real-device tests
1 parent 2487f9d commit bfc90fd

3 files changed

Lines changed: 18 additions & 2 deletions

File tree

wrappers/rest-api/tools/react-viewer/src/components/DevicePanel.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,6 @@ function SensorStreamControls({
722722
onClick={() => toggleSensor(sensor.sensor_id)}
723723
className="flex items-center gap-2 flex-1 min-w-0 text-left"
724724
aria-expanded={isExpanded}
725-
title={isExpanded ? 'Collapse' : 'Expand stream settings'}
726725
>
727726
<svg
728727
className={`w-3 h-3 shrink-0 text-gray-400 transition-transform ${isExpanded ? 'rotate-90' : ''}`}

wrappers/rest-api/tools/react-viewer/src/store/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function buildStreamConfigs(sensors: SensorInfo[]): StreamConfig[] {
4242
const streamTypeLower = profile.stream_type.toLowerCase()
4343
const enableByDefault =
4444
streamTypeLower === 'depth' || streamTypeLower === 'color' ||
45-
streamTypeLower.includes('gyro') || streamTypeLower.includes('accel')
45+
streamTypeLower === 'gyro' || streamTypeLower === 'accel'
4646
configs.push({
4747
sensor_id: sensor.sensor_id,
4848
stream_type: profile.stream_type,

wrappers/rest-api/tools/react-viewer/tests/e2e/real-device.spec.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@
1414
*/
1515

1616
import { test, expect, getTestMode, getApiUrl, dismissWhatsNewModal } from './fixtures'
17+
import type { Locator } from '@playwright/test'
18+
19+
// Per-stream toggles only render inside an expanded sensor module
20+
async function expandSensorModules(deviceCard: Locator) {
21+
const headers = deviceCard.locator('button[aria-expanded]')
22+
for (let i = 0; i < await headers.count(); i++) {
23+
const header = headers.nth(i)
24+
if (await header.getAttribute('aria-expanded') === 'false') await header.click()
25+
}
26+
}
1727

1828
// Skip entire file in mock mode
1929
test.beforeEach(async ({ testMode, page }) => {
@@ -72,6 +82,9 @@ test.describe('@real-device Real Device Tests', () => {
7282
// Wait for device to finish loading sensors
7383
await expect(page.locator('[title="Loading..."]')).not.toBeVisible({ timeout: 10000 })
7484

85+
// Sensor modules are collapsed by default; expand them to reveal the stream toggles
86+
await expandSensorModules(deviceCard)
87+
7588
// Enable depth stream
7689
const depthToggle = page.locator('[data-testid="toggle-stream-depth"]').first()
7790
await depthToggle.check()
@@ -102,6 +115,8 @@ test.describe('@real-device Real Device Tests', () => {
102115
// Wait for device to finish loading sensors
103116
await expect(page.locator('[title="Loading..."]')).not.toBeVisible({ timeout: 10000 })
104117

118+
await expandSensorModules(deviceCard)
119+
105120
const depthToggle = page.locator('[data-testid="toggle-stream-depth"]').first()
106121
await depthToggle.check()
107122

@@ -196,6 +211,8 @@ test.describe('@real-device Performance Tests', () => {
196211
// Wait for device to finish loading sensors
197212
await expect(page.locator('[title="Loading..."]')).not.toBeVisible({ timeout: 10000 })
198213

214+
await expandSensorModules(deviceCard)
215+
199216
const depthToggle = page.locator('[data-testid="toggle-stream-depth"]').first()
200217
await depthToggle.check()
201218

0 commit comments

Comments
 (0)