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 ChartSubjectiveTest 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 testCanEditHPI()
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->subjective->editHPI();
28: $this->keys("This is some text.");
29:
30: $chartView->subjective->hpi->assertCanSee("This is some text.");
31:
32:
33: $chartView->subjective->cancelHPI();
34:
35: 36: 37: 38:
39: $this->spinWait(function () use ($chartView) {
40: $chartView->subjective->hpi->assertCanNotSee("This is some text.");
41: return true;
42: });
43:
44: $this->wait(1);
45:
46:
47: $chartView->subjective->editHPI();
48: $this->keys("This is some more text.");
49:
50: $chartView->subjective->hpi->assertCanSee("This is some more text.");
51:
52:
53: $chartView->subjective->saveHPI();
54:
55: 56: 57: 58:
59: $this->spinWait(function () use ($chartView) {
60: $chartView->subjective->hpi->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->subjective->hpi->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: public function testAddEditRemoveImageAnnotation()
88: {
89: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
90:
91:
92: $chartView = $app->patients->get(Patients::CAMILA_FISHER_ID)->charts->navigate()->addChart();
93:
94:
95: $chartView->subjective->addImageAnnotation();
96:
97: $chartView->popups->images->verifyAndWait();
98: $chartView->popups->images->grid->waitForRowAt(0);
99:
100:
101: $chartView->popups->images->type("autoselect_search", "Body Diagrams");
102: $this->spinWait(function () use ($chartView) {
103: return $chartView->popups->images->grid->see("Body Diagrams");
104: });
105:
106:
107: $chartView->popups->images->grid->waitForRowAt(0)->click();
108:
109: 110: 111: 112:
113:
114: $this->spinWait(function () use ($chartView) {
115: $chartView->subjective->images->assertCanSee("Body Diagrams");
116: $chartView->subjective->images->assertElementExists("canvas");
117: return true;
118: });
119:
120:
121: $chartView->subjective->images->press("Edit");
122:
123: 124: 125: 126:
127: $this->spinWait(function ($driver) use ($chartView) {
128: $chartView->subjective->images->assertElementVisible("#canvas_controls");
129: return true;
130: });
131:
132:
133: $chartView->subjective->images->press("Cancel");
134:
135:
136: $chartView->subjective->images->press("Remove");
137:
138: $app->popup->confirmYes();
139:
140: 141: 142: 143:
144:
145: $this->spinWait(function () use ($chartView) {
146: $chartView->subjective->images->assertCanNotSee("Body Diagrams");
147: $chartView->subjective->images->assertElementNotExists("canvas");
148: return true;
149: });
150:
151:
152: $chartView->cancel();
153:
154: $this->assertNoErrorPopups();
155: }
156:
157: 158: 159: 160: 161:
162: public function testAddEditRemoveCustomFields()
163: {
164: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
165:
166:
167: $chartView = $app->patients->get(Patients::CAMILA_FISHER_ID)->charts->navigate()->addChart();
168:
169:
170: $chartView->subjective->removeAllCustomFields($app);
171:
172:
173:
174: $chartView->subjective->addSubjectiveField();
175:
176: $chartView->popups->fields->verifyAndWait();
177: $chartView->popups->fields->grid->waitForRowAt(0);
178:
179:
180: $chartView->popups->fields->type("autoselect_search", "Subjective Text Field");
181: $chartView->popups->fields->grid->waitForRowTextAt(0, "Subjective Text Field");
182:
183:
184: $chartView->popups->fields->grid->waitForRowAt(0)->click();
185:
186: 187: 188: 189:
190:
191: $this->spinWait(function () use ($chartView) {
192: $chartView->subjective->fields->assertCanSee("Subjective Text Field");
193: $chartView->subjective->fields->assertElementExists(".charts-HTMLInputView");
194: return true;
195: });
196:
197:
198: $chartView->subjective->fields->press("Edit");
199:
200: 201: 202: 203:
204: $chartView->subjective->fields->assertElementVisible(".charts-HTMLInputView > .editing");
205:
206:
207: $chartView->subjective->fields->press("Cancel");
208:
209:
210: $chartView->subjective->fields->press("Remove");
211:
212: $app->popup->confirmYes();
213:
214: 215: 216: 217:
218:
219: $this->spinWait(function () use ($chartView) {
220: $chartView->subjective->fields->assertCanNotSee("Subjective Text Field");
221: return true;
222: });
223:
224:
225:
226:
227: $chartView->subjective->addSubjectiveField();
228:
229: $chartView->popups->fields->verifyAndWait();
230: $chartView->popups->fields->grid->waitForRowAt(0);
231:
232:
233: $chartView->popups->fields->type("autoselect_search", "Subjective Form Field");
234: $chartView->popups->fields->grid->waitForRowTextAt(0, "Subjective Form Field");
235:
236:
237: $chartView->popups->fields->grid->waitForRowAt(0)->click();
238:
239: 240: 241: 242:
243:
244: $this->spinWait(function () use ($chartView) {
245: $chartView->subjective->fields->assertCanSee("Subjective Form Field");
246: $chartView->subjective->fields->assertElementExists(".charts-FormInputView");
247: return true;
248: });
249:
250: $this->wait(10);
251:
252: $chartView->subjective->fields->press("Edit");
253:
254: 255: 256: 257:
258:
259:
260: $this->assertNoErrorPopups();
261:
262:
263: $chartView->subjective->fields->press("Cancel");
264: $this->waitForAjax();
265:
266:
267: $chartView->subjective->fields->press("Remove");
268:
269: $app->popup->confirmYes();
270:
271: 272: 273: 274:
275:
276: $this->spinWait(function () use ($chartView) {
277: $chartView->subjective->fields->assertCanNotSee("Subjective Form Field");
278: return true;
279: });
280:
281:
282:
283:
284: $chartView->cancel();
285:
286: $this->assertNoErrorPopups();
287: }
288: }
289:
290: ?>