Skip to content

Commit 30b2dc6

Browse files
authored
feat(protocol-designer): add 8.5.0 migration modal (#18673)
This PR adds copy for 8.5.0 migration modal and wires it up. It also updates the copy for import confirmation from "Confirm" to "Import", and updates tests accordingly. Closes AUTH-1975
1 parent b6b4f20 commit 30b2dc6

File tree

7 files changed

+46
-257
lines changed

7 files changed

+46
-257
lines changed

protocol-designer/cypress/e2e/migrations.cy.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,65 +23,65 @@ describe('Protocol fixtures migrate and match snapshots', () => {
2323
title: 'example_1_1_0 (schema 1, PD version 1.1.1) -> PD 8.5.x, schema 8',
2424
importTestFile: TestFilePath.Example_1_1_0,
2525
expectedTestFile: TestFilePath.Example_1_1_0V8,
26-
migrationModal: 'newLabwareDefs',
26+
showMigrationModal: true,
2727
},
2828
{
2929
title: 'doItAllV3 (schema 3, PD version 4.0.0) -> PD 8.5.x, schema 8',
3030
importTestFile: TestFilePath.DoItAllV3V4,
3131
expectedTestFile: TestFilePath.DoItAllV3MigratedToV8,
32-
migrationModal: 'v8.1',
32+
showMigrationModal: true,
3333
},
3434
{
3535
title: 'doItAllV4 (schema 4, PD version 4.0.0) -> PD 8.5.x, schema 8',
3636
importTestFile: TestFilePath.DoItAllV4V4,
3737
expectedTestFile: TestFilePath.DoItAllV4MigratedToV8,
38-
migrationModal: 'v8.1',
38+
showMigrationModal: true,
3939
},
4040
{
4141
title:
4242
'doItAllv7MigratedToV8 (schema 7, PD version 8.0.0) -> should migrate to 8.5.x, schema 8',
4343
importTestFile: TestFilePath.DoItAllV7,
4444
expectedTestFile: TestFilePath.DoItAllV7MigratedToV8,
45-
migrationModal: 'v8.1',
45+
showMigrationModal: true,
4646
},
4747
{
4848
title:
4949
'96-channel full and column schema 8 -> should migrate to 8.5.x, schema 8',
5050
importTestFile: TestFilePath.NinetySixChannelFullAndColumn,
5151
expectedTestFile: TestFilePath.NinetySixChannelFullAndColumn,
52-
migrationModal: null,
52+
showMigrationModal: false,
5353
},
5454
{
5555
title:
5656
'doItAllV8 flex robot -> reimported, should migrate to 8.5.x, schema 8',
5757
importTestFile: TestFilePath.DoItAllV8,
5858
expectedTestFile: TestFilePath.DoItAllV8,
59-
migrationModal: null,
59+
showMigrationModal: false,
6060
},
6161
{
6262
title:
6363
'new advanced settings with multi temp => reimported, should not migrate and stay at 8.5.x, schema 8',
6464
importTestFile: TestFilePath.NewAdvancedSettingsAndMultiTemp,
6565
expectedTestFile: TestFilePath.NewAdvancedSettingsAndMultiTemp,
66-
migrationModal: null,
66+
showMigrationModal: false,
6767
},
6868
{
6969
title:
7070
'thermocycler on Ot2 (schema 7, PD version 7.0.0) -> should migrate to 8.5.x, schema 8',
7171
importTestFile: TestFilePath.ThermocyclerOnOt2V7,
7272
expectedTestFile: TestFilePath.ThermocyclerOnOt2V7MigratedToV8,
73-
migrationModal: 'v8.1',
73+
showMigrationModal: true,
7474
},
7575
]
7676

7777
testCases.forEach(
78-
({ title, importTestFile, expectedTestFile, migrationModal }) => {
78+
({ title, importTestFile, expectedTestFile, showMigrationModal }) => {
7979
it(title, () => {
8080
migrateAndMatchSnapshot({
8181
title,
8282
importTestFile,
8383
expectedTestFile,
84-
migrationModal,
84+
showMigrationModal,
8585
})
8686
})
8787
}

protocol-designer/cypress/support/Import.ts

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ export interface MigrateTestCase {
1111
title: string
1212
importTestFile: TestFilePath
1313
expectedTestFile: TestFilePath
14-
migrationModal: 'newLabwareDefs' | 'v8.1' | 'noBehaviorChange' | null
14+
showMigrationModal: boolean
1515
}
1616

1717
export const ContentStrings = {
1818
newLabwareDefs: 'Update protocol to use new labware definitions',
1919
v8_1: 'The default dispense height is now 1 mm from the bottom of the well',
20+
v8_5:
21+
'Your protocol will be automatically updated to the latest version. We recommend making a separate copy of your file before importing.',
2022
noBehaviorChange:
2123
'We have added new features since the last time this protocol was updated, but have not made any changes to existing protocol behavior',
2224
exportButton: 'Export JSON',
@@ -26,6 +28,7 @@ export const ContentStrings = {
2628
'Your protocol was made in an older version of Protocol Designer',
2729
confirmButton: 'Confirm',
2830
cancelButton: 'Cancel',
31+
importButton: 'Import',
2932
protocolMetadata: 'Protocol Metadata',
3033
instruments: 'Instruments',
3134
liquidDefinitions: 'Liquid Definitions',
@@ -46,9 +49,9 @@ export const verifyOldProtocolModal = (): void => {
4649
cy.contains(ContentStrings.migrationModal)
4750
.should('exist')
4851
.and('be.visible')
49-
cy.contains(ContentStrings.confirmButton).should('be.visible')
52+
cy.contains(ContentStrings.importButton).should('be.visible')
5053
cy.contains(ContentStrings.cancelButton).should('be.visible')
51-
cy.contains(ContentStrings.confirmButton).click({ force: true })
54+
cy.contains(ContentStrings.importButton).click({ force: true })
5255
})
5356
}
5457

@@ -70,21 +73,14 @@ export const verifyImportProtocolPage = (protocol: TestFile): void => {
7073
export const migrateAndMatchSnapshot = ({
7174
importTestFile,
7275
expectedTestFile,
73-
migrationModal,
76+
showMigrationModal,
7477
}: MigrateTestCase): void => {
7578
const uploadProtocol: TestFile = getTestFile(importTestFile)
7679
cy.importProtocol(uploadProtocol.path)
7780

78-
if (migrationModal !== null) {
79-
if (migrationModal === 'v8.1') {
80-
cy.get('div').contains(ContentStrings.v8_1).should('exist')
81-
} else if (migrationModal === 'newLabwareDefs') {
82-
cy.get('div').contains(ContentStrings.newLabwareDefs).should('exist')
83-
} else if (migrationModal === 'noBehaviorChange') {
84-
cy.get('div').contains(ContentStrings.noBehaviorChange).should('exist')
85-
}
81+
if (showMigrationModal) {
8682
cy.get('button')
87-
.contains(ContentStrings.confirmButton, { matchCase: false })
83+
.contains(ContentStrings.importButton, { matchCase: false })
8884
.click({ force: true })
8985
}
9086

protocol-designer/src/assets/localization/en/shared.json

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -63,35 +63,8 @@
6363
"magneticmoduletype": "Magnetic Module",
6464
"migration_header": "Your protocol was made in an older version of Protocol Designer",
6565
"migrations": {
66-
"noBehaviorChange": {
67-
"body1": "Your protocol will be automatically updated to the latest version.",
68-
"body2": "We have added new features since the last time this protocol was updated, but have not made any changes to existing protocol behavior. Because of this we do not expect any changes in how the robot will execute this protocol. To be safe we will still recommend keeping a separate copy of the file you just imported.",
69-
"body3": "As always, please contact us with any questions or feedback."
70-
},
71-
"toV8_1Migration": {
72-
"body1": "Your protocol will be automatically updated to the latest version.",
73-
"body2": "The default dispense height is now 1 mm from the bottom of the well, instead of 0.5 mm. All dispense commands without a custom height will change to use the new default height.",
74-
"body3": "Additionally, blowout actions now precede touch tip actions. The new order affects all dispenses that include both actions."
75-
},
76-
"toV8Migration": {
77-
"body1": "Your protocol will be automatically updated to the latest version.",
78-
"body2": "Protocol Designer no longer supports aspirate or mix actions in a trash bin. If your protocol contains these actions, an error icon will appear next to them in the Protocol Timeline. To resolve the error, choose another location for aspirating or mixing.",
79-
"body3": "Additionally, we have addressed a bug where blow out speeds were slower than expected. Your protocol will automatically update the flow rates unless they were specifically initialized.",
80-
"body4": "As always, please contact us with any questions or feedback."
81-
},
8266
"generic": {
83-
"body1": "Your protocol will be automatically updated to the latest version. Please note that the updated file will be incompatible with older versions of the Protocol Designer. We recommend making a separate copy of the file that you just imported before continuing.",
84-
"body2": "Updating the file may make changes to liquid handling actions. Please review your file in the Protocol Designer",
85-
"body3": "As always, please contact us with any questions or feedback."
86-
},
87-
"toV3Migration": {
88-
"title": "Update protocol to use new labware definitions",
89-
"body1": "<strong>To import your file successfully, you must update your protocol to use the new labware definitions. </strong>Your protocol was made using an older version of Protocol Designer. Since then, Protocol Designer has been improved to include new labware definitions which are more accurate and reliable.",
90-
"body2": "What this means for you protocol",
91-
"body3": "Updating your protocol to use the new labware definitions will consequently require you to re-calibrate all labware in your protocol prior to running it on your robot. We recommend you try a dry run or one with water to ensure everything is working as expected.",
92-
"body4": "What happens if you don't update",
93-
"body5": "If you choose not to update, you will still be able to run your protocol as usual with older labware, however you will not be able to make further updates to this protocol using the Protocol Designer.",
94-
"body6": "Please note that in order to run the updated protocol on your robot successfully, the OT-2 App and robot are required to be updated to version 3.10.0 or higher."
67+
"body1": "Your protocol will be automatically updated to the latest version. We recommend making a separate copy of your file before importing."
9568
}
9669
},
9770
"magneticBlockAndStagingArea": "{{module}} with Staging Area",

protocol-designer/src/components/organisms/FileUploadMessagesModal/__tests__/FileUploadMessagesModal.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ describe('FileUploadMessagesModal', () => {
3838
vi.mocked(getFileUploadMessages).mockReturnValue({
3939
isError: false,
4040
messageKey: 'DID_MIGRATE',
41-
migrationsRan: ['8.1.0'],
41+
migrationsRan: ['8.5.0'],
4242
})
4343
render()
4444
screen.getByText(
4545
'Your protocol was made in an older version of Protocol Designer'
4646
)
4747
screen.getByText(
48-
'Your protocol will be automatically updated to the latest version.'
48+
'Your protocol will be automatically updated to the latest version. We recommend making a separate copy of your file before importing.'
4949
)
50-
fireEvent.click(screen.getByRole('button', { name: 'Confirm' }))
50+
fireEvent.click(screen.getByRole('button', { name: 'Import' }))
5151
expect(vi.mocked(dismissFileUploadMessage)).toHaveBeenCalled()
5252
fireEvent.click(screen.getByRole('button', { name: 'Cancel' }))
5353
expect(vi.mocked(undoLoadFile)).toHaveBeenCalled()

protocol-designer/src/components/organisms/FileUploadMessagesModal/__tests__/utils.test.ts

Lines changed: 5 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -4,53 +4,10 @@ import { getMigrationMessage } from '../utils'
44

55
const tMock = (key: string) => key
66

7-
describe('modalContents', () => {
8-
describe('getMigrationMessage', () => {
9-
it('should return the v3 migration message when migrating to v3', () => {
10-
const migrationsList = [
11-
['3.0.0'],
12-
['3.0.0', '4.0.0'],
13-
['3.0.0', '4.0.0', '5.0.0'],
14-
['3.0.0', '4.0.0', '5.0.0', '5.1.0'],
15-
['3.0.0', '4.0.0', '5.0.0', '5.1.0, 5.2.0'],
16-
]
17-
migrationsList.forEach(migrations => {
18-
expect(
19-
JSON.stringify(
20-
getMigrationMessage({ migrationsRan: migrations, t: tMock })
21-
)
22-
).toEqual(expect.stringContaining('migrations.toV3Migration.title'))
23-
})
24-
})
25-
it('should return the "no behavior change message" when migrating from v5.x to 6', () => {
26-
const migrationsList = [
27-
['5.0.0'],
28-
['5.0.0', '5.1.0'],
29-
['5.0.0', '5.1.0', '5.2.0'],
30-
]
31-
migrationsList.forEach(migrations => {
32-
expect(
33-
JSON.stringify(
34-
getMigrationMessage({ migrationsRan: migrations, t: tMock })
35-
)
36-
).toEqual(expect.stringContaining('migrations.noBehaviorChange.body1'))
37-
})
38-
})
39-
it('should return the generic migration modal when a v4 migration or v7 migration is required', () => {
40-
const migrationsList = [
41-
['4.0.0'],
42-
['4.0.0', '5.0.0'],
43-
['4.0.0', '5.0.0', '5.1.0'],
44-
['4.0.0', '5.0.0', '5.1.0, 5.2.0'],
45-
['6.0.0', '6.1.0', '6.2.0', '6.2.1', '6.2.2'],
46-
]
47-
migrationsList.forEach(migrations => {
48-
expect(
49-
JSON.stringify(
50-
getMigrationMessage({ migrationsRan: migrations, t: tMock })
51-
)
52-
).toEqual(expect.stringContaining('migrations.generic.body1'))
53-
})
54-
})
7+
describe('getMigrationMessage', () => {
8+
it('should return the generic migration message when migrating', () => {
9+
expect(JSON.stringify(getMigrationMessage({ t: tMock }))).toEqual(
10+
expect.stringContaining('migrations.generic.body1')
11+
)
5512
})
5613
})

protocol-designer/src/components/organisms/FileUploadMessagesModal/index.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,29 @@ export function FileUploadMessagesModal(): JSX.Element | null {
3333
}
3434

3535
const { title, body } = modalContents
36+
37+
const isMigration = title === t('migration_header')
38+
3639
const showButtons =
3740
title !== t('invalid_json_file') &&
3841
title !== t('incorrect_file_header') &&
3942
title !== t('incorrect_python_file_header')
4043

44+
const handleClose = (): void => {
45+
if (isMigration) {
46+
dispatch(undoLoadFile())
47+
} else {
48+
dismissModal()
49+
}
50+
}
51+
4152
return (
4253
<Modal
4354
marginLeft="0"
4455
type={message?.isError ? 'error' : 'info'}
4556
title={title}
4657
closeOnOutsideClick
47-
onClose={dismissModal}
58+
onClose={handleClose}
4859
footer={
4960
showButtons && (
5061
<Flex
@@ -59,7 +70,9 @@ export function FileUploadMessagesModal(): JSX.Element | null {
5970
>
6071
{t('cancel')}
6172
</SecondaryButton>
62-
<PrimaryButton onClick={dismissModal}>{t('confirm')}</PrimaryButton>
73+
<PrimaryButton onClick={dismissModal}>
74+
{isMigration ? t('import') : t('confirm')}
75+
</PrimaryButton>
6376
</Flex>
6477
)
6578
}

0 commit comments

Comments
 (0)