-
Notifications
You must be signed in to change notification settings - Fork 179
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
feat(protocol-designer): allow custom labware on modules #5175
Conversation
Codecov Report
@@ Coverage Diff @@
## edge #5175 +/- ##
==========================================
+ Coverage 68.22% 68.68% +0.45%
==========================================
Files 1106 1118 +12
Lines 36640 39802 +3162
==========================================
+ Hits 24999 27338 +2339
- Misses 11641 12464 +823
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🍔
- Can upload and add custom labware to Magdeck
- Can upload and add custom labware to Tempdeck
- Can swap custom labware between both modules
- Can swap compatible labware with custom labware
- Adding an engage step with a custom labware on it does not have recommended value
- After swapping with compatible labware (not custom) the recommended value renders
- No temperature step errors
protocol-designer/src/components/DeckSetup/__tests__/DeckSetup.test.js
Outdated
Show resolved
Hide resolved
|
||
let getLabwareIsCompatibleSpy | ||
beforeEach(() => { | ||
getLabwareIsCompatibleSpy = jest.spyOn( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I understand the main difference btw a spy and a mock is that the mock requires you to explicitly mock any implementation / return value, and the spy implicitly uses the real implementation unless you overwrite it. Since getLabwareIsCompatible
doesn't have any knowledge of the fixture load names, the real implementation isn't relevant to the tests here. So should we use mock
instead of spyOn
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in jest world, a spy can have a mock return value (line 91). The spies are very useful for mocking out single functions in a module as opposed to the whole thing (I think that's necessary for flow?) and then manually unmocking other fns in there. I didn't want to mock out the getLabwareIsCustom
fn, just getLabwareIsCompatible` since it's checking against a specific list of labware.
@@ -0,0 +1,141 @@ | |||
// @flow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're missing a handful of cases here, since "from deck to module" and "from module to deck" (and from module A to module B and visa versa) are all distinct.
Related: even if we don't add more cases, would this test benefit from being driven by a forEach
to make it more concise?
I think there are 15 cases:
- Labware A from deck to empty deck slot: never blocked
- Labware A from deck to deck slot with some Labware B: never blocked
- Labware A from deck to empty module: block if A is not compatible
- Labware A from deck to empty module: allow if A is compatible
- Labware A from deck to module with some module-compatible labware B: block if A is not compatible
- Labware A from deck to module with some module-compatible labware B: allow if A is compatible
For all these, A starts on module X (and A is compatible with module X):
- Labware A from module X to empty deck slot: always allow
- Labware A from module X to empty module Y: allow if A is compatible with Y
- Labware A from module X to empty module Y: disallow if A is not compatible with Y
- Labware A from module X to deck slot with labware B: disallow if B is not compatible with X
- Labware A from module X to deck slot with labware B: allow if B is compatible with X
- Labware A from module X to module Y that has a labware B on it: (4 cases here!) allow if A is compatible with Y and B is compatible with X. disallow in the 3 other cases where A and/or B is not compatible with the other module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, I think some need to be added in there. It is much easier to see the cases on the ui.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As it turns out. this one function doesn't handle all these cases. It's handled as a joint effort between this fn and SlotControls. For example, for the case where you are moving an incompatible labware on to an empty module, there is no hovered labware so this getSwapBlocked fn will not say it is blocked. It is handled in SlotControls right when we drag the labware over the module. Maybe it is better to have some integration tests for these type of tests?
expect(isBlocked).toEqual(false) | ||
}) | ||
|
||
it('is not blocked when no dragged labware', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this happen? This would be a 16th case, I didn't count it in my list ^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure it can happen. It was in the function already so I added a case for it 😅 .
1511a05
to
d5a67d6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🖌️
overview
Closes #4910 by removing restrictions when placing custom labware on modules
changelog
review requests
#4910 - acceptance criteria here
This was tested with the python api but feel free to test it yourself.
Swapping labware
Adding steps
Labware is not magnet compatible
Add a magnet engage step
Labware is magnet compatible and has an engage height
Add a magnet engage step
Temperature steps
Add a set temperature step
Add a deactivate step