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 ChartAssessmentTest 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 testCanEditAssessmentNotesField()
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->assessment->editAssessmentNotes();
28: $this->keys("This is some text.");
29:
30: $chartView->assessment->notes->assertCanSee("This is some text.");
31:
32:
33: $chartView->assessment->cancelAssessmentNotes();
34:
35: 36: 37: 38:
39: $this->spinWait(function () use ($chartView) {
40: $chartView->assessment->notes->assertCanNotSee("This is some text.");
41: return true;
42: });
43:
44: $this->wait(1);
45:
46:
47: $chartView->assessment->editAssessmentNotes();
48: $this->keys("This is some more text.");
49:
50: $chartView->assessment->notes->assertCanSee("This is some more text.");
51:
52:
53: $chartView->assessment->saveAssessmentNotes();
54:
55: 56: 57: 58:
59: $this->spinWait(function () use ($chartView) {
60: $chartView->assessment->notes->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->assessment->notes->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 testAddEditRemoveCustomFields()
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: $this->waitFor(".chart-controls-edit #btn_jump_ass")->click();
96:
97:
98: $buttons = $chartView->assessment->fields->getButtons("Remove");
99: foreach ($buttons as $button) {
100: $button->click();
101: }
102:
103:
104:
105: $chartView->assessment->addAssessmentField();
106:
107: $chartView->popups->fields->verifyAndWait();
108: $chartView->popups->fields->grid->waitForRowAt(0);
109:
110:
111: $chartView->popups->fields->type("autoselect_search", "Assessment Text Field");
112: $chartView->popups->fields->grid->waitForRowTextAt(0, "Assessment Text Field");
113:
114:
115: $chartView->popups->fields->grid->waitForRowAt(0)->click();
116:
117: 118: 119: 120:
121:
122: $this->spinWait(function () use ($chartView) {
123: $chartView->assessment->fields->assertCanSee("Assessment Text Field");
124: $chartView->assessment->fields->assertElementExists(".charts-HTMLInputView");
125: return true;
126: });
127:
128:
129: $chartView->assessment->fields->press("Edit");
130:
131: 132: 133: 134:
135: $this->spinWait(function () use ($chartView) {
136: $chartView->assessment->fields->assertElementVisible(".charts-HTMLInputView > .editing");
137: return true;
138: });
139:
140:
141: $chartView->assessment->fields->press("Cancel");
142:
143:
144: $chartView->assessment->fields->press("Remove");
145:
146: $app->popup->confirmYes();
147:
148: 149: 150: 151:
152:
153: $this->spinWait(function () use ($chartView) {
154: $chartView->assessment->fields->assertCanNotSee("Assessment Text Field");
155: return true;
156: });
157:
158:
159:
160:
161: $chartView->assessment->addAssessmentField();
162:
163: $chartView->popups->fields->verifyAndWait();
164: $chartView->popups->fields->grid->waitForRowAt(0);
165:
166:
167: $chartView->popups->fields->type("autoselect_search", "Assessment Form Field");
168: $chartView->popups->fields->grid->waitForRowTextAt(0, "Assessment Form Field");
169:
170:
171: $chartView->popups->fields->grid->waitForRowAt(0)->click();
172:
173: 174: 175: 176:
177:
178: $this->spinWait(function () use ($chartView) {
179: $chartView->assessment->fields->assertCanSee("Assessment Form Field");
180: $chartView->assessment->fields->assertElementExists(".charts-FormInputView");
181: return true;
182: });
183:
184:
185: $chartView->assessment->fields->press("Edit");
186:
187: 188: 189: 190:
191:
192:
193: $this->assertNoErrorPopups();
194:
195:
196: $chartView->assessment->fields->press("Cancel");
197: $this->waitForAjax();
198:
199:
200: $chartView->assessment->fields->press("Remove");
201:
202: $app->popup->confirmYes();
203:
204: 205: 206: 207:
208:
209: $this->spinWait(function () use ($chartView) {
210: $chartView->assessment->fields->assertCanNotSee("Assessment Form Field");
211: return true;
212: });
213:
214:
215:
216:
217: $chartView->cancel();
218:
219: $this->assertNoErrorPopups();
220: }
221: }
222:
223: ?>