Skip to content
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): Make createNew.ts more robust and use it to start testing protocol actions in PD #17156

Open
wants to merge 40 commits into
base: edge
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
d83c729
I made a robotSelection() function added to commands.ts. Next commit …
alexjoel42 Dec 13, 2024
6b7eff3
you can now select pipettes
alexjoel42 Dec 16, 2024
6e40698
Merge branch 'edge' into E2E_Transfer_and_Command_update
alexjoel42 Dec 16, 2024
df1942d
I moved the base url to be the sandbox instead of local host. This wa…
alexjoel42 Dec 16, 2024
5e9e55d
updated url to 8.2.2 so we can plan for the confirmation modal
alexjoel42 Dec 16, 2024
2950726
refactoring for 8.2.0
alexjoel42 Dec 16, 2024
f156954
very small change to make JS checker happier
alexjoel42 Dec 16, 2024
f40e60e
fixed the protocols using our little pop up.
alexjoel42 Dec 17, 2024
50c6836
just added some functions to get us closer to transfer step 5 woo
alexjoel42 Dec 17, 2024
6300eaa
move baseurl and made deck selector
alexjoel42 Dec 18, 2024
2ccb2de
local host not updated yet
alexjoel42 Dec 18, 2024
13e762c
I changed chose deck slot to just return the deck slot. ToDo is to ma…
alexjoel42 Dec 19, 2024
391d04c
done
alexjoel42 Dec 19, 2024
5b7e02e
Merge branch 'edge' into E2E_Transfer_and_Command_update
alexjoel42 Dec 19, 2024
8750068
we did it! It's prettier
alexjoel42 Dec 19, 2024
8259eec
refactored and linted all tests
alexjoel42 Dec 19, 2024
ae5b69c
Merge branch 'edge' into E2E_Transfer_and_Command_update
alexjoel42 Dec 19, 2024
29903d3
formatting fixed in a few places with prettier
alexjoel42 Dec 19, 2024
f402fa5
hope this updates
alexjoel42 Dec 19, 2024
0a5c1c6
another commit to finally fix the deck slot function
alexjoel42 Dec 19, 2024
d7fb3d2
small steps
alexjoel42 Dec 19, 2024
2d35674
Did some prettier changes and am starting to move commands into creat…
alexjoel42 Dec 20, 2024
203d2bc
Made a new file createNewFlex.cy.ts this will be where I translate my…
alexjoel42 Dec 20, 2024
fcd9fb7
Almost done with gripper. Moving onto modules
alexjoel42 Dec 20, 2024
0b03395
Check NewFlex.cy.ts I am almost there
alexjoel42 Dec 21, 2024
2594d63
added closing analytics and selecting deck slots
alexjoel42 Dec 23, 2024
68acf18
addressed the close analytics button
alexjoel42 Dec 23, 2024
1af99d6
addresses comments
alexjoel42 Dec 23, 2024
6dea456
close analytics modal to edit protocol
alexjoel42 Dec 23, 2024
8739044
I have remodeled the transferSetting.cy.js page and will build on it …
alexjoel42 Dec 23, 2024
1f4e8d6
I think this should work! No typescript errors
alexjoel42 Dec 24, 2024
b0dffda
fixed the deck selection function I think
alexjoel42 Dec 24, 2024
9b6852d
last commit before vacation
alexjoel42 Dec 24, 2024
e9488ef
Merge branch 'edge' into E2E_Transfer_and_Command_update
alexjoel42 Dec 25, 2024
fda19a0
updating and taking in Koji's comments
alexjoel42 Dec 25, 2024
8844728
change mix settings to ts
alexjoel42 Jan 2, 2025
b54dbad
we are holding on createNew right now so that I can unblock Sara if p…
alexjoel42 Jan 2, 2025
50e0774
finally passes lint
alexjoel42 Jan 2, 2025
f9592a5
Wow, did not realize I broke my tests
alexjoel42 Jan 2, 2025
e60771b
Merge branch 'edge' into E2E_Transfer_and_Command_update
alexjoel42 Jan 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions protocol-designer/cypress/e2e/import.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@
describe('The Import Page', () => {
beforeEach(() => {
cy.visit('/')
cy.closeAnalyticsModal()

Check failure on line 10 in protocol-designer/cypress/e2e/import.cy.ts

View workflow job for this annotation

GitHub Actions / js checks

Property 'closeAnalyticsModal' does not exist on type 'cy & CyEventEmitter'.

Check failure on line 10 in protocol-designer/cypress/e2e/import.cy.ts

View workflow job for this annotation

GitHub Actions / js checks

Property 'closeAnalyticsModal' does not exist on type 'cy & CyEventEmitter'.
})

it('successfully loads a protocol exported on a previous version', () => {
cy.contains('button', 'Confirm').click()
alexjoel42 marked this conversation as resolved.
Show resolved Hide resolved
const protocol = getTestFile(TestFilePath.DoItAllV7)
cy.importProtocol(protocol.path)
verifyOldProtocolModal()
verifyImportProtocolPage(protocol)
})

it('successfully loads a protocol exported on the current version', () => {
cy.contains('button', 'Confirm').click()
alexjoel42 marked this conversation as resolved.
Show resolved Hide resolved
const protocol = getTestFile(TestFilePath.DoItAllV8)
cy.importProtocol(protocol.path)
verifyImportProtocolPage(protocol)
Expand Down
293 changes: 293 additions & 0 deletions protocol-designer/cypress/e2e/transferSettings.cy.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,289 @@
import '../support/commands.ts'; // Importing the custom commands file


/*
These constants will help us run through both test suites in one go
*/
const Flex_Home = 'Opentrons Flex';
const OT2_Home = 'Opentrons OT-2';
const pipette = '1-Channel'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the comment and define this in protocol-designer/cypress/support/createNew.ts
in the Content enum


describe('Happy Path Transfer Tests', () => {
it('It should verify the working function of every permutation of transfer checkboxes', () => {

cy.visit('/'); // Replace with the appropriate URL or navigation

cy.verifyHomePage(); // This calls the custom command from commands.ts
cy.clickCreateNew() /

Check failure on line 17 in protocol-designer/cypress/e2e/transferSettings.cy.js

View workflow job for this annotation

GitHub Actions / js checks

Expected an assignment or function call and instead saw an expression

Check failure on line 17 in protocol-designer/cypress/e2e/transferSettings.cy.js

View workflow job for this annotation

GitHub Actions / js checks

Expected an assignment or function call and instead saw an expression
cy.robotSelection(Flex_Home)


function putPipette(pipette) {
cy.contains('label', pipette).should('exist').and('be.visible').click()
}
putPipette(pipette)
// Check step 2 has the right text
cy.contains('Step 2')
cy.contains('Add a pipette')
cy.contains('Pick your first pipette. If you need a second pipette, you can add it next.')
// Check
cy.contains('button', 'Go back').click()
cy.robotSelection(Flex_Home)
putPipette(pipette)
// Make a function for this later that selects a pipette and its tips
let tip_volume = '50 µL'

Check failure on line 34 in protocol-designer/cypress/e2e/transferSettings.cy.js

View workflow job for this annotation

GitHub Actions / js checks

'tip_volume' is never reassigned. Use 'const' instead

Check failure on line 34 in protocol-designer/cypress/e2e/transferSettings.cy.js

View workflow job for this annotation

GitHub Actions / js checks

'tip_volume' is never reassigned. Use 'const' instead
let tip_rack = 'Filter Tip Rack 50 µL'

Check failure on line 35 in protocol-designer/cypress/e2e/transferSettings.cy.js

View workflow job for this annotation

GitHub Actions / js checks

'tip_rack' is never reassigned. Use 'const' instead

Check failure on line 35 in protocol-designer/cypress/e2e/transferSettings.cy.js

View workflow job for this annotation

GitHub Actions / js checks

'tip_rack' is never reassigned. Use 'const' instead
// I'm leaving them as "let" because they'll be lists some day
cy.contains(tip_volume).click()
cy.contains(tip_rack).click()
cy.contains('Confirm').click()
cy.contains('Left Mount').should('be.visible')
if (tip_rack === 'Filter Tip Rack 50 µL') {
cy.contains('Flex 1-Channel 50 μL').should('be.visible')
cy.contains(tip_rack).should('be.visible')
// block of code to be executed if the condition is true
}
cy.contains('Confirm').click()
// Gripper setup on step 3 of the onboarding flow

let wantGripper = 'Yes'

Check failure on line 49 in protocol-designer/cypress/e2e/transferSettings.cy.js

View workflow job for this annotation

GitHub Actions / js checks

'wantGripper' is never reassigned. Use 'const' instead

Check failure on line 49 in protocol-designer/cypress/e2e/transferSettings.cy.js

View workflow job for this annotation

GitHub Actions / js checks

'wantGripper' is never reassigned. Use 'const' instead

function step3Gripper(wantGripper) {
cy.contains('Add a gripper').should('be.visible')
cy.contains('Do you want to move labware automatically with the gripper?').should('be.visible')
cy.contains('Yes').should('be.visible')
cy.contains('No').should('be.visible')
cy.contains('Yes').click()
cy.contains('button', 'Confirm').click()
return console.log('step 3 onboarding step looks good!')
}
step3Gripper(wantGripper)
// Maybe a module selection function?
function step4modules() {


cy.contains('Thermocycler Module GEN2').click()
cy.get('img[alt="thermocyclerModuleType"]').should('be.visible')
cy.contains('Heater-Shaker Module GEN1').click()
cy.get('img[alt="heaterShakerModuleType"]').should('be.visible')
cy.contains('Magnetic Block GEN1').click()
cy.get('img[alt="magneticBlockType"]').should('be.visible')
cy.contains('Temperature Module GEN2').click()
cy.get('img[alt="temperatureModuleType"]').should('be.visible')
cy.contains('Confirm').click()
}
step4modules()
// Todo Step 5 and Step 6 test
cy.contains('Confirm').click()
cy.contains('Confirm').click()
// ToDo make sure that the protocol overview stage works.
cy.contains('Edit protocol').click()
cy.chooseDeckSlot('C2').click()
cy.contains('Add hardware/labware').click()
//cy.contains('foreignObject[x="164"][y="107"]', 'Edit slot').click()

Check failure on line 83 in protocol-designer/cypress/e2e/transferSettings.cy.js

View workflow job for this annotation

GitHub Actions / js checks

Expected space or tab after '//' in comment

Check failure on line 83 in protocol-designer/cypress/e2e/transferSettings.cy.js

View workflow job for this annotation

GitHub Actions / js checks

Expected space or tab after '//' in comment
cy.contains('Labware').click()
cy.contains('Well plates').click()
cy.contains('Armadillo 96 Well Plate 200 µL PCR Full Skirt').click({
force: true
})
cy.get('[data-testid="Toolbox_confirmButton"]').click({
force: true
})
// Todo make a liquid adding function
/*
*/
cy.chooseDeckSlot('C2')
.find('.Box-sc-8ozbhb-0.kIDovv')
.find('a[role="button"]')
.contains('Edit slot')
.click({
force: true
})
cy.contains('button', 'Add liquid').click()
cy.contains('button', 'Liquid').click()
cy.contains('button', 'Define a liquid').click()
cy.get('input[name="name"]') // Select the input with name="name"
.type('My liquid!')

cy.get('div[aria-label="ModalShell_ModalArea"]')
.find('form') // Target the form that wraps the button
.invoke('submit', (e) => {
e.preventDefault(); // Prevent default behavior
});

// Then click the Save button
cy.get('div[aria-label="ModalShell_ModalArea"]')
.find('button[type="submit"]')
.contains('Save')
.click()

cy.get('circle[data-wellname="A1"]').click({
force: true
})
cy.get('circle[data-wellname="A2"]').click({
force: true
});


// Open the dropdown
cy.get('div[tabindex="0"].sc-bqWxrE').click();

// Select the option with specific text
cy.contains('My liquid!').click();
cy.contains('Liquid')
cy.contains('Add liquid')
cy.contains('Liquid volume by well')
cy.contains('Cancel')
cy.get('input[name="volume"]').type(150)
cy.contains('button', 'Save').click();
cy.contains('button', 'Done').click({
force: true
})

cy.chooseDeckSlot('C3').click()
cy.contains('Add hardware/labware').click()
//cy.contains('foreignObject[x="164"][y="107"]', 'Edit slot').click()

Check failure on line 145 in protocol-designer/cypress/e2e/transferSettings.cy.js

View workflow job for this annotation

GitHub Actions / js checks

Expected space or tab after '//' in comment

Check failure on line 145 in protocol-designer/cypress/e2e/transferSettings.cy.js

View workflow job for this annotation

GitHub Actions / js checks

Expected space or tab after '//' in comment
cy.contains('Labware').click()
cy.contains('Well plates').click()
cy.contains('Bio-Rad 96 Well Plate 200 µL PCR').click({
force: true
})
cy.get('[data-testid="Toolbox_confirmButton"]').click({
force: true
})
//cy.get('[data-testid="Toolbox_confirmButton"]').click({ force: true })

Check failure on line 154 in protocol-designer/cypress/e2e/transferSettings.cy.js

View workflow job for this annotation

GitHub Actions / js checks

Expected space or tab after '//' in comment

Check failure on line 154 in protocol-designer/cypress/e2e/transferSettings.cy.js

View workflow job for this annotation

GitHub Actions / js checks

Expected space or tab after '//' in comment
// Todo make a liquid adding function
cy.contains('button', 'Protocol steps').click()
cy.contains('button', '+ Add Step').click()
cy.contains('button', 'Transfer').should('be.visible').click();
cy.contains('Source labware')
cy.contains('Select source wells')
cy.contains('Destination labware')
cy.contains('Volume per well')
cy.contains('Tip handling')
cy.contains('Tip handling')
cy.contains('Tip drop location')

//cy.get('button[type="submit"]').contains('Save').click();

Check failure on line 167 in protocol-designer/cypress/e2e/transferSettings.cy.js

View workflow job for this annotation

GitHub Actions / js checks

Expected space or tab after '//' in comment

Check failure on line 167 in protocol-designer/cypress/e2e/transferSettings.cy.js

View workflow job for this annotation

GitHub Actions / js checks

Expected space or tab after '//' in comment
alexjoel42 marked this conversation as resolved.
Show resolved Hide resolved

//cy.contains('button','Save').click()

Check failure on line 169 in protocol-designer/cypress/e2e/transferSettings.cy.js

View workflow job for this annotation

GitHub Actions / js checks

Expected space or tab after '//' in comment

Check failure on line 169 in protocol-designer/cypress/e2e/transferSettings.cy.js

View workflow job for this annotation

GitHub Actions / js checks

Expected space or tab after '//' in comment


/*

cy.get('foreignObject[x="164"][y="107"]') // Select the <foreignObject> with specific attributes
.find('.Box-sc-8ozbhb-0.kIDovv') // Find the parent <div> inside it
.find('a[role="button"]') // Find the <a> element acting as a button
.contains('Edit slot') // Ensure it contains the text "Edit slot"
.click()

*/

//cy.contains('foreignObject[x="164"][y="107"]', 'Edit slot').click({force:true})

Check failure on line 182 in protocol-designer/cypress/e2e/transferSettings.cy.js

View workflow job for this annotation

GitHub Actions / js checks

Expected space or tab after '//' in comment

Check failure on line 182 in protocol-designer/cypress/e2e/transferSettings.cy.js

View workflow job for this annotation

GitHub Actions / js checks

Expected space or tab after '//' in comment





//cy.contains('Labware')

//C2
//cy.contains('foreignObject[x="164"][y="107"]', 'Edit slot').click()
/*
List of foreign objects by their dimensions
A1 cy.contains('foreignObject[x="164"][y="107"]', 'Edit slot'.click())
A2 cy.contains('foreignObject[x="164"][y="321"]', 'Edit slot'.click())
A3 cy.contains('foreignObject[x="328"][y="321"]', 'Edit slot'.click())
B1 cy.contains('foreignObject[x="0"][y="214"]', 'Edit slot'.click())
B2 cy.contains('foreignObject[x="164"][y="214"]', 'Edit slot'.click())
B3 cy.contains('foreignObject[x="328"][y="214"]', 'Edit slot'.click())
C1 cy.contains('foreignObject[x="0"][y="107"]', 'Edit slot').click()
C2 cy.contains('foreignObject[x="164"][y="107"]', 'Edit slot').click()
C3 cy.contains('foreignObject[x="328"][y="107"]', 'Edit slot').click()
D1 cy.contains('foreignObject[x="0"][y="0"]', 'Edit slot').click()
D2 cy.contains('foreignObject[x="0"][y="0"]', 'Edit slot').click()
D3 cy.contains('foreignObject[x="328"][y="0"]', 'Edit slot').click()

const deck_slots = {
A1: cy.contains('foreignObject[x="164"][y="107"]', 'Edit slot').click(),
A2: cy.contains('foreignObject[x="164"][y="321"]', 'Edit slot').click(),
A3: cy.contains('foreignObject[x="328"][y="321"]', 'Edit slot').click(),
B1: cy.contains('foreignObject[x="0"][y="214"]', 'Edit slot').click(),
B2: cy.contains('foreignObject[x="164"][y="214"]', 'Edit slot').click(),
B3: cy.contains('foreignObject[x="328"][y="214"]', 'Edit slot').click(),
C1: cy.contains('foreignObject[x="0"][y="107"]', 'Edit slot').click(),
C2: cy.contains('foreignObject[x="164"][y="107"]', 'Edit slot').click(),
C3: cy.contains('foreignObject[x="328"][y="107"]', 'Edit slot').click(),
D1: cy.contains('foreignObject[x="0"][y="0"]', 'Edit slot').click(),
D2: cy.contains('foreignObject[x="0"][y="0"]', 'Edit slot').click(),
D3: cy.contains('foreignObject[x="328"][y="0"]', 'Edit slot').click()
};


*/


/*
cy.get('img src="https://sandbox.designer.opentrons.com/chore_release-pd-8.2.2/assets/MagneticBlock_GEN1_HERO-BOB_hSjt.png"')
.should('be.visible')
cy.contains('Temperature Module GEN2').click()
*/








//












// ToDo split pipette selector to only do one (left or right).
// ToDo Get a function that grabs all pipette names to select on this page
/*
Select pipette
<label tabindex="0" role="label" for="1-Channel" class="sc-hLBbgP sc-eDvSVe eXFOtc hkuXTe"><div class="Flex-sc-1qhp8l7-0 jnMqWr"><p class="Text-sc-1wb1h0f-0 StyledText__DesktopStyledText-sc-18lb8jp-0 StyledText-sc-18lb8jp-1 cJXFkZ bslzER jgHigt">1-Channel</p></div></label>
Select tip
Select Modules



*/
/*
const Flex_Home ='Opentrons Flex'
const OT2_Home = 'Opentrons OT-2'
cy.visit('/'); // Replace with the appropriate URL or navigation
cy.verifyHomePage(); // This calls the custom command from commands.ts
cy.clickCreateNew()
cy.contains('label', Flex_Home).should('be.visible')
cy.contains('label', OT2_Home ).should('be.visible').click()
cy.contains('button', "Confirm").should('be.visible')

*/



});
});








// TODO: refactor to test with new navigation
// const isMacOSX = Cypress.platform === 'darwin'
// const batchEditClickOptions = { [isMacOSX ? 'metaKey' : 'ctrlKey']: true }
Expand Down Expand Up @@ -43,7 +329,13 @@
// cy.get('button').contains('exit batch edit').should('exist')
// }

/*
describe('Advanced Settings for Transfer Form', () => {
cy.visit('/')




// before(() => {
// cy.visit('/')
// cy.closeAnnouncementModal()
Expand Down Expand Up @@ -345,3 +637,4 @@
// })
// })
})
*/
Loading
Loading