Skip to content

Commit

Permalink
Tweaks to tests. Add downloads to gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
dariober committed Sep 21, 2023
1 parent d3da898 commit e4ff48c
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 36 deletions.
1 change: 1 addition & 0 deletions packages/jbrowse-plugin-apollo/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
# Cypress specific files
cypress/videos
cypress/screenshots
cypress/downloads
14 changes: 11 additions & 3 deletions packages/jbrowse-plugin-apollo/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Testing with cypress

These are some notes to setup cypress and run tests. These notes are likely to
change and temporary.

These notes setup cypress and run tests. These notes are likely to change.

* One time step: **Outside** the Apollo dev container [install
cypress](https://docs.cypress.io/guides/getting-started/installing-cypress).
Expand All @@ -23,6 +21,16 @@ Add these lines to the `packageExtensions` section of `.yarnrc.yml`:

Then run `yarn` again.

-----

* Start [jbrowse](https://github.com/GMOD/jbrowse-components): You may want to pull the latest code to be consistent with the GitHub workflow

```
cd /path/to/jbrowse-components
git pull
yarn --cwd products/jbrowse-web start
```

* Start Apollo server. Within the docker container (*i.e* within vscode) and in distinct terminals run:

```
Expand Down
2 changes: 2 additions & 0 deletions packages/jbrowse-plugin-apollo/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ const { defineConfig } = require('cypress')
const { configurePlugin } = require('cypress-mongodb')

module.exports = defineConfig({
// Make viewport long and thin to avoid the scrollbar on the right intefere
// with the coordinates
viewportHeight: 2000,
viewportWidth: 1000,
env: {
Expand Down
17 changes: 8 additions & 9 deletions packages/jbrowse-plugin-apollo/cypress/e2e/downloadGff.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('Download GFF', () => {
cy.loginAsGuest()
})

it('FIXME: Can download gff', () => {
it('Can download gff', () => {
cy.addAssemblyFromGff('volvox.fasta.gff3', 'test_data/volvox.fasta.gff3')
cy.get('button[data-testid="dropDownMenuButton"]')
.contains('Apollo')
Expand All @@ -28,13 +28,12 @@ describe('Download GFF', () => {
// TODO 1: Wait for download to complete
// TODO 2: Be sure you scan the right gff file! There may be other gffs
// in downloadsFolder, possibly even from the same assembly used here
/*
cy.exec(`wc -l ${Cypress.config('downloadsFolder')}/*_apollo.gff3`).then(
(result) => {
expect(result.stdout).eq(242)
cy.log(result.stderr)
},
)
*/
// eslint-disable-next-line prettier/prettier
const cmd = `grep -v -P '^#' ${Cypress.config('downloadsFolder')}/*_apollo.gff3 | wc -l`
cy.log(cmd)
cy.exec(cmd).then((result) => {
expect(result.stdout).eq('242')
cy.log(result.stderr)
})
})
})
43 changes: 22 additions & 21 deletions packages/jbrowse-plugin-apollo/cypress/e2e/editFeature.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,6 @@ describe('Different ways of editing features', () => {
cy.loginAsGuest()
})

it.skip('Can select region on rubber-band and zoom into it', () => {
const assemblyName = 'space.gff3'
cy.addAssemblyFromGff(assemblyName, `test_data/${assemblyName}`)
cy.selectAssemblyToView(assemblyName)
cy.get('input[placeholder="Search for location"]').type(
'ctgA:1..10000{enter}',
)
cy.get('[data-testid="rubberband_controls"]').trigger('mouseover')
cy.get('[data-testid="rubberband_controls"]').trigger('mousedown', 100, 5)
cy.get('[data-testid="rubberband_controls"]').trigger('mousemove', 200, 5)
cy.get('[data-testid="rubberband_controls"]').trigger('mouseup', 200, 5, {
force: true,
})
cy.intercept('POST', '/users/userLocation').as('done')
cy.contains('Zoom to region').click()
cy.wait('@done')
cy.currentLocationEquals('ctgA', 1021, 2041, 10)
})

it('FIXME: edit feature via table editor', () => {
const assemblyName = 'space.gff3'
cy.addAssemblyFromGff(assemblyName, `test_data/${assemblyName}`)
Expand Down Expand Up @@ -56,7 +37,7 @@ describe('Different ways of editing features', () => {
'ctgA:9400..9600{enter}',
)

cy.get('tbody')
cy.get('tbody', { timeout: 10_000 })
.contains('tr', 'Match5')
.within(() => {
cy.get('input[type="text"][value="EST_match"]').type('CDS{enter}', {
Expand All @@ -70,16 +51,36 @@ describe('Different ways of editing features', () => {
})
})
cy.get('body').click(0, 0)

// Check edit is done
cy.reload()
cy.get('tbody').within(() => {
cy.get('tbody', { timeout: 10_000 }).within(() => {
cy.get('input[type="text"][value="CDS"]')
cy.contains('9432')
// FIXME: It *should* contain 9567
cy.contains('9567').should('not.exist')
})
})

it.skip('Can select region on rubber-band and zoom into it', () => {
const assemblyName = 'space.gff3'
cy.addAssemblyFromGff(assemblyName, `test_data/${assemblyName}`)
cy.selectAssemblyToView(assemblyName)
cy.get('input[placeholder="Search for location"]').type(
'ctgA:1..10000{enter}',
)
cy.get('[data-testid="rubberband_controls"]').trigger('mouseover')
cy.get('[data-testid="rubberband_controls"]').trigger('mousedown', 100, 5)
cy.get('[data-testid="rubberband_controls"]').trigger('mousemove', 200, 5)
cy.get('[data-testid="rubberband_controls"]').trigger('mouseup', 200, 5, {
force: true,
})
cy.intercept('POST', '/users/userLocation').as('done')
cy.contains('Zoom to region').click()
cy.wait('@done')
cy.currentLocationEquals('ctgA', 1021, 2041, 10)
})

it.skip('Can drag and move position', () => {
const assemblyName = 'space.gff3'
cy.addAssemblyFromGff(assemblyName, `test_data/${assemblyName}`)
Expand Down
16 changes: 13 additions & 3 deletions packages/jbrowse-plugin-apollo/cypress/e2e/searchFeatures.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,20 @@ describe('Search features', () => {
cy.contains('Error: Unknown reference sequence "SpamGene"')
})

it('FIXME: Can handle space in attribute values', () => {
it('Can use quotes to handle spaces', () => {
cy.addAssemblyFromGff('space.gff3', 'test_data/space.gff3')
cy.selectAssemblyToView('space.gff3')
cy.searchFeatures('.1')
cy.contains('Error: Unknown reference sequence')
cy.searchFeatures('"agt A"')
cy.currentLocationEquals('ctgA', 7500, 8000, 10)
})

it('FIXME: Can handle regex and space in attribute values', () => {
cy.addAssemblyFromGff('space.gff3', 'test_data/space.gff3')
cy.selectAssemblyToView('space.gff3')
cy.get('input[placeholder="Search for location"]').type('Ma*.1{enter}')
cy.contains('Search results')
// It should instead either:
// * Return only one hit for Match1, or
// * Return 'Error: Unknown reference sequence'
})
})

0 comments on commit e4ff48c

Please sign in to comment.