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 ChartSigningTest 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 testCanSignChart()
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->sign();
28: $chartView->clearCache();
29:
30: 31: 32: 33: 34:
35: $this->spinWait(function ($driver) use ($chartView) {
36: $chartView->filter('[data-key="signature.top"]')->assertCanSee("Signed by: FELIX MILLER");
37: $chartView->filter('[data-key="signature.bottom"]')->assertCanSee("FELIX MILLER");
38: $driver->assertFalse($chartView->canSign());
39: return true;
40: });
41:
42: $this->assertNoErrorPopups();
43: }
44:
45: 46: 47: 48:
49: public function testCanCancelSignedChart()
50: {
51: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
52:
53:
54: $patientView = $app->patients->get(Patients::MABLE_D_CARROLL);
55: $chartView = $patientView->charts->navigate()->addChart();
56:
57:
58: $chartView->sign();
59: $chartView->clearCache();
60:
61: 62: 63: 64:
65: $this->spinWait(function ($driver) use ($chartView) {
66: $driver->assertFalse($chartView->canSign());
67: return true;
68: });
69:
70:
71: $this->getFirstVisible("#enc_more_actions")->click();
72: $this->getFirstVisible(".encounter-action-cancel > a")->click();
73:
74: 75: 76: 77: 78:
79: $app->popup->last()->assertCanSee("This chart is signed. To cancel this chart please amend it first. Please note that charts with associated payments or charges cannot be canceled.");
80:
81:
82: $app->popup->last()->press("OK");
83:
84:
85: $this->assertTrue($chartView->canAmend());
86: $chartView->amend();
87:
88:
89: $this->getFirstVisible("#enc_more_actions")->click();
90: $this->getFirstVisible(".encounter-action-cancel > a")->click();
91:
92: 93: 94: 95:
96: $this->spinWait(function ($driver) use ($app) {
97: $app->popup->confirmIsVisible();
98: return true;
99: });
100:
101:
102: $app->popup->confirmYes();
103: $this->waitForAjax();
104:
105: 106: 107: 108:
109: $selector = $chartView->getRoot();
110:
111: $this->assertElementNotExists($selector);
112:
113: $this->assertNoErrorPopups();
114: }
115: }
116:
117: ?>