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\Providers;
6: use Azalea\Selenium\App\Users;
7:
8: class PatientsListProviderAccessTest extends ApplicationTestCase
9: {
10: public function supportsCustomer($cus_id)
11: {
12:
13: return (Customers::isEhrCustomer($cus_id));
14: }
15:
16: 17: 18: 19: 20: 21:
22: public function testAdminWithAccessToAllProviders()
23: {
24: $app = $this->login(Users::RUTH_BELL, Users::PASSWORD);
25:
26:
27: $app->patients->navigate()->verifyAndWait();
28: $patientsList = $app->patients->list;
29: $this->waitForAjax();
30:
31: 32: 33: 34:
35: $this->spinWait(function () use ($patientsList) {
36: $this->assertEquals(10, $patientsList->grid->count());
37: return true;
38: });
39:
40:
41: $app->patients->search->searchFor("Clement Bradtke");
42:
43: 44: 45: 46:
47: $app->patients->list->grid->waitForModelId(265891);
48:
49:
50: $this->resetPatientFilters($app);
51:
52:
53: $app->patients->search->searchFor("Rashawn Crist");
54:
55: 56: 57: 58:
59: $app->patients->list->grid->waitForModelId(265900);
60:
61:
62: $this->resetPatientFilters($app);
63:
64:
65: $app->patients->search->searchFor("Pearline Gottlieb");
66:
67: 68: 69: 70:
71: $app->patients->list->grid->waitForModelId(265896);
72:
73:
74: $this->resetPatientFilters($app);
75:
76:
77: $app->patients->search->searchFor("Agnes Schimmel");
78:
79: 80: 81: 82:
83: $app->patients->list->grid->waitForModelId(265892);
84:
85:
86: $this->resetPatientFilters($app);
87:
88: $this->assertNoErrorPopups();
89: }
90:
91: 92: 93: 94: 95: 96:
97: public function testUserWithAccessToOneProvider()
98: {
99: $app = $this->login(Users::THEO_FIFIELD, Users::PASSWORD);
100:
101:
102: $app->patients->navigate()->verifyAndWait();
103: $patientsList = $app->patients->list;
104: $this->waitForAjax();
105:
106: 107: 108: 109: 110:
111: $this->spinWait(function () use ($patientsList) {
112: $this->assertEquals(5, $patientsList->grid->count());
113: $patientsList->grid->assertCanSee("Berry Carter");
114: $patientsList->grid->assertCanNotSee("Lacey McClure");
115: $patientsList->grid->assertCanNotSee("Cordelia Wolff");
116: $patientsList->grid->assertCanNotSee("Roma Wilkinson");
117: return true;
118: });
119:
120:
121: $app->patients->search->searchFor("Crist, Rashawn");
122:
123: 124: 125: 126:
127: $app->patients->list->grid->waitForModelId(265900);
128:
129:
130: $this->resetPatientFilters($app);
131:
132:
133: $app->patients->search->searchFor("Agnes Schimmel");
134:
135: 136: 137: 138:
139: $app->patients->list->grid->waitForRowCount(0);
140:
141:
142: $this->resetPatientFilters($app);
143:
144:
145: $app->patients->search->searchFor("Patience Jaskolski");
146:
147: 148: 149: 150:
151: $app->patients->list->grid->waitForRowCount(0);
152:
153:
154: $this->resetPatientFilters($app);
155:
156:
157: $app->patients->search->searchFor("Pearline Gottlieb");
158:
159: 160: 161: 162:
163: $app->patients->list->grid->waitForRowCount(0);
164:
165:
166: $this->resetPatientFilters($app);
167:
168:
169: $app->patients->search->searchFor("Clement Bradtke");
170:
171: 172: 173: 174:
175: $app->patients->list->grid->waitForRowCount(0);
176:
177:
178: $this->resetPatientFilters($app);
179:
180:
181: $app->patients->list->filters->byRenderingProvider(3567)->go();
182:
183: 184: 185: 186: 187:
188: $this->spinWait(function () use ($patientsList) {
189: $this->assertEquals(5, $patientsList->grid->count());
190: $patientsList->grid->assertCanSee("Berry Carter");
191: $patientsList->grid->assertCanNotSee("Lacey McClure");
192: $patientsList->grid->assertCanNotSee("Cordelia Wolff");
193: $patientsList->grid->assertCanNotSee("Roma Wilkinson");
194: return true;
195: });
196:
197: $this->assertNoErrorPopups();
198: }
199:
200: 201: 202: 203: 204: 205:
206: public function testUserWithAccessToMultipleProviders()
207: {
208: $app = $this->login(Users::KATHERINE_IZZO, Users::PASSWORD);
209:
210:
211: $app->patients->navigate()->verifyAndWait();
212: $patientsList = $app->patients->list;
213: $this->waitForAjax();
214:
215: 216: 217: 218: 219: 220:
221: $this->spinWait(function () use ($patientsList) {
222: $this->assertEquals(3, $patientsList->grid->count());
223: $patientsList->grid->assertCanNotSee("Berry Carter");
224: $patientsList->grid->assertCanNotSee("Lacey McClure");
225: $patientsList->grid->assertCanSee("Cordelia Wolff");
226: $patientsList->grid->assertCanSee("Roma Wilkinson");
227: return true;
228: });
229:
230:
231: $app->patients->search->searchFor("Pearline Gottlieb");
232:
233: 234: 235: 236:
237: $app->patients->list->grid->waitForModelId(265896);
238:
239:
240: $this->resetPatientFilters($app);
241:
242:
243:
244: $app->patients->search->searchFor("Agnes Schimmel");
245:
246: 247: 248: 249:
250: $app->patients->list->grid->waitForModelId(265892);
251:
252:
253: $this->resetPatientFilters($app);
254:
255:
256: $app->patients->search->searchFor("Clement Bradtke");
257:
258: 259: 260: 261:
262: $app->patients->list->grid->waitForRowCount(0);
263:
264:
265: $this->resetPatientFilters($app);
266:
267:
268: $app->patients->search->searchFor("Rashawn Crist");
269:
270: 271: 272: 273:
274: $app->patients->list->grid->waitForRowCount(0);
275:
276:
277: $this->resetPatientFilters($app);
278:
279:
280: $app->patients->list->filters->byRenderingProvider(3568)->go();
281:
282: 283: 284: 285: 286:
287: $this->spinWait(function () use ($patientsList) {
288: $this->assertEquals(2, $patientsList->grid->count());
289: $patientsList->grid->assertCanNotSee("Berry Carter");
290: $patientsList->grid->assertCanNotSee("Lacey McClure");
291: $patientsList->grid->assertCanNotSee("Cordelia Wolff");
292: $patientsList->grid->assertCanSee("Roma Wilkinson");
293: return true;
294: });
295:
296:
297: $app->patients->list->filters->byRenderingProvider(3570)->go();
298:
299: 300: 301: 302: 303:
304: $this->spinWait(function () use ($patientsList) {
305: $this->assertEquals(1, $patientsList->grid->count());
306: $patientsList->grid->assertCanNotSee("Berry Carter");
307: $patientsList->grid->assertCanNotSee("Lacey McClure");
308: $patientsList->grid->assertCanSee("Cordelia Wolff");
309: $patientsList->grid->assertCanNotSee("Roma Wilkinson");
310: return true;
311: });
312:
313: $this->assertNoErrorPopups();
314: }
315:
316: 317: 318:
319: protected function resetPatientFilters($app)
320: {
321:
322: $app->patients->list->filters->reset();
323: $this->spinWait(function() use ($app) {
324: return ($app->patients->list->grid->count() > 1);
325: });
326: }
327: }
328:
329: ?>