Skip to content

Commit

Permalink
feat(app): add id attributes for e2e testing (#8262)
Browse files Browse the repository at this point in the history
* feat(app): add id attributes for e2e testing
  • Loading branch information
shlokamin committed Aug 27, 2021
1 parent 557e583 commit 9d4274c
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export const ExtraAttentionWarning = (
marginY={SPACING_3}
backgroundColor={COLOR_WARNING_LIGHT}
color={C_DARK_GRAY}
id={'ExtraAttentionWarning'}
>
<Box margin={SPACING_3}>
<Flex margin={SPACING_2}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export const LabwareSetupModal = (
onClick={props.onCloseClick}
width={SIZE_4}
backgroundColor={C_BLUE}
id={'LabwareSetupModal_closeButton'}
>
{t('shared:close')}
</PrimaryBtn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export const LabwareSetup = (props: LabwareSetupProps): JSX.Element | null => {
viewBox={DECK_MAP_VIEWBOX}
className={styles.deck_map}
deckLayerBlocklist={DECK_LAYER_BLOCKLIST}
id={'LabwareSetup_deckMap'}
>
{() => {
return (
Expand Down Expand Up @@ -154,6 +155,7 @@ export const LabwareSetup = (props: LabwareSetupProps): JSX.Element | null => {
marginRight={SPACING_3}
onClick={() => console.log('check labware positions!')}
color={C_BLUE}
id={'LabwareSetup_checkLabwarePositionsButton'}
>
{t('check_labware_positions')}
</SecondaryBtn>
Expand All @@ -162,6 +164,7 @@ export const LabwareSetup = (props: LabwareSetupProps): JSX.Element | null => {
disabled={proceedToRunDisabled}
as={LinkComponent}
backgroundColor={C_BLUE}
id={'LabwareSetup_proceedToRunButton'}
{...linkProps}
{...targetProps}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const ModuleSetup = (props: ModuleSetupProps): JSX.Element | null => {
viewBox={DECK_VIEW_BOX}
className={styles.deck_map}
deckLayerBlocklist={DECK_LAYER_BLOCKLIST}
id={'ModuleSetup_deckMap'}
>
{() => {
return (
Expand Down Expand Up @@ -115,6 +116,7 @@ export const ModuleSetup = (props: ModuleSetupProps): JSX.Element | null => {
title={t('proceed_to_labware_setup_step')}
onClick={expandLabwareSetupStep}
backgroundColor={C_BLUE}
id={'ModuleSetup_proceedToLabwareSetup'}
>
{t('proceed_to_labware_setup_step')}
</PrimaryBtn>
Expand Down
14 changes: 12 additions & 2 deletions app/src/organisms/ProtocolUpload/UploadInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ export function UploadInput(props: UploadInputProps): JSX.Element {
<Text as="h1" css={FONT_HEADER_DARK} marginBottom={SPACING_3}>
{t('open_a_protocol')}
</Text>
<PrimaryBtn onClick={handleClick} marginBottom={SPACING_4}>
<PrimaryBtn
onClick={handleClick}
marginBottom={SPACING_4}
id={'UploadInput_protocolUploadButton'}
>
{t('choose_file')}
</PrimaryBtn>
<label
Expand All @@ -123,7 +127,11 @@ export function UploadInput(props: UploadInputProps): JSX.Element {
css={dropZoneStyles}
>
<Icon width={SIZE_3} name="upload" marginBottom={SPACING_4} />
<span aria-controls="file_input" role="button">
<span
aria-controls="file_input"
role="button"
id={'UploadInput_fileUploadLabel'}
>
{t('drag_file_here')}
</span>
<input
Expand All @@ -148,6 +156,7 @@ export function UploadInput(props: UploadInputProps): JSX.Element {
href={PROTOCOL_LIBRARY_URL}
width="19rem"
marginBottom={SPACING_3}
id={'UploadInput_protocolLibraryButton'}
>
{t('browse_protocol_library')}
</SecondaryBtn>
Expand All @@ -156,6 +165,7 @@ export function UploadInput(props: UploadInputProps): JSX.Element {
external
href={PROTOCOL_DESIGNER_URL}
width="19rem"
id={'UploadInput_protocolDesignerButton'}
>
{t('launch_protocol_designer')}
</SecondaryBtn>
Expand Down
4 changes: 3 additions & 1 deletion components/src/deck/RobotWorkSpace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ export interface RobotWorkSpaceProps {
className?: string
children?: (props: RobotWorkSpaceRenderProps) => React.ReactNode
deckLayerBlocklist?: string[]
id?: string
}

type GetRobotCoordsFromDOMCoords = RobotWorkSpaceRenderProps['getRobotCoordsFromDOMCoords']

export function RobotWorkSpace(props: RobotWorkSpaceProps): JSX.Element | null {
const { children, deckDef, deckLayerBlocklist = [], viewBox } = props
const { children, deckDef, deckLayerBlocklist = [], viewBox, id } = props
const wrapperRef = React.useRef<SVGSVGElement>(null)

// NOTE: getScreenCTM in Chrome a DOMMatrix type,
Expand Down Expand Up @@ -55,6 +56,7 @@ export function RobotWorkSpace(props: RobotWorkSpaceProps): JSX.Element | null {
className={cx(styles.robot_work_space, props.className)}
viewBox={viewBox || wholeDeckViewBox}
ref={wrapperRef}
id={id}
>
{deckDef && (
<DeckFromData def={deckDef} layerBlocklist={deckLayerBlocklist} />
Expand Down

0 comments on commit 9d4274c

Please sign in to comment.