Skip to content

Commit

Permalink
Fix default delivery test
Browse files Browse the repository at this point in the history
  • Loading branch information
jkuester committed Sep 2, 2021
1 parent 7a05299 commit 0f17b49
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 22 deletions.
Binary file modified config/default/forms/app/delivery.xlsx
Binary file not shown.
38 changes: 19 additions & 19 deletions config/default/forms/app/delivery.xml
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@
</translation>
</itext>
<instance>
<delivery id="delivery" prefix="J1!delivery!" delimiter="#" version="2021-08-31 8-32">
<delivery id="delivery" prefix="J1!delivery!" delimiter="#" version="2021-09-02 10-00">
<inputs>
<meta>
<location>
Expand Down Expand Up @@ -864,7 +864,7 @@
<woman_death_add_notes/>
<death_profile_note/>
<death_baby_note tag="hidden"/>
<death_report tag="hidden" db-doc="true">
<death_report db-doc="true" tag="hidden">
<form/>
<type/>
<content_type/>
Expand Down Expand Up @@ -905,7 +905,7 @@
<baby_death_place/>
<stillbirth/>
<baby_death_add_notes/>
<baby_death_profile tag="hidden" db-doc="true">
<baby_death_profile db-doc="true" tag="hidden">
<type/>
<name/>
<sex/>
Expand Down Expand Up @@ -1377,10 +1377,10 @@ selected(../vaginal_bleeding, 'yes') or
selected(../vaginal_discharge, 'yes') or
selected(../convulsion, 'yes'), 'yes', 'no')"/>
<bind nodeset="/delivery/death_info_woman" relevant="selected(../condition/woman_outcome, 'deceased')"/>
<bind nodeset="/delivery/death_info_woman/woman_death_date" type="date" jr:constraintMsg="jr:itext('/delivery/death_info_woman/woman_death_date:jr:constraintMsg')" required="true()" constraint="decimal-date-time(.) &lt;= floor(decimal-date-time(today())) and difference-in-months( date(.), today() ) &lt; 1"/>
<bind nodeset="/delivery/death_info_woman/woman_death_date" type="date" required="true()" constraint="decimal-date-time(.) &lt;= floor(decimal-date-time(today())) and difference-in-months( date(.), today() ) &lt; 1" jr:constraintMsg="jr:itext('/delivery/death_info_woman/woman_death_date:jr:constraintMsg')"/>
<bind nodeset="/delivery/death_info_woman/woman_death_place" type="select1" required="true()"/>
<bind nodeset="/delivery/death_info_woman/woman_death_birth" type="select1" required="true()"/>
<bind nodeset="/delivery/death_info_woman/woman_death_add_notes" type="string" jr:constraintMsg="jr:itext('/delivery/death_info_woman/woman_death_add_notes:jr:constraintMsg')" required="false()" constraint="string-length(.) &lt;= 300"/>
<bind nodeset="/delivery/death_info_woman/woman_death_add_notes" type="string" required="false()" constraint="string-length(.) &lt;= 300" jr:constraintMsg="jr:itext('/delivery/death_info_woman/woman_death_add_notes:jr:constraintMsg')"/>
<bind nodeset="/delivery/death_info_woman/death_profile_note" readonly="true()" type="string" relevant="../woman_death_date != '' and ../woman_death_place != ''"/>
<bind nodeset="/delivery/death_info_woman/death_baby_note" readonly="true()" type="string" relevant="../woman_death_date != '' and ../woman_death_place != '' and ../woman_death_birth = 'yes'"/>
<bind nodeset="/delivery/death_info_woman/death_report/form" type="string" calculate="&quot;death_report&quot;"/>
Expand All @@ -1397,24 +1397,24 @@ selected(../convulsion, 'yes'), 'yes', 'no')"/>
<bind nodeset="/delivery/death_info_woman/woman_death_report_doc" type="string" calculate=" /delivery/death_info_woman/death_report "/>
<bind nodeset="/delivery/delivery_outcome" relevant="not(selected(../condition/woman_outcome, 'deceased')) or selected(../death_info_woman/woman_death_birth, 'yes')"/>
<bind nodeset="/delivery/delivery_outcome/babies_delivered" type="select1" required="true()"/>
<bind nodeset="/delivery/delivery_outcome/babies_delivered_other" type="int" jr:constraintMsg="jr:itext('/delivery/delivery_outcome/babies_delivered_other:jr:constraintMsg')" relevant="selected(../babies_delivered, 'other')" required="true()" constraint=". &gt; 3"/>
<bind nodeset="/delivery/delivery_outcome/babies_delivered_other" type="int" required="true()" constraint=". &gt; 3" jr:constraintMsg="jr:itext('/delivery/delivery_outcome/babies_delivered_other:jr:constraintMsg')" relevant="selected(../babies_delivered, 'other')"/>
<bind nodeset="/delivery/delivery_outcome/babies_alive" type="select1" required="true()"/>
<bind nodeset="/delivery/delivery_outcome/babies_alive_other" type="int" jr:constraintMsg="jr:itext('/delivery/delivery_outcome/babies_alive_other:jr:constraintMsg')" relevant="selected(../babies_alive, 'other')" required="true()" constraint=". &lt;= ../babies_delivered_other"/>
<bind nodeset="/delivery/delivery_outcome/babies_alive_other" type="int" required="true()" constraint=". &lt;= ../babies_delivered_other" jr:constraintMsg="jr:itext('/delivery/delivery_outcome/babies_alive_other:jr:constraintMsg')" relevant="selected(../babies_alive, 'other')"/>
<bind nodeset="/delivery/delivery_outcome/babies_delivered_num" type="string" calculate="if(selected(../babies_delivered, '1'), 1, if(selected(../babies_delivered, '2'), 2, if(selected(../babies_delivered, '3'), 3, if(selected(../babies_delivered, 'other'), ../babies_delivered_other, 0))))"/>
<bind nodeset="/delivery/delivery_outcome/babies_alive_num" type="string" calculate="if(selected(../babies_alive, '1'), 1, if(selected(../babies_alive, '2'), 2, if(selected(../babies_alive, '3'), 3, if(selected(../babies_alive, 'other'), ../babies_alive_other, 0))))"/>
<bind nodeset="/delivery/delivery_outcome/babies_deceased_num" type="string" calculate="../babies_delivered_num - ../babies_alive_num"/>
<bind nodeset="/delivery/delivery_outcome/delivery_date" type="date" jr:constraintMsg="jr:itext('/delivery/delivery_outcome/delivery_date:jr:constraintMsg')" required="true()" constraint="decimal-date-time(.) &lt;= floor(decimal-date-time(today())) and difference-in-months( date(.), today() ) &lt; 1"/>
<bind nodeset="/delivery/delivery_outcome/delivery_date" type="date" required="true()" constraint="decimal-date-time(.) &lt;= floor(decimal-date-time(today())) and difference-in-months( date(.), today() ) &lt; 1" jr:constraintMsg="jr:itext('/delivery/delivery_outcome/delivery_date:jr:constraintMsg')"/>
<bind nodeset="/delivery/delivery_outcome/delivery_place" type="select1" required="true()"/>
<bind nodeset="/delivery/delivery_outcome/delivery_place_other" type="string" jr:constraintMsg="jr:itext('/delivery/delivery_outcome/delivery_place_other:jr:constraintMsg')" relevant="../delivery_place = 'other'" required="true()" constraint="string-length(.) &lt;= 100"/>
<bind nodeset="/delivery/delivery_outcome/delivery_mode" type="select1" relevant="../delivery_place = 'health_facility'" required="true()"/>
<bind nodeset="/delivery/delivery_outcome/delivery_conductor" type="select1" relevant="../delivery_place = 'home' or ../delivery_place = 'other'" required="true()"/>
<bind nodeset="/delivery/delivery_outcome/delivery_conductor_other" type="string" jr:constraintMsg="jr:itext('/delivery/delivery_outcome/delivery_conductor_other:jr:constraintMsg')" relevant="../delivery_conductor = 'other'" required="true()" constraint="string-length(.) &lt;= 100"/>
<bind nodeset="/delivery/delivery_outcome/delivery_place_other" type="string" required="true()" constraint="string-length(.) &lt;= 100" jr:constraintMsg="jr:itext('/delivery/delivery_outcome/delivery_place_other:jr:constraintMsg')" relevant="../delivery_place = 'other'"/>
<bind nodeset="/delivery/delivery_outcome/delivery_mode" type="select1" required="true()" relevant="../delivery_place = 'health_facility'"/>
<bind nodeset="/delivery/delivery_outcome/delivery_conductor" type="select1" required="true()" relevant="../delivery_place = 'home' or ../delivery_place = 'other'"/>
<bind nodeset="/delivery/delivery_outcome/delivery_conductor_other" type="string" required="true()" constraint="string-length(.) &lt;= 100" jr:constraintMsg="jr:itext('/delivery/delivery_outcome/delivery_conductor_other:jr:constraintMsg')" relevant="../delivery_conductor = 'other'"/>
<bind nodeset="/delivery/baby_death" relevant="../delivery_outcome/babies_deceased_num &gt; 0"/>
<bind nodeset="/delivery/baby_death/baby_death_repeat_count" type="string" readonly="true()" calculate=" /delivery/delivery_outcome/babies_deceased_num "/>
<bind nodeset="/delivery/baby_death/baby_death_repeat/baby_death_date" type="date" jr:constraintMsg="jr:itext('/delivery/baby_death/baby_death_repeat/baby_death_date:jr:constraintMsg')" required="true()" constraint="decimal-date-time(.) &lt;= floor(decimal-date-time(today())) and difference-in-months( date(.), today() ) &lt; 1"/>
<bind nodeset="/delivery/baby_death/baby_death_repeat/baby_death_date" type="date" required="true()" constraint="decimal-date-time(.) &lt;= floor(decimal-date-time(today())) and difference-in-months( date(.), today() ) &lt; 1" jr:constraintMsg="jr:itext('/delivery/baby_death/baby_death_repeat/baby_death_date:jr:constraintMsg')"/>
<bind nodeset="/delivery/baby_death/baby_death_repeat/baby_death_place" type="select1" required="true()"/>
<bind nodeset="/delivery/baby_death/baby_death_repeat/stillbirth" type="select1" required="true()"/>
<bind nodeset="/delivery/baby_death/baby_death_repeat/baby_death_add_notes" type="string" jr:constraintMsg="jr:itext('/delivery/baby_death/baby_death_repeat/baby_death_add_notes:jr:constraintMsg')" required="false()" constraint="string-length(.) &lt;= 300"/>
<bind nodeset="/delivery/baby_death/baby_death_repeat/baby_death_add_notes" type="string" required="false()" constraint="string-length(.) &lt;= 300" jr:constraintMsg="jr:itext('/delivery/baby_death/baby_death_repeat/baby_death_add_notes:jr:constraintMsg')"/>
<bind nodeset="/delivery/baby_death/baby_death_repeat/baby_death_profile/type" type="string" calculate="&quot;person&quot;"/>
<bind nodeset="/delivery/baby_death/baby_death_repeat/baby_death_profile/name" type="string" calculate="&quot;Deceased baby&quot;"/>
<bind nodeset="/delivery/baby_death/baby_death_repeat/baby_death_profile/sex" type="string" calculate="&quot;undefined&quot;"/>
Expand All @@ -1433,14 +1433,14 @@ selected(../convulsion, 'yes'), 'yes', 'no')"/>
<bind nodeset="/delivery/babys_condition/baby_repeat/baby_details/baby_name" type="string" required="true()"/>
<bind nodeset="/delivery/babys_condition/baby_repeat/baby_details/baby_sex" type="select1" required="true()"/>
<bind nodeset="/delivery/babys_condition/baby_repeat/baby_details/birth_weight_know" type="select1" required="true()"/>
<bind nodeset="/delivery/babys_condition/baby_repeat/baby_details/birth_weight" type="decimal" jr:constraintMsg="jr:itext('/delivery/babys_condition/baby_repeat/baby_details/birth_weight:jr:constraintMsg')" relevant="selected(../birth_weight_know, 'yes')" required="true()" constraint=". &gt;= 1500 and . &lt;= 5000"/>
<bind nodeset="/delivery/babys_condition/baby_repeat/baby_details/birth_weight" type="decimal" required="true()" constraint=". &gt;= 1500 and . &lt;= 5000" jr:constraintMsg="jr:itext('/delivery/babys_condition/baby_repeat/baby_details/birth_weight:jr:constraintMsg')" relevant="selected(../birth_weight_know, 'yes')"/>
<bind nodeset="/delivery/babys_condition/baby_repeat/baby_details/birth_length_know" type="select1" required="true()"/>
<bind nodeset="/delivery/babys_condition/baby_repeat/baby_details/birth_length" type="decimal" jr:constraintMsg="jr:itext('/delivery/babys_condition/baby_repeat/baby_details/birth_length:jr:constraintMsg')" relevant="selected(../birth_length_know, 'yes')" required="true()" constraint=". &gt;= 35.6 and . &lt;= 70"/>
<bind nodeset="/delivery/babys_condition/baby_repeat/baby_details/birth_length" type="decimal" required="true()" constraint=". &gt;= 35.6 and . &lt;= 70" jr:constraintMsg="jr:itext('/delivery/babys_condition/baby_repeat/baby_details/birth_length:jr:constraintMsg')" relevant="selected(../birth_length_know, 'yes')"/>
<bind nodeset="/delivery/babys_condition/baby_repeat/baby_details/vaccines_received" type="select1" required="true()"/>
<bind nodeset="/delivery/babys_condition/baby_repeat/baby_details/imm_counsel_note" readonly="true()" type="string" relevant="selected(../vaccines_received, 'none')" required="true()"/>
<bind nodeset="/delivery/babys_condition/baby_repeat/baby_details/imm_counsel_note" readonly="true()" type="string" relevant="selected(../vaccines_received, 'none')"/>
<bind nodeset="/delivery/babys_condition/baby_repeat/baby_details/breatfeeding" type="select1" required="true()"/>
<bind nodeset="/delivery/babys_condition/baby_repeat/baby_details/breastfed_within_1_hour" type="select1" required="true()"/>
<bind nodeset="/delivery/babys_condition/baby_repeat/baby_details/baby_danger_sign_note" readonly="true()" type="string" required="true()"/>
<bind nodeset="/delivery/babys_condition/baby_repeat/baby_details/baby_danger_sign_note" readonly="true()" type="string"/>
<bind nodeset="/delivery/babys_condition/baby_repeat/baby_details/infected_umbilical_cord" type="select1" required="true()"/>
<bind nodeset="/delivery/babys_condition/baby_repeat/baby_details/convulsion" type="select1" required="true()"/>
<bind nodeset="/delivery/babys_condition/baby_repeat/baby_details/difficulty_feeding" type="select1" required="true()"/>
Expand Down Expand Up @@ -1495,7 +1495,7 @@ selected(../condition/woman_outcome, 'alive_unwell') or
../delivery_outcome/babies_alive_num &gt; 0"/>
<bind nodeset="/delivery/pnc_visits/who_note" readonly="true()" type="string"/>
<bind nodeset="/delivery/pnc_visits/pnc_visits_attended" type="select" required="true()" constraint="not(selected(.,'none')) or count-selected(.) &lt; 2"/>
<bind nodeset="/delivery/pnc_visits/pnc_visits_additional" type="int" jr:constraintMsg="jr:itext('/delivery/pnc_visits/pnc_visits_additional:jr:constraintMsg')" required="false()" constraint=". &gt;=0 and . &lt;= 6"/>
<bind nodeset="/delivery/pnc_visits/pnc_visits_additional" type="int" required="false()" constraint=". &gt;=0 and . &lt;= 6" jr:constraintMsg="jr:itext('/delivery/pnc_visits/pnc_visits_additional:jr:constraintMsg')"/>
<bind nodeset="/delivery/pnc_visits/days" type="string" calculate="floor(decimal-date-time(today())) - decimal-date-time( /delivery/delivery_outcome/delivery_date )"/>
<bind nodeset="/delivery/summary/r_submit_note" readonly="true()" type="string"/>
<bind nodeset="/delivery/summary/r_summary_details" readonly="true()" type="string"/>
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/forms/submit-default-delivery-form.specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const utils = require('../../utils');
const userData = require('../../page-objects/forms/data/user.po.data');
const _ = require('lodash');
const { assert } = require('chai');
const moment = require('moment');

