Skip to content

Commit

Permalink
chore: tests for data-table
Browse files Browse the repository at this point in the history
  • Loading branch information
jenniferarnesen committed Oct 5, 2023
1 parent 5fc879c commit b285ea3
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
62 changes: 62 additions & 0 deletions cypress/integration/dataTable.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { EXTENDED_TIMEOUT } from '../support/util.js'

const map = {
id: 'eDlFx0jTtV9',
name: 'ANC: LLITN Cov Chiefdom this year',
downloadFileNamePrefix: 'ANC LLITN Cov Chiefdom this year',
cardTitle: 'ANC LLITN coverage',
}

// const openMoreMenuWithOptions = (numOptions) => {
// cy.get('[data-test="moremenubutton"]').first().click()

// cy.get('[data-test="more-menu"]')
// .find('li')
// .not('.disabled')
// .should('have.length', numOptions)

// cy.get('[data-test="more-menu"]')
// .find('li')
// .contains('Show data table')
// .click()

// //check that the bottom panel is present
// cy.getByDataTest('bottom-panel').should('be.visible')

// // option switched to "Hide data table"

// }

describe('data table', () => {
it('opens data table', () => {
cy.visit(`/?id=${map.id}`, EXTENDED_TIMEOUT)
cy.get('canvas', EXTENDED_TIMEOUT).should('be.visible')

cy.get('[data-test="moremenubutton"]').first().click()

cy.get('[data-test="more-menu"]')
.find('li')
.not('.disabled')
.should('have.length', 6)

cy.get('[data-test="more-menu"]')
.find('li')
.contains('Show data table')
.click()

//check that the bottom panel is present
cy.getByDataTest('bottom-panel').should('be.visible')

// check number of columns
cy.getByDataTest('bottom-panel')
.find('[role="columnheader"]')
.should('have.length', 10)

// try the filtering
cy.getByDataTest('bottom-panel')
.find('[role="columnheader"]')
.containsExact('Name')
.siblings('input')
.type('Kakua')
})
})
1 change: 1 addition & 0 deletions src/components/datatable/BottomPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const BottomPanel = () => {
ref={panelRef}
className={styles.bottomPanel}
style={{ height: tableHeight }}
data-test="bottom-panel"
>
<span
className={styles.closeIcon}
Expand Down

0 comments on commit b285ea3

Please sign in to comment.