Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(app): Fix gantry not homing when no labware in gripper jaws during Error Recovery #17201

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@ export const HOLDING_LABWARE_OPTIONS: HoldingLabwareOption[] = [
export function GripperIsHoldingLabware({
routeUpdateActions,
currentRecoveryOptionUtils,
recoveryCommands,
}: RecoveryContentProps): JSX.Element {
const {
proceedNextStep,
proceedToRouteAndStep,
goBackPrevStep,
handleMotionRouting,
} = routeUpdateActions
const { homeExceptPlungers } = recoveryCommands
const { selectedRecoveryOption } = currentRecoveryOptionUtils
const {
MANUAL_MOVE_AND_SKIP,
Expand All @@ -48,24 +51,29 @@ export function GripperIsHoldingLabware({
const { t } = useTranslation(['error_recovery', 'shared'])

const handleNoOption = (): void => {
switch (selectedRecoveryOption) {
case MANUAL_MOVE_AND_SKIP.ROUTE:
void proceedToRouteAndStep(
MANUAL_MOVE_AND_SKIP.ROUTE,
MANUAL_MOVE_AND_SKIP.STEPS.MANUAL_MOVE
)
break
case MANUAL_REPLACE_AND_RETRY.ROUTE:
void proceedToRouteAndStep(
MANUAL_REPLACE_AND_RETRY.ROUTE,
MANUAL_REPLACE_AND_RETRY.STEPS.MANUAL_REPLACE
)
break
default: {
console.error('Unexpected recovery option for gripper routing.')
void proceedToRouteAndStep(OPTION_SELECTION.ROUTE)
}
}
// The "yes" option also contains a home, but it occurs later in the control flow,
// after the user has extricated the labware from the gripper jaws.
void handleMotionRouting(true)
.then(() => homeExceptPlungers())
.then(() => {
switch (selectedRecoveryOption) {
case MANUAL_MOVE_AND_SKIP.ROUTE:
return proceedToRouteAndStep(
MANUAL_MOVE_AND_SKIP.ROUTE,
MANUAL_MOVE_AND_SKIP.STEPS.MANUAL_MOVE
)
case MANUAL_REPLACE_AND_RETRY.ROUTE:
return proceedToRouteAndStep(
MANUAL_REPLACE_AND_RETRY.ROUTE,
MANUAL_REPLACE_AND_RETRY.STEPS.MANUAL_REPLACE
)
default: {
console.error('Unexpected recovery option for gripper routing.')
return proceedToRouteAndStep(OPTION_SELECTION.ROUTE)
}
}
})
.finally(() => handleMotionRouting(false))
}

const primaryOnClick = (): void => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,25 @@ const render = (props: ComponentProps<typeof GripperIsHoldingLabware>) => {

let mockProceedToRouteAndStep: Mock
let mockProceedNextStep: Mock
let mockHandleMotionRouting: Mock
let mockHomeExceptPlungers: Mock

describe('GripperIsHoldingLabware', () => {
let props: ComponentProps<typeof GripperIsHoldingLabware>
beforeEach(() => {
mockProceedToRouteAndStep = vi.fn(() => Promise.resolve())
mockProceedNextStep = vi.fn(() => Promise.resolve())
mockHandleMotionRouting = vi.fn(() => Promise.resolve())
mockHomeExceptPlungers = vi.fn(() => Promise.resolve())

props = {
...mockRecoveryContentProps,
routeUpdateActions: {
proceedToRouteAndStep: mockProceedToRouteAndStep,
proceedNextStep: mockProceedNextStep,
handleMotionRouting: mockHandleMotionRouting,
} as any,
recoveryCommands: { homeExceptPlungers: mockHomeExceptPlungers } as any,
}
})

Expand Down Expand Up @@ -82,12 +88,24 @@ describe('GripperIsHoldingLabware', () => {
fireEvent.click(screen.getAllByLabelText('No')[0])
clickButtonLabeled('Continue')

await waitFor(() => {
expect(mockHandleMotionRouting).toHaveBeenCalledWith(true)
})

await waitFor(() => {
expect(mockHomeExceptPlungers).toHaveBeenCalled()
})

await waitFor(() => {
expect(mockProceedToRouteAndStep).toHaveBeenCalledWith(
RECOVERY_MAP.MANUAL_MOVE_AND_SKIP.ROUTE,
RECOVERY_MAP.MANUAL_MOVE_AND_SKIP.STEPS.MANUAL_MOVE
)
})

await waitFor(() => {
expect(mockHandleMotionRouting).toHaveBeenCalledWith(false)
})
})

it(`proceeds to the correct step when the no option is clicked for ${RECOVERY_MAP.MANUAL_REPLACE_AND_RETRY.ROUTE}`, async () => {
Expand Down
Loading