From 2fd0f845feafc0f69b94ef736d5bfc13a670ee33 Mon Sep 17 00:00:00 2001 From: Dario Beraldi Date: Wed, 18 Dec 2024 02:17:14 +0000 Subject: [PATCH] Fix closing drawer in cypress tests (#498) * Fix closing drawer in cypress tests When loading an assembly close the drawer of jobs tasks *before* reloading the page since occasionally the drawer is already closed after reloading. * Close drawer if you can find it; increase viewport width --- packages/jbrowse-plugin-apollo/cypress.config.js | 2 +- .../jbrowse-plugin-apollo/cypress/e2e/editFeature.cy.ts | 6 +++--- .../jbrowse-plugin-apollo/cypress/support/commands.ts | 8 +++++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/jbrowse-plugin-apollo/cypress.config.js b/packages/jbrowse-plugin-apollo/cypress.config.js index 3e308d85e..2f5c2438e 100644 --- a/packages/jbrowse-plugin-apollo/cypress.config.js +++ b/packages/jbrowse-plugin-apollo/cypress.config.js @@ -12,7 +12,7 @@ module.exports = defineConfig({ // Make viewport long and thin to avoid the scrollbar on the right interfere // with the coordinates viewportHeight: 2000, - viewportWidth: 1000, + viewportWidth: 1300, retries: { runMode: 2, }, diff --git a/packages/jbrowse-plugin-apollo/cypress/e2e/editFeature.cy.ts b/packages/jbrowse-plugin-apollo/cypress/e2e/editFeature.cy.ts index 1875490f4..5f1cc46a3 100644 --- a/packages/jbrowse-plugin-apollo/cypress/e2e/editFeature.cy.ts +++ b/packages/jbrowse-plugin-apollo/cypress/e2e/editFeature.cy.ts @@ -21,7 +21,7 @@ describe('Different ways of editing features', () => { cy.deleteAssemblies() }) - it.skip('Edit feature via table editor', () => { + it('Edit feature via table editor', () => { const assemblyName = 'space.gff3' cy.addAssemblyFromGff(assemblyName, `test_data/${assemblyName}`) cy.selectAssemblyToView(assemblyName) @@ -81,7 +81,7 @@ describe('Different ways of editing features', () => { }) }) - it.skip('Can add gene ontology attribute', () => { + it('Can add gene ontology attribute', () => { cy.addAssemblyFromGff('onegene.fasta.gff3', 'test_data/onegene.fasta.gff3') cy.selectAssemblyToView('onegene.fasta.gff3') cy.searchFeatures('gx1', 1) @@ -110,7 +110,7 @@ describe('Different ways of editing features', () => { cy.contains('td', 'Gene Ontology=GO:0044838') }) - it.only('FIXME: Can delete feature with checks', () => { + it('FIXME: Can delete feature with checks', () => { cy.addAssemblyFromGff('stopcodon', 'test_data/cdsChecks/stopcodon.gff3') cy.selectAssemblyToView('stopcodon') cy.searchFeatures('gene02', 1) diff --git a/packages/jbrowse-plugin-apollo/cypress/support/commands.ts b/packages/jbrowse-plugin-apollo/cypress/support/commands.ts index 5c071376c..765ddc14b 100644 --- a/packages/jbrowse-plugin-apollo/cypress/support/commands.ts +++ b/packages/jbrowse-plugin-apollo/cypress/support/commands.ts @@ -119,10 +119,16 @@ Cypress.Commands.add('addAssemblyFromGff', (assemblyName, fin) => { cy.contains('AddAssemblyAndFeaturesFromFileChange') .parent() .should('contain', 'All operations successful') + // cy.get('button[aria-label="Close drawer"]', { timeout: 20_000 }).click() // eslint-disable-next-line cypress/no-unnecessary-waiting cy.wait(1000) cy.reload() - cy.get('button[aria-label="Close drawer"]', { timeout: 20_000 }).click() + // If the drawer is still open close it + cy.get('body').then(($body) => { + if ($body.find('button[aria-label="Close drawer"]').length > 0) { + cy.get('button[aria-label="Close drawer"]').click() + } + }) cy.contains('Select assembly to view', { timeout: 10_000 }) })