Skip to content

Commit

Permalink
fix(app): unload adapters after checking position of labware on adapt…
Browse files Browse the repository at this point in the history
…er on heater shaker module (#13803)

Properly combine dynamic logic for opening the heater shaker latch and offloading the labware and
adapters in the correct order during LPC checks of labware on adapters on heater shaker modules

Closes RAUT-803

Co-authored-by: Shlok Amin <[email protected]>
  • Loading branch information
b-cooper and shlokamin authored Oct 18, 2023
1 parent 295908b commit 855ec92
Show file tree
Hide file tree
Showing 2 changed files with 159 additions and 15 deletions.
28 changes: 13 additions & 15 deletions app/src/organisms/LabwarePositionCheck/CheckItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,18 @@ export const CheckItem = (props: CheckItemProps): JSX.Element | null => {
]

const handleConfirmPosition = (): void => {
let confirmPositionCommands: CreateCommand[] = [
const heaterShakerPrepCommands: CreateCommand[] =
moduleId != null &&
moduleType != null &&
moduleType === HEATERSHAKER_MODULE_TYPE
? [
{
commandType: 'heaterShaker/openLabwareLatch',
params: { moduleId },
},
]
: []
const confirmPositionCommands: CreateCommand[] = [
{
commandType: 'retractAxis' as const,
params: {
Expand All @@ -338,23 +349,10 @@ export const CheckItem = (props: CheckItemProps): JSX.Element | null => {
commandType: 'retractAxis' as const,
params: { axis: 'y' },
},
...heaterShakerPrepCommands,
...moveLabwareOffDeck,
]

if (
moduleId != null &&
moduleType != null &&
moduleType === HEATERSHAKER_MODULE_TYPE
) {
confirmPositionCommands = [
confirmPositionCommands[0],
{
commandType: 'heaterShaker/openLabwareLatch',
params: { moduleId },
},
confirmPositionCommands[1],
]
}
chainRunCommands(
[
{ commandType: 'savePosition', params: { pipetteId } },
Expand Down
146 changes: 146 additions & 0 deletions app/src/organisms/LabwarePositionCheck/__tests__/CheckItem.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,152 @@ describe('CheckItem', () => {
)
})

it('executes correct chained commands when confirm position clicked with HS and adapter', async () => {
props = {
...props,
location: { slotName: 'D1', moduleModel: HEATERSHAKER_MODULE_V1 },
adapterId: 'adapterId',
moduleId: 'heaterShakerId',
protocolData: {
...props.protocolData,
modules: [
{
id: 'heaterShakerId',
model: HEATERSHAKER_MODULE_V1,
location: { slotName: 'D3' },
serialNumber: 'firstHSSerial',
},
],
},
workingOffsets: [
{
location: { slotName: 'D1', moduleModel: HEATERSHAKER_MODULE_V1 },
labwareId: 'labwareId1',
initialPosition: { x: 1, y: 2, z: 3 },
finalPosition: null,
},
],
}
when(mockChainRunCommands)
.calledWith(
[
{
commandType: 'savePosition',
params: { pipetteId: 'pipetteId1' },
},
{
commandType: 'retractAxis' as const,
params: {
axis: 'leftZ',
},
},
{
commandType: 'retractAxis' as const,
params: {
axis: 'x',
},
},
{
commandType: 'retractAxis' as const,
params: {
axis: 'y',
},
},
{
commandType: 'heaterShaker/openLabwareLatch',
params: { moduleId: 'heaterShakerId' },
},
{
commandType: 'moveLabware',
params: {
labwareId: 'labwareId1',
newLocation: 'offDeck',
strategy: 'manualMoveWithoutPause',
},
},
{
commandType: 'moveLabware',
params: {
labwareId: 'adapterId',
newLocation: 'offDeck',
strategy: 'manualMoveWithoutPause',
},
},
],
false
)
.mockImplementation(() =>
Promise.resolve([
{
data: {
commandType: 'savePosition',
result: { position: mockEndPosition },
},
},
{},
{},
{},
{},
{},
{},
])
)

const { getByRole } = render(props)
await getByRole('button', { name: 'Confirm position' }).click()

await expect(props.chainRunCommands).toHaveBeenNthCalledWith(
1,
[
{
commandType: 'savePosition',
params: { pipetteId: 'pipetteId1' },
},
{
commandType: 'retractAxis' as const,
params: {
axis: 'leftZ',
},
},
{
commandType: 'retractAxis' as const,
params: { axis: 'x' },
},
{
commandType: 'retractAxis' as const,
params: { axis: 'y' },
},
{
commandType: 'heaterShaker/openLabwareLatch',
params: { moduleId: 'heaterShakerId' },
},
{
commandType: 'moveLabware',
params: {
labwareId: 'labwareId1',
newLocation: 'offDeck',
strategy: 'manualMoveWithoutPause',
},
},
{
commandType: 'moveLabware',
params: {
labwareId: 'adapterId',
newLocation: 'offDeck',
strategy: 'manualMoveWithoutPause',
},
},
],
false
)
await expect(props.registerPosition).toHaveBeenNthCalledWith(1, {
type: 'finalPosition',
labwareId: 'labwareId1',
location: { slotName: 'D1', moduleModel: HEATERSHAKER_MODULE_V1 },
position: mockEndPosition,
})
})

it('executes thermocycler open lid command on mount if checking labware on thermocycler', () => {
props = {
...props,
Expand Down

0 comments on commit 855ec92

Please sign in to comment.