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 PatientDocumentsTest extends ApplicationTestCase
8: {
9: 10: 11: 12: 13: 14:
15: public function testCanAddEditRemovePatientDocuments()
16: {
17: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
18:
19:
20: $patientView = $app->patients->open(Patients::PATIENT_DOCUMENTS_UPLOAD_TEST);
21:
22:
23: $patientDocs = $patientView->documents->navigate()->verifyAndWait();
24:
25:
26: $this->waitForAjax();
27: $app->popup->closeAll();
28:
29:
30: $patientDocs->controls->press("Upload");
31:
32: 33: 34: 35:
36: $patientDocs->popups->upload->verifyAndWait();
37:
38:
39: $filebox = $patientDocs->popups->upload->getInputElement("file_upload");
40: $this->sendKeys($filebox, TEST_BASE_PATH."/data/documents/pdf-example-lab-order.pdf");
41:
42:
43: $patientDocs->popups->upload->setInput("pi_name", "PDF Sample");
44:
45:
46: $patientDocs->popups->upload->select("pi_pic_id", 7);
47:
48:
49: $app->popup->last()->press("Upload");
50: $this->waitForAjax();
51:
52: 53: 54: 55:
56: $this->spinWait(function () use ($patientDocs) {
57: $patientDocs->grid->assertCanSee("PDF Sample");
58: $patientDocs->grid->assertCanSee("Clinical Doc");
59: $patientDocs->grid->assertCanSee(date("m/d/Y"));
60: return true;
61: });
62:
63:
64: $patientDocs->grid->first()->querySelector('[data-button-class="document_view"]')->click();
65: $this->waitForAjax();
66:
67: 68: 69: 70:
71: $patientDocs->popups->view->verifyAndWait();
72: $patientDocs->popups->view->assertCanSee("PDF Sample");
73: $this->assertNoErrorPopups();
74:
75:
76: $this->querySelector("#btn_document_popup_close")->click();
77:
78:
79: $patientDocs->grid->first()->querySelector('[data-button-class="document_edit"]')->click();
80: $this->waitForAjax();
81:
82: 83: 84: 85:
86: $patientDocs->popups->edit->verifyAndWait();
87:
88:
89: $patientDocs->popups->edit->setInput("pi_name", "Edited Name");
90:
91:
92: $app->popup->last()->press("Save");
93:
94: 95: 96: 97:
98: $this->spinWait(function () use ($patientDocs) {
99: $patientDocs->grid->assertCanSee("Edited Name");
100: return true;
101: });
102:
103:
104: $patientDocs->grid->first()->querySelector('[data-button-class="document_delete"]')->click();
105:
106: $this->waitForAjax();
107: $app->popup->confirmYes();
108:
109: 110: 111: 112:
113: $this->spinWait(function () use ($patientDocs) {
114: $patientDocs->grid->assertCanNotSee("Edited Name");
115: return true;
116: });
117: }
118:
119: 120: 121: 122: 123: 124:
125: public function testCanFilterPatientDocumentsByLabels()
126: {
127: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
128:
129:
130: $patientView = $app->patients->open(Patients::PATIENT_DOCUMENTS_LABELS_TEST);
131:
132:
133: $patientDocs = $patientView->documents->navigate()->verifyAndWait();
134:
135:
136: $this->waitForAjax();
137: $app->popup->closeAll();
138:
139: 140: 141: 142: 143:
144: $patientDocs->grid->waitForRowCount(3);
145: $patientDocs->grid->assertCanSee("Legal");
146: $patientDocs->grid->assertCanSee("Labs");
147: $patientDocs->grid->assertCanSee("Education");
148:
149:
150: $patientDocs->controls->check(
151: $patientDocs->controls->showLabelsCheckbox
152: );
153:
154: 155: 156: 157: 158: 159: 160:
161: $patientDocs->sidebar->labels->verifyAndWait();
162: $patientDocs->sidebar->labels->assertCanSee("Education (1)");
163: $patientDocs->sidebar->labels->assertCanSee("Labs (1)");
164: $patientDocs->sidebar->labels->assertCanSee("Legal (1)");
165:
166:
167: $patientDocs->sidebar->labels->querySelector('[data-model-id="2"]')->click();
168:
169: 170: 171: 172:
173: $this->spinWait(function () use ($patientDocs) {
174: $patientDocs->grid->assertCanNotSee("Legal");
175: $patientDocs->grid->assertCanNotSee("Labs");
176: $patientDocs->grid->assertCanSee("Education");
177: return true;
178: });
179:
180:
181: $patientDocs->sidebar->labels->querySelector('[data-model-id="1"]')->click();
182:
183: 184: 185: 186:
187: $this->spinWait(function () use ($patientDocs) {
188: $patientDocs->grid->assertCanNotSee("Legal");
189: $patientDocs->grid->assertCanSee("Labs");
190: $patientDocs->grid->assertCanNotSee("Education");
191: return true;
192: });
193:
194:
195: $patientDocs->sidebar->labels->querySelector('[data-model-id="3"]')->click();
196:
197: 198: 199: 200:
201: $this->spinWait(function () use ($patientDocs) {
202: $patientDocs->grid->assertCanSee("Legal");
203: $patientDocs->grid->assertCanNotSee("Labs");
204: $patientDocs->grid->assertCanNotSee("Education");
205: return true;
206: });
207:
208:
209: $patientDocs->sidebar->labels->click("All Labels");
210:
211: 212: 213: 214:
215: $this->spinWait(function () use ($patientDocs) {
216: $patientDocs->grid->assertCanSee("Legal");
217: $patientDocs->grid->assertCanSee("Labs");
218: $patientDocs->grid->assertCanSee("Education");
219: return true;
220: });
221: }
222: }
223:
224: ?>