Skip to content

Commit

Permalink
test(protocol-designer): start of cypress happy path test for mix set…
Browse files Browse the repository at this point in the history
…tings (#17320)

<!--
Thanks for taking the time to open a Pull Request (PR)! Please make sure
you've read the "Opening Pull Requests" section of our Contributing
Guide:


https://github.com/Opentrons/opentrons/blob/edge/CONTRIBUTING.md#opening-pull-requests

GitHub provides robust markdown to format your PR. Links, diagrams,
pictures, and videos along with text formatting make it possible to
create a rich and informative PR. For more information on GitHub
markdown, see:


https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax

To ensure your code is reviewed quickly and thoroughly, please fill out
the sections below to the best of your ability!
-->

# Overview

<!--
Describe your PR at a high level. State acceptance criteria and how this
PR fits into other work. Link issues, PRs, and other relevant resources.
-->

Cypress happy path testing for mix settings

## Test Plan and Hands on Testing

<!--
Describe your testing of the PR. Emphasize testing not reflected in the
code. Attach protocols, logs, screenshots and any other assets that
support your testing.
-->

## Changelog

<!--
List changes introduced by this PR considering future developers and the
end user. Give careful thought and clear documentation to breaking
changes.
-->

Added cypress actions and verifications for intended PD behavior 

## Review requests

<!--
- What do you need from reviewers to feel confident this PR is ready to
merge?
- Ask questions.
-->

## Risk assessment

<!--
- Indicate the level of attention this PR needs.
- Provide context to guide reviewers.
- Discuss trade-offs, coupling, and side effects.
- Look for the possibility, even if you think it's small, that your
change may affect some other part of the system.
- For instance, changing return tip behavior may also change the
behavior of labware calibration.
- How do your unit tests and on hands on testing mitigate this PR's
risks and the risk of future regressions?
- Especially in high risk PRs, explain how you know your testing is
enough.
-->
  • Loading branch information
skowalski08 authored Feb 11, 2025
1 parent 831c4ae commit 4b054ad
Show file tree
Hide file tree
Showing 6 changed files with 651 additions and 17 deletions.
15 changes: 0 additions & 15 deletions protocol-designer/cypress.config.js

This file was deleted.

10 changes: 10 additions & 0 deletions protocol-designer/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from 'cypress'

module.exports = defineConfig({
video: false,
viewportWidth: 1440,
viewportHeight: 900,
e2e: {
baseUrl: 'http://localhost:5178',
},
})
77 changes: 77 additions & 0 deletions protocol-designer/cypress/e2e/mixSettings.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import '../support/commands'
import { MixActions, MixVerifications } from '../support/mixSetting'
import { UniversalActions } from '../support/universalActions'
import { TestFilePath, getTestFile } from '../support/testFiles'
import { verifyImportProtocolPage } from '../support/import'
import { runSteps } from '../support/StepExecution'
import type { StepsList } from '../support/StepExecution'

describe('Redesigned Mixing Steps - Happy Path', () => {
beforeEach(() => {
cy.visit('/')
cy.closeAnalyticsModal()
const protocol = getTestFile(TestFilePath.DoItAllV8)
cy.importProtocol(protocol.path)
verifyImportProtocolPage(protocol)

// NOTE: vv make this chunk better//
cy.contains('Edit protocol').click()
cy.contains('Protocol steps').click()
cy.get('[id="AddStepButton"]').contains('Add Step').click()
cy.verifyOverflowBtn()
})

it('It should verify the working function of every permutation of mix checkboxes', () => {
const steps: StepsList = [
MixActions.SelectMix,
UniversalActions.Snapshot,
MixVerifications.PartOne,
MixActions.SelectLabware,
MixActions.SelectWellInputField,
MixVerifications.WellSelectPopout,
UniversalActions.Snapshot,
MixActions.Save,
MixActions.EnterVolume,
MixActions.EnterMixReps,
MixActions.SelectTipHandling,
UniversalActions.Snapshot,
MixActions.Continue,
MixVerifications.PartTwoAsp,
MixActions.AspirateFlowRate,
MixActions.AspWellOrder,
MixVerifications.AspWellOrder,
MixActions.AspMixTipPos,
MixVerifications.AspMixTipPos,
MixActions.Delay,
MixActions.Dispense,
MixVerifications.PartTwoDisp,
MixActions.DispenseFlowRate,
MixActions.Delay,
MixActions.BlowoutLocation,
MixActions.BlowoutFlowRate,
MixActions.BlowoutPosFromTop,
MixVerifications.BlowoutPopout,
MixActions.Save,
MixVerifications.Blowout,
MixActions.TouchTip,
MixVerifications.TouchTipPopout,
MixActions.Save,
MixVerifications.TouchTip,
MixActions.Rename,
MixActions.Save,
MixVerifications.Rename,
MixActions.Save,
]
runSteps(steps)
})
})

/*
To Add:
MixActions.TipPosSideImageMove,
MixActions.TipPosTopImageMove,
MixActions.FlowRateWarning, **for asp and disp
To Change:
Need to refactor labware set up to have different labware on deck for better well selection coverage
*/
14 changes: 14 additions & 0 deletions protocol-designer/cypress/support/StepExecution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,21 @@ import {
executeModSteps,
executeVerifyModStep,
} from './SupportModules'
import {
MixActions,
MixVerifications,
executeMixAction,
executeVerifyMixStep,
} from './mixSetting'

export type StepsList = Array<
| SetupActions
| SetupVerifications
| UniversalActions
| ModActions
| ModVerifications
| MixActions
| MixVerifications
>

export const runSteps = (steps: StepsList): void => {
Expand All @@ -29,6 +37,8 @@ export const runSteps = (steps: StepsList): void => {
ModVerifications,
SetupVerifications,
UniversalActions,
MixActions,
MixVerifications,
]

if (!isEnumValue(enumsToCheck, steps)) {
Expand All @@ -46,6 +56,10 @@ export const runSteps = (steps: StepsList): void => {
executeModSteps(step as ModActions)
} else if (isEnumValue([ModVerifications], step)) {
executeVerifyModStep(step as ModVerifications)
} else if (isEnumValue([MixActions], step)) {
executeMixAction(step as MixActions)
} else if (isEnumValue([MixVerifications], step)) {
executeVerifyMixStep(step as MixVerifications)
}
})
}
25 changes: 23 additions & 2 deletions protocol-designer/cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ declare global {
verifyCreateNewPage: () => Cypress.Chainable<void>
togglePreWetTip: () => Cypress.Chainable<void>
mixaspirate: () => Cypress.Chainable<void>
clickConfirm: () => Cypress.Chainable<void>
verifyOverflowBtn: () => Cypress.Chainable<void>
}
}
}
Expand All @@ -49,6 +51,12 @@ export const content = {
appSettings: 'App Info',
privacy: 'Privacy',
shareSessions: 'Share analytics with Opentrons',
move: 'Move',
transfer: 'Transfer',
mix: 'Mix',
pause: 'Pause',
heaterShaker: 'Heater-shaker',
thermocyler: 'Thermocycler',
}

