Skip to content

Commit

Permalink
Merge branch 'cypress' of https://github.com/GMOD/Apollo3 into cypress
Browse files Browse the repository at this point in the history
  • Loading branch information
dariober committed Sep 4, 2023
2 parents 2155cb9 + 5067f28 commit 9638e6b
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 1 deletion.
52 changes: 52 additions & 0 deletions packages/jbrowse-plugin-apollo/cypress/e2e/add_assembly.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
describe('Add Assembly', () => {
beforeEach(() => {
cy.fixture('tmp.json').then((config) => {
cy.exec(
`mongosh ${config.MONGODB_URI} --eval 'db.assemblies.deleteOne({name: "volvox_deleteme"})'`,
).then((result) => {
cy.log(result.stdout)
cy.log(result.stderr)
})
})
cy.loginAsGuest('config.tmp.json')
})

it('Can add assembly from fasta', () => {
cy.contains('Apollo').click()
cy.contains('Add Assembly').click()
cy.get('input[type="TextField"]').type('volvox_deleteme')
cy.get('input[value="text/x-fasta"]').check()
cy.get('input[type="file"]').selectFile('test_data/volvox.fa')

cy.intercept('/changes').as('changes')
cy.contains('Submit').click()
cy.contains('is being added', { timeout: 10000 })
cy.wait('@changes').its('response.statusCode').should('match', /2../)
})

it('Can add assembly from 2bit', () => {
cy.contains('Apollo').click()
cy.contains('Add Assembly').click()
cy.get('input[type="TextField"]').type('volvox_deleteme')
cy.get('input[value="text/x-fasta"]').check()
cy.get('input[type="file"]').selectFile('test_data/volvox.2bit')

cy.intercept('/changes').as('changes')
cy.contains('Submit').click()
cy.contains('is being added', { timeout: 10000 })
cy.wait('@changes').its('response.statusCode').should('match', /2../)
})

it('Can add assembly from gff3 with fasta', () => {
cy.contains('Apollo').click()
cy.contains('Add Assembly').click()
cy.get('input[type="TextField"]').type('volvox_deleteme')
cy.get('input[value="text/x-gff3"]').check()
cy.get('input[type="file"]').selectFile('test_data/volvox.fasta.gff3')

cy.intercept('/changes').as('changes')
cy.contains('Submit').click()
cy.contains('is being added', { timeout: 10000 })
cy.wait('@changes').its('response.statusCode').should('match', /2../)
})
})
3 changes: 2 additions & 1 deletion packages/jbrowse-plugin-apollo/cypress/e2e/apollo.cy.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*
describe('My First Test', () => {
it('visits JBrowse with Apollo', () => {
// You can put JBrowse 2 into any session you want this way at the beginning
Expand All @@ -13,4 +14,4 @@ describe('My First Test', () => {
cy.contains('Log in to Demo Server')
})
})
})
}) */
11 changes: 11 additions & 0 deletions packages/jbrowse-plugin-apollo/cypress/e2e/open_assembly.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
describe('Open Assembly', () => {
it('Can open assembly', () => {
cy.loginAsGuest('config.tmp.json')
cy.contains('Select assembly to view', { timeout: 10000 })
cy.get('input[data-testid="assembly-selector"]').parent().click()
cy.contains('volvox_cy').click()
cy.contains('Open').click()
// It would be better to test that the screen contains "volvox_cy" somewhere (at the moment it doesn't)
cy.get('input[placeholder="Search for location"][value="ctgA:1..50,001"]')
})
})
50 changes: 50 additions & 0 deletions packages/jbrowse-plugin-apollo/cypress/e2e/search_features.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
describe('Search features', () => {
beforeEach(() => {
cy.fixture('config.tmp.json').then((config) => {
cy.exec(
`mongosh ${config.MONGODB_URI} --eval 'db.assemblies.deleteMany({})'`,
).then((result) => {
cy.log(result.stdout)
cy.log(result.stderr)
})
})
cy.loginAsGuest('config.tmp.json')
})

it('One hit, no children', () => {
cy.addAssemblyFromGff('volvox_cy', 'test_data/volvox.fasta.gff3')
cy.selectAssemblyToView('volvox_cy')
cy.searchFeatures('Match6')
cy.currentLocationEquals('ctgA', 8000, 9000, 10)
})

it('One matching Parent and multiple matching children', () => {
cy.addAssemblyFromGff('volvox_cy', 'test_data/volvox.fasta.gff3')
cy.selectAssemblyToView('volvox_cy')
cy.searchFeatures('EDEN')
cy.currentLocationEquals('ctgA', 1050, 9000, 10)
})

it.only('Can handle space in attribute values', () => {
cy.addAssemblyFromGff('volvox_cy', 'test_data/space.gff3')
cy.selectAssemblyToView('volvox_cy')
cy.searchFeatures('.1')
cy.contains('Error: Unknown reference sequence "SpamGene"')
})

it('Search only the selected assembly', () => {
cy.addAssemblyFromGff('volvox_cy', 'test_data/volvox.fasta.gff3')
cy.addAssemblyFromGff('volvox_spam', 'test_data/volvox2.fasta.gff3')

cy.selectAssemblyToView('volvox_spam')
cy.searchFeatures('SpamGene')
cy.currentLocationEquals('ctgA', 100, 200, 10)

cy.fixture('config.tmp.json').then((config) => {
cy.visit(config.apollo_url)
})
cy.selectAssemblyToView('volvox_cy')
cy.searchFeatures('SpamGene')
cy.contains('Error: Unknown reference sequence "SpamGene"')
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"apollo_url": "http://localhost:3000/?config=http%3A%2F%2Flocalhost%3A9000%2Fjbrowse_config.json" ,
"MONGODB_URI": "mongodb://localhost:27017/apolloTestDb"
}

0 comments on commit 9638e6b

Please sign in to comment.