diff --git a/cypress/e2e/NewPage.feature b/cypress/e2e/NewPage.feature index fd0ad26b65..43f1a18395 100644 --- a/cypress/e2e/NewPage.feature +++ b/cypress/e2e/NewPage.feature @@ -224,3 +224,15 @@ Feature: User creates a new entries from the registration page Scenario: First stage appears on registration page Given you are in Child programme registration page Then the first stage appears on registration page + + Scenario: New malaria entity without enrollment + Given you are in the registration page with Ngelehun CHC org unit selected + And you select Malaria Entity from the available tracked entity types + And you click the location button + Then the map opens + + Scenario: New focus area without enrollment + Given you are in the registration page with Ngelehun CHC org unit selected + And you select Focus area from the available tracked entity types + And the user clicks the element containing the text: Choose area on map + Then the map opens diff --git a/cypress/e2e/NewPage/index.js b/cypress/e2e/NewPage/index.js index 3c968d2b3f..d104f14c6d 100644 --- a/cypress/e2e/NewPage/index.js +++ b/cypress/e2e/NewPage/index.js @@ -7,6 +7,10 @@ And('you are on the default registration page', () => { cy.visit('/#/new'); }); +Given('you are in the registration page with Ngelehun CHC org unit selected', () => { + cy.visit('/#/new?orgUnitId=DiszpKrYNg8'); +}); + And('there should be informative message explaining you need to select an organisation unit', () => { cy.get('[data-test="informative-paper"]') .contains('Choose a registering unit to start reporting') @@ -638,3 +642,20 @@ And('you delete the recently added tracked entity', () => { }); cy.url().should('include', 'selectedTemplateId=IpHINAT79UW'); }); + +And(/^you select (.*) from the available tracked entity types/, (selection) => { + cy.get('[data-test="dhis2-uicore-select-input"]') + .click(); + cy.contains(selection) + .click(); +}); + +And('you click the location button', () => { + cy.get('[data-test="mapIconButton"]') + .click(); +}); + +Then('the map opens', () => { + cy.get('.leaflet-container').should('exist'); +}); + diff --git a/src/core_modules/capture-core/components/DataEntries/TrackedEntityInstance/TrackedEntityInstanceDataEntry.component.js b/src/core_modules/capture-core/components/DataEntries/TrackedEntityInstance/TrackedEntityInstanceDataEntry.component.js index fad0f62845..b98d36f10e 100644 --- a/src/core_modules/capture-core/components/DataEntries/TrackedEntityInstance/TrackedEntityInstanceDataEntry.component.js +++ b/src/core_modules/capture-core/components/DataEntries/TrackedEntityInstance/TrackedEntityInstanceDataEntry.component.js @@ -10,6 +10,7 @@ import { import type { TeiRegistration } from '../../../metaData'; type FinalTeiDataEntryProps = { + orgUnitId: string, teiRegistrationMetadata: TeiRegistration, }; // final step before the generic dataEntry is inserted @@ -19,10 +20,11 @@ class FinalTeiDataEntry extends React.Component { } render() { - const { teiRegistrationMetadata, ...passOnProps } = this.props; + const { teiRegistrationMetadata, orgUnitId, ...passOnProps } = this.props; return ( ); @@ -62,7 +64,6 @@ export class PreTeiDataEntry extends React.Component { render() { const { - orgUnitId, trackedEntityTypeId, onUpdateField, onStartAsyncUpdateField, diff --git a/src/core_modules/capture-ui/CoordinateField/CoordinateField.component.js b/src/core_modules/capture-ui/CoordinateField/CoordinateField.component.js index 39bb978211..782b38b821 100644 --- a/src/core_modules/capture-ui/CoordinateField/CoordinateField.component.js +++ b/src/core_modules/capture-ui/CoordinateField/CoordinateField.component.js @@ -129,6 +129,7 @@ export class CoordinateField extends React.Component {