1: <?php
2: use Azalea\Selenium\App\ApplicationTestCase;
3: use Azalea\Selenium\App\Patients;
4: use Azalea\Selenium\App\Users;
5:
6: class SchedulerInsuranceBlocksTest extends ApplicationTestCase
7: {
8: 9: 10: 11: 12: 13: 14:
15: public function testInsuranceBlocksAppearOnScheduler()
16: {
17: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
18:
19:
20: $scheduler = $app->scheduler->navigate()->verifyAndWait();
21:
22:
23: $this->wait(1);
24: $scheduler->changeLocation(402);
25:
26:
27: $scheduler->goToDate(new DateTime("09/01/2016"));
28: $this->wait(1);
29:
30: 31: 32: 33: 34: 35:
36: $this->spinWait(function ($driver) use ($scheduler) {
37: $scheduler->scrollTo("0900");
38: $driver->assertElementHasText("#p3552_0900 .sched_block", "Open");
39: $driver->assertElementExists("#p3552_0900 .sched_block .shield16");
40: $driver->assertElementHasText("#p3552_0905 .sched_block", "Open");
41: $driver->assertElementExists("#p3552_0905 .sched_block .shield16");
42: $driver->assertElementHasText("#p3552_0910 .sched_block", "Open");
43: $driver->assertElementExists("#p3552_0910 .sched_block .shield16");
44: $driver->assertElementHasText("#p3552_0915 .sched_block", "Open");
45: $driver->assertElementExists("#p3552_0915 .sched_block .shield16");
46: $driver->assertElementHasText("#p3552_0920 .sched_block", "Open");
47: $driver->assertElementExists("#p3552_0920 .sched_block .shield16");
48: $driver->assertElementHasText("#p3552_0925 .sched_block", "Open");
49: $driver->assertElementExists("#p3552_0925 .sched_block .shield16");
50:
51: $scheduler->scrollTo("0930");
52: $driver->assertElementHasText("#p3552_0930 .sched_block", "Open");
53: $driver->assertElementExists("#p3552_0930 .sched_block .shield16");
54: $driver->assertElementHasText("#p3552_0935 .sched_block", "Open");
55: $driver->assertElementExists("#p3552_0935 .sched_block .shield16");
56: $driver->assertElementHasText("#p3552_0940 .sched_block", "Open");
57: $driver->assertElementExists("#p3552_0940 .sched_block .shield16");
58: $driver->assertElementHasText("#p3552_0945 .sched_block", "Open");
59: $driver->assertElementExists("#p3552_0945 .sched_block .shield16");
60: $driver->assertElementHasText("#p3552_0950 .sched_block", "Open");
61: $driver->assertElementExists("#p3552_0950 .sched_block .shield16");
62: $driver->assertElementHasText("#p3552_0955 .sched_block", "Open");
63: $driver->assertElementExists("#p3552_0955 .sched_block .shield16");
64:
65: $scheduler->scrollTo("1000");
66: $driver->assertElementHasText("#p3552_1000 .sched_block", "Consultation");
67: $driver->assertElementExists("#p3552_1000 .sched_block .shield16");
68: $driver->assertElementHasText("#p3552_1005 .sched_block", "Consultation");
69: $driver->assertElementExists("#p3552_1005 .sched_block .shield16");
70: $driver->assertElementHasText("#p3552_1010 .sched_block", "Consultation");
71: $driver->assertElementExists("#p3552_1010 .sched_block .shield16");
72: $driver->assertElementHasText("#p3552_1015 .sched_block", "Consultation");
73: $driver->assertElementExists("#p3552_1015 .sched_block .shield16");
74: $driver->assertElementHasText("#p3552_1020 .sched_block", "Consultation");
75: $driver->assertElementExists("#p3552_1020 .sched_block .shield16");
76: $driver->assertElementHasText("#p3552_1025 .sched_block", "Consultation");
77: $driver->assertElementExists("#p3552_1025 .sched_block .shield16");
78:
79: $scheduler->scrollTo("1030");
80: $driver->assertElementHasText("#p3552_1030 .sched_block", "Consultation");
81: $driver->assertElementExists("#p3552_1030 .sched_block .shield16");
82: $driver->assertElementHasText("#p3552_1035 .sched_block", "Consultation");
83: $driver->assertElementExists("#p3552_1035 .sched_block .shield16");
84: $driver->assertElementHasText("#p3552_1040 .sched_block", "Consultation");
85: $driver->assertElementExists("#p3552_1040 .sched_block .shield16");
86: $driver->assertElementHasText("#p3552_1045 .sched_block", "Consultation");
87: $driver->assertElementExists("#p3552_1045 .sched_block .shield16");
88: $driver->assertElementHasText("#p3552_1050 .sched_block", "Consultation");
89: $driver->assertElementExists("#p3552_1050 .sched_block .shield16");
90: $driver->assertElementHasText("#p3552_1055 .sched_block", "Consultation");
91: $driver->assertElementExists("#p3552_1055 .sched_block .shield16");
92:
93: return true;
94: });
95:
96: $this->assertNoErrorPopups();
97: }
98:
99: 100: 101: 102: 103:
104: public function testCannotScheduleSelfPayOnInsuranceBlock()
105: {
106: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
107:
108:
109: $scheduler = $app->scheduler->navigate()->verifyAndWait();
110:
111:
112: $this->wait(1);
113: $scheduler->changeLocation(402);
114:
115:
116: $scheduler->goToDate(new DateTime("08/01/2016"));
117: $this->wait(1);
118:
119:
120: $scheduler->scrollTo("0900");
121: $scheduler->scrollTo("1000");
122: $scheduler->scrollTo("0800");
123:
124:
125:
126:
127: $this->clickElement("#p3552_0900 .sched_block");
128:
129:
130: $this->within("#find_patient_popup", function ($driver) {
131: $driver->type("autoselect_search", "Selenium Self Pay");
132: $driver->wait(1);
133: $driver->waitFor('[data-grid-row="0"]')->click();
134: });
135:
136: $this->waitForAjax();
137:
138: 139: 140: 141: 142: 143:
144: $popup = $app->popup->last();
145: $popup->assertCanSee("A non-insurance patient cannot be scheduled on a time slot reserved for one or more insurances.");
146: $popup->assertCanSee("Override");
147: $popup->press("Cancel");
148:
149: 150: 151: 152:
153: $this->spinWait(function ($driver) use ($scheduler) {
154: $driver->assertElementHasText("#p3552_0900 .sched_block", "Open");
155: return true;
156: });
157:
158: $this->assertNoErrorPopups();
159: }
160:
161: 162: 163: 164: 165: 166:
167: public function testCannotScheduleInsurancePatientOnInvalidInsuranceBlock()
168: {
169: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
170:
171:
172: $scheduler = $app->scheduler->navigate()->verifyAndWait();
173:
174:
175: $this->wait(1);
176: $scheduler->changeLocation(402);
177:
178:
179: $scheduler->goToDate(new DateTime("08/01/2016"));
180: $this->wait(1);
181:
182:
183: $scheduler->scrollTo("0900");
184: $scheduler->scrollTo("1000");
185: $scheduler->scrollTo("0800");
186:
187:
188:
189:
190: $this->clickElement("#p3552_0900 .sched_block");
191:
192:
193: $this->within("#find_patient_popup", function ($driver) {
194: $driver->type("autoselect_search", "Selenium Primary Insurance");
195: $driver->wait(1);
196: $driver->waitFor('[data-grid-row="0"]')->click();
197: });
198:
199: $this->waitForAjax();
200:
201: 202: 203: 204: 205: 206:
207: $popup = $app->popup->last();
208: $popup->assertCanSee("The patient's insurance does not match the insurance(s) reserved for this appointment time slot.");
209: $popup->assertCanSee("Override");
210: $popup->press("Cancel");
211:
212: 213: 214: 215:
216: $this->spinWait(function ($driver) use ($scheduler) {
217: $driver->assertElementHasText("#p3552_0900 .sched_block", "Open");
218: return true;
219: });
220:
221: $this->assertNoErrorPopups();
222: }
223:
224: 225: 226: 227: 228: 229:
230: public function testCanOverrideScheduleInsurancePatientOnInvalidInsuranceBlock()
231: {
232: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
233:
234:
235: $scheduler = $app->scheduler->navigate()->verifyAndWait();
236:
237:
238: $this->wait(1);
239: $scheduler->changeLocation(402);
240:
241:
242: $scheduler->goToDate(new DateTime("08/01/2016"));
243: $this->wait(1);
244:
245:
246: $scheduler->scrollTo("0900");
247: $scheduler->scrollTo("1000");
248: $scheduler->scrollTo("0800");
249:
250:
251:
252:
253: $this->clickElement("#p3552_0900 .sched_block");
254:
255:
256: $this->within("#find_patient_popup", function ($driver) {
257: $driver->type("autoselect_search", "Selenium Primary Insurance");
258: $driver->wait(1);
259: $driver->waitFor('[data-grid-row="0"]')->click();
260: });
261:
262: $this->waitForAjax();
263:
264: 265: 266: 267: 268: 269:
270: $popup = $app->popup->last();
271: $popup->assertCanSee("The patient's insurance does not match the insurance(s) reserved for this appointment time slot.");
272: $popup->assertCanSee("Override");
273: $popup->press("Override");
274:
275: 276: 277: 278:
279: $popup = $scheduler->appointmentPopup->verifyAndWait();
280:
281:
282: $app->popup->last()->press("Cancel");
283: $this->waitForAjax();
284:
285: $this->assertNoErrorPopups();
286: }
287:
288: 289: 290: 291: 292: 293:
294: public function testCanSchedulePatientByMatchingInsurance()
295: {
296: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
297:
298:
299: $scheduler = $app->scheduler->navigate()->verifyAndWait();
300:
301:
302: $this->wait(1);
303: $scheduler->changeLocation(402);
304:
305:
306: $scheduler->goToDate(new DateTime("08/01/2016"));
307: $this->wait(1);
308:
309:
310: $scheduler->scrollTo("0950");
311:
312:
313:
314:
315: $this->clickElement("#p3552_1000 .sched_block");
316:
317:
318: $this->within("#find_patient_popup", function ($driver) {
319: $driver->type("autoselect_search", "Selenium Insurance Block Test");
320: $driver->wait(1);
321: $driver->waitFor('[data-grid-row="0"]')->click();
322: });
323:
324: $this->waitForAjax();
325:
326: 327: 328: 329:
330: $popup = $scheduler->appointmentPopup->verifyAndWait();
331:
332:
333: $app->popup->last()->press("Cancel");
334: $this->waitForAjax();
335:
336: $this->assertNoErrorPopups();
337: }
338:
339: 340: 341: 342: 343: 344:
345: public function testCanSchedulePatientByMatchingInsuranceClass()
346: {
347: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
348:
349:
350: $scheduler = $app->scheduler->navigate()->verifyAndWait();
351:
352:
353: $this->wait(1);
354: $scheduler->changeLocation(402);
355:
356:
357: $scheduler->goToDate(new DateTime("08/01/2016"));
358: $this->wait(1);
359:
360:
361: $scheduler->scrollTo("0950");
362:
363:
364:
365:
366: $this->clickElement("#p3552_1020 .sched_block");
367:
368:
369: $this->within("#find_patient_popup", function ($driver) {
370: $driver->type("autoselect_search", "Selenium Ins Class Block");
371: $driver->wait(1);
372: $driver->waitFor('[data-grid-row="0"]')->click();
373: });
374:
375: $this->waitForAjax();
376:
377: 378: 379: 380:
381: $popup = $scheduler->appointmentPopup->verifyAndWait();
382:
383:
384: $app->popup->last()->press("Cancel");
385: $this->waitForAjax();
386:
387: $this->assertNoErrorPopups();
388: }
389:
390: 391: 392: 393: 394: 395: 396:
397: public function testCanScheduleWithMultipleApptMode()
398: {
399: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
400:
401:
402: $scheduler = $app->scheduler->navigate()->verifyAndWait();
403:
404:
405: $this->wait(1);
406: $scheduler->changeLocation(402);
407:
408:
409: $scheduler->goToDate(new DateTime("08/01/2016"));
410: $this->wait(1);
411:
412:
413: $app->home->search->type("search", "Selenium Insurance Block Test");
414:
415:
416: $this->waitFor(".autoCompleteResult")->click();
417: $this->waitForAjax();
418:
419: 420: 421: 422: 423:
424: $this->spinWait(function () use ($scheduler) {
425: $scheduler->assertCanSee("Scheduling");
426: $scheduler->assertCanSee("Selenium Insurance Block Test");
427: return true;
428: });
429:
430:
431: $scheduler->scrollTo("1000");
432:
433:
434:
435:
436:
437: $this->clickElement("#p3552_1030 .sched_block");
438: $this->waitForAjax();
439:
440: 441: 442: 443:
444: $popup = $scheduler->appointmentPopup->verifyAndWait();
445:
446:
447: $app->popup->last()->press("Cancel");
448: $this->waitForAjax();
449:
450:
451: $scheduler->select("apt_are_id", 6628);
452:
453:
454: $this->clickElement("#p3552_1030 .sched_block");
455: $this->waitForAjax();
456:
457: 458: 459: 460:
461: $this->spinWait(function ($driver) {
462: $driver->assertElementHasText("#p3552_1030 .sched_appointment", "Block Test, Selenium Insurance");
463: return true;
464: });
465:
466:
467: $this->clickElement("#finish_sched");
468:
469:
470: $this->clickElement("#p3552_1030 .sched_appointment");
471: $this->waitForAjax();
472:
473: 474: 475: 476: 477:
478:
479: $popup = $scheduler->appointmentPopup->verifyAndWait();
480: $popup->assertInputHasValue("apt_are_id", 6628);
481:
482:
483: $popup->select("apt_ast_id", 7);
484:
485: $app->popup->last()->press("Submit");
486: $this->waitForAjax();
487:
488: $this->assertNoErrorPopups();
489: }
490:
491: 492: 493: 494: 495: 496: 497:
498: public function testCanScheduleOverrideWithMultipleApptMode()
499: {
500: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
501:
502:
503: $scheduler = $app->scheduler->navigate()->verifyAndWait();
504:
505:
506: $this->wait(1);
507: $scheduler->changeLocation(402);
508:
509:
510: $scheduler->goToDate(new DateTime("08/01/2016"));
511: $this->wait(1);
512:
513:
514: $app->home->search->type("search", "Selenium Primary Insurance");
515:
516:
517: $this->waitFor(".autoCompleteResult")->click();
518: $this->waitForAjax();
519:
520: 521: 522: 523: 524:
525: $this->spinWait(function () use ($scheduler) {
526: $scheduler->assertCanSee("Scheduling");
527: $scheduler->assertCanSee("Selenium Primary Insurance");
528: return true;
529: });
530:
531:
532: $scheduler->scrollTo("1030");
533:
534:
535:
536:
537:
538: $this->clickElement("#p3552_1040 .sched_block");
539: $this->waitForAjax();
540:
541: 542: 543: 544: 545: 546:
547: $popup = $app->popup->last();
548: $popup->assertCanSee("The patient's insurance does not match the insurance(s) reserved for this appointment time slot.");
549: $popup->assertCanSee("Override");
550: $popup->press("Override");
551:
552: 553: 554: 555:
556: $popup = $scheduler->appointmentPopup->verifyAndWait();
557:
558:
559: $app->popup->last()->press("Cancel");
560: $this->waitForAjax();
561:
562:
563: $scheduler->select("apt_are_id", 6628);
564:
565:
566: $this->clickElement("#p3552_1040 .sched_block");
567: $this->waitForAjax();
568:
569: 570: 571: 572: 573: 574:
575: $popup = $app->popup->last();
576: $popup->assertCanSee("The patient's insurance does not match the insurance(s) reserved for this appointment time slot.");
577: $popup->assertCanSee("Override");
578: $popup->press("Override");
579:
580: 581: 582: 583:
584: $this->spinWait(function ($driver) {
585: $driver->assertElementHasText("#p3552_1040 .sched_appointment", "Primary Insurance, Selenium");
586: return true;
587: });
588:
589:
590: $this->clickElement("#finish_sched");
591:
592:
593: $this->clickElement("#p3552_1040 .sched_appointment");
594: $this->waitForAjax();
595:
596: 597: 598: 599: 600:
601:
602: $popup = $scheduler->appointmentPopup->verifyAndWait();
603: $popup->assertInputHasValue("apt_are_id", 6628);
604:
605:
606: $popup->select("apt_ast_id", 7);
607:
608: $app->popup->last()->press("Submit");
609: $this->waitForAjax();
610:
611: $this->assertNoErrorPopups();
612: }
613: }
614:
615: ?>