Skip to content

Commit

Permalink
feat(protocol-designer, step-generation): wire up trash bin commands (#…
Browse files Browse the repository at this point in the history
…14052)

closes RAUT-866 RAUT-883, partially addresses RAUT-876
  • Loading branch information
jerader authored Dec 1, 2023
1 parent 3fdaf68 commit aa6312f
Show file tree
Hide file tree
Showing 53 changed files with 1,728 additions and 1,791 deletions.
148 changes: 50 additions & 98 deletions protocol-designer/cypress/integration/migrations.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'cypress-file-upload'
import cloneDeep from 'lodash/cloneDeep'
import { expectDeepEqual } from '@opentrons/shared-data/js/cypressUtils'
import { FLEX_TRASH_DEF_URI, OT_2_TRASH_DEF_URI } from '../../src/constants'
const semver = require('semver')

// TODO: (sa 2022-03-31: change these migration fixtures to v6 protocols once the liquids key is added to PD protocols
Expand All @@ -13,55 +12,54 @@ describe('Protocol fixtures migrate and match snapshots', () => {
})

const testCases = [
// TODO(jr, 11/20/23): add a test for v8 migrated to v8 with the deck config commands
// and fix up all the cypress tests when movable trash commands are all wired up
{
title: 'example_1_1_0 (schema 1, PD version 1.1.1) -> PD 8.0.x, schema 8',
importFixture: '../../fixtures/protocol/1/example_1_1_0.json',
expectedExportFixture:
'../../fixtures/protocol/8/example_1_1_0MigratedToV8.json',
unusedPipettes: true,
migrationModal: 'newLabwareDefs',
},
{
title: 'doItAllV3 (schema 3, PD version 4.0.0) -> PD 8.0.x, schema 8',
importFixture: '../../fixtures/protocol/4/doItAllV3.json',
expectedExportFixture:
'../../fixtures/protocol/8/doItAllV3MigratedToV8.json',
unusedPipettes: false,
migrationModal: 'v8',
},
{
title: 'doItAllV4 (schema 4, PD version 4.0.0) -> PD 8.0.x, schema 8',
importFixture: '../../fixtures/protocol/4/doItAllV4.json',
expectedExportFixture:
'../../fixtures/protocol/8/doItAllV4MigratedToV8.json',
unusedPipettes: false,
migrationModal: 'v8',
},
{
title:
'doItAll78MigratedToV8 (schema 7, PD version 8.0.0) -> should migrate to 8.0.x, schema 8',
importFixture: '../../fixtures/protocol/7/doItAllV7.json',
expectedExportFixture:
'../../fixtures/protocol/8/doItAllV7MigratedToV8.json',
unusedPipettes: false,
migrationModal: 'v8',
},
{
title:
'mix 5.0.x (schema 3, PD version 5.0.0) -> should migrate to 8.0.x, schema 8',
importFixture: '../../fixtures/protocol/5/mix_5_0_x.json',
expectedExportFixture: '../../fixtures/protocol/8/mix_8_0_0.json',
migrationModal: 'v8',
unusedPipettes: false,
},
// TODO(jr, 11/30/23): write a test fixture here for v8 migrated to v8 with deck config when the ff is removed
// {
// title: 'example_1_1_0 (schema 1, PD version 1.1.1) -> PD 8.0.x, schema 8',
// importFixture: '../../fixtures/protocol/1/example_1_1_0.json',
// title: 'doItAllV8 flex robot -> reimported',
// importFixture: '../../fixtures/protocol/8/doItAllV8.json',
// expectedExportFixture:
// '../../fixtures/protocol/8/example_1_1_0MigratedToV8.json',
// unusedPipettes: true,
// migrationModal: 'newLabwareDefs',
// },
// {
// title: 'doItAllV3 (schema 3, PD version 4.0.0) -> PD 8.0.x, schema 8',
// importFixture: '../../fixtures/protocol/4/doItAllV3.json',
// expectedExportFixture:
// '../../fixtures/protocol/8/doItAllV3MigratedToV8.json',
// unusedPipettes: false,
// migrationModal: 'generic',
// },
// {
// title: 'doItAllV4 (schema 4, PD version 4.0.0) -> PD 8.0.x, schema 8',
// importFixture: '../../fixtures/protocol/4/doItAllV4.json',
// expectedExportFixture:
// '../../fixtures/protocol/8/doItAllV4MigratedToV8.json',
// unusedPipettes: false,
// migrationModal: 'generic',
// },
// {
// title:
// 'doItAllV8 (schema 7, PD version 8.0.0) -> import and re-export should preserve data',
// importFixture: '../../fixtures/protocol/7/doItAllV4MigratedToV7.json',
// expectedExportFixture:
// '../../fixtures/protocol/7/doItAllV4MigratedToV7.json',
// unusedPipettes: false,
// migrationModal: null,
// },
// {
// title:
// 'mix 5.0.x (schema 3, PD version 5.0.0) -> should migrate to 8.0.x, schema 8',
// importFixture: '../../fixtures/protocol/5/mix_5_0_x.json',
// expectedExportFixture: '../../fixtures/protocol/8/mix_8_0_0.json',
// migrationModal: 'generic',
// unusedPipettes: false,
// },
// {
// title: 'doItAll7MigratedToV8 flex robot (schema 8, PD version 8.0.x)',
// importFixture: '../../fixtures/protocol/7/doItAllV7.json',
// expectedExportFixture:
// '../../fixtures/protocol/8/doItAllV7MigratedToV8.json',
// migrationModal: 'generic',
// '../../fixtures/protocol/8/doItAllV8.json',
// migrationModal: 'noBehaviorChange',
// unusedPipettes: false,
// },
]
Expand Down Expand Up @@ -95,11 +93,9 @@ describe('Protocol fixtures migrate and match snapshots', () => {
})