describe('Submit Default Delivery Report', () => {
const { userContactDoc, docs } = userData;
Expand Down Expand Up @@ -41,8 +42,7 @@ describe('Submit Default Delivery Report', () => {
await deliveryReport.selectBabiesDeliveredButton();
await deliveryReport.enterNoOfBabiesDelivered(6);
await deliveryReport.selectBabiesAliveButton(3);

await deliveryReport.enterDeliveryDate('');
await deliveryReport.enterDeliveryDate(moment().format('YYYY-MM-DD'));

await deliveryReport.selectDeliveryPlaceButton();
await deliveryReport.selectDeliveryMethod();
Expand Down
3 changes: 2 additions & 1 deletion tests/page-objects/forms/default-delivery-report.po.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const utils = require('../../utils');
const helper = require('../../helper');
const fs = require('fs');
const { element, by } = require('protractor');
const moment = require('moment');

const xml = fs.readFileSync(`${__dirname}/../../../config/default/forms/app/delivery.xml`, 'utf8');

Expand Down Expand Up @@ -126,7 +127,7 @@ module.exports = {
const basePath = `(//*[@class="repeat-number"])[${deadBabyIndex}]/..//`;
const dateOfDeathPicker = await element(by.xpath(`${basePath}*[@placeholder="yyyy-mm-dd"]`));
await dateOfDeathPicker.click();
await dateOfDeathPicker.sendKeys('').sendKeys(protractor.Key.TAB);
await dateOfDeathPicker.sendKeys(moment().format('YYYY-MM-DD')).sendKeys(protractor.Key.TAB);

const placeOfDeathRadio = await element(by.xpath(`${basePath}*[@value="health_facility"]`));
await placeOfDeathRadio.click();
Expand Down

0 comments on commit 0f17b49

Please sign in to comment.