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 ChartObjectiveTest extends ApplicationTestCase
8: {
9: public function supportsCustomer($cus_id)
10: {
11:
12: return (Customers::isEhrCustomer($cus_id) || Customers::isEmrCustomer($cus_id));
13: }
14:
15: 16: 17: 18:
19: public function testCanEditObjectiveNotesField()
20: {
21: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
22:
23:
24: $chartView = $app->patients->get(Patients::CAMILA_FISHER_ID)->charts->navigate()->addChart();
25:
26:
27: $chartView->objective->editObjectiveNotes();
28: $this->keys("This is some text.");
29:
30: $chartView->objective->notes->assertCanSee("This is some text.");
31:
32:
33: $chartView->objective->cancelObjectiveNotes();
34:
35: 36: 37: 38:
39: $this->spinWait(function () use ($chartView) {
40: $chartView->objective->notes->assertCanNotSee("This is some text.");
41: return true;
42: });
43:
44: $this->wait(1);
45:
46:
47: $chartView->objective->editObjectiveNotes();
48: $this->keys("This is some more text.");
49:
50: $chartView->objective->notes->assertCanSee("This is some more text.");
51:
52:
53: $chartView->objective->saveObjectiveNotes();
54:
55: 56: 57: 58:
59: $this->spinWait(function () use ($chartView) {
60: $chartView->objective->notes->assertCanSee("This is some more text.");
61: return true;
62: });
63:
64:
65: $chartView->save();
66:
67: 68: 69: 70:
71: $this->spinWait(function () use ($chartView) {
72: $chartView->objective->notes->assertCanSee("This is some more text.");
73: return true;
74: });
75:
76:
77: $chartView->cancel();
78:
79: $this->assertNoErrorPopups();
80: }
81:
82: 83: 84: 85: 86: 87:
88: public function testAddEditDeleteVitals()
89: {
90: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
91:
92:
93: $chartView = $app->patients->get(Patients::CAMILA_FISHER_ID)->charts->navigate()->addChart();
94:
95:
96: $chartView->objective->addVitals();
97:
98:
99:
100: $chartView->popups->vitals->verifyAndWait()->setInput(array(
101: "espv_height_ft_in" => "in",
102: "espv_height_in" => 60,
103: "espv_weight_lbs" => 150,
104: "espv_blood_pressure_mm" => 80,
105: "espv_blood_pressure_hg" => 120,
106: "espv_temp" => 98,
107: "espv_pulse" => 90,
108: "espv_resp_rate" => 75,
109: "espv_pulse_oximetry" => 50,
110: "espv_notes" => "These are some notes"
111: ));
112:
113:
114: $app->popup->last()->press("Save");
115:
116:
117: $vitalsGrid = $chartView->objective->vitals->grid;
118:
119: 120: 121: 122:
123: $vitalsGrid->waitForRowCount(1);
124: $this->spinWait(function () use ($vitalsGrid) {
125: $vitalsGrid->assertCanSee("60");
126: $vitalsGrid->assertCanSee("150");
127: $vitalsGrid->assertCanSee("80");
128: $vitalsGrid->assertCanSee("120");
129: $vitalsGrid->assertCanSee("98");
130: $vitalsGrid->assertCanSee("90");
131: $vitalsGrid->assertCanSee("75");
132: $vitalsGrid->assertCanSee("50");
133: $vitalsGrid->assertCanSee("These are some notes");
134: return true;
135: });
136:
137:
138: $chartView->objective->addVitals();
139:
140:
141: $chartView->popups->vitals->verifyAndWait()->setInput(array(
142: "espv_height_ft_in" => "in",
143: "espv_height_in" => 61,
144: "espv_weight_lbs" => 151,
145: "espv_blood_pressure_mm" => 81,
146: "espv_blood_pressure_hg" => 121,
147: "espv_temp" => 99,
148: "espv_pulse" => 91,
149: "espv_resp_rate" => 76,
150: "espv_pulse_oximetry" => 51,
151: "espv_notes" => "These are some more notes"
152: ));
153:
154:
155: $app->popup->last()->press("Save");
156:
157: 158: 159: 160:
161: $vitalsGrid->waitForRowCount(2);
162: $this->spinWait(function () use ($vitalsGrid) {
163: $vitalsGrid->assertCanSee("61");
164: $vitalsGrid->assertCanSee("151");
165: $vitalsGrid->assertCanSee("81");
166: $vitalsGrid->assertCanSee("121");
167: $vitalsGrid->assertCanSee("99");
168: $vitalsGrid->assertCanSee("91");
169: $vitalsGrid->assertCanSee("76");
170: $vitalsGrid->assertCanSee("51");
171: $vitalsGrid->assertCanSee("These are some more notes");
172: return true;
173: });
174:
175:
176: $chartView->objective->vitals->grid->waitForRowAt(0)->click();
177:
178:
179: $chartView->popups->vitals->verifyAndWait()->setInput(array(
180: "espv_height_ft_in" => "in",
181: "espv_height_in" => 62,
182: "espv_weight_lbs" => 153,
183: "espv_blood_pressure_mm" => 83,
184: "espv_blood_pressure_hg" => 123,
185: "espv_temp" => 99,
186: "espv_pulse" => 93,
187: "espv_resp_rate" => 77,
188: "espv_pulse_oximetry" => 53,
189: "espv_notes" => "These are some edited notes"
190: ));
191:
192:
193: $app->popup->last()->press("Save");
194:
195: 196: 197: 198:
199: $this->spinWait(function () use ($vitalsGrid) {
200: $vitalsGrid->assertCanSee("62");
201: $vitalsGrid->assertCanSee("153");
202: $vitalsGrid->assertCanSee("83");
203: $vitalsGrid->assertCanSee("123");
204: $vitalsGrid->assertCanSee("99");
205: $vitalsGrid->assertCanSee("93");
206: $vitalsGrid->assertCanSee("77");
207: $vitalsGrid->assertCanSee("53");
208: $vitalsGrid->assertCanSee("These are some edited notes");
209: return true;
210: });
211:
212:
213: $chartView->objective->vitals->grid->waitForRowAt(0)->click();
214:
215:
216: $chartView->popups->vitals->verifyAndWait()->select("espv_height_ft_in", "ft");
217:
218:
219: $app->popup->last()->press("Save");
220:
221: 222: 223: 224:
225: $this->spinWait(function () use ($chartView) {
226: $chartView->objective->vitals->grid->assertCanSee("5 ft. 2.00 in.");
227: return true;
228: });
229:
230:
231: $chartView->objective->vitals->grid->waitForRowAt(0)->click();
232:
233:
234: $chartView->popups->vitals->verifyAndWait()->select("espv_height_ft_in", "cm");
235:
236:
237: $app->popup->last()->press("Save");
238:
239: 240: 241: 242:
243: $this->spinWait(function () use ($chartView) {
244: $chartView->objective->vitals->grid->assertCanSee("157.480 cm");
245: return true;
246: });
247:
248:
249:
250: $chartView->objective->vitals->grid->waitForRowAt(0)->click();
251:
252:
253: $chartView->popups->vitals->verifyAndWait()->select("espv_weight_lbs_ozs", "ozs");
254:
255:
256: $chartView->popups->vitals->setInput(array(
257: "espv_weight_lbs" => "153",
258: "espv_weight_ozs" => "8"
259: ));
260:
261:
262: $app->popup->last()->press("Save");
263:
264: 265: 266: 267:
268: $this->spinWait(function () use ($chartView) {
269: $chartView->objective->vitals->grid->assertCanSee("153 lbs. 8.00 oz.");
270: return true;
271: });
272:
273:
274:
275: $chartView->objective->vitals->grid->waitForRowAt(0)->click();
276:
277:
278: $chartView->popups->vitals->verifyAndWait()->select("espv_weight_lbs_ozs", "kg");
279:
280:
281: $app->popup->last()->press("Save");
282:
283: 284: 285: 286:
287: $this->spinWait(function () use ($chartView) {
288: $chartView->objective->vitals->grid->assertCanSee("69.626 kg");
289: return true;
290: });
291:
292:
293:
294:
295: 296: 297: 298:
299:
300:
301: $chartView->objective->vitals->grid->first()->querySelector('[data-button-class="delete"]')->click();
302:
303: $app->popup->confirmYes();
304:
305: $chartView->objective->vitals->grid->waitForRowCount(1);
306:
307:
308: $chartView->objective->vitals->grid->first()->querySelector('[data-button-class="delete"]')->click();
309:
310: $app->popup->confirmYes();
311:
312: $chartView->objective->vitals->grid->waitForEmpty();
313:
314: 315: 316: 317:
318:
319:
320: $chartView->cancel();
321:
322: $this->assertNoErrorPopups();
323: }
324:
325: 326: 327: 328: 329:
330: public function testAddEditRemoveImageAnnotation()
331: {
332: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
333:
334:
335: $chartView = $app->patients->get(Patients::CAMILA_FISHER_ID)->charts->navigate()->addChart();
336:
337:
338: $chartView->objective->addImageAnnotation();
339:
340: $chartView->popups->images->verifyAndWait();
341: $chartView->popups->images->grid->waitForRowAt(0);
342:
343:
344: $chartView->popups->images->type("autoselect_search", "Body Diagrams");
345: $this->spinWait(function () use ($chartView) {
346: return $chartView->popups->images->grid->see("Body Diagrams");
347: });
348:
349:
350: $chartView->popups->images->grid->waitForRowAt(0)->click();
351:
352: 353: 354: 355:
356:
357: $this->spinWait(function () use ($chartView) {
358: $chartView->objective->images->assertCanSee("Body Diagrams");
359: $chartView->objective->images->assertElementExists("canvas");
360: return true;
361: });
362:
363:
364: $chartView->objective->images->press("Edit");
365:
366: 367: 368: 369:
370: $chartView->objective->images->assertElementVisible("#canvas_controls");
371:
372:
373: $chartView->objective->images->press("Cancel");
374:
375:
376: $chartView->objective->images->press("Remove");
377:
378: $app->popup->confirmYes();
379:
380: 381: 382: 383:
384:
385: $this->spinWait(function () use ($chartView) {
386: $chartView->objective->images->assertCanNotSee("Body Diagrams");
387: $chartView->objective->images->assertElementNotExists("canvas");
388: return true;
389: });
390:
391:
392: $chartView->cancel();
393:
394: $this->assertNoErrorPopups();
395: }
396:
397: 398: 399: 400: 401:
402: public function testAddEditRemoveCustomFields()
403: {
404: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
405:
406:
407: $chartView = $app->patients->get(Patients::CAMILA_FISHER_ID)->charts->navigate()->addChart();
408:
409:
410: $this->waitFor(".chart-controls-edit #btn_jump_obj")->click();
411:
412:
413: $buttons = $chartView->objective->fields->getButtons("Remove");
414: foreach ($buttons as $button) {
415: $button->click();
416: }
417:
418:
419:
420: $chartView->objective->addObjectiveField();
421:
422: $chartView->popups->fields->verifyAndWait();
423: $chartView->popups->fields->grid->waitForRowAt(0);
424:
425:
426: $chartView->popups->fields->type("autoselect_search", "Objective Text Field");
427: $chartView->popups->fields->grid->waitForRowTextAt(0, "Objective Text Field");
428:
429:
430: $chartView->popups->fields->grid->waitForRowAt(0)->click();
431:
432: 433: 434: 435:
436:
437: $this->spinWait(function () use ($chartView) {
438: $chartView->objective->fields->assertCanSee("Objective Text Field");
439: $chartView->objective->fields->assertElementExists(".charts-HTMLInputView");
440: return true;
441: });
442:
443:
444: $chartView->objective->fields->press("Edit");
445:
446: 447: 448: 449:
450: $this->spinWait(function () use ($chartView) {
451: $chartView->objective->fields->assertElementVisible(".charts-HTMLInputView > .editing");
452: return true;
453: });
454:
455:
456: $chartView->objective->fields->press("Cancel");
457:
458:
459: $chartView->objective->fields->press("Remove");
460:
461: $app->popup->confirmYes();
462:
463: 464: 465: 466:
467:
468: $this->spinWait(function () use ($chartView) {
469: $chartView->objective->fields->assertCanNotSee("Objective Text Field");
470: return true;
471: });
472:
473:
474:
475:
476: $chartView->objective->addObjectiveField();
477:
478: $chartView->popups->fields->verifyAndWait();
479: $chartView->popups->fields->grid->waitForRowAt(0);
480:
481:
482: $chartView->popups->fields->type("autoselect_search", "Objective Form Field");
483: $chartView->popups->fields->grid->waitForRowTextAt(0, "Objective Form Field");
484:
485:
486: $chartView->popups->fields->grid->waitForRowAt(0)->click();
487:
488: 489: 490: 491:
492:
493: $this->spinWait(function () use ($chartView) {
494: $chartView->objective->fields->assertCanSee("Objective Form Field");
495: $chartView->objective->fields->assertElementExists(".charts-FormInputView");
496: return true;
497: });
498:
499:
500: $chartView->objective->fields->press("Edit");
501:
502: 503: 504: 505:
506:
507:
508: $this->assertNoErrorPopups();
509:
510:
511: $chartView->objective->fields->press("Cancel");
512: $this->waitForAjax();
513:
514:
515: $chartView->objective->fields->press("Remove");
516:
517: $app->popup->confirmYes();
518:
519: 520: 521: 522:
523:
524: $this->spinWait(function () use ($chartView) {
525: $chartView->objective->fields->assertCanNotSee("Objective Form Field");
526: return true;
527: });
528:
529:
530:
531:
532: $chartView->cancel();
533:
534: $this->assertNoErrorPopups();
535: }
536: }
537:
538: ?>