Skip to content

Commit

Permalink
I changed chose deck slot to just return the deck slot. ToDo is to ma…
Browse files Browse the repository at this point in the history
…ke an add lawbare and an add liquid function.
  • Loading branch information
alexjoel42 committed Dec 19, 2024
1 parent 2ccb2de commit 13e762c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 22 deletions.
27 changes: 21 additions & 6 deletions protocol-designer/cypress/e2e/transferSettings.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ 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 19 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
/
Expand Down Expand Up @@ -80,14 +80,16 @@ describe('Happy Path Transfer Tests', () => {
cy.contains('Confirm').click()
// ToDo make sure that the protocol overview stage works.
cy.contains('Edit protocol').click()
cy.chooseDeckSlot('C2')
cy.chooseDeckSlot('C2').click()
cy.contains('Add hardware/labware').click()
//cy.contains('foreignObject[x="164"][y="107"]', 'Edit slot').click()

Check failure on line 85 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()
cy.contains('Armadillo 96 Well Plate 200 µL PCR Full Skirt').click({force:true})
cy.get('[data-testid="Toolbox_confirmButton"]').click({ force: true })
cy.get('foreignObject[x="164"][y="107"]')
// To do make a liquid adding function
// I suspect we're almost there, just need
cy.chooseDeckSlot('C2')
.find('.Box-sc-8ozbhb-0.kIDovv')
.find('a[role="button"]')
.contains('Edit slot')
Expand All @@ -97,7 +99,20 @@ describe('Happy Path Transfer Tests', () => {
cy.contains('button', 'Define a liquid').click()
cy.get('input[name="name"]') // Select the input with name="name"
.type('My liquid!')
cy.get('button[type="submit"]').contains('Save').click();

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('button[type="submit"]').contains('Save').click();

Check failure on line 115 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('button','Save').click()

Check failure on line 117 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

Expand Down
34 changes: 18 additions & 16 deletions protocol-designer/cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ Cypress.Commands.add('verifyCreateNewHeader', () => {

// Home Page
Cypress.Commands.add('verifyHomePage', () => {
cy.contains('button', 'Confirm').click()
// Todo re-add when Once 8.2.2 comes back in
//cy.contains('button', 'Confirm').click()
cy.contains(content.welcome)
cy.contains('button', locators.createProtocol).should('be.visible')
cy.contains('label', locators.editProtocol).should('be.visible')
Expand All @@ -118,8 +119,9 @@ Cypress.Commands.add('verifyHomePage', () => {
Cypress.Commands.add('clickCreateNew', () => {
// cy.get('[data-testid="SettingsIconButton"]').click();
cy.getByTestId(locators.settingsDataTestid).click()
cy.get('[data-testid="analyticsToggle"] svg')
.should('have.css', 'fill', 'rgb(0, 108, 250)')
// ToDo re-add when 8.2.2 pushed to edge
// cy.get('[data-testid="analyticsToggle"] svg')
// .should('have.css', 'fill', 'rgb(0, 108, 250)')
cy.getByTestId(locators.settingsDataTestid).click()
cy.contains(locators.createProtocol).click()

Expand Down Expand Up @@ -212,18 +214,18 @@ Cypress.Commands.add(

Cypress.Commands.add('chooseDeckSlot', (slot: string) => {
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()
A1: () => cy.contains('foreignObject[x="164"][y="107"]', 'Edit slot'),
A2: () => cy.contains('foreignObject[x="164"][y="321"]', 'Edit slot'),
A3: () => cy.contains('foreignObject[x="328"][y="321"]', 'Edit slot'),
B1: () => cy.contains('foreignObject[x="0"][y="214"]', 'Edit slot'),
B2: () => cy.contains('foreignObject[x="164"][y="214"]', 'Edit slot'),
B3: () => cy.contains('foreignObject[x="328"][y="214"]', 'Edit slot'),
C1: () => cy.contains('foreignObject[x="0"][y="107"]', 'Edit slot'),
C2: () => cy.contains('foreignObject[x="164"][y="107"]', 'Edit slot'),
C3: () => cy.contains('foreignObject[x="328"][y="107"]', 'Edit slot'),
D1: () => cy.contains('foreignObject[x="0"][y="0"]', 'Edit slot'),
D2: () => cy.contains('foreignObject[x="0"][y="0"]', 'Edit slot'),
D3: () => cy.contains('foreignObject[x="328"][y="0"]', 'Edit slot')
};

// Correct syntax: just assign the action to `slotAction`
Expand All @@ -232,7 +234,7 @@ Cypress.Commands.add('chooseDeckSlot', (slot: string) => {
// Call the corresponding Cypress command, if the action exists
if (slotAction) {
slotAction() // Execute the Cypress command for the selected slot
cy.contains('Add hardware/labware').click()

} else {
throw new Error(`Slot ${slot} not found in deck slots.`);
}
Expand Down

0 comments on commit 13e762c

Please sign in to comment.