forked from openemr/openemr
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
92791a5
commit 1530593
Showing
9 changed files
with
164 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,11 @@ | |
/** | ||
* CheckUserMenuLinksTest class | ||
* | ||
* @package OpenEMR | ||
* @link https://www.open-emr.org | ||
* @author Brady Miller <[email protected]> | ||
* @package OpenEMR | ||
* @link https://www.open-emr.org | ||
* @author Brady Miller <[email protected]> | ||
* @copyright Copyright (c) 2024 Brady Miller <[email protected]> | ||
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 | ||
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,5 +28,4 @@ class CreatePatientTest extends PantherTestCase | |
|
||
protected $client; | ||
protected $crawler; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,11 @@ | |
/** | ||
* LoginTrait trait | ||
* | ||
* @package OpenEMR | ||
* @link https://www.open-emr.org | ||
* @author Brady Miller <[email protected]> | ||
* @package OpenEMR | ||
* @link https://www.open-emr.org | ||
* @author Brady Miller <[email protected]> | ||
* @copyright Copyright (c) 2024 Brady Miller <[email protected]> | ||
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 | ||
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
/** | ||
* OpenPatientTest class | ||
* | ||
* @package OpenEMR | ||
* @link https://www.open-emr.org | ||
* @author Brady Miller <[email protected]> | ||
* @copyright Copyright (c) 2024 Brady Miller <[email protected]> | ||
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenEMR\Tests\E2e; | ||
|
||
use OpenEMR\Tests\E2e\Base\BaseTrait; | ||
use OpenEMR\Tests\E2e\Login\LoginTrait; | ||
use OpenEMR\Tests\E2e\Patient\PatientOpenTrait; | ||
use Symfony\Component\Panther\PantherTestCase; | ||
use Symfony\Component\Panther\Client; | ||
|
||
class OpenPatientTest extends PantherTestCase | ||
{ | ||
use BaseTrait; | ||
use LoginTrait; | ||
use PatientOpenTrait; | ||
|
||
protected $client; | ||
protected $crawler; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?php | ||
|
||
/** | ||
* PatientOpenTrait | ||
* | ||
* @package OpenEMR | ||
* @link https://www.open-emr.org | ||
* @author Brady Miller <[email protected]> | ||
* @copyright Copyright (c) 2024 Brady Miller <[email protected]> | ||
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenEMR\Tests\E2e\Patient; | ||
|
||
use OpenEMR\Tests\E2e\Base\BaseTrait; | ||
use OpenEMR\Tests\E2e\Login\LoginTrait; | ||
use OpenEMR\Tests\E2e\Patient\PatientAddTrait; | ||
use OpenEMR\Tests\E2e\Xpaths\XpathsConstants; | ||
use OpenEMR\Tests\E2e\Xpaths\XpathsConstantsPatientOpenTrait; | ||
|
||
trait PatientOpenTrait | ||
{ | ||
use BaseTrait; | ||
use LoginTrait; | ||
use PatientAddTrait; | ||
|
||
/** | ||
* @depends testLoginAuthorized | ||
*/ | ||
public function testPatientOpen(): void | ||
{ | ||
$this->base(); | ||
try { | ||
$this->patientOpenIfExist('Ftest', 'Ltest', '1968-06-01', 'Male'); | ||
} catch (\Throwable $e) { | ||
// Close client | ||
$this->client->quit(); | ||
// re-throw the exception | ||
throw $e; | ||
} | ||
// Close client | ||
$this->client->quit(); | ||
} | ||
|
||
protected function PatientOpenIfExist(string $firstname, string $lastname, string $dob, string $sex): void | ||
{ | ||
// if patient does not already exists, then fail | ||
if (!$this->isPatientExist($firstname, $lastname, $dob, $sex)) { | ||
$this->fail('Patient does not exist so FAIL'); | ||
} | ||
|
||
// login | ||
$this->login('admin', 'pass'); | ||
|
||
// search for last name via anySearchBox | ||
$this->client->waitFor(XpathsConstantsPatientOpenTrait::ANYSEARCHBOX_FORM_PATIENTOPEN_TRAIT); | ||
$this->crawler = $this->client->refreshCrawler(); | ||
$searchForm = $this->crawler->filterXPath(XpathsConstantsPatientOpenTrait::ANYSEARCHBOX_FORM_PATIENTOPEN_TRAIT)->form(); | ||
$searchForm['anySearchBox'] = $lastname; | ||
$this->client->waitFor(XpathsConstantsPatientOpenTrait::ANYSEARCHBOX_CLICK_PATIENTOPEN_TRAIT); | ||
$this->crawler = $this->client->refreshCrawler(); | ||
$this->crawler->filterXPath(XpathsConstantsPatientOpenTrait::ANYSEARCHBOX_CLICK_PATIENTOPEN_TRAIT)->click(); | ||
|
||
// click on the name in the patient list | ||
$this->client->waitFor(XpathsConstants::PATIENT_FINDER_IFRAME); | ||
$this->switchToIFrame(XpathsConstants::PATIENT_FINDER_IFRAME); | ||
$this->client->waitFor('//a[text()="' . $lastname . ", " . $firstname . '"]'); | ||
$this->crawler = $this->client->refreshCrawler(); | ||
$this->crawler->filterXPath('//a[text()="' . $lastname . ", " . $firstname . '"]')->click(); | ||
|
||
// ensure the patient summary screen is shown | ||
$this->client->switchTo()->defaultContent(); | ||
$this->client->waitFor(XpathsConstants::PATIENT_IFRAME); | ||
$this->switchToIFrame(XpathsConstants::PATIENT_IFRAME); | ||
// below line will timeout if did not go to the patient summary screen for the opened patient | ||
$this->client->waitFor('//*[text()="Medical Record Dashboard - ' . $firstname . " " . $lastname . '"]'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,11 @@ | |
/** | ||
* XpathsConstants class | ||
* | ||
* @package OpenEMR | ||
* @link https://www.open-emr.org | ||
* @author Brady Miller <[email protected]> | ||
* @package OpenEMR | ||
* @link https://www.open-emr.org | ||
* @author Brady Miller <[email protected]> | ||
* @copyright Copyright (c) 2024 Brady Miller <[email protected]> | ||
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 | ||
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
@@ -25,4 +25,6 @@ class XpathsConstants | |
public const ADMIN_IFRAME = "//*[@id='framesDisplay']//iframe[@name='adm']"; | ||
|
||
public const PATIENT_IFRAME = "//*[@id='framesDisplay']//iframe[@name='pat']"; | ||
|
||
public const PATIENT_FINDER_IFRAME = "//*[@id='framesDisplay']//iframe[@name='fin']"; | ||
} |
27 changes: 27 additions & 0 deletions
27
tests/Tests/E2e/Xpaths/XpathsConstantsPatientOpenTrait.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
/** | ||
* XpathsConstantsPatientOpenTrait class | ||
* | ||
* | ||
* TODO when no longer supporting PHP 8.1 | ||
* THIS class is needed since unable to add constants directly to the PatientOpenTrait in PHP 8.1 | ||
* | ||
* | ||
* @package OpenEMR | ||
* @link https://www.open-emr.org | ||
* @author Brady Miller <[email protected]> | ||
* @copyright Copyright (c) 2024 Brady Miller <[email protected]> | ||
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenEMR\Tests\E2e\Xpaths; | ||
|
||
class XpathsConstantsPatientOpenTrait | ||
{ | ||
public const ANYSEARCHBOX_FORM_PATIENTOPEN_TRAIT = "//form[@name='frm_search_globals']"; | ||
|
||
public const ANYSEARCHBOX_CLICK_PATIENTOPEN_TRAIT = "//button[@id='search_globals']"; | ||
} |