Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: merge dev to master #3122

Merged
merged 5 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions .github/workflows/dhis2-verify-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,41 @@ jobs:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
payload: |
{
"text": ":large_green_circle: :maps-app: :tada: Maps app release succeeded for version: ${{ steps.extract_version.outputs.version }}",
"text": "Maps app release ${{ steps.extract_version.outputs.version }} succeeded",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": ":large_green_circle: :maps-app: Maps version ${{ steps.extract_version.outputs.version }} released :tada:",
"emoji": true
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":large_green_circle: :maps-app: :tada: Maps version ${{ steps.extract_version.outputs.version }} released <https://github.com/dhis2/maps-app/actions/workflows/dhis2-verify-app.yml?query=branch%3Amaster+is%3Asuccess|successfully>"
"type": "mrkdwn",
"text": "*Release Notes*"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ${{ toJSON(github.event.head_commit.message) }}
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Link to <https://github.com/dhis2/maps-app/actions/workflows/dhis2-verify-app.yml?query=branch%3Amaster+is%3Asuccess|build>"
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ module.exports = defineConfig({
// Enabled to reduce the risk of out-of-memory issues
experimentalMemoryManagement: true,
// Set to a low number to reduce the risk of out-of-memory issues
numTestsKeptInMemory: 5,
numTestsKeptInMemory: 4,
/* When allowing 1 retry on CI, the test suite will pass if
* it's flaky. And/but we also get to identify flaky tests on the
* Cypress Dashboard. */
Expand Down
8 changes: 8 additions & 0 deletions cypress/elements/event_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Layer } from './layer.js'
export class EventLayer extends Layer {
selectProgram(program) {
cy.get('[data-test="programselect"]').click()
cy.contains(program).scrollIntoView()
cy.contains(program).click()

return this
Expand All @@ -22,4 +23,11 @@ export class EventLayer extends Layer {

return this
}

selectPeriodType(periodType) {
cy.getByDataTest('relative-period-select-content').click()
cy.contains(periodType).click()

return this
}
}
265 changes: 265 additions & 0 deletions cypress/integration/dataTable.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,265 @@
import { EventLayer } from '../elements/event_layer.js'
import { CURRENT_YEAR, EXTENDED_TIMEOUT } from '../support/util.js'

Cypress.on('uncaught:exception', (err) => {
if (
err.message.includes(
'ResizeObserver loop completed with undelivered notifications.'
)
) {
return false
}
})

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

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

cy.getByDataTest('moremenubutton').first().click()

cy.getByDataTest('more-menu')
.find('li')
.not('.disabled')
.should('have.length', 6)

cy.getByDataTest('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')
.findByDataTest('dhis2-uicore-datatablecellhead')
.should('have.length', 10)

// Filter by name
cy.getByDataTest('data-table-column-filter-input-Name')
.find('input')
.type('bar')

// check that the filter returned the correct number of rows
cy.getByDataTest('bottom-panel')
.findByDataTest('dhis2-uicore-tablebody')
.findByDataTest('dhis2-uicore-datatablerow')
.should('have.length', 7)

// confirm that the sort order is initially ascending by Name
cy.getByDataTest('bottom-panel')
.findByDataTest('dhis2-uicore-tablebody')
.find('tr')
.first()
.find('td')
.eq(1)
.should('contain', 'Bargbe')

cy.getByDataTest('bottom-panel')
.findByDataTest('dhis2-uicore-tablebody')
.find('tr')
.last()
.find('td')
.eq(1)
.should('contain', 'Upper Bambara')

// Sort by name
cy.get('button[title="Sort by Name"]').click()

// confirm that the rows are sorted by Name descending
cy.getByDataTest('bottom-panel')
.findByDataTest('dhis2-uicore-tablebody')
.find('tr')
.first()
.find('td')
.eq(1)
.should('contain', 'Upper Bambara')

cy.getByDataTest('bottom-panel')
.findByDataTest('dhis2-uicore-tablebody')
.find('tr')
.last()
.find('td')
.eq(1)
.should('contain', 'Bargbe')

// filter by Value (numeric)
cy.getByDataTest('data-table-column-filter-input-Value')
.find('input')
.type('>26')

// check that the (combined) filter returned the correct number of rows
cy.getByDataTest('bottom-panel')
.findByDataTest('dhis2-uicore-tablebody')
.findByDataTest('dhis2-uicore-datatablerow')
.should('have.length', 5)

// Sort by value
cy.get('button[title="Sort by Value"]').click()

// check that the rows are sorted by Value ascending
cy.getByDataTest('bottom-panel')
.findByDataTest('dhis2-uicore-tablebody')
.find('tr')
.first()
.find('td')
.eq(3)
.should('contain', '35')

cy.getByDataTest('bottom-panel')
.findByDataTest('dhis2-uicore-tablebody')
.find('tr')
.last()
.find('td')
.eq(3)
.should('contain', '76')

// click on a row
cy.getByDataTest('bottom-panel')
.findByDataTest('dhis2-uicore-tablebody')
.findByDataTest('dhis2-uicore-datatablerow')
.first()
.click()

// check that the org unit profile drawer is opened
cy.getByDataTest('org-unit-profile').should('be.visible')
})

it('opens the data table for an Event layer', () => {
cy.visit('/', EXTENDED_TIMEOUT)

const Layer = new EventLayer()

Layer.openDialog('Events')
.selectProgram('Malaria case registration')
.validateStage('Malaria case registration')
.selectTab('Period')
.selectPeriodType('Start/end dates')
.typeStartDate(`${CURRENT_YEAR - 1}-01-01`)
.typeEndDate(`${CURRENT_YEAR - 1}-01-15`)
.selectTab('Org Units')
.selectOu('Bo')
.addToMap()

Layer.validateDialogClosed(true)

Layer.validateCardTitle('Malaria case registration')

cy.getByDataTest('moremenubutton').first().click()

cy.getByDataTest('more-menu')
.find('li')
.contains('Show data table')
.not('disabled')
.click()

cy.getByDataTest('bottom-panel').should('be.visible')

// check number of columns
cy.getByDataTest('bottom-panel')
.findByDataTest('dhis2-uicore-datatablecellhead')
.should('have.length', 9)

cy.getByDataTest('bottom-panel')
.findByDataTest('dhis2-uicore-datatablecellhead')
.contains('Age in years', { matchCase: false })
.should('be.visible')

// filter by Org unit
const ouName = 'Benduma'
cy.getByDataTest('data-table-column-filter-input-Org unit')
.find('input')
.type(ouName)

// check that all the rows have Org unit Yakaji

cy.getByDataTest('bottom-panel')
.findByDataTest('dhis2-uicore-tablebody')
.find('tr')
.first()
.find('td')
.eq(1)
.should('contain', ouName)

cy.getByDataTest('bottom-panel')
.findByDataTest('dhis2-uicore-tablebody')
.find('tr')
.last()
.find('td')
.eq(1)
.should('contain', ouName)

cy.getByDataTest('bottom-panel')
.findByDataTest('dhis2-uicore-tablebody')
.findByDataTest('dhis2-uicore-datatablerow')
.should('have.length', 5)

// filter by Gender
cy.getByDataTest('data-table-column-filter-input-Gender')
.find('input')
.type('Female')

cy.getByDataTest('bottom-panel')
.findByDataTest('dhis2-uicore-tablebody')
.findByDataTest('dhis2-uicore-datatablerow')
.should('have.length', 4)

cy.getByDataTest('data-table-column-filter-input-Gender')
.find('input')
.clear()

cy.getByDataTest('bottom-panel')
.findByDataTest('dhis2-uicore-tablebody')
.findByDataTest('dhis2-uicore-datatablerow')
.should('have.length', 5)

// filter by Age in years (numeric)
cy.getByDataTest('data-table-column-filter-input-Age in years')
.find('input')
.type('<51')

// check that the filter returned the correct number of rows
cy.getByDataTest('bottom-panel')
.findByDataTest('dhis2-uicore-tablebody')
.findByDataTest('dhis2-uicore-datatablerow')
.should('have.length', 3)

// Sort by Age in years
cy.get('button[title="Sort by Age in years"]').click()

// confirm that the rows are sorted by Age in years descending
cy.getByDataTest('bottom-panel')
.findByDataTest('dhis2-uicore-tablebody')
.find('tr')
.first()
.find('td')
.eq(7)
.should('contain', '44')

cy.getByDataTest('bottom-panel')
.findByDataTest('dhis2-uicore-tablebody')
.find('tr')
.last()
.find('td')
.eq(7)
.should('contain', '6')

// click on a row
cy.getByDataTest('bottom-panel')
.findByDataTest('dhis2-uicore-tablebody')
.findByDataTest('dhis2-uicore-datatablerow')
.first()
.click()

// check that the org unit profile drawer is NOT opened
cy.getByDataTest('org-unit-profile').should('not.exist')
})
})
12 changes: 12 additions & 0 deletions cypress/integration/mapDownload.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,18 @@ describe('Map Download', () => {
clickDownloadSetting('Show map name')
cy.getByDataTest('download-map-info').find('h1').should('not.exist')

clickDownloadSetting('Show north arrow')
cy.getByDataTest('north-arrow').should('not.exist')

clickDownloadSetting('Show overview map')
cy.getByDataTest('download-map-info')
.findByDataTest('overview-map')
.should('not.exist')

clickDownloadSetting('Show legend')
cy.getByDataTest('download-map-info').should('not.exist')

// and download the map
cy.getByDataTest('download-settings')
.find('button')
.contains('Download')
Expand Down
Loading
Loading