Skip to content

Commit

Permalink
Test updates
Browse files Browse the repository at this point in the history
  • Loading branch information
smb2268 committed Jul 19, 2024
1 parent 4067224 commit 1604dac
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 188 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export function LabwareListItem(
switch (moduleTypeNeedsAttention) {
case MAGNETIC_MODULE_TYPE:
case THERMOCYCLER_MODULE_TYPE:
if (moduleModel == THERMOCYCLER_MODULE_V2) {
if (moduleModel !== THERMOCYCLER_MODULE_V2) {
secureLabwareInstructions = (
<Btn
css={css`
Expand Down Expand Up @@ -274,7 +274,12 @@ export function LabwareListItem(
{slotInfo != null && isFlex ? (
<LocationIcon slotName={slotInfo} />
) : (
{ slotInfo }
<StyledText
css={TYPOGRAPHY.pSemiBold}
data-testid={`slot_info_${slotInfo}`}
>
{slotInfo}
</StyledText>
)}
{nestedLabwareInfo != null || moduleDisplayName != null ? (
<LocationIcon iconName="stacked" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@ import {
StyledText,
COLORS,
} from '@opentrons/components'
import {
getLabwareSetupItemGroups,
LabwareSetupItem,
} from '../../../../pages/Protocols/utils'
import { getLabwareSetupItemGroups } from '../../../../pages/Protocols/utils'
import { LabwareListItem } from './LabwareListItem'
import { getNestedLabwareInfo } from './getNestedLabwareInfo'

import type { RunTimeCommand } from '@opentrons/shared-data'
import type { ModuleRenderInfoForProtocol } from '../../hooks'
import type { ModuleTypesThatRequireExtraAttention } from '../utils/getModuleTypesThatRequireExtraAttention'
import type { LabwareSetupItem } from '../../../../pages/Protocols/utils'

const HeaderRow = styled.div`
display: grid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ describe('LabwareListItem', () => {
})
screen.getByText('Mock Labware Definition')
screen.getByTestId('slot_info_7')
screen.getByTestId('LocationIcon_stacked')
screen.getByText('Magnetic Module GEN1')
const button = screen.getByText('Secure labware instructions')
fireEvent.click(button)
Expand Down Expand Up @@ -206,6 +207,7 @@ describe('LabwareListItem', () => {
})
screen.getByText('Mock Labware Definition')
screen.getByTestId('slot_info_7')
screen.getByTestId('LocationIcon_stacked')
screen.getByText('Temperature Module GEN1')
screen.getByText('nickName')
})
Expand Down Expand Up @@ -314,7 +316,6 @@ describe('LabwareListItem', () => {
screen.getByText('mock nested display name')
screen.getByText('nestedLabwareNickName')
screen.getByText('nickName')
screen.getByText('On deck')
})

it('renders the correct info for a labware on top of a heater shaker', () => {
Expand Down Expand Up @@ -375,6 +376,6 @@ describe('LabwareListItem', () => {
nestedLabwareInfo: null,
})
screen.getByText('Mock Labware Definition')
screen.getByText('Off deck')
screen.getByTestId('slot_info_OFF DECK')
})
})
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import * as React from 'react'
import { StaticRouter } from 'react-router-dom'
import { describe, it, beforeEach, vi, expect } from 'vitest'
import { describe, it, beforeEach, vi } from 'vitest'
import { screen } from '@testing-library/react'

import { multiple_tipacks_with_tc } from '@opentrons/shared-data'

import { renderWithProviders } from '../../../../../__testing-utils__'
import { i18n } from '../../../../../i18n'
import { mockDefinition } from '../../../../../redux/custom-labware/__fixtures__'
import { SetupLabwareList } from '../SetupLabwareList'
import { LabwareListItem } from '../LabwareListItem'
import type {
CompletedProtocolAnalysis,
RunTimeCommand,
} from '@opentrons/shared-data'
import type { CompletedProtocolAnalysis } from '@opentrons/shared-data'

vi.mock('../LabwareListItem')

Expand All @@ -30,139 +26,6 @@ const render = (props: React.ComponentProps<typeof SetupLabwareList>) => {
)[0]
}

const mockOffDeckCommands = ([
{
id: '0abc1',
commandType: 'loadPipette',
params: {
pipetteId: 'pipetteId',
mount: 'left',
},
},
{
id: '0abc2',
commandType: 'loadLabware',
params: {
labwareId: 'fixedTrash',
location: {
slotName: '12',
},
},
result: {
labwareId: 'fixedTrash',
definition: {
ordering: [['A1']],
metadata: {
displayCategory: 'trash',
displayName: 'Opentrons Fixed Trash',
},
},
},
},
{
id: '0abc3',
commandType: 'loadLabware',
params: {
labwareId: 'tiprackId',
location: {
slotName: '1',
},
},
result: {
labwareId: 'labwareId',
definition: mockDefinition,
},
},
{
id: '0abc4',
commandType: 'loadLabware',
params: {
labwareId: 'sourcePlateId',
location: {
slotName: '2',
},
},
result: {
labwareId: 'labwareId',
definition: mockDefinition,
},
},
{
id: '0abc4',
commandType: 'loadLabware',
params: {
labwareId: 'destPlateId',
location: {
slotName: '3',
},
},
result: {
labwareId: 'labwareId',
definition: mockDefinition,
},
},
{
id: '0',
commandType: 'pickUpTip',
params: {
pipetteId: 'pipetteId',
labwareId: 'tiprackId',
wellName: 'B1',
},
},
{
id: '1',
commandType: 'aspirate',
params: {
pipetteId: 'pipetteId',
labwareId: 'sourcePlateId',
wellName: 'A1',
volume: 5,
flowRate: 3,
wellLocation: {
origin: 'bottom',
offset: { x: 0, y: 0, z: 2 },
},
},
},
{
id: '2',
commandType: 'dispense',
params: {
pipetteId: 'pipetteId',
labwareId: 'destPlateId',
wellName: 'B1',
volume: 4.5,
flowRate: 2.5,
wellLocation: {
origin: 'bottom',
offset: { x: 0, y: 0, z: 1 },
},
},
},
{
id: '3',
commandType: 'dropTip',
params: {
pipetteId: 'pipetteId',
labwareId: 'fixedTrash',
wellName: 'A1',
},
},
{
id: '4',
commandType: 'loadLabware',
params: {
labwareId: 'fixedTrash',
location: 'offDeck',
},
result: {
labwareId: 'labwareId',
definition: mockDefinition,
},
},
] as any) as RunTimeCommand[]

describe('SetupLabwareList', () => {
beforeEach(() => {
vi.mocked(LabwareListItem).mockReturnValue(
Expand All @@ -186,34 +49,5 @@ describe('SetupLabwareList', () => {
screen.getAllByText('mock labware list item')
screen.getByText('Labware name')
screen.getByText('Location')
screen.getByText('Placement')
})
it('renders null for the offdeck labware list when there are none', () => {
render({
commands: protocolWithTC.commands,
extraAttentionModules: [],
attachedModuleInfo: {
x: 1,
y: 2,
z: 3,
attachedModuleMatch: null,
moduleId: 'moduleId',
} as any,
isFlex: false,
})
expect(
screen.queryByText('Additional Off-Deck Labware')
).not.toBeInTheDocument()
})

it('renders offdeck labware list when there are additional offdeck labwares', () => {
render({
commands: mockOffDeckCommands,
extraAttentionModules: [],
attachedModuleInfo: {} as any,
isFlex: false,
})
screen.getByText('Additional Off-Deck Labware')
screen.getAllByText('mock labware list item')
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ describe('EmptySetupStep', () => {
props = {
title: 'mockTitle',
description: 'mockDescription',
label: 'mockLabel',
}
})

it('should render the title, description, and label', () => {
render(props)
screen.getByText('mockTitle')
screen.getByText('mockDescription')
screen.getByText('mockLabel')
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ describe('ProtocolRunSetup', () => {
.thenReturn({ complete: false })

render()
screen.getByText('STEP 2')
screen.getByText('Deck hardware')
screen.getByText('Calibration needed')
})
Expand All @@ -304,7 +303,6 @@ describe('ProtocolRunSetup', () => {
.thenReturn({ complete: false })

render()
screen.getByText('STEP 2')
screen.getByText('Deck hardware')
screen.getByText('Action needed')
})
Expand Down Expand Up @@ -338,7 +336,6 @@ describe('ProtocolRunSetup', () => {
.thenReturn({ complete: false })

render()
screen.getByText('STEP 2')
screen.getByText('Deck hardware')
screen.getByText('Action needed')
})
Expand All @@ -353,16 +350,13 @@ describe('ProtocolRunSetup', () => {
it('renders correct text contents for multiple modules', () => {
render()

screen.getByText('STEP 1')
screen.getByText('Instruments')
screen.getByText(
'Review required pipettes and tip length calibrations for this protocol.'
)
screen.getByText('STEP 2')
screen.getByText('Deck hardware')

screen.getByText('Install the required modules.')
screen.getByText('STEP 3')
screen.getByText('Labware')

screen.getByText(
Expand All @@ -389,16 +383,13 @@ describe('ProtocolRunSetup', () => {
])
render()

screen.getByText('STEP 1')
screen.getByText('Instruments')
screen.getByText(
'Review required pipettes and tip length calibrations for this protocol.'
)
screen.getByText('STEP 2')
screen.getByText('Deck hardware')

screen.getByText('Install the required module.')
screen.getByText('STEP 3')
screen.getByText('Labware')
screen.getByText(
'Gather the following labware and full tip racks. To run your protocol without Labware Position Check, place and secure labware in their initial locations.'
Expand All @@ -425,7 +416,6 @@ describe('ProtocolRunSetup', () => {
])
render()

screen.getByText('STEP 2')
screen.getByText('Deck hardware')
screen.getByText(
'Install and calibrate the required modules. Install the required fixtures.'
Expand Down

0 comments on commit 1604dac

Please sign in to comment.