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

fix(labware-library): remove python test protocol affordances from labware-creator #13896

Merged
merged 20 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'cypress-file-upload'
import JSZip from 'jszip'
import { expectDeepEqual } from '@opentrons/shared-data/js/cypressUtils'

const expectedExportFixture =
Expand Down Expand Up @@ -39,12 +38,6 @@ context('Tubes and Rack', () => {
cy.contains('start creating labware').click({ force: true })
})

it('contains a button to the testing guide', () => {
cy.contains('labware test guide')
.should('have.prop', 'href')
.and('to.have.string', 'labwareDefinition_testGuide')
})

it('does not have a preview image', () => {
cy.contains('Add missing info to see labware preview').should('exist')
})
Expand Down Expand Up @@ -187,47 +180,25 @@ context('Tubes and Rack', () => {
cy.get("input[placeholder='somerackbrand_24_tuberack_1500ul']").should(
'exist'
)

// Test pipette
cy.contains('Test Pipette is a required field').should('exist')
// TODO(IL, 2021-05-15): give Dropdown component semantic selectors for E2E
cy.get('label')
.contains('Test Pipette')
.children()
.first()
.trigger('mousedown')
cy.get('*[class^="_option_label"]')
.contains(/P20.*Single-Channel.*GEN2/)
.click()
cy.contains('Test Pipette is a required field').should('not.exist')

// All fields present
cy.get('button[class*="_export_button_"]').click({ force: true })
cy.contains(
'Please resolve all invalid fields in order to export the labware definition'
).should('not.exist')
})

it('should export a file matching the fixture', () => {
cy.fixture(expectedExportFixture).then(expectedExportLabwareDef => {
cy.get('button').contains('EXPORT FILE').click()

cy.window()
.its('__lastSavedBlobZip__')
.its('__lastSavedFileBlob__')
.should('be.a', 'blob')
.should(async blob => {
const zipObj = await JSZip.loadAsync(blob)
const labwareDefFile =
zipObj.files['somerackbrand_24_tuberack_1500ul.json']
const labwareDefText = await labwareDefFile.async('text')
const labwareDefText = await blob.text()
const savedDef = JSON.parse(labwareDefText)

expectDeepEqual(assert, savedDef, expectedExportLabwareDef)
})

cy.window()
.its('__lastSavedFileName__')
.should('equal', `somerackbrand_24_tuberack_1500ul.zip`)
.should('equal', `somerackbrand_24_tuberack_1500ul.json`)
})
})
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import jszip from 'jszip'
import { expectDeepEqual } from '@opentrons/shared-data/js/cypressUtils'

const importedLabwareFile = 'TestLabwareDefinition.json'
const pythonFileFixture = 'TestLabwareProtocol.py'

