1: <?php
2: use Azalea\Selenium\App\ApplicationTestCase;
3: use Azalea\Selenium\App\Customers;
4: use Azalea\Selenium\App\Patients;
5: use Azalea\Selenium\App\Users;
6:
7: class PatientDemographicsEditTest extends ApplicationTestCase
8: {
9: 10: 11: 12: 13: 14: 15:
16: public function testEditPatientSimple()
17: {
18: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
19:
20:
21: $patientView = $app->patients->open(Patients::DEVAN_ZULAUF);
22:
23:
24: $patientEditDemog = $patientView->demographicsEdit->navigate()->verifyAndWait();
25:
26:
27: $this->waitForAjax();
28: $app->popup->closeAll();
29:
30: $patientForm = $patientEditDemog->form;
31:
32:
33: $fname = $patientForm->getInput("pat_fname");
34: $mname = $patientForm->getInput("pat_mname");
35: $lname = $patientForm->getInput("pat_lname");
36:
37: $patient = $patientForm->fillRandom();
38:
39: $patientForm->setInput(array(
40: "pat_fname" => $fname,
41: "pat_mname" => $mname,
42: "pat_lname" => $lname
43: ));
44:
45: $patientView->press("Save Changes");
46:
47:
48: $this->waitForAjax();
49: if ($app->popup->confirmIsVisible()) {
50: $app->popup->confirmYes();
51: }
52:
53: $patientDemog = $patientView->demographics->verifyAndWait();
54:
55: $this->assertElementHasText("#pat_mrn + td", $patient->pat_mrn);
56: $this->assertElementHasText("#pat_xray_num + td", $patient->pat_xray_num);
57: $this->assertElementHasText("#pat_bill_type + td", "SELF PAY (PATIENT)");
58: $this->assertElementHasTextNoCase("#pat_phy_id_rendering + td > a", $patient->pat_phy_name);
59: $this->assertElementHasTextNoCase("#pat_phy_id_requested + td > a", $patient->pat_phy_requested_name);
60: $this->assertElementHasTextNoCase("#pat_phy_id_referring + td > a", $patient->pat_phy_referring_name);
61: $this->assertElementHasTextNoCase("#par_fname + td", $fname);
62: $this->assertElementHasTextNoCase("#pat_mname + td", $mname);
63: $this->assertElementHasTextNoCase("#pat_lname + td", $lname);
64: $patientDemog->assertCanSee(substr($patient->pat_dob, 4, 2)."/".substr($patient->pat_dob, 6, 2)."/".substr($patient->pat_dob, 0, 4));
65: $patientDemog->assertCanSee(strtoupper($patient->pat_sex));
66: $this->assertElementHasTextNoCase("#pat_martial_status + td", $patient->pat_maritial_status);
67: $this->assertElementHasTextNoCase("#pat_ethnicity + td", $patient->pat_ethnicity);
68: $this->assertElementHasTextNoCase("#pat_email + td", $patient->pat_email);
69: $this->assertElementHasTextNoCase("#pat_address1 + td", $patient->pat_address1);
70: $this->assertElementHasTextNoCase("#pat_address1 + td", $patient->pat_city);
71: $this->assertElementHasTextNoCase("#pat_address1 + td", $patient->pat_state);
72: $this->assertElementHasText("#pat_address1 + td", $patient->pat_zip);
73:
74: $this->assertNoErrorPopups();
75: }
76:
77: 78: 79: 80: 81:
82: public function testAddGuarantorInfo()
83: {
84: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
85:
86:
87: $patientView = $app->patients->open(Patients::DAYTON_BARTOLETTI);
88:
89:
90: $patientEditDemog = $patientView->demographicsEdit->navigate()->verifyAndWait();
91:
92:
93: $this->waitForAjax();
94: $app->popup->closeAll();
95:
96: $patientForm = $patientEditDemog->form;
97:
98:
99: $patientForm->clearInput("pat_guarantor_pid")->tab();
100: $patientForm->select("pat_guarantor_relation", "");
101:
102: $patientForm->assertNotInputHasValue("pat_guarantor_pid");
103: $patientForm->assertNotInputHasValue("pat_guarantor_relation");
104: $patientForm->assertNotInputHasValue("pat_guarantor");
105: $patientForm->assertNotInputHasValue("pat_guarantor_dob");
106: $patientForm->assertNotInputHasValue("pat_guarantor_address1");
107: $patientForm->assertNotInputHasValue("pat_guarantor_address2");
108: $patientForm->assertNotInputHasValue("pat_guarantor_city");
109: $patientForm->assertInputDisabled("pat_guarantor_city");
110: $patientForm->assertNotInputHasValue("pat_guarantor_state");
111: $patientForm->assertInputDisabled("pat_guarantor_state");
112: $patientForm->assertNotInputHasValue("pat_guarantor_zip");
113: $patientForm->assertNotInputHasValue("pat_guarantor_zip_plus4");
114: $patientForm->assertNotInputHasValue("pat_guarantor_employer");
115:
116:
117: $patientForm->setInput("pat_guarantor_pid", "QA17")->tab();
118: $patientForm->focusInput("pat_guarantor_relation");
119:
120:
121: $this->wait(2);
122:
123: $patientForm->assertInputHasValue("pat_guarantor_pid");
124: $patientForm->assertInputHasValue("pat_guarantor_relation");
125: $patientForm->assertInputHasValue("pat_guarantor");
126: $patientForm->assertInputDisabled("pat_guarantor");
127: $patientForm->assertInputHasValue("pat_guarantor_dob");
128: $patientForm->assertInputDisabled("pat_guarantor_dob");
129: $patientForm->assertInputHasValue("pat_guarantor_address1");
130: $patientForm->assertInputDisabled("pat_guarantor_address1");
131: $patientForm->assertInputDisabled("pat_guarantor_address2");
132: $patientForm->assertInputHasValue("pat_guarantor_city");
133: $patientForm->assertInputDisabled("pat_guarantor_city");
134: $patientForm->assertInputHasValue("pat_guarantor_state");
135: $patientForm->assertInputDisabled("pat_guarantor_state");
136: $patientForm->assertInputHasValue("pat_guarantor_zip");
137: $patientForm->assertInputDisabled("pat_guarantor_zip");
138: $patientForm->assertInputDisabled("pat_guarantor_zip_plus4");
139: $patientForm->assertInputDisabled("pat_guarantor_employer");
140:
141:
142: $patientForm->clearInput("pat_guarantor_pid")->tab();
143:
144: $patientForm->assertNotInputHasValue("pat_guarantor_pid");
145: $patientForm->assertNotInputHasValue("pat_guarantor_relation");
146: $patientForm->assertNotInputHasValue("pat_guarantor");
147: $patientForm->assertNotInputHasValue("pat_guarantor_dob");
148: $patientForm->assertNotInputHasValue("pat_guarantor_address1");
149: $patientForm->assertNotInputHasValue("pat_guarantor_address2");
150: $patientForm->assertNotInputHasValue("pat_guarantor_city");
151: $patientForm->assertInputDisabled("pat_guarantor_city");
152: $patientForm->assertNotInputHasValue("pat_guarantor_state");
153: $patientForm->assertInputDisabled("pat_guarantor_state");
154: $patientForm->assertNotInputHasValue("pat_guarantor_zip");
155: $patientForm->assertNotInputHasValue("pat_guarantor_zip_plus4");
156: $patientForm->assertNotInputHasValue("pat_guarantor_employer");
157:
158: $this->assertNoErrorPopups();
159: }
160:
161: 162: 163: 164: 165:
166: public function testAddPatientPowerAttorney()
167: {
168: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
169:
170:
171: $patientView = $app->patients->open(Patients::DAYTON_BARTOLETTI);
172:
173:
174: $patientEditDemog = $patientView->demographicsEdit->navigate()->verifyAndWait();
175:
176:
177: $this->waitForAjax();
178: $app->popup->closeAll();
179:
180: $patientForm = $patientEditDemog->form;
181:
182:
183: $this->waitFor("#btn_add_pat_poa")->click();
184:
185:
186: $poaForm = $this->getView("patients/add-power-of-attorney-popup-form.json")->verifyAndWait();
187:
188: $gender = (rand(1, 2) == 1 ? 'male' : 'female');
189: $poaForm->setInput(array(
190: "npat_fname" => $this->faker->firstName($gender),
191: "npat_lname" => $this->faker->lastName($gender),
192: "poa_relation" => "SPOUSE"
193: ))->tab();
194:
195:
196: $app->popup->last()->press("Submit");
197:
198: $this->waitForElementText('#poa_relation', "SPOUSE", 10);
199: $patientForm->assertTrue($patientForm->querySelector("#pat_poa_select")->value() > 0);
200: $patientForm->assertInputHasValue("npat_fname")
201: ->assertInputHasValue("npat_lname");
202: $patientForm->assertNotElementEmpty("#poa_relation");
203:
204:
205:
206: $this->waitFor("#btn_edit_pat_poa")->click();
207:
208: $poaForm = $this->getView("patients/add-power-of-attorney-popup-form.json")->verifyAndWait();
209: $poaForm->assertInputHasValue("npat_fname")
210: ->assertInputHasValue("npat_lname")
211: ->assertInputHasValue("poa_relation");
212:
213: $app->popup->last()->press("Cancel");
214: $this->wait(1);
215:
216:
217: $this->waitFor("#btn_remove_pat_poa")->click();
218: $app->popup->confirmYes();
219:
220: $this->waitForElementText('#poa_relation', "", 10);
221: $patientForm->assertFalse($patientForm->querySelector("#pat_poa_select")->value() > 0);
222: $patientForm->assertNotInputHasValue("npat_fname")
223: ->assertNotInputHasValue("npat_lname");
224: $patientForm->assertElementEmpty("#poa_relation");
225: }
226:
227: 228: 229: 230: 231:
232: public function testAddInsurance()
233: {
234: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
235:
236:
237: $patientView = $app->patients->open(Patients::DEVAN_ZULAUF);
238:
239:
240: $patientEditDemog = $patientView->demographicsEdit->navigate()->verifyAndWait();
241:
242:
243: $this->waitForAjax();
244: $app->popup->closeAll();
245:
246: $patientForm = $patientEditDemog->form;
247:
248:
249: $patientForm->setAsInsurancePay();
250:
251:
252: $patientForm->select("pat_ins1_irep_id", "");
253: $patientForm->select("pat_ins2_irep_id", "");
254: $patientForm->select("pat_ins3_irep_id", "");
255:
256: $patientForm->assertNotInputHasValue("pat_linked_ins1_pid")
257: ->assertNotInputHasValue("pat_ins1_irep_id")
258: ->assertCanSee("Primary Ins.");
259: $patientForm->assertNotInputHasValue("pat_linked_ins2_pid")
260: ->assertNotInputHasValue("pat_ins2_irep_id")
261: ->assertCanSee("Secondary Ins.");
262: $patientForm->assertNotInputHasValue("pat_linked_ins3_pid")
263: ->assertNotInputHasValue("pat_ins3_irep_id")
264: ->assertCanSee("Tertiary Ins.");
265:
266:
267: $patientForm->addPrimaryInsurance();
268:
269: $this->within("#pat_ins_search_popup", function ($driver) {
270: $driver->waitFor('[data-grid-row="0"]')->click();
271: $driver->wait(1);
272: });
273: $app->popup->last()->press("Add");
274:
275:
276: $form = $this->getView("patients/add-insurance-popup-form.json")->verifyAndWait();
277: $form->setInput(array(
278: "pat_ins_policy_num" => $this->faker->numerify("##########"),
279: "pat_ins_group_num" => $this->faker->numerify("##########"),
280: "dd_pat_ins_insured_relation" => "SELF"
281: ))->tab();
282:
283: $form->assertInputValueEquals("dd_insurance_type", "1");
284:
285:
286: $app->popup->last()->press("Save");
287:
288: $this->waitForAjax();
289: $this->waitForElementText('[data-model-attribute-display="pat_ins1_insured_relation"]', "SELF", 10);
290: $this->wait(1);
291: $patientForm->assertInputHasValue("pat_ins1_irep_id");
292: $patientForm->assertNotElementEmpty('[data-model-attribute-display="pat_ins1_policy_num"]')
293: ->assertNotElementEmpty('[data-model-attribute-display="pat_ins1_group_num"]')
294: ->assertNotElementEmpty('[data-model-attribute-display="pat_ins1_insured"]')
295: ->assertNotElementEmpty('[data-model-attribute-display="pat_ins1_insured_dob"]')
296: ->assertNotElementEmpty('[data-model-attribute-display="pat_ins1_insured_sex"]');
297:
298:
299:
300: $patientForm->select("pat_ins2_irep_id", "");
301:
302: $patientForm->addSecondaryInsurance();
303:
304: $this->within("#pat_ins_search_popup", function ($driver) {
305:
306: $driver->wait(1)->waitFor('[data-grid-row="0"]')->click();
307: $driver->wait(1);
308: });
309: $app->popup->last()->press("Add");
310:
311:
312: $form = $this->getView("patients/add-insurance-popup-form.json")->verifyAndWait();
313: $form->setInput(array(
314: "pat_ins_policy_num" => $this->faker->numerify("##########"),
315: "pat_ins_group_num" => $this->faker->numerify("##########"),
316: "dd_pat_ins_insured_relation" => "SELF"
317: ))->tab();
318:
319: $form->assertInputValueEquals("dd_insurance_type", "2");
320:
321:
322: $app->popup->last()->press("Save");
323:
324: $this->waitForAjax();
325: $this->waitForElementText('[data-model-attribute-display="pat_ins2_insured_relation"]', "SELF", 10);
326: $this->wait(1);
327: $patientForm->assertInputHasValue("pat_ins2_irep_id");
328: $patientForm->assertNotElementEmpty('[data-model-attribute-display="pat_ins2_policy_num"]')
329: ->assertNotElementEmpty('[data-model-attribute-display="pat_ins2_group_num"]')
330: ->assertNotElementEmpty('[data-model-attribute-display="pat_ins2_insured"]')
331: ->assertNotElementEmpty('[data-model-attribute-display="pat_ins2_insured_dob"]')
332: ->assertNotElementEmpty('[data-model-attribute-display="pat_ins2_insured_sex"]');
333:
334:
335:
336: $patientForm->select("pat_ins3_irep_id", "");
337:
338: $patientForm->addTertiaryInsurance();
339:
340: $this->within("#pat_ins_search_popup", function ($driver) {
341:
342: $driver->wait(1)->waitFor('[data-grid-row="0"]')->click();
343: $driver->wait(1);
344: });
345: $app->popup->last()->press("Add");
346:
347:
348: $form = $this->getView("patients/add-insurance-popup-form.json")->verifyAndWait();
349: $form->setInput(array(
350: "pat_ins_policy_num" => $this->faker->numerify("##########"),
351: "pat_ins_group_num" => $this->faker->numerify("##########"),
352: "dd_pat_ins_insured_relation" => "SELF"
353: ))->tab();
354:
355: $form->assertInputValueEquals("dd_insurance_type", "4");
356:
357:
358: $app->popup->last()->press("Save");
359:
360: $this->waitForAjax();
361: $this->waitForElementText('[data-model-attribute-display="pat_ins3_insured_relation"]', "SELF", 10);
362: $this->wait(1);
363: $patientForm->assertInputHasValue("pat_ins3_irep_id");
364: $patientForm->assertNotElementEmpty('[data-model-attribute-display="pat_ins3_policy_num"]')
365: ->assertNotElementEmpty('[data-model-attribute-display="pat_ins3_group_num"]')
366: ->assertNotElementEmpty('[data-model-attribute-display="pat_ins3_insured"]')
367: ->assertNotElementEmpty('[data-model-attribute-display="pat_ins3_insured_dob"]')
368: ->assertNotElementEmpty('[data-model-attribute-display="pat_ins3_insured_sex"]');
369:
370:
371:
372: $patientForm->select("pat_ins1_irep_id", "");
373: $patientForm->select("pat_ins2_irep_id", "");
374: $patientForm->select("pat_ins3_irep_id", "");
375:
376:
377: $patientForm->setAsSelfPay();
378:
379: $patientView->press("Save Changes");
380: $this->waitForAjax();
381: $this->assertNoErrorPopups();
382: }
383:
384: 385: 386: 387: 388: 389: 390: 391: 392:
393: public function testEditPatientHouseholdInfo()
394: {
395: if (!Customers::isEhrCustomer($this->getCustomerId()) && !Customers::isPmCustomer($this->getCustomerId())) {
396: return $this->skip();
397: }
398:
399: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
400:
401:
402: $patientView = $app->patients->open(Patients::SAMIR_FUNK);
403:
404:
405: $patientEditDemog = $patientView->demographicsEdit->navigate()->verifyAndWait();
406:
407:
408: $this->waitForAjax();
409: $app->popup->closeAll();
410:
411: $patientForm = $patientEditDemog->form;
412:
413: $pfrAnnualIncomeInput = $patientForm->selectors->pfrAnnualIncomeInput;
414: $pfrAnnualIncomeVerifyDate = $patientForm->selectors->pfrAnnualIncomeVerifyDate;
415: $pfrHouseholdMembersInput = $patientForm->selectors->pfrHouseholdMembersInput;
416:
417:
418: $patientForm->setInput($pfrAnnualIncomeInput, "");
419: $patientForm->querySelector($pfrAnnualIncomeVerifyDate)->value("");
420: $patientForm->setInput($pfrHouseholdMembersInput, "");
421:
422:
423: $patientForm->setInput($pfrAnnualIncomeInput, "5000.50");
424:
425:
426: $patientView->press("Save Changes");
427:
428:
429: $this->waitForAjax();
430: if ($app->popup->confirmIsVisible()) {
431: $app->popup->confirmYes();
432: }
433:
434: 435: 436: 437: 438:
439: $this->spinWait(function () use ($patientForm) {
440: $patientForm->assertCanSee("Enter a valid integer (whole number).");
441: return true;
442: });
443:
444:
445: $patientForm->setInput($pfrAnnualIncomeInput, "0")->tab();
446:
447:
448: $patientForm->querySelector($pfrAnnualIncomeVerifyDate)
449: ->value(date("m/d/Y"));
450:
451:
452: $patientForm->setInput($pfrHouseholdMembersInput, "3");
453:
454:
455: $patientView->press("Save Changes");
456:
457:
458: $this->waitForAjax();
459: if ($app->popup->confirmIsVisible()) {
460: $app->popup->confirmYes();
461: }
462:
463:
464: $patientDemog = $patientView->demographics->verifyAndWait();
465:
466: 467: 468: 469:
470: $this->assertElementHasText("#pat_finance_record-pfr_annual_income + td", "$0");
471: $this->assertElementHasText("#pat_finance_record-pfr_annual_income + td", "Verified: ".date("m/d/Y"));
472: $this->assertElementHasText("#pat_finance_record-pfr_household_members + td", "3");
473:
474:
475: $patientEditDemog = $patientView->demographicsEdit->navigate()->verifyAndWait();
476:
477:
478: $this->waitForAjax();
479: $app->popup->closeAll();
480:
481: $patientForm = $patientEditDemog->form;
482:
483:
484: $patientForm->setInput($pfrAnnualIncomeInput, "50000")->tab();
485:
486:
487: $patientView->press("Save Changes");
488:
489:
490: $this->waitForAjax();
491: if ($app->popup->confirmIsVisible()) {
492: $app->popup->confirmYes();
493: }
494:
495:
496: $patientDemog = $patientView->demographics->verifyAndWait();
497:
498: 499: 500: 501:
502: $this->assertElementHasText("#pat_finance_record-pfr_annual_income + td", "$50000");
503: $this->assertElementHasText("#pat_finance_record-pfr_annual_income + td", "Verified: ".date("m/d/Y"));
504: $this->assertElementHasText("#pat_finance_record-pfr_household_members + td", "3");
505: }
506: }
507:
508: ?>