Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
y3rsh committed Oct 17, 2024
1 parent 6e88932 commit 984ff41
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 35 deletions.
4 changes: 4 additions & 0 deletions labware-library/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,7 @@ Certain environment variables, when set, will affect the artifact output.
| OT_LL_MIXPANEL_DEV_ID | some string ID | Mixpanel token for dev environment. |
| OT_LL_VERSION | semver string eg "1.2.3" | reported to analytics. Read from package.json by default. |
| OT_LL_BUILD_DATE | result of `new Date().toUTCString()` | reported to analytics. Uses current date-time by default. |

## Cypress

`npx cypress open` will open the Cypress test runner. From there, you can run the tests in the `labware-library` directory.
5 changes: 3 additions & 2 deletions labware-library/cypress/e2e/home.cy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { navigateToUrl } from '../support/e2e'

describe('The Desktop Home Page', () => {
beforeEach(() => {
cy.visit('/')
cy.viewport('macbook-15')
navigateToUrl('/')
})

it('successfully loads', () => {
Expand Down
4 changes: 2 additions & 2 deletions labware-library/cypress/e2e/labware-creator/create.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// an element is in view before clicking or checking with
// { force: true }

import { navigateToPage } from '../../support/e2e'
import { navigateToUrl } from '../../support/e2e'

context('The Labware Creator Landing Page', () => {
beforeEach(() => {
navigateToPage('create')
navigateToUrl('/#/create')
})

describe('The initial text', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {
navigateToPage,
navigateToUrl,
fileHelper,
wellBottomImageLocator,
} from '../../support/e2e'
const fileHolder = fileHelper('somerackbrand_24_tuberack_1500ul')

context('Tubes and Rack', () => {
before(() => {
navigateToPage('create')
navigateToUrl('/#/create')
})

describe('Custom 6 x 4 tube rack', () => {
Expand Down
4 changes: 2 additions & 2 deletions labware-library/cypress/e2e/labware-creator/fileImport.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
navigateToPage,
navigateToUrl,
fileHelper,
wellBottomImageLocator,
} from '../../support/e2e'
Expand All @@ -9,7 +9,7 @@ const importedLabwareFile = 'TestLabwareDefinition.json'

describe('File Import', () => {
before(() => {
navigateToPage('create')
navigateToUrl('/#/create')
})

it('tests the file import flow', () => {
Expand Down
4 changes: 2 additions & 2 deletions labware-library/cypress/e2e/labware-creator/reservoir.cy.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {
navigateToPage,
navigateToUrl,
fileHelper,
wellBottomImageLocator,
} from '../../support/e2e'
const fileHolder = fileHelper('testpro_10_reservoir_250ul')

context('Reservoirs', () => {
before(() => {
navigateToPage('create')
navigateToUrl('/#/create')
})

describe('Reservoir', () => {
Expand Down
4 changes: 2 additions & 2 deletions labware-library/cypress/e2e/labware-creator/tipRack.cy.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { navigateToPage, fileHelper } from '../../support/e2e'
import { navigateToUrl, fileHelper } from '../../support/e2e'
const fileHolder = fileHelper('generic_1_tiprack_20ul')

describe('Create a Tip Rack', () => {
before(() => {
navigateToPage('create')
navigateToUrl('/#/create')
})
it('Should create a tip rack', () => {
// Tip Rack Selection from drop down
Expand Down
9 changes: 3 additions & 6 deletions labware-library/cypress/e2e/labware-creator/tubesBlock.cy.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import {
navigateToPage,
navigateToUrl,
fileHelper,
wellBottomImageLocator,
} from '../../support/e2e'
const fileHolder = fileHelper('testpro_24_aluminumblock_10ul')

context('Tubes and Block', () => {
beforeEach(() => {
navigateToPage('create')

navigateToUrl('/#/create')
cy.get('label')
.contains('What type of labware are you creating?')
.children()
Expand Down Expand Up @@ -447,9 +446,7 @@ context('Tubes and Block', () => {
})

it('tests the whole form and file export', () => {
cy.visit('/')
cy.get('a[href="/create"]').first().click()
cy.viewport('macbook-15')
navigateToUrl('/#/create')
cy.get('label')
.contains('What type of labware are you creating?')
.children()
Expand Down
14 changes: 4 additions & 10 deletions labware-library/cypress/e2e/labware-creator/tubesRack.cy.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { navigateToPage, wellBottomImageLocator } from '../../support/e2e'
import { navigateToUrl, wellBottomImageLocator } from '../../support/e2e'

context('Tubes and Rack', () => {
describe('Six tubes', () => {
before(() => {
navigateToPage('create')
navigateToUrl('/#/create')
cy.get('label')
.contains('What type of labware are you creating?')
.children()
Expand Down Expand Up @@ -134,10 +134,7 @@ context('Tubes and Rack', () => {

describe('Fifteen tubes', () => {
before(() => {
cy.visit('/')
cy.get('a[href="/create"]').first().click()
cy.viewport('macbook-15')

navigateToUrl('#/create')
cy.get('label')
.contains('What type of labware are you creating?')
.children()
Expand Down Expand Up @@ -266,10 +263,7 @@ context('Tubes and Rack', () => {

describe('Twentyfour tubes', () => {
before(() => {
cy.visit('/')
cy.get('a[href="/create"]').first().click()
cy.viewport('macbook-15')

navigateToUrl('/#/create')
cy.get('label')
.contains('What type of labware are you creating?')
.children()
Expand Down
4 changes: 2 additions & 2 deletions labware-library/cypress/e2e/labware-creator/wellPlate.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
// a user to do this.

import {
navigateToPage,
navigateToUrl,
fileHelper,
wellBottomImageLocator,
} from '../../support/e2e'
const fileHolder = fileHelper('testpro_80_wellplate_100ul')

context('Well Plates', () => {
before(() => {
navigateToPage('create')
navigateToUrl('/#/create')
})

describe('Create a well plate', () => {
Expand Down
5 changes: 3 additions & 2 deletions labware-library/cypress/e2e/navigation.cy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { navigateToUrl } from '../support/e2e'

describe('Desktop Navigation', () => {
beforeEach(() => {
cy.visit('/')
cy.viewport('macbook-15')
navigateToUrl('/')
})

it('contains the subdomain nav bar', () => {
Expand Down
5 changes: 2 additions & 3 deletions labware-library/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
import { join } from 'path'
import './commands'

export const navigateToPage = (page: string): void => {
cy.visit('/')
cy.get(`a[href="/${page}"]`).first().click()
export const navigateToUrl = (url: string): void => {
cy.visit(url)
cy.viewport('macbook-15')
}

Expand Down

0 comments on commit 984ff41

Please sign in to comment.