export const locators = {
Expand Down Expand Up @@ -104,11 +112,11 @@ Cypress.Commands.add('verifyCreateNewHeader', () => {
// Home Page
Cypress.Commands.add('verifyHomePage', () => {
cy.contains(content.welcome)
cy.get(locators.privacyPolicy).should('exist').and('be.visible')
cy.get(locators.eula).should('exist').and('be.visible')
cy.contains('button', locators.createProtocol).should('be.visible')
cy.contains('label', locators.importProtocol).should('be.visible')
cy.getByTestId(locators.settingsDataTestid).should('be.visible')
cy.get(locators.privacyPolicy).should('exist').and('be.visible')
cy.get(locators.eula).should('exist').and('be.visible')
})

Cypress.Commands.add('clickCreateNew', () => {
Expand All @@ -122,6 +130,10 @@ Cypress.Commands.add('closeAnalyticsModal', () => {
.click({ force: true })
})

Cypress.Commands.add('clickConfirm', () => {
cy.contains(locators.confirm).click()
})

// Header Import
Cypress.Commands.add('importProtocol', (protocolFilePath: string) => {
cy.contains(locators.import).click()
Expand Down Expand Up @@ -158,6 +170,15 @@ Cypress.Commands.add('verifySettingsPage', () => {
.should('be.visible')
})

Cypress.Commands.add('verifyOverflowBtn', () => {
cy.contains(content.move).should('exist').should('be.visible')
cy.contains(content.transfer).should('exist').should('be.visible')
cy.contains(content.mix).should('exist').should('be.visible')
cy.contains(content.pause).should('exist').should('be.visible')
cy.contains(content.heaterShaker).should('exist').should('be.visible')
cy.contains(content.thermocyler).should('exist').should('be.visible')
})

/// /////////////////////////////////////////////////////////////////
// Legacy Code Section
// This code is deprecated and should be removed
Expand Down
Loading

0 comments on commit 4b054ad

Please sign in to comment.