From 7d67da4f7c153ef0636e0725f483d21d12d1a915 Mon Sep 17 00:00:00 2001 From: Brent Hagen Date: Wed, 2 Mar 2022 16:49:38 -0500 Subject: [PATCH] test(app): add selectors for devices pages (#9611) backfill selectors for a variety of unified app devices pages closes #9434 --- app/src/atoms/ToggleBtn/index.tsx | 7 ++++--- app/src/organisms/Devices/DevicesEmptyState.tsx | 16 ++++++++++++++-- app/src/organisms/Devices/ModuleIcon.tsx | 1 + .../organisms/Devices/PipettesAndModules.tsx | 7 ++----- .../organisms/Devices/RecentProtocolRuns.tsx | 7 ++----- app/src/organisms/Devices/RobotCard.tsx | 9 +++++---- app/src/organisms/Devices/RobotOverview.tsx | 17 ++++++++++++----- app/src/organisms/Devices/RobotStatusBanner.tsx | 6 +++--- app/src/pages/Devices/DevicesLanding/index.tsx | 6 +++++- 9 files changed, 48 insertions(+), 28 deletions(-) diff --git a/app/src/atoms/ToggleBtn/index.tsx b/app/src/atoms/ToggleBtn/index.tsx index 96d50a6592d..5fa3aacd242 100644 --- a/app/src/atoms/ToggleBtn/index.tsx +++ b/app/src/atoms/ToggleBtn/index.tsx @@ -17,10 +17,11 @@ export interface ToggleBtnProps extends StyleProps { toggledOn: boolean disabled?: boolean | null onClick?: (e: React.MouseEvent) => unknown + id?: string } export function ToggleBtn(props: ToggleBtnProps): JSX.Element { - const { label, toggledOn, disabled, ...buttonProps } = props + const { label, toggledOn, disabled, id, ...buttonProps } = props const iconName = toggledOn ? 'ot-toggle-switch-on' : 'ot-toggle-switch-off' let color = C_DARK_GRAY @@ -32,12 +33,12 @@ export function ToggleBtn(props: ToggleBtnProps): JSX.Element { return ( diff --git a/app/src/organisms/Devices/DevicesEmptyState.tsx b/app/src/organisms/Devices/DevicesEmptyState.tsx index 0c37fd6a159..cd5a26e52e2 100644 --- a/app/src/organisms/Devices/DevicesEmptyState.tsx +++ b/app/src/organisms/Devices/DevicesEmptyState.tsx @@ -43,11 +43,21 @@ export function DevicesEmptyState(): JSX.Element { justifyContent={JUSTIFY_CENTER} padding={`${SPACING_5} 0`} > - + {t('no_robots_found')} - {t('refresh')} + + {t('refresh')} + {t('setting_up_new_robot')}{' '} @@ -70,6 +81,7 @@ export function DevicesEmptyState(): JSX.Element { color={C_BLUE} fontSize={FONT_SIZE_BODY_1} fontWeight={FONT_WEIGHT_SEMIBOLD} + id="DevicesEmptyState_troubleshootingConnectionProblems" > {t('troubleshooting_connection_problems')} diff --git a/app/src/organisms/Devices/ModuleIcon.tsx b/app/src/organisms/Devices/ModuleIcon.tsx index 638d92ac640..85c38ea9dd9 100644 --- a/app/src/organisms/Devices/ModuleIcon.tsx +++ b/app/src/organisms/Devices/ModuleIcon.tsx @@ -27,6 +27,7 @@ export const ModuleIcon = (props: ModuleIconProps): JSX.Element => { size={SIZE_1} marginRight={SPACING_1} color={C_HARBOR_GRAY} + id={`ModuleIcon_${moduleType}`} /> ) } diff --git a/app/src/organisms/Devices/PipettesAndModules.tsx b/app/src/organisms/Devices/PipettesAndModules.tsx index 7ae9249c1df..1174a109572 100644 --- a/app/src/organisms/Devices/PipettesAndModules.tsx +++ b/app/src/organisms/Devices/PipettesAndModules.tsx @@ -42,7 +42,7 @@ export function PipettesAndModules({ fontWeight={FONT_WEIGHT_SEMIBOLD} fontSize={FONT_SIZE_BODY_2} marginBottom={SPACING_3} - data-testid="PipettesAndModules_title" + id="PipettesAndModules_title" > {t('pipettes_and_modules')} @@ -64,10 +64,7 @@ export function PipettesAndModules({ })} ) : ( - + {t('offline_pipettes_and_modules')} )} diff --git a/app/src/organisms/Devices/RecentProtocolRuns.tsx b/app/src/organisms/Devices/RecentProtocolRuns.tsx index 578017ada01..899d36a616f 100644 --- a/app/src/organisms/Devices/RecentProtocolRuns.tsx +++ b/app/src/organisms/Devices/RecentProtocolRuns.tsx @@ -46,7 +46,7 @@ export function RecentProtocolRuns({ borderBottom={`1px solid ${C_MED_LIGHT_GRAY}`} padding={SPACING_3} width="100%" - data-testid="RecentProtocolRuns_title" + id="RecentProtocolRuns_title" > {t('recent_protocol_runs')} @@ -61,10 +61,7 @@ export function RecentProtocolRuns({ // TODO: recent protocol runs section (ticket #8696)
recent protocol runs here
) : ( - + {t('offline_recent_protocol_runs')} )} diff --git a/app/src/organisms/Devices/RobotCard.tsx b/app/src/organisms/Devices/RobotCard.tsx index 3b5a8fd6d88..2e011c90c32 100644 --- a/app/src/organisms/Devices/RobotCard.tsx +++ b/app/src/organisms/Devices/RobotCard.tsx @@ -47,7 +47,7 @@ export function RobotCard(props: RobotCardProps): JSX.Element | null { padding={SPACING_2} width="100%" > - + @@ -55,7 +55,7 @@ export function RobotCard(props: RobotCardProps): JSX.Element | null { {t('left_mount')} - + {attachedPipettes?.left?.modelSpecs.displayName ?? t('empty')} @@ -63,7 +63,7 @@ export function RobotCard(props: RobotCardProps): JSX.Element | null { {t('right_mount')} - + {attachedPipettes?.right?.modelSpecs.displayName ?? t('empty')} @@ -78,7 +78,8 @@ export function RobotCard(props: RobotCardProps): JSX.Element | null { {/* temp link from three dot menu to device detail page. Robot actions menu covered in ticket #8673 */} - + {/* attachment of RobotCard_overflowMenu selector may change */} + diff --git a/app/src/organisms/Devices/RobotOverview.tsx b/app/src/organisms/Devices/RobotOverview.tsx index cca5d6f1777..44ad3dd04bf 100644 --- a/app/src/organisms/Devices/RobotOverview.tsx +++ b/app/src/organisms/Devices/RobotOverview.tsx @@ -59,7 +59,11 @@ export function RobotOverview({ padding={SPACING_2} width="100%" > - + @@ -75,7 +79,7 @@ export function RobotOverview({ onClick={toggleLights} size={SIZE_2} marginRight={SPACING_2} - data-testid={`RobotOverview_${robot.name}_lights_toggle`} + id={`RobotOverview_lightsToggle`} /> {t('lights')} @@ -83,7 +87,7 @@ export function RobotOverview({ {/* this link will change once protocol selection designs are finalized and functionality built out */} - {/* temp link to robot settings until overflow menu implemented */} - + {/* temp link to robot settings until overflow menu implemented. selector may change */} + diff --git a/app/src/organisms/Devices/RobotStatusBanner.tsx b/app/src/organisms/Devices/RobotStatusBanner.tsx index abce026e29b..1ac7b9de18a 100644 --- a/app/src/organisms/Devices/RobotStatusBanner.tsx +++ b/app/src/organisms/Devices/RobotStatusBanner.tsx @@ -39,7 +39,7 @@ export function RobotStatusBanner(props: RobotStatusBannerProps): JSX.Element { {/* TODO: link to specific run page when built out */} {t('go_to_run')} @@ -50,13 +50,13 @@ export function RobotStatusBanner(props: RobotStatusBannerProps): JSX.Element { {/* robot_model can be seen in the health response, but only for "connectable" robots. Probably best to leave as "OT-2" for now */} - OT-2 + OT-2 {name} diff --git a/app/src/pages/Devices/DevicesLanding/index.tsx b/app/src/pages/Devices/DevicesLanding/index.tsx index 60b4fcc3ffe..765703a29a0 100644 --- a/app/src/pages/Devices/DevicesLanding/index.tsx +++ b/app/src/pages/Devices/DevicesLanding/index.tsx @@ -48,7 +48,11 @@ export function DevicesLanding(): JSX.Element { return ( - + {t('devices')}