Skip to content

Commit 1604dac

Browse files
committed
Test updates
1 parent 4067224 commit 1604dac

File tree

6 files changed

+14
-188
lines changed

6 files changed

+14
-188
lines changed

app/src/organisms/Devices/ProtocolRun/SetupLabware/LabwareListItem.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export function LabwareListItem(
169169
switch (moduleTypeNeedsAttention) {
170170
case MAGNETIC_MODULE_TYPE:
171171
case THERMOCYCLER_MODULE_TYPE:
172-
if (moduleModel == THERMOCYCLER_MODULE_V2) {
172+
if (moduleModel !== THERMOCYCLER_MODULE_V2) {
173173
secureLabwareInstructions = (
174174
<Btn
175175
css={css`
@@ -274,7 +274,12 @@ export function LabwareListItem(
274274
{slotInfo != null && isFlex ? (
275275
<LocationIcon slotName={slotInfo} />
276276
) : (
277-
{ slotInfo }
277+
<StyledText
278+
css={TYPOGRAPHY.pSemiBold}
279+
data-testid={`slot_info_${slotInfo}`}
280+
>
281+
{slotInfo}
282+
</StyledText>
278283
)}
279284
{nestedLabwareInfo != null || moduleDisplayName != null ? (
280285
<LocationIcon iconName="stacked" />

app/src/organisms/Devices/ProtocolRun/SetupLabware/SetupLabwareList.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,14 @@ import {
88
StyledText,
99
COLORS,
1010
} from '@opentrons/components'
11-
import {
12-
getLabwareSetupItemGroups,
13-
LabwareSetupItem,
14-
} from '../../../../pages/Protocols/utils'
11+
import { getLabwareSetupItemGroups } from '../../../../pages/Protocols/utils'
1512
import { LabwareListItem } from './LabwareListItem'
1613
import { getNestedLabwareInfo } from './getNestedLabwareInfo'
1714

1815
import type { RunTimeCommand } from '@opentrons/shared-data'
1916
import type { ModuleRenderInfoForProtocol } from '../../hooks'
2017
import type { ModuleTypesThatRequireExtraAttention } from '../utils/getModuleTypesThatRequireExtraAttention'
18+
import type { LabwareSetupItem } from '../../../../pages/Protocols/utils'
2119

2220
const HeaderRow = styled.div`
2321
display: grid;

app/src/organisms/Devices/ProtocolRun/SetupLabware/__tests__/LabwareListItem.test.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ describe('LabwareListItem', () => {
172172
})
173173
screen.getByText('Mock Labware Definition')
174174
screen.getByTestId('slot_info_7')
175+
screen.getByTestId('LocationIcon_stacked')
175176
screen.getByText('Magnetic Module GEN1')
176177
const button = screen.getByText('Secure labware instructions')
177178
fireEvent.click(button)
@@ -206,6 +207,7 @@ describe('LabwareListItem', () => {
206207
})
207208
screen.getByText('Mock Labware Definition')
208209
screen.getByTestId('slot_info_7')
210+
screen.getByTestId('LocationIcon_stacked')
209211
screen.getByText('Temperature Module GEN1')
210212
screen.getByText('nickName')
211213
})
@@ -314,7 +316,6 @@ describe('LabwareListItem', () => {
314316
screen.getByText('mock nested display name')
315317
screen.getByText('nestedLabwareNickName')
316318
screen.getByText('nickName')
317-
screen.getByText('On deck')
318319
})
319320

320321
it('renders the correct info for a labware on top of a heater shaker', () => {
@@ -375,6 +376,6 @@ describe('LabwareListItem', () => {
375376
nestedLabwareInfo: null,
376377
})
377378
screen.getByText('Mock Labware Definition')
378-
screen.getByText('Off deck')
379+
screen.getByTestId('slot_info_OFF DECK')
379380
})
380381
})
Lines changed: 2 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
import * as React from 'react'
22
import { StaticRouter } from 'react-router-dom'
3-
import { describe, it, beforeEach, vi, expect } from 'vitest'
3+
import { describe, it, beforeEach, vi } from 'vitest'
44
import { screen } from '@testing-library/react'
55

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

88
import { renderWithProviders } from '../../../../../__testing-utils__'
99
import { i18n } from '../../../../../i18n'
10-
import { mockDefinition } from '../../../../../redux/custom-labware/__fixtures__'
1110
import { SetupLabwareList } from '../SetupLabwareList'
1211
import { LabwareListItem } from '../LabwareListItem'
13-
import type {
14-
CompletedProtocolAnalysis,
15-
RunTimeCommand,
16-
} from '@opentrons/shared-data'
12+
import type { CompletedProtocolAnalysis } from '@opentrons/shared-data'
1713

1814
vi.mock('../LabwareListItem')
1915

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

33-
const mockOffDeckCommands = ([
34-
{
35-
id: '0abc1',
36-
commandType: 'loadPipette',
37-
params: {
38-
pipetteId: 'pipetteId',
39-
mount: 'left',
40-
},
41-
},
42-
{
43-
id: '0abc2',
44-
commandType: 'loadLabware',
45-
params: {
46-
labwareId: 'fixedTrash',
47-
location: {
48-
slotName: '12',
49-
},
50-
},
51-
result: {
52-
labwareId: 'fixedTrash',
53-
definition: {
54-
ordering: [['A1']],
55-
metadata: {
56-
displayCategory: 'trash',
57-
displayName: 'Opentrons Fixed Trash',
58-
},
59-
},
60-
},
61-
},
62-
{
63-
id: '0abc3',
64-
commandType: 'loadLabware',
65-
params: {
66-
labwareId: 'tiprackId',
67-
location: {
68-
slotName: '1',
69-
},
70-
},
71-
result: {
72-
labwareId: 'labwareId',
73-
definition: mockDefinition,
74-
},
75-
},
76-
{
77-
id: '0abc4',
78-
commandType: 'loadLabware',
79-
params: {
80-
labwareId: 'sourcePlateId',
81-
location: {
82-
slotName: '2',
83-
},
84-
},
85-
result: {
86-
labwareId: 'labwareId',
87-
definition: mockDefinition,
88-
},
89-
},
90-
{
91-
id: '0abc4',
92-
commandType: 'loadLabware',
93-
params: {
94-
labwareId: 'destPlateId',
95-
location: {
96-
slotName: '3',
97-
},
98-
},
99-
result: {
100-
labwareId: 'labwareId',
101-
definition: mockDefinition,
102-
},
103-
},
104-
{
105-
id: '0',
106-
commandType: 'pickUpTip',
107-
params: {
108-
pipetteId: 'pipetteId',
109-
labwareId: 'tiprackId',
110-
wellName: 'B1',
111-
},
112-
},
113-
{
114-
id: '1',
115-
commandType: 'aspirate',
116-
params: {
117-
pipetteId: 'pipetteId',
118-
labwareId: 'sourcePlateId',
119-
wellName: 'A1',
120-
volume: 5,
121-
flowRate: 3,
122-
wellLocation: {
123-
origin: 'bottom',
124-
offset: { x: 0, y: 0, z: 2 },
125-
},
126-
},
127-
},
128-
{
129-
id: '2',
130-
commandType: 'dispense',
131-
params: {
132-
pipetteId: 'pipetteId',
133-
labwareId: 'destPlateId',
134-
wellName: 'B1',
135-
volume: 4.5,
136-
flowRate: 2.5,
137-
wellLocation: {
138-
origin: 'bottom',
139-
offset: { x: 0, y: 0, z: 1 },
140-
},
141-
},
142-
},
143-
{
144-
id: '3',
145-
commandType: 'dropTip',
146-
params: {
147-
pipetteId: 'pipetteId',
148-
labwareId: 'fixedTrash',
149-
wellName: 'A1',
150-
},
151-
},
152-
{
153-
id: '4',
154-
commandType: 'loadLabware',
155-
params: {
156-
labwareId: 'fixedTrash',
157-
location: 'offDeck',
158-
},
159-
result: {
160-
labwareId: 'labwareId',
161-
definition: mockDefinition,
162-
},
163-
},
164-
] as any) as RunTimeCommand[]
165-
16629
describe('SetupLabwareList', () => {
16730
beforeEach(() => {
16831
vi.mocked(LabwareListItem).mockReturnValue(
@@ -186,34 +49,5 @@ describe('SetupLabwareList', () => {
18649
screen.getAllByText('mock labware list item')
18750
screen.getByText('Labware name')
18851
screen.getByText('Location')
189-
screen.getByText('Placement')
190-
})
191-
it('renders null for the offdeck labware list when there are none', () => {
192-
render({
193-
commands: protocolWithTC.commands,
194-
extraAttentionModules: [],
195-
attachedModuleInfo: {
196-
x: 1,
197-
y: 2,
198-
z: 3,
199-
attachedModuleMatch: null,
200-
moduleId: 'moduleId',
201-
} as any,
202-
isFlex: false,
203-
})
204-
expect(
205-
screen.queryByText('Additional Off-Deck Labware')
206-
).not.toBeInTheDocument()
207-
})
208-
209-
it('renders offdeck labware list when there are additional offdeck labwares', () => {
210-
render({
211-
commands: mockOffDeckCommands,
212-
extraAttentionModules: [],
213-
attachedModuleInfo: {} as any,
214-
isFlex: false,
215-
})
216-
screen.getByText('Additional Off-Deck Labware')
217-
screen.getAllByText('mock labware list item')
21852
})
21953
})

app/src/organisms/Devices/ProtocolRun/__tests__/EmptySetupStep.test.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@ describe('EmptySetupStep', () => {
1818
props = {
1919
title: 'mockTitle',
2020
description: 'mockDescription',
21-
label: 'mockLabel',
2221
}
2322
})
2423

2524
it('should render the title, description, and label', () => {
2625
render(props)
2726
screen.getByText('mockTitle')
2827
screen.getByText('mockDescription')
29-
screen.getByText('mockLabel')
3028
})
3129
})

app/src/organisms/Devices/ProtocolRun/__tests__/ProtocolRunSetup.test.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,6 @@ describe('ProtocolRunSetup', () => {
279279
.thenReturn({ complete: false })
280280

281281
render()
282-
screen.getByText('STEP 2')
283282
screen.getByText('Deck hardware')
284283
screen.getByText('Calibration needed')
285284
})
@@ -304,7 +303,6 @@ describe('ProtocolRunSetup', () => {
304303
.thenReturn({ complete: false })
305304

306305
render()
307-
screen.getByText('STEP 2')
308306
screen.getByText('Deck hardware')
309307
screen.getByText('Action needed')
310308
})
@@ -338,7 +336,6 @@ describe('ProtocolRunSetup', () => {
338336
.thenReturn({ complete: false })
339337

340338
render()
341-
screen.getByText('STEP 2')
342339
screen.getByText('Deck hardware')
343340
screen.getByText('Action needed')
344341
})
@@ -353,16 +350,13 @@ describe('ProtocolRunSetup', () => {
353350
it('renders correct text contents for multiple modules', () => {
354351
render()
355352

356-
screen.getByText('STEP 1')
357353
screen.getByText('Instruments')
358354
screen.getByText(
359355
'Review required pipettes and tip length calibrations for this protocol.'
360356
)
361-
screen.getByText('STEP 2')
362357
screen.getByText('Deck hardware')
363358

364359
screen.getByText('Install the required modules.')
365-
screen.getByText('STEP 3')
366360
screen.getByText('Labware')
367361

368362
screen.getByText(
@@ -389,16 +383,13 @@ describe('ProtocolRunSetup', () => {
389383
])
390384
render()
391385

392-
screen.getByText('STEP 1')
393386
screen.getByText('Instruments')
394387
screen.getByText(
395388
'Review required pipettes and tip length calibrations for this protocol.'
396389
)
397-
screen.getByText('STEP 2')
398390
screen.getByText('Deck hardware')
399391

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

428-
screen.getByText('STEP 2')
429419
screen.getByText('Deck hardware')
430420
screen.getByText(
431421
'Install and calibrate the required modules. Install the required fixtures.'

0 commit comments

Comments
 (0)