Skip to content

Commit

Permalink
Merge branch 'master' into fix/list-filters-for-deg-degs
Browse files Browse the repository at this point in the history
  • Loading branch information
Birkbjo committed May 14, 2024
2 parents cb63cf9 + 77f5695 commit 2da80da
Show file tree
Hide file tree
Showing 38 changed files with 635 additions and 308 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/dhis2-verify-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
run: yarn d2-app-scripts test --coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3

e2e:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -98,8 +98,8 @@ jobs:
BROWSER: none
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
CYPRESS_dhis2BaseUrl: https://debug.dhis2.org/dev
CYPRESS_dhis2BaseUrl: https://debug.dhis2.org/2.41dev
CYPRESS_dhis2Username: ${{ secrets.CYPRESS_DHIS2_USERNAME }}
CYPRESS_dhis2Password: ${{ secrets.CYPRESS_DHIS2_PASSWORD }}
CYPRESS_dhis2ApiVersion: 40
CYPRESS_dhis2ApiVersion: 41
CYPRESS_networkMode: live
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ cypress.env.json
.env.test.local
.env.production.local
cypress/screenshots/*
coverage/
coverage/
cypress.env.json
209 changes: 209 additions & 0 deletions cypress/e2e/dataElements/New.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
describe('Data elements', () => {
it('should create a data element with only the required values', () => {
const now = Date.now()
const newDataElementName = `ZZZ ${now}` // Will be at the end, does not pollute the first page of the list

cy.visit('/')

// Open data elements group in side nav
cy.get('[data-test="sidenav"] button:contains("Data elements")', {
timeout: 10000,
}).click()

// Navigate to data element list view
cy.get('[data-test="sidenav"] a:contains("Data element")')
.first() // the selector will also grab "Data element group" and "Data element group set"
.click()

// Go to New form
cy.get('button:contains("New")').click()

cy.get('[data-test="formfields-name-content"] input').type(
newDataElementName
)
cy.get('[data-test="formfields-shortname-content"] input').type(
`shortname ${now}`
)
cy.get(
'[data-test="formfields-categorycombo"] [data-test="dhis2-uicore-select-input"]'
).click()
cy.get(
'[data-test="dhis2-uicore-singleselectoption"]:contains("None")'
).click()

// Submit form
cy.get('button:contains("Create data element")').click()

cy.contains('Data element management').should('exist')
})

it('should create a data element with all values', () => {
const now = Date.now()
const newDataElementName = `ZZZ ${now}` // Will be at the end, does not pollute the first page of the list

cy.visit('/')

// Open data elements group in side nav
cy.get('[data-test="sidenav"] button:contains("Data elements")', {
timeout: 10000,
}).click()

// Navigate to data element list view
cy.get('[data-test="sidenav"] a:contains("Data element")')
.first() // the selector will also grab "Data element group" and "Data element group set"
.click()

// Go to New form
cy.get('button:contains("New")').click()

cy.get('[data-test="formfields-name"] input').type(newDataElementName)
cy.get('[data-test="formfields-shortname"] input').type(
`Short name ${now}`
)
cy.get('[data-test="formfields-formname"] input').type(
`Form name ${now}`
)
cy.get('[data-test="formfields-code"] input').type(`Code ${now}`)
cy.get('[data-test="formfields-description"] textarea').type(
`Multiline{enter}description ${now}`
)
cy.get('[data-test="formfields-url"] input').type(
`https://dhis2.org ${now}`
)

// pick color
cy.get('[data-test="colorpicker-trigger"]').click()
cy.get('[title="#b71c1c"]').click()

// icon color
cy.get('[data-test="iconpicker-trigger"]').click()
cy.get('[data-test="dhis2-uicore-modal"] img[src$="/icon"]')
.first()
.click()
cy.get(
'[data-test="dhis2-uicore-modal"] button:contains("Select")'
).click()

cy.get('[data-test="formfields-fieldmask"] input').type(
`000 1111 000 ${now}`
)
cy.get('[data-test="formfields-zeroissignificant"] input').check()

// Select value type
cy.get(
'[data-test="formfields-valuetype"] [data-test="dhis2-uicore-select-input"]'
).click()
cy.get(
'[data-test="dhis2-uicore-singleselectoption"]:contains("Integer")'
).click()

// Select aggregation type
cy.get(
'[data-test="formfields-aggregationtype"] [data-test="dhis2-uicore-select-input"]'
).click()
cy.get(
'[data-test="dhis2-uicore-singleselectoption"]:contains("Sum")'
).click()

// Select category combo
cy.get(
'[data-test="formfields-categorycombo"] [data-test="dhis2-uicore-select-input"]'
).click()
cy.get(
'[data-test="dhis2-uicore-singleselectoption"]:contains("None")'
).click()

// Select category combo
cy.get(
'[data-test="formfields-optionset"] [data-test="dhis2-uicore-select-input"]'
).click()
cy.get(
'[data-test="dhis2-uicore-singleselectoption"]:contains("ARV drugs")'
).click()

// Select category combo
cy.get(
'[data-test="formfields-commentoptionset"] [data-test="dhis2-uicore-select-input"]'
).click()
cy.get(
'[data-test="dhis2-uicore-singleselectoption"]:contains("ARV treatment plan")'
).click()

// Select legend sets
cy.get(
'[data-test="formfields-legendsets"] [data-test="dhis2-uicore-transferoption"]:contains("ANC Coverage")'
).dblclick()
cy.get(
'[data-test="formfields-legendsets"] [data-test="dhis2-uicore-transferoption"]:contains("Age 10y interval")'
).dblclick()

// Select aggregation levels
cy.get(
'[data-test="formfields-aggregationlevels"] [data-test="dhis2-uicore-select-input"]'
).click()
cy.get(
'[data-test="dhis2-uicore-checkbox"]:contains("Chiefdom")'
).click()
cy.get(
'[data-test="dhis2-uicore-checkbox"]:contains("District")'
).click()
cy.get('.backdrop').click()

// Select custom attribute "Classification"
cy.get(
'[data-test="dhis2-uiwidgets-singleselectfield"]:contains("Classification") [data-test="dhis2-uicore-select-input"]'
).click()
cy.get(
'[data-test="dhis2-uicore-singleselectoption"]:contains("Input")'
).click()

cy.get('[name="attributeValues[1].value"]').type(
`Collection{enter}method! ${now}`
)
cy.get('[name="attributeValues[2].value"]').type(`PEPFAR ID! ${now}`)
cy.get('[name="attributeValues[3].value"]').type(`Rationale! ${now}`)
cy.get('[name="attributeValues[4].value"]').type(
`Unit of measure! ${now}`
)

// Submit form
cy.get('button:contains("Create data element")').click()

cy.contains('Data element management').should('exist')
})

it('should not create a DE when reuired fields are missing', () => {
cy.visit('/')

// Open data elements group in side nav
cy.get('[data-test="sidenav"] button:contains("Data elements")', {
timeout: 10000,
}).click()

// Navigate to data element list view
cy.get('[data-test="sidenav"] a:contains("Data element")')
.first() // the selector will also grab "Data element group" and "Data element group set"
.click()

// Go to New form
cy.get('button:contains("New")').click()

// Submit form
cy.get('button:contains("Create data element")').click()

// Should have required errors for name, shortname and cat combo
cy.get('[data-test$="-validation"]:contains("Required")').should(
'have.length',
3
)
cy.get(
'[data-test="formfields-name-validation"]:contains("Required")'
).should('exist')
cy.get(
'[data-test="formfields-shortname-validation"]:contains("Required")'
).should('exist')
cy.get(
'[data-test="formfields-categorycombo-validation"]:contains("Required")'
).should('exist')
})
})
65 changes: 46 additions & 19 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2024-03-13T00:05:18.041Z\n"
"PO-Revision-Date: 2024-03-13T00:05:18.041Z\n"
"POT-Creation-Date: 2024-04-30T06:34:26.402Z\n"
"PO-Revision-Date: 2024-04-30T06:34:26.402Z\n"

msgid "schemas"
msgstr "schemas"
Expand Down Expand Up @@ -75,6 +75,12 @@ msgstr "Save and close"
msgid "<No value>"
msgstr "<No value>"

msgid "Custom attributes"
msgstr "Custom attributes"

msgid "Custom fields for your DHIS2 instance"
msgstr "Custom fields for your DHIS2 instance"

msgid "Code"
msgstr "Code"

Expand Down Expand Up @@ -249,15 +255,45 @@ msgstr "Search by name, code or ID"
msgid "Public access"
msgstr "Public access"

msgid "Delete"
msgstr "Delete"

msgid "Successfully deleted {{modelType}} \"{{displayName}}\""
msgstr "Successfully deleted {{modelType}} \"{{displayName}}\""

msgid "Are you sure that you want to delete this {{modelType}}?"
msgstr "Are you sure that you want to delete this {{modelType}}?"

msgid "Something went wrong deleting the {{modelType}}"
msgstr "Something went wrong deleting the {{modelType}}"

msgid "Failed to delete {{modelType}} \"{{displayName}}\"! {{messages}}"
msgstr "Failed to delete {{modelType}} \"{{displayName}}\"! {{messages}}"

msgid "Try again"
msgstr "Try again"

msgid "Confirm deletion"
msgstr "Confirm deletion"

msgid "Show details"
msgstr "Show details"

msgid "Sharing settings"
msgstr "Sharing settings"

msgid "At least one column must be selected"
msgstr "At least one column must be selected"

msgid "At least one filter must be selected"
msgstr "At least one filter must be selected"

msgid "Columns"
msgstr "Columns"

msgid "Filters"
msgstr "Filters"

msgid "Available columns"
msgstr "Available columns"

Expand Down Expand Up @@ -552,6 +588,12 @@ msgstr "Locale"
msgid "Locales"
msgstr "Locales"

msgid "You do not have access to edit this item."
msgstr "You do not have access to edit this item."

msgid "You do not have access to delete this item."
msgstr "You do not have access to delete this item."

msgid "Sum"
msgstr "Sum"

Expand Down Expand Up @@ -723,9 +765,6 @@ msgstr "This field requires a unique value, please choose another one"
msgid "Required"
msgstr "Required"

msgid "Custom attributes"
msgstr "Custom attributes"

msgid "Exit without saving"
msgstr "Exit without saving"

Expand Down Expand Up @@ -756,21 +795,9 @@ msgstr "Set up the information for this data element group"
msgid "Explain the purpose of this data element group."
msgstr "Explain the purpose of this data element group."

msgid "@TODO"
msgstr "@TODO"

msgid "Custom fields for your DHIS2 instance"
msgstr "Custom fields for your DHIS2 instance"

msgid "Selected data elements"
msgstr "Selected data elements"

msgid "Explain the purpose of this data element and how it's measured."
msgstr "Explain the purpose of this data element and how it's measured."

msgid "A data element name should be concise and easy to recognize."
msgstr "A data element name should be concise and easy to recognize."

msgid "Create data element"
msgstr "Create data element"

Expand Down Expand Up @@ -860,8 +887,8 @@ msgstr "Disaggregation and Option sets"
msgid "Set up disaggregation and predefined options."
msgstr "Set up disaggregation and predefined options."

msgid "LegendSet"
msgstr "LegendSet"
msgid "Legend set"
msgstr "Legend set"

msgid ""
"Visualize values for this data element in Analytics app. Multiple legendSet "
Expand Down
4 changes: 3 additions & 1 deletion src/app/sidebar/sidenav/Sidenav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import React, { PropsWithChildren } from 'react'
import styles from './Sidenav.module.css'

export const Sidenav = ({ children }: PropsWithChildren) => (
<nav className={styles['sidenav-wrap']}>{children}</nav>
<nav data-test="sidenav" className={styles['sidenav-wrap']}>
{children}
</nav>
)

export const SidenavItems = ({ children }: PropsWithChildren) => (
Expand Down
1 change: 1 addition & 0 deletions src/components/ColorAndIconPicker/ColorPicker.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
background: var(--colors-white);
width: 68px;
cursor: pointer;
align-items: center;
}

.chosenColor {
Expand Down
Loading

0 comments on commit 2da80da

Please sign in to comment.