PoonLab / covizu

Rapid analysis and visualization of coronavirus genome variation
https://filogeneti.ca/CoVizu/
MIT License
45 stars 20 forks source link

Populate Cypress test suite #447

Closed ArtPoon closed 1 year ago

ArtPoon commented 1 year ago
ArtPoon commented 1 year ago
nav-mohan commented 1 year ago

I have a question about the tooltips. According to one of the tests (from an older version), the nodes of the tree used to maintain a relationship between their #id and the number of variants.


    it('Cluster tooltips contain relevant and correct information', () => {
        cy.get('rect:visible').first().trigger('mouseover').invoke('attr','id').as('id')
        cy.get('@id').then(id => {
            var id_number = id.substring(3)
            cy.window().then((win) => {
                // Number of variants
                cy.get('.tooltip').contains(`Number of variants: ${win.tips[id_number]['varcount']}`)
                // Mutations list
                cy.wrap(win.tips[id_number]['mutations']).each(($el) => {
                    cy.get('.tooltip').contains($el)
                })
                // Regions: Num of Cases 
                cy.wrap(Object.keys(win.tips[id_number]['allregions'])).each(($el, index) => {
                    cy.get('.tooltip').contains(`${$el}: ${Object.values(win.tips[id_number]['allregions'])[index]}`)
                })
                // Mean diffs from root
                cy.get('.tooltip').contains(`Mean diffs from root: ${win.tips[id_number]['mean_ndiffs'].toFixed(2)}`) 
                // Deviation from clock
                cy.get('.tooltip').contains(`Deviation from clock: ${win.tips[id_number]['residual'].toFixed(2)}`)
                // Collection dates (UTC)
                cy.get('.tooltip').contains(`${win.tips[id_number]['first_date'].toISOString().slice(0, 10)} / ${win.tips[id_number]['last_date'].toISOString().slice(0, 10)}`)
            })
        })
    })

From looking at the UI and the code, I couldn't figure out how to modify this test-code to reflect the newer UI. I'm particularly confused about terms such as win.tips[id_number]['varcount']

bonnielu commented 1 year ago

For reference, there are a couple of more test files in the iss259 branch.

ArtPoon commented 1 year ago

Let's keep this to a separate branch for now (test-suite?) and merge iss259 - keep tests off dev branch for now

ArtPoon commented 1 year ago

@bonnielu added some unit tests for utils.js

ArtPoon commented 1 year ago
ArtPoon commented 1 year ago

@nav-mohan reported a discrepancy between headless and Electron browser unit test results. This is apparently a known issue with Cypress. Open in a new issue.

nav-mohan commented 1 year ago

One of my tests seems to be running into this issue. The test fails in the headless browser. But it passes in the Electron browser. Opening a new issue.

GopiGugan commented 1 year ago

@bonnielu - adding unit tests for beadplot.js.

There were concerns over the number of times the page refreshes when running the tests. @nav-mohan mentioned that this could be addressed by adding switch statements: https://github.com/PoonLab/covizu/blob/0ec4a711e591ae7f6005be550f85994e4726e531/cypress/e2e/covizu.spec.cy.js#L47-L61

ArtPoon commented 1 year ago

@bonnielu continuing to work on this with new test files from @GopiGugan

ArtPoon commented 1 year ago

@bonnielu to continue populating this test suite

ArtPoon commented 1 year ago

@bonnielu to push recent changes into dev branch