1: <?php
2: use Azalea\Selenium\App\ApplicationTestCase;
3: use Azalea\Selenium\App\Patients;
4: use Azalea\Selenium\App\Users;
5:
6: class SchedulerBlocksTest extends ApplicationTestCase
7: {
8: 9: 10: 11: 12:
13: public function testBasicSchedulerBlockRendering()
14: {
15: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
16:
17:
18: $scheduler = $app->scheduler->navigate()->verifyAndWait();
19:
20:
21: $this->wait(1);
22: $scheduler->changeLocation(401);
23:
24:
25: $scheduler->goToDate(new DateTime("03/15/2016"));
26: $this->wait(1);
27:
28:
29: $scheduler->scrollTo("1100");
30:
31: 32: 33: 34: 35: 36: 37:
38: $this->spinWait(function ($driver) use ($scheduler) {
39: $driver->assertElementNotHasText("#p3554_1125", "Open");
40:
41: $scheduler->scrollTo("1130");
42: $driver->assertElementHasText("#p3554_1130 .sched_opening ", "Open");
43: $driver->assertElementHasText("#p3554_1135 .sched_opening ", "Open");
44: $driver->assertElementHasText("#p3554_1140 .sched_opening ", "Open");
45: $driver->assertElementHasText("#p3554_1145 .sched_opening ", "Open");
46: $driver->assertElementHasText("#p3554_1150 .sched_opening ", "Open");
47: $driver->assertElementHasText("#p3554_1155 .sched_opening ", "Open");
48:
49: $scheduler->scrollTo("1200");
50: $driver->assertElementHasText("#p3554_1200 .sched_lockout", "Lockout Test");
51: $driver->assertElementHasText("#p3554_1205 .sched_lockout", "Lockout Test");
52: $driver->assertElementHasText("#p3554_1210 .sched_lockout", "Lockout Test");
53: $driver->assertElementHasText("#p3554_1215 .sched_lockout", "Lockout Test");
54: $driver->assertElementHasText("#p3554_1220 .sched_lockout", "Lockout Test");
55:
56: $driver->assertElementHasText("#p3554_1225 .sched_opening", "Open");
57:
58: $scheduler->scrollTo("1230");
59: $driver->assertElementHasText("#p3554_1230 .sched_block", "Consultation");
60: $driver->assertElementHasText("#p3554_1235 .sched_block", "Consultation");
61: $driver->assertElementHasText("#p3554_1240 .sched_block", "Consultation");
62: $driver->assertElementHasText("#p3554_1245 .sched_block", "Consultation");
63: $driver->assertElementHasText("#p3554_1250 .sched_block", "Consultation");
64: $driver->assertElementHasText("#p3554_1255 .sched_block", "Consultation");
65:
66: $driver->assertElementNotHasText("#p3554_1255", "Open");
67:
68: return true;
69: });
70:
71: $this->assertNoErrorPopups();
72: }
73:
74: 75: 76: 77:
78: public function testCanScheduleOnOpenBlock()
79: {
80: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
81:
82:
83: $scheduler = $app->scheduler->navigate()->verifyAndWait();
84:
85:
86: $this->wait(1);
87: $scheduler->changeLocation(401);
88:
89:
90: $scheduler->goToDate(new DateTime("03/16/2016"));
91: $this->wait(1);
92:
93:
94: $scheduler->scrollTo("1100");
95:
96:
97: $this->querySelector("#p3554_1130 .sched_opening")->click();
98:
99:
100: $this->within("#find_patient_popup", function ($driver) {
101: $driver->type("autoselect_search", "Selenium Primary Insurance");
102: $driver->wait(1);
103: $driver->waitFor('[data-grid-row="0"]')->click();
104: });
105:
106: $this->waitForAjax();
107:
108: 109: 110: 111:
112: $popup = $scheduler->appointmentPopup->verifyAndWait();
113:
114:
115: $app->popup->last()->press("Cancel");
116: $this->waitForAjax();
117:
118: $this->assertNoErrorPopups();
119: }
120:
121: 122: 123: 124:
125: public function testCanScheduleOnAppointmentBlock()
126: {
127: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
128:
129:
130: $scheduler = $app->scheduler->navigate()->verifyAndWait();
131:
132:
133: $this->wait(1);
134: $scheduler->changeLocation(401);
135:
136:
137: $scheduler->goToDate(new DateTime("03/16/2016"));
138: $this->wait(1);
139:
140:
141: $scheduler->scrollTo("1100");
142: $scheduler->scrollTo("1200");
143:
144:
145: $this->querySelector("#p3554_1230 .sched_block")->click();
146:
147:
148: $this->within("#find_patient_popup", function ($driver) {
149: $driver->type("autoselect_search", "Selenium Primary Insurance");
150: $driver->wait(1);
151: $driver->waitFor('[data-grid-row="0"]')->click();
152: });
153:
154: $this->waitForAjax();
155:
156: 157: 158: 159: 160:
161: $popup = $scheduler->appointmentPopup->verifyAndWait();
162:
163: $value = $popup->getInput("apt_are_id");
164: $this->assertEquals("CONSULTATION", $popup->getSelectOptionText("apt_are_id", $value));
165:
166:
167: $app->popup->last()->press("Cancel");
168: $this->waitForAjax();
169:
170: $this->assertNoErrorPopups();
171: }
172:
173: 174: 175: 176:
177: public function testCannotScheduleOnLockoutBlock()
178: {
179: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
180:
181:
182: $scheduler = $app->scheduler->navigate()->verifyAndWait();
183:
184:
185: $this->wait(1);
186: $scheduler->changeLocation(401);
187:
188:
189: $scheduler->goToDate(new DateTime("03/16/2016"));
190: $this->wait(1);
191:
192:
193: $scheduler->scrollTo("1100");
194: $scheduler->scrollTo("1200");
195:
196:
197: $this->querySelector("#p3554_1200 .sched_lockout")->click();
198:
199: 200: 201: 202: 203:
204: $popup = $app->popup->first();
205: $popup->assertCanSee("What would you like to do? Please select on option below.");
206: $popup->assertCanSee("Edit Lock-out");
207: $popup->assertCanSee("Add Exception");
208: $popup->press("Cancel");
209:
210: $this->assertNoErrorPopups();
211: }
212:
213: 214: 215: 216: 217:
218: public function testCanScheduleWithMultipleApptMode()
219: {
220: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
221:
222:
223: $scheduler = $app->scheduler->navigate()->verifyAndWait();
224:
225:
226: $this->wait(1);
227: $scheduler->changeLocation(401);
228:
229:
230: $scheduler->goToDate(new DateTime("03/16/2016"));
231: $this->wait(1);
232:
233:
234: $app->home->search->type("search", "Selenium Primary Insurance");
235:
236:
237: $this->waitFor(".autoCompleteResult")->click();
238: $this->waitForAjax();
239:
240: 241: 242: 243: 244:
245: $this->spinWait(function () use ($scheduler) {
246: $scheduler->assertCanSee("Scheduling");
247: $scheduler->assertCanSee("Selenium Primary Insurance");
248: return true;
249: });
250:
251:
252: $scheduler->scrollTo("1100");
253:
254:
255:
256: $this->clickElement("#p3554_1140 .sched_opening");
257: $this->waitForAjax();
258:
259: 260: 261: 262:
263: $popup = $scheduler->appointmentPopup->verifyAndWait();
264:
265:
266: $app->popup->last()->press("Cancel");
267: $this->waitForAjax();
268:
269:
270: $scheduler->select("apt_are_id", 6628);
271:
272:
273: $this->clickElement("#p3554_1150 .sched_opening");
274: $this->waitForAjax();
275:
276: 277: 278: 279:
280: $this->spinWait(function ($driver) {
281: $driver->assertElementHasText("#p3554_1150 .sched_appointment", "Primary Insurance, Selenium");
282: return true;
283: });
284:
285:
286: $scheduler->scrollTo("1230");
287:
288:
289: $scheduler->select("apt_are_id", "");
290:
291:
292:
293: $this->clickElement("#p3554_1250 .sched_block");
294: $this->waitForAjax();
295:
296: 297: 298: 299:
300: $this->spinWait(function ($driver) {
301: $driver->assertElementHasText("#p3554_1250 .sched_appointment", "Primary Insurance, Selenium");
302: return true;
303: });
304:
305:
306: $this->clickElement("#finish_sched");
307:
308:
309: $scheduler->scrollTo("1130");
310: $this->clickElement("#p3554_1150 .sched_appointment");
311: $this->waitForAjax();
312:
313: 314: 315: 316: 317:
318: $popup = $scheduler->appointmentPopup->verifyAndWait();
319: $popup->assertInputHasValue("apt_are_id", 6628);
320:
321:
322: $popup->select("apt_ast_id", 7);
323:
324: $app->popup->last()->press("Submit");
325: $this->waitForAjax();
326:
327:
328: $scheduler->scrollTo("1230");
329: $this->clickElement("#p3554_1250 .sched_appointment");
330: $this->waitForAjax();
331:
332: 333: 334: 335: 336:
337: $popup = $scheduler->appointmentPopup->verifyAndWait();
338: $popup->assertInputHasValue("apt_are_id", 6628);
339:
340:
341: $popup->select("apt_ast_id", 7);
342:
343: $app->popup->last()->press("Submit");
344: $this->waitForAjax();
345:
346: $this->assertNoErrorPopups();
347: }
348: }
349:
350: ?>