1: <?php
2: use Azalea\Selenium\App\ApplicationTestCase;
3: use Azalea\Selenium\App\Users;
4:
5: class AddPatientTest extends ApplicationTestCase
6: {
7: 8: 9: 10: 11: 12: 13:
14: public function testAddPatientSimple()
15: {
16: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
17:
18:
19: $patientPopup = $app->home->addPatient();
20: $patient = $patientPopup->form->fillRandom();
21:
22:
23: $patientPopup->form->select("pat_guarantor_relation", "SELF");
24:
25: $this->wait(1);
26: $patientPopup->form->assertInputHasValue("pat_pid");
27: $patientPopup->press("Save & View");
28:
29:
30: $this->waitForAjax();
31: if ($app->popup->confirmIsVisible()) {
32: $app->popup->confirmYes();
33: }
34:
35:
36: $pat_id = $app->patients->getIdFromHash();
37:
38:
39: $patientView = $app->patients->open($pat_id);
40:
41:
42: $patientDemog = $patientView->demographics->navigate()->verifyAndWait();
43:
44: $this->assertElementHasText("#pat_mrn + td", $patient->pat_mrn);
45: $this->assertElementHasText("#pat_xray_num + td", $patient->pat_xray_num);
46: $this->assertElementHasText("#pat_bill_type + td", "SELF PAY (PATIENT)");
47: $this->assertElementHasTextNoCase("#pat_phy_id_rendering + td > a", $patient->pat_phy_name);
48: $this->assertElementHasTextNoCase("#pat_phy_id_requested + td > a", $patient->pat_phy_requested_name);
49: $this->assertElementHasTextNoCase("#pat_phy_id_referring + td > a", $patient->pat_phy_referring_name);
50: $this->assertElementHasTextNoCase("#par_fname + td", $patient->pat_fname);
51: $this->assertElementHasTextNoCase("#pat_mname + td", $patient->pat_mname);
52: $this->assertElementHasTextNoCase("#pat_lname + td", $patient->pat_lname);
53: $patientDemog->assertCanSee(substr($patient->pat_dob, 4, 2)."/".substr($patient->pat_dob, 6, 2)."/".substr($patient->pat_dob, 0, 4));
54: $patientDemog->assertCanSee(strtoupper($patient->pat_sex));
55: $this->assertElementHasTextNoCase("#pat_martial_status + td", $patient->pat_maritial_status);
56: $this->assertElementHasTextNoCase("#pat_ethnicity + td", $patient->pat_ethnicity);
57: $this->assertElementHasTextNoCase("#pat_email + td", $patient->pat_email);
58: $this->assertElementHasTextNoCase("#pat_address1 + td", $patient->pat_address1);
59: $this->assertElementHasTextNoCase("#pat_address1 + td", $patient->pat_city);
60: $this->assertElementHasTextNoCase("#pat_address1 + td", $patient->pat_state);
61: $this->assertElementHasText("#pat_address1 + td", $patient->pat_zip);
62: }
63:
64: 65: 66: 67: 68:
69: public function testAddGuarantorInfo()
70: {
71: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
72:
73: $patientPopupForm = $app->home->addPatient()->form;
74:
75: $patientPopupForm->assertNotInputHasValue("pat_guarantor_pid");
76: $patientPopupForm->assertNotInputHasValue("pat_guarantor_relation");
77: $patientPopupForm->assertNotInputHasValue("pat_guarantor");
78: $patientPopupForm->assertNotInputHasValue("pat_guarantor_dob");
79: $patientPopupForm->assertNotInputHasValue("pat_guarantor_address1");
80: $patientPopupForm->assertNotInputHasValue("pat_guarantor_address2");
81: $patientPopupForm->assertNotInputHasValue("pat_guarantor_city");
82: $patientPopupForm->assertInputDisabled("pat_guarantor_city");
83: $patientPopupForm->assertNotInputHasValue("pat_guarantor_state");
84: $patientPopupForm->assertInputDisabled("pat_guarantor_state");
85: $patientPopupForm->assertNotInputHasValue("pat_guarantor_zip");
86: $patientPopupForm->assertNotInputHasValue("pat_guarantor_zip_plus4");
87: $patientPopupForm->assertNotInputHasValue("pat_guarantor_employer");
88:
89:
90: $patientPopupForm->setInput("pat_guarantor_pid", "QA17")->tab();
91: $patientPopupForm->focusInput("pat_guarantor_relation");
92:
93:
94: $this->wait(2);
95:
96: $patientPopupForm->assertInputHasValue("pat_guarantor_pid");
97: $patientPopupForm->assertInputHasValue("pat_guarantor_relation");
98: $patientPopupForm->assertInputHasValue("pat_guarantor");
99: $patientPopupForm->assertInputDisabled("pat_guarantor");
100: $patientPopupForm->assertInputHasValue("pat_guarantor_dob");
101: $patientPopupForm->assertInputDisabled("pat_guarantor_dob");
102: $patientPopupForm->assertInputHasValue("pat_guarantor_address1");
103: $patientPopupForm->assertInputDisabled("pat_guarantor_address1");
104: $patientPopupForm->assertInputDisabled("pat_guarantor_address2");
105: $patientPopupForm->assertInputHasValue("pat_guarantor_city");
106: $patientPopupForm->assertInputDisabled("pat_guarantor_city");
107: $patientPopupForm->assertInputHasValue("pat_guarantor_state");
108: $patientPopupForm->assertInputDisabled("pat_guarantor_state");
109: $patientPopupForm->assertInputHasValue("pat_guarantor_zip");
110: $patientPopupForm->assertInputDisabled("pat_guarantor_zip");
111: $patientPopupForm->assertInputDisabled("pat_guarantor_zip_plus4");
112: $patientPopupForm->assertInputDisabled("pat_guarantor_employer");
113:
114:
115: $patientPopupForm->clearInput("pat_guarantor_pid")->tab();
116:
117: $patientPopupForm->assertNotInputHasValue("pat_guarantor_pid");
118: $patientPopupForm->assertNotInputHasValue("pat_guarantor_relation");
119: $patientPopupForm->assertNotInputHasValue("pat_guarantor");
120: $patientPopupForm->assertNotInputHasValue("pat_guarantor_dob");
121: $patientPopupForm->assertNotInputHasValue("pat_guarantor_address1");
122: $patientPopupForm->assertNotInputHasValue("pat_guarantor_address2");
123: $patientPopupForm->assertNotInputHasValue("pat_guarantor_city");
124: $patientPopupForm->assertInputDisabled("pat_guarantor_city");
125: $patientPopupForm->assertNotInputHasValue("pat_guarantor_state");
126: $patientPopupForm->assertInputDisabled("pat_guarantor_state");
127: $patientPopupForm->assertNotInputHasValue("pat_guarantor_zip");
128: $patientPopupForm->assertNotInputHasValue("pat_guarantor_zip_plus4");
129: $patientPopupForm->assertNotInputHasValue("pat_guarantor_employer");
130: }
131:
132: 133: 134: 135: 136:
137: public function testAddInsurancePatient()
138: {
139: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
140:
141: $patientPopupForm = $app->home->addPatient()->form;
142: $patientPopupForm->fillRandom();
143: $patientPopupForm->setAsInsurancePay();
144:
145: $patientPopupForm->assertNotInputHasValue("pat_linked_ins1_pid")
146: ->assertNotInputHasValue("pat_ins1_irep_id")
147: ->assertCanSee("Primary Ins.");
148: $patientPopupForm->assertNotInputHasValue("pat_linked_ins2_pid")
149: ->assertNotInputHasValue("pat_ins2_irep_id")
150: ->assertCanSee("Secondary Ins.");
151: $patientPopupForm->assertNotInputHasValue("pat_linked_ins3_pid")
152: ->assertNotInputHasValue("pat_ins3_irep_id")
153: ->assertCanSee("Tertiary Ins.");
154:
155:
156: $patientPopupForm->addPrimaryInsurance();
157:
158: $this->within("#pat_ins_search_popup", function ($driver) {
159: $driver->waitFor('[data-grid-row="0"]')->click();
160: $driver->wait(1);
161: });
162: $app->popup->last()->press("Add");
163:
164:
165: $form = $this->getView("patients/add-insurance-popup-form.json")->verifyAndWait();
166: $form->setInput(array(
167: "pat_ins_policy_num" => $this->faker->numerify("##########"),
168: "pat_ins_group_num" => $this->faker->numerify("##########"),
169: "dd_pat_ins_insured_relation" => "SELF"
170: ))->tab();
171:
172: $form->assertInputValueEquals("dd_insurance_type", "1");
173:
174:
175: $app->popup->last()->press("Save");
176:
177: $this->waitForElementText('[data-model-attribute-display="pat_ins1_insured_relation"]', "SELF", 10);
178: $patientPopupForm->assertInputHasValue("pat_ins1_irep_id");
179: $patientPopupForm->assertNotElementEmpty('[data-model-attribute-display="pat_ins1_policy_num"]')
180: ->assertNotElementEmpty('[data-model-attribute-display="pat_ins1_group_num"]')
181: ->assertNotElementEmpty('[data-model-attribute-display="pat_ins1_insured"]')
182: ->assertNotElementEmpty('[data-model-attribute-display="pat_ins1_insured_dob"]')
183: ->assertNotElementEmpty('[data-model-attribute-display="pat_ins1_insured_sex"]');
184:
185:
186: $patientPopupForm->addSecondaryInsurance();
187:
188: $this->within("#pat_ins_search_popup", function ($driver) {
189:
190: $driver->wait(1)->waitFor('[data-grid-row="0"]')->click();
191: $driver->wait(1);
192: });
193: $app->popup->last()->press("Add");
194:
195:
196: $form = $this->getView("patients/add-insurance-popup-form.json")->verifyAndWait();
197: $form->setInput(array(
198: "pat_ins_policy_num" => $this->faker->numerify("##########"),
199: "pat_ins_group_num" => $this->faker->numerify("##########"),
200: "dd_pat_ins_insured_relation" => "SELF"
201: ))->tab();
202:
203: $form->assertInputValueEquals("dd_insurance_type", "2");
204:
205:
206: $app->popup->last()->press("Save");
207:
208: $this->waitForElementText('[data-model-attribute-display="pat_ins2_insured_relation"]', "SELF", 10);
209: $patientPopupForm->assertInputHasValue("pat_ins2_irep_id");
210: $patientPopupForm->assertNotElementEmpty('[data-model-attribute-display="pat_ins2_policy_num"]')
211: ->assertNotElementEmpty('[data-model-attribute-display="pat_ins2_group_num"]')
212: ->assertNotElementEmpty('[data-model-attribute-display="pat_ins2_insured"]')
213: ->assertNotElementEmpty('[data-model-attribute-display="pat_ins2_insured_dob"]')
214: ->assertNotElementEmpty('[data-model-attribute-display="pat_ins2_insured_sex"]');
215:
216:
217: $patientPopupForm->addTertiaryInsurance();
218:
219: $this->within("#pat_ins_search_popup", function ($driver) {
220:
221: $driver->wait(1)->waitFor('[data-grid-row="0"]')->click();
222: $driver->wait(1);
223: });
224: $app->popup->last()->press("Add");
225:
226:
227: $form = $this->getView("patients/add-insurance-popup-form.json")->verifyAndWait();
228: $form->setInput(array(
229: "pat_ins_policy_num" => $this->faker->numerify("##########"),
230: "pat_ins_group_num" => $this->faker->numerify("##########"),
231: "dd_pat_ins_insured_relation" => "SELF"
232: ))->tab();
233:
234: $form->assertInputValueEquals("dd_insurance_type", "4");
235:
236:
237: $app->popup->last()->press("Save");
238:
239: $this->waitForElementText('[data-model-attribute-display="pat_ins3_insured_relation"]', "SELF", 10);
240: $patientPopupForm->assertInputHasValue("pat_ins3_irep_id");
241: $patientPopupForm->assertNotElementEmpty('[data-model-attribute-display="pat_ins3_policy_num"]')
242: ->assertNotElementEmpty('[data-model-attribute-display="pat_ins3_group_num"]')
243: ->assertNotElementEmpty('[data-model-attribute-display="pat_ins3_insured"]')
244: ->assertNotElementEmpty('[data-model-attribute-display="pat_ins3_insured_dob"]')
245: ->assertNotElementEmpty('[data-model-attribute-display="pat_ins3_insured_sex"]');
246:
247: $this->assertNoErrorPopups();
248: }
249:
250: 251: 252: 253: 254:
255: public function testAddPatientPowerAttorney()
256: {
257: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
258:
259: $patientPopupForm = $app->home->addPatient()->form;
260:
261:
262: $this->waitFor("#btn_add_pat_poa")->click();
263:
264:
265: $form = $this->getView("patients/add-power-of-attorney-popup-form.json")->verifyAndWait();
266:
267: $gender = (rand(1, 2) == 1 ? 'male' : 'female');
268: $form->setInput(array(
269: "npat_fname" => $this->faker->firstName($gender),
270: "npat_lname" => $this->faker->lastName($gender),
271: "poa_relation" => "SPOUSE"
272: ))->tab();
273:
274:
275: $app->popup->last()->press("Submit");
276:
277: $this->waitForElementText('#poa_relation', "SPOUSE", 10);
278: $patientPopupForm->assertTrue($patientPopupForm->querySelector("#pat_poa_select")->value() > 0);
279: $patientPopupForm->assertInputHasValue("npat_fname")
280: ->assertInputHasValue("npat_lname");
281: $patientPopupForm->assertNotElementEmpty("#poa_relation");
282:
283:
284:
285: $this->waitFor("#btn_edit_pat_poa")->click();
286:
287: $form = $this->getView("patients/add-power-of-attorney-popup-form.json")->verifyAndWait();
288: $form->assertInputHasValue("npat_fname")
289: ->assertInputHasValue("npat_lname")
290: ->assertInputHasValue("poa_relation");
291:
292: $app->popup->last()->press("Cancel");
293: $this->wait(1);
294:
295:
296: $this->waitFor("#btn_remove_pat_poa")->click();
297: $app->popup->confirmYes();
298:
299: $this->waitForElementText('#poa_relation', "", 10);
300: $patientPopupForm->assertFalse($patientPopupForm->querySelector("#pat_poa_select")->value() > 0);
301: $patientPopupForm->assertNotInputHasValue("npat_fname")
302: ->assertNotInputHasValue("npat_lname");
303: $patientPopupForm->assertElementEmpty("#poa_relation");
304: }
305: }
306:
307: ?>