context('File Import', () => {
before(() => {
Expand All @@ -26,12 +24,6 @@ context('File Import', () => {
})
})

it('contains a button to the testing guide', () => {
cy.contains('labware test guide')
.should('have.prop', 'href')
.and('to.have.string', 'labwareDefinition_testGuide')
})

it('does has a preview image', () => {
cy.contains('Add missing info to see labware preview').should('not.exist')
})
Expand Down Expand Up @@ -103,50 +95,26 @@ context('File Import', () => {
cy.get("input[placeholder='TestPro 15 Well Plate 5 µL']").should('exist')
cy.get("input[placeholder='testpro_15_wellplate_5ul']").should('exist')

// Test pipette
// TODO(IL, 2021-05-15): give Dropdown component semantic selectors for E2E
cy.get('label')
.contains('Test Pipette')
.children()
.first()
.trigger('mousedown')
cy.get('*[class^="_option_label"]')
.contains(/P10.*Single-Channel.*GEN1/)
.click()

// All fields present
cy.get('button[class*="_export_button_"]').click({ force: true })
cy.contains(
'Please resolve all invalid fields in order to export the labware definition'
).should('not.exist')

cy.window()
.its('__lastSavedBlobZip__')
.should('be.a', 'blob') // wait until we get the blob
.then(blob => jszip.loadAsync(blob)) // load blob into ZipObject
.then(zipObject => {
const jsonFiles = zipObject.file(/.*\.json$/)
expect(jsonFiles).to.have.lengthOf(1)
cy.wrap(jsonFiles[0])
.invoke('async', 'string')
.then(jsonFile => {
cy.fixture(importedLabwareFile).then(expected => {
// TODO(IL, 2020/04/13): use deep equal util from PD cypress tests
expectDeepEqual(assert, JSON.parse(jsonFile), expected)
})
})

const pythonFiles = zipObject.file(/.*\.py$/)
expect(pythonFiles).to.have.lengthOf(1)
cy.wrap(pythonFiles[0].async('string')).then(contents => {
cy.fixture(pythonFileFixture).then(expected => {
expect(contents).to.equal(expected)
})
cy.fixture(importedLabwareFile).then(expected => {
cy.window()
.its('__lastSavedFileBlob__')
.should('be.a', 'blob') // wait until we get the blob
.should(async blob => {
const labwareDefText = await blob.text()
const savedDef = JSON.parse(labwareDefText)

expectDeepEqual(assert, savedDef, expected)
})
})
})

cy.window()
.its('__lastSavedFileName__')
.should('equal', 'testpro_15_wellplate_5ul.zip')
.should('equal', 'testpro_15_wellplate_5ul.json')
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ context('Reservoirs', () => {
cy.contains('start creating labware').click({ force: true })
})

it('contains a button to the testing guide', () => {
cy.contains('labware test guide')
.should('have.prop', 'href')
.and('to.have.string', 'labwareDefinition_testGuide')
})

it('does not have a preview image', () => {
cy.contains('Add missing info to see labware preview').should('exist')
})
Expand Down Expand Up @@ -225,19 +219,6 @@ context('Reservoirs', () => {
'exist'
)

// Test pipette
cy.contains('Test Pipette is a required field').should('exist')
// TODO(IL, 2021-05-15): give Dropdown component semantic selectors for E2E
cy.get('label')
.contains('Test Pipette')
.children()
.first()
.trigger('mousedown')
cy.get('*[class^="_option_label"]')
.contains(/P10.*Single-Channel.*GEN1/)
.click()
cy.contains('Test Pipette is a required field').should('not.exist')

// All fields present
cy.get('button[class*="_export_button_"]').click({ force: true })
cy.contains(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'cypress-file-upload'
import JSZip from 'jszip'
import { expectDeepEqual } from '@opentrons/shared-data/js/cypressUtils'

const expectedExportFixture = '../fixtures/generic_1_tiprack_20ul.json'
Expand Down Expand Up @@ -260,43 +259,24 @@ describe('Create a Tip Rack', () => {
cy.get('input[name="loadName"]').clear().type('generic_1_tiprack_20ul')
})

it('Select the pipette', () => {
cy.get('#Export h2').contains('Labware Test Protocol').should('exist')
cy.get('#react-select-4-input').click()
cy.get('input[name="pipetteName"]')
.invoke('attr', 'value', 'p20_single_gen2')
.should('have.attr', 'value', 'p20_single_gen2')
cy.get('*[class^="_option_label"]')
.contains(/P20.*Single-Channel.*GEN2/)
.click()
cy.get('#DefinitionTest a').contains('tip rack test guide').click()
cy.get('#DefinitionTest a').should(
'have.attr',
'href',
'https://insights.opentrons.com/hubfs/Products/Consumables%20and%20Reagents/labwareDefinition_tipRack_testGuide.pdf'
)
})

it('Verify the exported file to the fixture', () => {
cy.fixture(expectedExportFixture).then(expectedExportLabwareDef => {
cy.get('button').contains('EXPORT FILE').click()
cy.get('button').contains('EXPORT FILE').click()

cy.fixture(expectedExportFixture).then(expectedExportLabwareDef => {
cy.window()
.its('__lastSavedBlobZip__')
.its('__lastSavedFileBlob__')
.should('be.a', 'blob')
.should(async blob => {
const zipObj = await JSZip.loadAsync(blob)
const labwareDefFile = zipObj.files['generic_1_tiprack_20ul.json']
const labwareDefText = await labwareDefFile.async('text')
const labwareDefText = await blob.text()
const savedDef = JSON.parse(labwareDefText)

expectDeepEqual(assert, savedDef, expectedExportLabwareDef)
})

cy.window()
.its('__lastSavedFileName__')
.should('equal', `generic_1_tiprack_20ul.zip`)
})

cy.window()
.its('__lastSavedFileName__')
.should('equal', `generic_1_tiprack_20ul.json`)
})
it('verify the too big, too small error', () => {
cy.get('input[name="gridOffsetY"]').clear().type('24')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ context('Tubes and Block', () => {
cy.contains('start creating labware').click({ force: true })
})

it('contains a button to the testing guide', () => {
cy.contains('labware test guide')
.should('have.prop', 'href')
.and('to.have.string', 'labwareDefinition_testGuide')
})

it('does not have a preview image', () => {
cy.contains('Add missing info to see labware preview').should('exist')
})
Expand Down Expand Up @@ -171,19 +165,6 @@ context('Tubes and Block', () => {
'exist'
)

// Test pipette
cy.contains('Test Pipette is a required field').should('exist')
// TODO(IL, 2021-05-15): give Dropdown component semantic selectors for E2E
cy.get('label')
.contains('Test Pipette')
.children()
.first()
.trigger('mousedown')
cy.get('*[class^="_option_label"]')
.contains(/P10.*Single-Channel.*GEN1/)
.click()
cy.contains('Test Pipette is a required field').should('not.exist')

// All fields present
cy.get('button[class*="_export_button_"]').click({ force: true })
cy.contains(
Expand Down Expand Up @@ -228,12 +209,6 @@ context('Tubes and Block', () => {
cy.contains('start creating labware').click({ force: true })
})

it('contains a button to the testing guide', () => {
cy.contains('labware test guide')
.should('have.prop', 'href')
.and('to.have.string', 'labwareDefinition_testGuide')
})

it('does not have a preview image', () => {
cy.contains('Add missing info to see labware preview').should('exist')
})
Expand Down Expand Up @@ -358,19 +333,6 @@ context('Tubes and Block', () => {
'exist'
)

// Test pipette
cy.contains('Test Pipette is a required field').should('exist')
// TODO(IL, 2021-05-15): give Dropdown component semantic selectors for E2E
cy.get('label')
.contains('Test Pipette')
.children()
.first()
.trigger('mousedown')
cy.get('*[class^="_option_label"]')
.contains(/P10.*Single-Channel.*GEN1/)
.click()
cy.contains('Test Pipette is a required field').should('not.exist')

// All fields present
cy.get('button[class*="_export_button_"]').click({ force: true })
cy.contains(
Expand Down Expand Up @@ -415,12 +377,6 @@ context('Tubes and Block', () => {
cy.contains('start creating labware').click({ force: true })
})

it('contains a button to the testing guide', () => {
cy.contains('labware test guide')
.should('have.prop', 'href')
.and('to.have.string', 'labwareDefinition_testGuide')
})

it('does not have a preview image', () => {
cy.contains('Add missing info to see labware preview').should('exist')
})
Expand Down Expand Up @@ -545,19 +501,6 @@ context('Tubes and Block', () => {
'exist'
)

// Test pipette
cy.contains('Test Pipette is a required field').should('exist')
// TODO(IL, 2021-05-15): give Dropdown component semantic selectors for E2E
cy.get('label')
.contains('Test Pipette')
.children()
.first()
.trigger('mousedown')
cy.get('*[class^="_option_label"]')
.contains(/P10.*Single-Channel.*GEN1/)
.click()
cy.contains('Test Pipette is a required field').should('not.exist')

// All fields present
cy.get('button[class*="_export_button_"]').click({ force: true })
cy.contains(
Expand Down Expand Up @@ -600,12 +543,6 @@ context('Tubes and Block', () => {
cy.contains('start creating labware').click({ force: true })
})

it('contains a button to the testing guide', () => {
cy.contains('labware test guide')
.should('have.prop', 'href')
.and('to.have.string', 'labwareDefinition_testGuide')
})

it('does not have a preview image', () => {
cy.contains('Add missing info to see labware preview').should('exist')
})
Expand Down Expand Up @@ -730,19 +667,6 @@ context('Tubes and Block', () => {
'exist'
)

// Test pipette
cy.contains('Test Pipette is a required field').should('exist')
// TODO(IL, 2021-05-15): give Dropdown component semantic selectors for E2E
cy.get('label')
.contains('Test Pipette')
.children()
.first()
.trigger('mousedown')
cy.get('*[class^="_option_label"]')
.contains(/P10.*Single-Channel.*GEN1/)
.click()
cy.contains('Test Pipette is a required field').should('not.exist')

// All fields present
cy.get('button[class*="_export_button_"]').click({ force: true })
cy.contains(
Expand Down
Loading
Loading