if (migrationModal) {
if (migrationModal === 'generic') {
if (migrationModal === 'v8') {
cy.get('div')
.contains(
'Updating the file may make changes to liquid handling actions'
)
.contains('Protocol Designer no longer supports aspirate or mix')
.should('exist')
cy.get('button').contains('ok', { matchCase: false }).click()
} else if (migrationModal === 'newLabwareDefs') {
Expand Down Expand Up @@ -156,44 +152,18 @@ describe('Protocol fixtures migrate and match snapshots', () => {
f.designerApplication.data._internalAppBuildDate = 'Foo Date'
f.designerApplication.version = 'x.x.x'

// NOTE: labwareLocationUpdates, trash stubs can be removed for the release after 8.0.0
// NOTE: trash stubs can be removed post-8.0.0 release
// currently stubbed because of the newly created trash id for movable trash support
const labwareLocationUpdate =
f.designerApplication.data.savedStepForms
.__INITIAL_DECK_SETUP_STEP__.labwareLocationUpdate

Object.entries(labwareLocationUpdate).forEach(
([labwareId, slot]) => {
if (
labwareId.includes(OT_2_TRASH_DEF_URI) ||
labwareId.includes(FLEX_TRASH_DEF_URI)
) {
const trashId = 'trashId'
labwareLocationUpdate[trashId] = slot
delete labwareLocationUpdate[labwareId]
}
}
)

Object.values(
f.designerApplication.data.savedStepForms
).forEach(stepForm => {
if (stepForm.stepType === 'moveLiquid') {
stepForm.dropTip_location = 'trash drop tip location'
if (
stepForm.blowout_location.includes(OT_2_TRASH_DEF_URI) ||
stepForm.blowout_location.includes(FLEX_TRASH_DEF_URI)
) {
if (stepForm.blowout_location.includes('trashBin')) {
stepForm.blowout_location = 'trash blowout location'
}
}
if (stepForm.stepType === 'mix') {
if (
stepForm.labware.includes(OT_2_TRASH_DEF_URI) ||
stepForm.labware.includes(FLEX_TRASH_DEF_URI)
) {
stepForm.labware = 'trash'
}
stepForm.dropTip_location = 'trash drop tip location'
stepForm.blowout_location = 'trash blowout location'
}
Expand All @@ -202,24 +172,6 @@ describe('Protocol fixtures migrate and match snapshots', () => {
if ('key' in command) {
command.key = '123'
}
if (
command.commandType === 'loadLabware' &&
command.params.displayName === 'Opentrons Fixed Trash'
) {
command.params.labwareId = 'loadTrash'
}
if (command.commandType === 'dropTip') {
command.params.labwareId = 'dropTipLabwareId'
}
if (
(command.commandType === 'aspirate' ||
command.commandType === 'dispense' ||
command.commandType === 'blowout') &&
(command.params.labwareId.includes(OT_2_TRASH_DEF_URI) ||
command.params.labwareId.includes(FLEX_TRASH_DEF_URI))
) {
command.params.labwareId = 'trash'
}
})
})

Expand Down
Loading

0 comments on commit aa6312f

Please sign in to comment.