From 2ee9c41d32772a5359958df804a9dec0d181c67a Mon Sep 17 00:00:00 2001 From: Alexander Purr <purr@ub.uni-leipzig.de> Date: Fri, 24 Feb 2023 16:55:54 +0100 Subject: [PATCH] refs #23384 [finc] adlr-test-getit-box: using data provider & data provider annotation * add getitbase trait ** data provider itself ** move rule set testing method here * adapt in test classes (TC 1 - TC 7) ** set constants (RECORDS, RULES) *** records just as record ID instead path ** add annotation for data provider ** use runGetItRecord from getitbase trait * shrink nested rules to simple rule set * move test method into GetitTestBaseTrait * force login while setUp if login method is implemented - for prof or student * implementation of test method within each getit test class is not needed any more * adjust TC 01-07 & TC 16-17 * selenium docker compose file: add extra host for connection vufind environment with selenium setup refs #23384 [finc] remove getit rules testing * part of GetitTestBaseTrait now --- .../finc/tests/selenium/docker-compose.yaml | 5 +- .../tests/selenium/tests/adlr/AdlrBase.php | 69 +---------- .../tests/adlr/Getit01DefaultTest.php | 73 ++++++------ .../tests/adlr/Getit01ProfessorTest.php | 10 +- .../tests/adlr/Getit01StudentTest.php | 13 +- .../tests/adlr/Getit02DefaultTest.php | 73 ++++++------ .../tests/adlr/Getit03DefaultTest.php | 65 +++++----- .../tests/adlr/Getit03ProfessorTest.php | 68 +++++------ .../tests/adlr/Getit03StudentTest.php | 11 +- .../tests/adlr/Getit04DefaultTest.php | 64 +++++----- .../tests/adlr/Getit04ProfessorTest.php | 48 +++----- .../tests/adlr/Getit04StudentTest.php | 11 +- .../tests/adlr/Getit05DefaultTest.php | 57 ++++----- .../tests/adlr/Getit05ProfessorTest.php | 12 +- .../tests/adlr/Getit05StudentTest.php | 13 +- .../tests/adlr/Getit06DefaultTest.php | 59 +++++----- .../tests/adlr/Getit06ProfessorTest.php | 15 +-- .../tests/adlr/Getit06StudentTest.php | 13 +- .../tests/adlr/Getit07DefaultTest.php | 59 +++++----- .../tests/adlr/Getit07ProfessorTest.php | 12 +- .../tests/adlr/Getit07StudentTest.php | 13 +- .../tests/adlr/Getit08DefaultTest.php | 57 ++++----- .../tests/adlr/Getit08ProfessorTest.php | 12 +- .../tests/adlr/Getit08StudentTest.php | 13 +- .../tests/adlr/Getit09DefaultTest.php | 43 +++---- .../tests/adlr/Getit09ProfessorTest.php | 12 +- .../tests/adlr/Getit09StudentTest.php | 13 +- .../tests/adlr/Getit10DefaultTest.php | 62 +++++----- .../tests/adlr/Getit10ProfessorTest.php | 47 +++----- .../tests/adlr/Getit10StudentTest.php | 13 +- .../tests/adlr/Getit11DefaultTest.php | 61 +++++----- .../tests/adlr/Getit11ProfessorTest.php | 12 +- .../tests/adlr/Getit11StudentTest.php | 13 +- .../tests/adlr/Getit12DefaultTest.php | 77 ++++++------ .../tests/adlr/Getit12ProfessorTest.php | 59 ++++------ .../tests/adlr/Getit12StudentTest.php | 13 +- .../tests/adlr/Getit13DefaultTest.php | 87 +++++++------- .../tests/adlr/Getit13ProfessorTest.php | 51 ++++---- .../tests/adlr/Getit13StudentTest.php | 13 +- .../tests/adlr/Getit14DefaultTest.php | 87 +++++++------- .../tests/adlr/Getit14ProfessorTest.php | 49 ++++---- .../tests/adlr/Getit14StudentTest.php | 13 +- .../tests/adlr/Getit15DefaultTest.php | 77 ++++++------ .../tests/adlr/Getit15ProfessorTest.php | 12 +- .../tests/adlr/Getit15StudentTest.php | 13 +- .../tests/adlr/Getit16DefaultTest.php | 57 ++++----- .../tests/adlr/Getit16ProfessorTest.php | 12 +- .../tests/adlr/Getit16StudentTest.php | 13 +- .../tests/adlr/Getit17DefaultTest.php | 71 ++++++----- .../tests/adlr/Getit17ProfessorTest.php | 12 +- .../tests/adlr/Getit17StudentTest.php | 13 +- .../tests/adlr/Getit18DefaultTest.php | 57 ++++----- .../tests/adlr/Getit18ProfessorTest.php | 12 +- .../tests/adlr/Getit18StudentTest.php | 13 +- .../tests/adlr/Getit19DefaultTest.php | 45 ++++--- .../tests/adlr/Getit19ProfessorTest.php | 12 +- .../tests/adlr/Getit19StudentTest.php | 13 +- .../tests/adlr/GetitTestBaseTrait.php | 111 ++++++++++++++++++ .../finc/tests/selenium/tests/adlr/Login.php | 4 +- 59 files changed, 965 insertions(+), 1152 deletions(-) create mode 100755 module/finc/tests/selenium/tests/adlr/GetitTestBaseTrait.php diff --git a/module/finc/tests/selenium/docker-compose.yaml b/module/finc/tests/selenium/docker-compose.yaml index cfd8a9ffc65..fc53c11bc8a 100755 --- a/module/finc/tests/selenium/docker-compose.yaml +++ b/module/finc/tests/selenium/docker-compose.yaml @@ -18,6 +18,8 @@ services: - SE_EVENT_BUS_HOST=selenium-hub - SE_EVENT_BUS_PUBLISH_PORT=4442 - SE_EVENT_BUS_SUBSCRIBE_PORT=4443 + extra_hosts: + - "host.docker.internal:10.111.0.1" firefox: image: selenium/node-firefox depends_on: @@ -26,7 +28,8 @@ services: - SE_EVENT_BUS_HOST=selenium-hub - SE_EVENT_BUS_PUBLISH_PORT=4442 - SE_EVENT_BUS_SUBSCRIBE_PORT=4443 - + extra_hosts: + - "host.docker.internal:10.111.0.1" php: image: php:7.3-fpm working_dir: /usr/local/vufind diff --git a/module/finc/tests/selenium/tests/adlr/AdlrBase.php b/module/finc/tests/selenium/tests/adlr/AdlrBase.php index 0339ebee0fb..76b7ad42489 100644 --- a/module/finc/tests/selenium/tests/adlr/AdlrBase.php +++ b/module/finc/tests/selenium/tests/adlr/AdlrBase.php @@ -1,18 +1,18 @@ <?php namespace Selenium\adlr; -use Facebook\WebDriver\WebDriverBy; -use Facebook\WebDriver\WebDriverExpectedCondition; use Lmc\Steward\ConfigProvider; use Lmc\Steward\Test\AbstractTestCase; class AdlrBase extends AbstractTestCase { public static $port = ''; + // public static $port = ':81'; /** @var string */ public static $host = 'https://staging.finc.info/vufind2/fid_adlr'; + // public static $baseUrl = 'http://host.docker.internal'; // public static $baseUrl = 'http://127.0.0.1'; // public static $baseUrl = 'http://localhost'; @@ -48,70 +48,6 @@ class AdlrBase extends AbstractTestCase } } - protected function runGetItTest($records = [], $rules = []): void - { - foreach ($records as $record) { - $this->log("object id of webdriver: " . spl_object_id($this->wd)); - $this->wd->get(self::$host . self::$port . $record); - $this->wd->takeScreenshot("logs/adlr/info{$record}" . ($this->user ? '-' . $this->user : '') . ".png"); - - foreach ($rules["desc"] ?? [] as $rule) { - if ($rule["waitForClass"]) { - $this->waitForClass($rule["waitForClass"], true); - } - if ($rule["waitForId"]) { - $this->waitForId($rule["waitForId"], true); - } - if ($rule["waitForLinkText"]) { - $this->waitForLinkText($rule["waitForLinkText"], true); - } - if ($rule["wait"]) { - try { - $this->wd->wait(5, 5000)->until( - WebDriverExpectedCondition::elementTextContains( - WebDriverBy::className($rule["wait"]), - $rule["text"] - ) - ); - } catch (\Facebook\WebDriver\Exception\NoSuchElementException $x) { - $this->log("Timeout for $record when fething {$rule["wait"]}."); - } - } - try { - $value = $this->findByCss($rule["path"])->getText(); - } catch (\Facebook\WebDriver\Exception\NoSuchElementException $x) { - $value = false; - } - switch ($rule["type"] ?? '') { - case 'text': - $this->assertEqualsIgnoringCase( - $rule["text"], - $value, - $rule["path"] . ($value === false ? " does not exists" : " is '" . $value . "' ") - . ", but should be '" . $rule["text"] . "'" - ); - break; - case 'contains': - $this->assertStringContainsStringIgnoringCase( - $rule["text"], - $value, - $record . ": " . - $rule["path"] . ($value === false ? " does not exists" : " is '" . $value . "' ") - . ", but should contain '" . $rule["text"] . "'" - ); - break; - case 'anti-exi': - $this->assertNotEqualsIgnoringCase( - $rule["text"], - $value, - $rule["path"] . " must not be equals to '" . $rule["text"] . "'" - ); - break; - } - } - } - } - #region helper methods protected function changeLanguage($lang = 'de') { @@ -135,5 +71,6 @@ class AdlrBase extends AbstractTestCase $this->changeLanguage(); parent::setUp(); } + #endregion } diff --git a/module/finc/tests/selenium/tests/adlr/Getit01DefaultTest.php b/module/finc/tests/selenium/tests/adlr/Getit01DefaultTest.php index 1f33b8ebf10..db4ebc98c57 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit01DefaultTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit01DefaultTest.php @@ -3,53 +3,56 @@ namespace Selenium\adlr; /** * @group adlr + * @group adlr-getit * @group adlr-getit-01 * @group adlr-getit-default */ class Getit01DefaultTest extends AdlrBase { + use GetitTestBaseTrait; + public const RECORDS = [ - "/Record/finc-87-14159", - "/Record/finc-88-694", - "/Record/finc-99-1482", - "/Record/finc-101-aHR0cDovL3d3dy5maWxtbXVzaWsudW5pLWtpZWwuZGUvS0IxNC9LQjE0LVZvcndvcnQucGRm", - "/Record/finc-150-10500", - "/Record/finc-153-bWFuLWluLXRoZS1hdHRpYy0xOTUzLXJlc3RvcmVkLW1vdmllLTcyMHAtaGQ", - "/Record/finc-170-12835", - "/Record/191-eunhj", - "/Record/196-1213742994", - "/Record/26-80811", - "/Record/ai-28-d2580a888c2d405983dd08b4cbf24560", - "/Record/finc-30-61040", - "/Record/finc-39-comin118937881985num731329", - "/Record/ai-53-757382", - "/Record/finc-80-6678", - "/Record/84-on1079058527" + "finc-87-14159", + "finc-88-694", + "finc-99-1482", + "finc-101-aHR0cDovL3d3dy5maWxtbXVzaWsudW5pLWtpZWwuZGUvS0IxNC9LQjE0LVZvcndvcnQucGRm", + "finc-150-10500", + "finc-153-bWFuLWluLXRoZS1hdHRpYy0xOTUzLXJlc3RvcmVkLW1vdmllLTcyMHAtaGQ", + "finc-170-12835", + "191-eunhj", + "196-1213742994", + "26-80811", + "ai-28-d2580a888c2d405983dd08b4cbf24560", + "finc-30-61040", + "finc-39-comin118937881985num731329", + "ai-53-757382", + "finc-80-6678", + "84-on1079058527" ]; public const RULES = [ - "test_case_id" => "01", - "desc" => [ - [ - "type" => "text", - "path" => ".getitbox-getit > h4", - "text" => "GET IT" - ], - [ - "type" => "text", - "path" => "#get-it-button", - "text" => "LINKS ZUR RESSOURCE" - ], - [ - "type" => "text", - "path" => ".getitbox-notices", - "text" => "Diese Ressource ist frei verfügbar." - ] + [ + "type" => "text", + "path" => ".getitbox-getit > h4", + "text" => "GET IT" + ], + [ + "type" => "text", + "path" => "#get-it-button", + "text" => "LINKS ZUR RESSOURCE" + ], + [ + "type" => "text", + "path" => ".getitbox-notices", + "text" => "Diese Ressource ist frei verfügbar." ] ]; - public function testGetItDefault01() + /** + * @dataProvider provideRecords + */ + public function testGetItDefault01($record) : void { - $this->runGetItTest(self::RECORDS, self::RULES); + $this->runGetItRecord($record); } } diff --git a/module/finc/tests/selenium/tests/adlr/Getit01ProfessorTest.php b/module/finc/tests/selenium/tests/adlr/Getit01ProfessorTest.php index bc4d95b2a89..8917b4ef705 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit01ProfessorTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit01ProfessorTest.php @@ -3,17 +3,15 @@ namespace Selenium\adlr; /** * @group adlr + * @group adlr-getit * @group adlr-getit-01 * @group adlr-getit-professor */ class Getit01ProfessorTest extends AdlrLoginBase { use ProfessorTrait; + use GetitTestBaseTrait; - public function testGetItProfessor01() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit01DefaultTest::RECORDS, Getit01DefaultTest::RULES); - } + public const RECORDS = Getit01DefaultTest::RECORDS; + public const RULES = Getit01DefaultTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit01StudentTest.php b/module/finc/tests/selenium/tests/adlr/Getit01StudentTest.php index 1687fe9abe6..9957af9a125 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit01StudentTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit01StudentTest.php @@ -1,20 +1,17 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** + * @group adlr + * @group adlr-getit * @group adlr-getit-01 * @group adlr-getit-student */ class Getit01StudentTest extends AdlrLoginBase { use StudentTrait; + use GetitTestBaseTrait; - public function testGetItStudent01() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit01DefaultTest::RECORDS, Getit01DefaultTest::RULES); - } + public const RECORDS = Getit01DefaultTest::RECORDS; + public const RULES = Getit01DefaultTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit02DefaultTest.php b/module/finc/tests/selenium/tests/adlr/Getit02DefaultTest.php index 7b42486e44f..ec1ce701648 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit02DefaultTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit02DefaultTest.php @@ -3,54 +3,49 @@ namespace Selenium\adlr; /** * @group adlr + * @group adlr-getit * @group adlr-getit-02 * @group adlr-getit-default */ class Getit02DefaultTest extends AdlrBase { + use GetitTestBaseTrait; + public const RECORDS = [ - "/Record/ai-49-aHR0cDovL2R4LmRvaS5vcmcvMTAuMTA4MC8xMDMwNDMxMi4yMDIxLjE5ODMyNTQ", - "/Record/ai-49-aHR0cDovL2R4LmRvaS5vcmcvMTAuMTA4MC8xNzQzOTg4NC4yMDIxLjE5MjI0Mzc", - "/Record/ai-55-aHR0cHM6Ly93d3cuanN0b3Iub3JnL3N0YWJsZS8xMC4yOTc5L2JsYWNrY2FtZXJhLjEwLjIuMTk", - "/Record/ai-55-aHR0cHM6Ly93d3cuanN0b3Iub3JnL3N0YWJsZS80MDQwNjAyMQ", - "/Record/ai-68-OLC1936107031", - "/Record/ai-68-OLC1852389117" + "ai-49-aHR0cDovL2R4LmRvaS5vcmcvMTAuMTA4MC8xMDMwNDMxMi4yMDIxLjE5ODMyNTQ", + "ai-49-aHR0cDovL2R4LmRvaS5vcmcvMTAuMTA4MC8xNzQzOTg4NC4yMDIxLjE5MjI0Mzc", + "ai-55-aHR0cHM6Ly93d3cuanN0b3Iub3JnL3N0YWJsZS8xMC4yOTc5L2JsYWNrY2FtZXJhLjEwLjIuMTk", + "ai-55-aHR0cHM6Ly93d3cuanN0b3Iub3JnL3N0YWJsZS80MDQwNjAyMQ", + "ai-68-OLC1936107031", + "ai-68-OLC1852389117" ]; public const RULES = [ - "test_case_id" => "02", - "desc" => [ - [ - "type" => "text", - "path" => ".getitbox-getit > h4", - "text" => "NICHT ANGEMELDET", - ], - [ - "type" => "text", - "path" => "#get-it-button", - "text" => "LINKS ZUR RESSOURCE", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => "Weitere Informationen sehen Sie, wenn Sie angemeldet sind.", - "waitForClass" => "openUrlPrint" - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => "Noch keinen Account?", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => "Jetzt registrieren", - ] + [ + "type" => "text", + "path" => ".getitbox-getit > h4", + "text" => "NICHT ANGEMELDET", + ], + [ + "type" => "text", + "path" => "#get-it-button", + "text" => "LINKS ZUR RESSOURCE", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => "Weitere Informationen sehen Sie, wenn Sie angemeldet sind.", + "waitForClass" => "openUrlPrint" + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => "Noch keinen Account?", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => "Jetzt registrieren", ] ]; - - public function testGetItDefault02() - { - $this->runGetItTest(self::RECORDS, self::RULES); - } } diff --git a/module/finc/tests/selenium/tests/adlr/Getit03DefaultTest.php b/module/finc/tests/selenium/tests/adlr/Getit03DefaultTest.php index 2f2df900956..751f71bc1be 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit03DefaultTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit03DefaultTest.php @@ -3,50 +3,45 @@ namespace Selenium\adlr; /** * @group adlr + * @group adlr-getit * @group adlr-getit-03 * @group adlr-getit-default */ class Getit03DefaultTest extends AdlrBase { + use GetitTestBaseTrait; + public const RECORDS = [ - "/Record/51-9783864881091", - "/Record/51-9781443890199", - "/Record/51-9783631784259", + "51-9783864881091", + "51-9781443890199", + "51-9783631784259", ]; public const RULES = [ - "test_case_id" => "03", - "desc" => [ - [ - "type" => "text", - "path" => ".getitbox-getit > h4", - "text" => "NICHT ANGEMELDET", - ], - [ - "type" => "text", - "path" => "#get-it-button", - "text" => "INFOS ZUR RESSOURCE", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => "Diese Neuerscheinung können Sie zur Leihe bestellen, wenn Sie angemeldet sind.", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => "Noch keinen Account?", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => "Jetzt registrieren", - ] + [ + "type" => "text", + "path" => ".getitbox-getit > h4", + "text" => "NICHT ANGEMELDET", + ], + [ + "type" => "text", + "path" => "#get-it-button", + "text" => "INFOS ZUR RESSOURCE", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => "Diese Neuerscheinung können Sie zur Leihe bestellen, wenn Sie angemeldet sind.", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => "Noch keinen Account?", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => "Jetzt registrieren", ] ]; - - public function testGetItDefault03() - { - $this->runGetItTest(self::RECORDS, self::RULES); - } } diff --git a/module/finc/tests/selenium/tests/adlr/Getit03ProfessorTest.php b/module/finc/tests/selenium/tests/adlr/Getit03ProfessorTest.php index f74cfc57b39..2fdcd9045c6 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit03ProfessorTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit03ProfessorTest.php @@ -3,55 +3,43 @@ namespace Selenium\adlr; /** * @group adlr + * @group adlr-getit * @group adlr-getit-03 * @group adlr-getit-professor */ class Getit03ProfessorTest extends AdlrLoginBase { use ProfessorTrait; + use GetitTestBaseTrait; - public const RECORDS = [ - "/Record/51-9783864881091", - "/Record/51-9781443890199", - "/Record/51-9783631784259", - ]; + public const RECORDS = Getit03DefaultTest::RECORDS; public const RULES = [ - "test_case_id" => "03L", - "desc" => [ - [ - "type" => "text", - "path" => ".getitbox-getit > h4", - "text" => "GET IT", - ], - [ - "type" => "text", - "path" => "#get-it-button", - "text" => "INFOS ZUR RESSOURCE", - ], - [ - "type" => "text", - "path" => ".full-order", - "text" => "KOSTENLOS BESTELLEN", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => - "Bestellen Sie ein Leihexemplar dieser Neuerscheinung auf Kosten von adlr.link. Das Buch wird direkt an Sie geschickt.", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => "Verfügbarkeit:", - ], + [ + "type" => "text", + "path" => ".getitbox-getit > h4", + "text" => "GET IT", + ], + [ + "type" => "text", + "path" => "#get-it-button", + "text" => "INFOS ZUR RESSOURCE", + ], + [ + "type" => "text", + "path" => ".full-order", + "text" => "KOSTENLOS BESTELLEN", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => + "Bestellen Sie ein Leihexemplar dieser Neuerscheinung auf Kosten von adlr.link. Das Buch wird direkt an Sie geschickt.", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => "Verfügbarkeit:", ], ]; - - public function testGetItProfessor03() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(self::RECORDS, self::RULES); - } } diff --git a/module/finc/tests/selenium/tests/adlr/Getit03StudentTest.php b/module/finc/tests/selenium/tests/adlr/Getit03StudentTest.php index 790395b527a..97813042e0d 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit03StudentTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit03StudentTest.php @@ -2,17 +2,16 @@ namespace Selenium\adlr; /** + * @group adlr + * @group adlr-getit * @group adlr-getit-03 * @group adlr-getit-student */ class Getit03StudentTest extends AdlrLoginBase { use StudentTrait; + use GetitTestBaseTrait; - public function testGetItStudent03() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit03ProfessorTest::RECORDS, Getit03ProfessorTest::RULES); - } + public const RECORDS = Getit03DefaultTest::RECORDS; + public const RULES = Getit03ProfessorTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit04DefaultTest.php b/module/finc/tests/selenium/tests/adlr/Getit04DefaultTest.php index cf2fa4454cb..c5ed865e0b5 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit04DefaultTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit04DefaultTest.php @@ -3,47 +3,45 @@ namespace Selenium\adlr; /** * @group adlr + * @group adlr-getit * @group adlr-getit-04 * @group adlr-getit-default */ class Getit04DefaultTest extends AdlrBase { + use GetitTestBaseTrait; + public const RECORDS = [ - "/Record/76-EBC5939400", - "/Record/76-EBC6915648", - "/Record/76-EBC6138849", + "76-EBC5939400", + "76-EBC6915648", + "76-EBC6138849", ]; public const RULES = [ - "test_case_id" => "04", - "desc" => [ - [ - "type" => "text", - "path" => ".getitbox-getit > h4", - "text" => "NICHT ANGEMELDET", - ], - ["type" => "anti-exi", "path" => "#get-it-button"], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => - "Sie müssen angemeldet sein, um Zugang zu diesem Titel zu erhalten.", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => "Noch keinen Account?", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => "Jetzt registrieren", - ], - ] + [ + "type" => "text", + "path" => ".getitbox-getit > h4", + "text" => "NICHT ANGEMELDET", + ], + [ + "type" => "anti-exi", + "path" => "#get-it-button", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => + "Sie müssen angemeldet sein, um Zugang zu diesem Titel zu erhalten.", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => "Noch keinen Account?", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => "Jetzt registrieren", + ], ]; - - public function testGetItDefault04() - { - $this->runGetItTest(self::RECORDS, self::RULES); - } } diff --git a/module/finc/tests/selenium/tests/adlr/Getit04ProfessorTest.php b/module/finc/tests/selenium/tests/adlr/Getit04ProfessorTest.php index f4afe9a83a0..5992c12a4e4 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit04ProfessorTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit04ProfessorTest.php @@ -3,45 +3,33 @@ namespace Selenium\adlr; /** * @group adlr + * @group adlr-getit * @group adlr-getit-04 * @group adlr-getit-professor */ class Getit04ProfessorTest extends AdlrLoginBase { use ProfessorTrait; + use GetitTestBaseTrait; - public const RECORDS = [ - "/Record/76-EBC5939400", - "/Record/76-EBC6915648", - "/Record/76-EBC6138849", - ]; + public const RECORDS = Getit04DefaultTest::RECORDS; public const RULES = [ - "test_case_id" => "04L", - "desc" => [ - [ - "type" => "text", - "path" => ".getitbox-getit > h4", - "text" => "GET IT", - ], - [ - "type" => "text", - "path" => "#get-it-button", - "text" => "LINKS ZUR RESSOURCE", - ], - [ - "type" => "text", - "path" => ".getitbox-notices", - "text" => - "Dieses E-Book ist für Sie über eine adlr.link-Lizenz freigeschaltet.", - ], + [ + "type" => "text", + "path" => ".getitbox-getit > h4", + "text" => "GET IT", + ], + [ + "type" => "text", + "path" => "#get-it-button", + "text" => "LINKS ZUR RESSOURCE", + ], + [ + "type" => "text", + "path" => ".getitbox-notices", + "text" => + "Dieses E-Book ist für Sie über eine adlr.link-Lizenz freigeschaltet.", ], ]; - - public function testGetItProfessor04() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(self::RECORDS, self::RULES); - } } diff --git a/module/finc/tests/selenium/tests/adlr/Getit04StudentTest.php b/module/finc/tests/selenium/tests/adlr/Getit04StudentTest.php index 0585fd201a1..3099dec3778 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit04StudentTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit04StudentTest.php @@ -2,17 +2,16 @@ namespace Selenium\adlr; /** + * @group adlr + * @group adlr-getit * @group adlr-getit-04 * @group adlr-getit-student */ class Getit04StudentTest extends AdlrLoginBase { use StudentTrait; + use GetitTestBaseTrait; - public function testGetItStudent04() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit04ProfessorTest::RECORDS, Getit04ProfessorTest::RULES); - } + public const RECORDS = Getit04DefaultTest::RECORDS; + public const RULES = Getit04ProfessorTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit05DefaultTest.php b/module/finc/tests/selenium/tests/adlr/Getit05DefaultTest.php index 4a69655b647..5545a21c699 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit05DefaultTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit05DefaultTest.php @@ -3,45 +3,40 @@ namespace Selenium\adlr; /** * @group adlr + * @group adlr-getit * @group adlr-getit-05 * @group adlr-getit-default */ class Getit05DefaultTest extends AdlrBase { + use GetitTestBaseTrait; + public const RECORDS = [ - "/Record/finc-78-39818", - "/Record/finc-78-18524", - "/Record/finc-78-19486", + "finc-78-39818", + "finc-78-18524", + "finc-78-19486", ]; public const RULES = [ - "test_case_id" => "05", - "desc" => [ - [ - "type" => "text", - "path" => ".getitbox-getit > h4", - "text" => "GET IT", - ], - [ - "type" => "text", - "path" => "#get-it-button", - "text" => "INFOS ZUR RESSOURCE", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => "Dieser Titel ist in der IZI-Datenbank des Internationalen Zentralinstituts für das Jugend- und Bildungsfernsehen nachgewiesen.", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => "Zugang zum Volltext erhalten Sie nur bei einigen Titeln dieser Quelle über den obigen Link.", - ], - ] + [ + "type" => "text", + "path" => ".getitbox-getit > h4", + "text" => "GET IT", + ], + [ + "type" => "text", + "path" => "#get-it-button", + "text" => "INFOS ZUR RESSOURCE", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => "Dieser Titel ist in der IZI-Datenbank des Internationalen Zentralinstituts für das Jugend- und Bildungsfernsehen nachgewiesen.", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => "Zugang zum Volltext erhalten Sie nur bei einigen Titeln dieser Quelle über den obigen Link.", + ], ]; - - public function testGetItDefault05() - { - $this->runGetItTest(self::RECORDS, self::RULES); - } } diff --git a/module/finc/tests/selenium/tests/adlr/Getit05ProfessorTest.php b/module/finc/tests/selenium/tests/adlr/Getit05ProfessorTest.php index 5fdc9779ee5..ee8a2ffeead 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit05ProfessorTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit05ProfessorTest.php @@ -1,21 +1,17 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** * @group adlr + * @group adlr-getit * @group adlr-getit-05 * @group adlr-getit-professor */ class Getit05ProfessorTest extends AdlrLoginBase { use ProfessorTrait; + use GetitTestBaseTrait; - public function testGetItProfessor05() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit05DefaultTest::RECORDS, Getit05DefaultTest::RULES); - } + public const RECORDS = Getit05DefaultTest::RECORDS; + public const RULES = Getit05DefaultTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit05StudentTest.php b/module/finc/tests/selenium/tests/adlr/Getit05StudentTest.php index ba117f509a4..b827b66b268 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit05StudentTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit05StudentTest.php @@ -1,20 +1,17 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** + * @group adlr + * @group adlr-getit * @group adlr-getit-05 * @group adlr-getit-student */ class Getit05StudentTest extends AdlrLoginBase { use StudentTrait; + use GetitTestBaseTrait; - public function testGetItStudent05() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit05DefaultTest::RECORDS, Getit05DefaultTest::RULES); - } + public const RECORDS = Getit05DefaultTest::RECORDS; + public const RULES = Getit05DefaultTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit06DefaultTest.php b/module/finc/tests/selenium/tests/adlr/Getit06DefaultTest.php index 8705037ce7a..e5fdad9508a 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit06DefaultTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit06DefaultTest.php @@ -3,46 +3,41 @@ namespace Selenium\adlr; /** * @group adlr + * @group adlr-getit * @group adlr-getit-06 * @group adlr-getit-default */ class Getit06DefaultTest extends AdlrBase { + use GetitTestBaseTrait; + public const RECORDS = [ - "/Record/finc-103-b2FpOmNkbTE1NzU5LmNvbnRlbnRkbS5vY2xjLm9yZzpwMTU3NTljb2xsOS8xMTgwNA", - "/Record/finc-103-b2FpOmNkbTE1NzU5LmNvbnRlbnRkbS5vY2xjLm9yZzpwMTU3NTljb2xsNy8xMDg", - "/Record/finc-103-b2FpOmNkbTE1NzU5LmNvbnRlbnRkbS5vY2xjLm9yZzpwMTU3NTljb2xsOS8xMTkyNw", + "finc-103-b2FpOmNkbTE1NzU5LmNvbnRlbnRkbS5vY2xjLm9yZzpwMTU3NTljb2xsOS8xMTgwNA", + "finc-103-b2FpOmNkbTE1NzU5LmNvbnRlbnRkbS5vY2xjLm9yZzpwMTU3NTljb2xsNy8xMDg", + "finc-103-b2FpOmNkbTE1NzU5LmNvbnRlbnRkbS5vY2xjLm9yZzpwMTU3NTljb2xsOS8xMTkyNw", ]; public const RULES = [ - "test_case_id" => "06", - "desc" => [ - [ - "type" => "text", - "path" => ".getitbox-getit > h4", - "text" => "GET IT", - ], - [ - "type" => "text", - "path" => "#get-it-button", - "text" => "LINKS ZUR RESSOURCE", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => "Diese Ressource ist frei verfügbar.", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => - "Dieser Titel ist im Bestand der Margaret Herrick Library, Academy of Motion Picture Arts and Sciences, und wird mit freundlicher Genehmigung hier angezeigt.", - ], - ] + [ + "type" => "text", + "path" => ".getitbox-getit > h4", + "text" => "GET IT", + ], + [ + "type" => "text", + "path" => "#get-it-button", + "text" => "LINKS ZUR RESSOURCE", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => "Diese Ressource ist frei verfügbar.", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => + "Dieser Titel ist im Bestand der Margaret Herrick Library, Academy of Motion Picture Arts and Sciences, und wird mit freundlicher Genehmigung hier angezeigt.", + ], ]; - - public function testGetItDefault06() - { - $this->runGetItTest(self::RECORDS, self::RULES); - } } diff --git a/module/finc/tests/selenium/tests/adlr/Getit06ProfessorTest.php b/module/finc/tests/selenium/tests/adlr/Getit06ProfessorTest.php index 60b80b6a3e2..42dac7d7a76 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit06ProfessorTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit06ProfessorTest.php @@ -1,24 +1,17 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** * @group adlr + * @group adlr-getit * @group adlr-getit-06 * @group adlr-getit-professor */ class Getit06ProfessorTest extends AdlrLoginBase { use ProfessorTrait; + use GetitTestBaseTrait; - /** - * @group adlr - */ - public function testGetItProfessor06() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit06DefaultTest::RECORDS, Getit06DefaultTest::RULES); - } + public const RECORDS = Getit06DefaultTest::RECORDS; + public const RULES = Getit06DefaultTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit06StudentTest.php b/module/finc/tests/selenium/tests/adlr/Getit06StudentTest.php index 3d6bdfb563c..97396650677 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit06StudentTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit06StudentTest.php @@ -1,20 +1,17 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** + * @group adlr + * @group adlr-getit * @group adlr-getit-06 * @group adlr-getit-student */ class Getit06StudentTest extends AdlrLoginBase { use StudentTrait; + use GetitTestBaseTrait; - public function testGetItStudent06() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit06DefaultTest::RECORDS, Getit06DefaultTest::RULES); - } + public const RECORDS = Getit06DefaultTest::RECORDS; + public const RULES = Getit06DefaultTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit07DefaultTest.php b/module/finc/tests/selenium/tests/adlr/Getit07DefaultTest.php index 122e5531121..561bc4d88c5 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit07DefaultTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit07DefaultTest.php @@ -3,46 +3,41 @@ namespace Selenium\adlr; /** * @group adlr + * @group adlr-getit * @group adlr-getit-07 * @group adlr-getit-default */ class Getit07DefaultTest extends AdlrBase { + use GetitTestBaseTrait; + public const RECORDS = [ - "/Record/dswarm-126-ZnR1bml2a2Fuc2FzOm9haTprdXNjaG9sYXJ3b3Jrcy5rdS5lZHU6MTgwOC8zMTgwNg", - "/Record/dswarm-126-ZnR1bmlhYXJodXNwdWJsOm9haTpwdXJlLmF0aXJhLmRrOnB1YmxpY2F0aW9ucy8wYzQ4NTgzNi0zOWU3LTRmNjMtOGViMi0wYmZjMDE1ZjJkMmQ" + "dswarm-126-ZnR1bml2a2Fuc2FzOm9haTprdXNjaG9sYXJ3b3Jrcy5rdS5lZHU6MTgwOC8zMTgwNg", + "dswarm-126-ZnR1bmlhYXJodXNwdWJsOm9haTpwdXJlLmF0aXJhLmRrOnB1YmxpY2F0aW9ucy8wYzQ4NTgzNi0zOWU3LTRmNjMtOGViMi0wYmZjMDE1ZjJkMmQ" ]; public const RULES = [ - "test_case_id" => "07", - "desc" => [ - [ - "type" => "text", - "path" => ".getitbox-getit > h4", - "text" => "GET IT", - ], - [ - "type" => "text", - "path" => "#get-it-button", - "text" => "INFOS ZUR RESSOURCE", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => - "Dieser Titel stammt aus der Bielefeld Academic Search Engine.", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => - "Einige Dokumente aus dieser Quelle sind möglicherweise nicht als Volltext zugänglich.", - ], - ] + [ + "type" => "text", + "path" => ".getitbox-getit > h4", + "text" => "GET IT", + ], + [ + "type" => "text", + "path" => "#get-it-button", + "text" => "INFOS ZUR RESSOURCE", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => + "Dieser Titel stammt aus der Bielefeld Academic Search Engine.", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => + "Einige Dokumente aus dieser Quelle sind möglicherweise nicht als Volltext zugänglich.", + ], ]; - - public function testGetItDefault07() - { - $this->runGetItTest(self::RECORDS, self::RULES); - } } diff --git a/module/finc/tests/selenium/tests/adlr/Getit07ProfessorTest.php b/module/finc/tests/selenium/tests/adlr/Getit07ProfessorTest.php index 825a0cce51a..de884977b0e 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit07ProfessorTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit07ProfessorTest.php @@ -1,21 +1,17 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** * @group adlr + * @group adlr-getit * @group adlr-getit-07 * @group adlr-getit-professor */ class Getit07ProfessorTest extends AdlrLoginBase { use ProfessorTrait; + use GetitTestBaseTrait; - public function testGetItProfessor07() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit07DefaultTest::RECORDS, Getit07DefaultTest::RULES); - } + public const RECORDS = Getit07DefaultTest::RECORDS; + public const RULES = Getit07DefaultTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit07StudentTest.php b/module/finc/tests/selenium/tests/adlr/Getit07StudentTest.php index a32f05c11aa..db41c4de497 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit07StudentTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit07StudentTest.php @@ -1,20 +1,17 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** + * @group adlr + * @group adlr-getit * @group adlr-getit-07 * @group adlr-getit-student */ class Getit07StudentTest extends AdlrLoginBase { use StudentTrait; + use GetitTestBaseTrait; - public function testGetItStudent07() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit07DefaultTest::RECORDS, Getit07DefaultTest::RULES); - } + public const RECORDS = Getit07DefaultTest::RECORDS; + public const RULES = Getit07DefaultTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit08DefaultTest.php b/module/finc/tests/selenium/tests/adlr/Getit08DefaultTest.php index 51190d5b050..9758e7e31a0 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit08DefaultTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit08DefaultTest.php @@ -3,46 +3,41 @@ namespace Selenium\adlr; /** * @group adlr + * @group adlr-getit * @group adlr-getit-08 * @group adlr-getit-default */ class Getit08DefaultTest extends AdlrBase { + use GetitTestBaseTrait; + public const RECORDS = [ - "/Record/finc-169-QVJEQVJEIEtsYXNzaVdpbGxpYW1zIMK3IEhhcnJ5IFBvdGVyIMK3IE5pYyBSYWluZSDCtyBXRFIwMDowNToxMDYxMTY0NjkzMDI1Nw", - "/Record/finc-169-WkRGS3VsdHVyemVpdE1pbG8gUmF1IMO8YmVyICJEYXMgTnMgTmV1ZSBFdmFuZ2VsaXVtIiAtMDA6MDU6NTkxMDMxNTk5NDk5MjAw" + "finc-169-QVJEQVJEIEtsYXNzaVdpbGxpYW1zIMK3IEhhcnJ5IFBvdGVyIMK3IE5pYyBSYWluZSDCtyBXRFIwMDowNToxMDYxMTY0NjkzMDI1Nw", + "finc-169-WkRGS3VsdHVyemVpdE1pbG8gUmF1IMO8YmVyICJEYXMgTnMgTmV1ZSBFdmFuZ2VsaXVtIiAtMDA6MDU6NTkxMDMxNTk5NDk5MjAw" ]; public const RULES = [ - "test_case_id" => "08", - "desc" => [ - [ - "type" => "text", - "path" => ".getitbox-getit > h4", - "text" => "GET IT", - ], - [ - "type" => "text", - "path" => "#get-it-button", - "text" => "LINKS ZUR RESSOURCE", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => - "Aus Deutschland freier Zugang zu oder Download von Mediathek-Videos möglich.", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => - "Der Zugang kann aus rechtlichen Gründen nach Ablauf eines bestimmten Zeitraums oder aus anderen Ländern gesperrt sein.", - ], + [ + "type" => "text", + "path" => ".getitbox-getit > h4", + "text" => "GET IT", + ], + [ + "type" => "text", + "path" => "#get-it-button", + "text" => "LINKS ZUR RESSOURCE", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => + "Aus Deutschland freier Zugang zu oder Download von Mediathek-Videos möglich.", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => + "Der Zugang kann aus rechtlichen Gründen nach Ablauf eines bestimmten Zeitraums oder aus anderen Ländern gesperrt sein.", ], ]; - - public function testGetItDefault08() - { - $this->runGetItTest(self::RECORDS, self::RULES); - } } diff --git a/module/finc/tests/selenium/tests/adlr/Getit08ProfessorTest.php b/module/finc/tests/selenium/tests/adlr/Getit08ProfessorTest.php index 63472008367..658fd17782f 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit08ProfessorTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit08ProfessorTest.php @@ -1,21 +1,17 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** * @group adlr + * @group adlr-getit * @group adlr-getit-08 * @group adlr-getit-professor */ class Getit08ProfessorTest extends AdlrLoginBase { use ProfessorTrait; + use GetitTestBaseTrait; - public function testGetItProfessor08() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit08DefaultTest::RECORDS, Getit08DefaultTest::RULES); - } + public const RECORDS = Getit08DefaultTest::RECORDS; + public const RULES = Getit08DefaultTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit08StudentTest.php b/module/finc/tests/selenium/tests/adlr/Getit08StudentTest.php index 6ca4a330a2e..2af0af9a998 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit08StudentTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit08StudentTest.php @@ -1,20 +1,17 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** + * @group adlr + * @group adlr-getit * @group adlr-getit-08 * @group adlr-getit-student */ class Getit08StudentTest extends AdlrLoginBase { use StudentTrait; + use GetitTestBaseTrait; - public function testGetItStudent08() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit08DefaultTest::RECORDS, Getit08DefaultTest::RULES); - } + public const RECORDS = Getit08DefaultTest::RECORDS; + public const RULES = Getit08DefaultTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit09DefaultTest.php b/module/finc/tests/selenium/tests/adlr/Getit09DefaultTest.php index 1a6a6d866c4..2820c6edcae 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit09DefaultTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit09DefaultTest.php @@ -3,39 +3,34 @@ namespace Selenium\adlr; /** * @group adlr + * @group adlr-getit * @group adlr-getit-09 * @group adlr-getit-default */ class Getit09DefaultTest extends AdlrBase { + use GetitTestBaseTrait; + public const RECORDS = [ - "/Record/0-1049705947", - "/Record/0-1042440905" + "0-1049705947", + "0-1042440905" ]; public const RULES = [ - "test_case_id" => "09", - "desc" => [ - [ - "type" => "text", - "path" => ".getitbox-getit > h4", - "text" => "GET IT", - ], - [ - "type" => "text", - "path" => "#get-it-button", - "text" => "LINKS ZUR RESSOURCE", - ], - [ - "type" => "text", - "path" => ".getitbox-notices", - "text" => "Diese Ressource ist frei verfügbar.", - ] + [ + "type" => "text", + "path" => ".getitbox-getit > h4", + "text" => "GET IT", + ], + [ + "type" => "text", + "path" => "#get-it-button", + "text" => "LINKS ZUR RESSOURCE", + ], + [ + "type" => "text", + "path" => ".getitbox-notices", + "text" => "Diese Ressource ist frei verfügbar.", ] ]; - - public function testGetItDefault09() - { - $this->runGetItTest(self::RECORDS, self::RULES); - } } diff --git a/module/finc/tests/selenium/tests/adlr/Getit09ProfessorTest.php b/module/finc/tests/selenium/tests/adlr/Getit09ProfessorTest.php index 203acde53c7..e912269ed4e 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit09ProfessorTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit09ProfessorTest.php @@ -1,21 +1,17 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** * @group adlr + * @group adlr-getit * @group adlr-getit-09 * @group adlr-getit-professor */ class Getit09ProfessorTest extends AdlrLoginBase { use ProfessorTrait; + use GetitTestBaseTrait; - public function testGetItProfessor09() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit09DefaultTest::RECORDS, Getit09DefaultTest::RULES); - } + public const RECORDS = Getit09DefaultTest::RECORDS; + public const RULES = Getit09DefaultTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit09StudentTest.php b/module/finc/tests/selenium/tests/adlr/Getit09StudentTest.php index 7c718d10f8b..e75b7bb6df9 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit09StudentTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit09StudentTest.php @@ -1,20 +1,17 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** + * @group adlr + * @group adlr-getit * @group adlr-getit-09 * @group adlr-getit-student */ class Getit09StudentTest extends AdlrLoginBase { use StudentTrait; + use GetitTestBaseTrait; - public function testGetItStudent09() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit09DefaultTest::RECORDS, Getit09DefaultTest::RULES); - } + public const RECORDS = Getit09DefaultTest::RECORDS; + public const RULES = Getit09DefaultTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit10DefaultTest.php b/module/finc/tests/selenium/tests/adlr/Getit10DefaultTest.php index a30d4b548c5..c5be0c04eea 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit10DefaultTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit10DefaultTest.php @@ -3,46 +3,44 @@ namespace Selenium\adlr; /** * @group adlr + * @group adlr-getit * @group adlr-getit-10 * @group adlr-getit-default */ class Getit10DefaultTest extends AdlrBase { + use GetitTestBaseTrait; + public const RECORDS = [ - "/Record/0-1039949797", - "/Record/0-1656224038" + "0-1039949797", + "0-1656224038" ]; public const RULES = [ - "test_case_id" => "10", - "desc" => [ - [ - "type" => "text", - "path" => ".getitbox-getit > h4", - "text" => "NICHT ANGEMELDET", - ], - ["type" => "anti-exi", "path" => "#get-it-button"], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => - "Sie müssen angemeldet sein, um Zugang zu diesem Titel zu erhalten.", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => "Noch keinen Account?", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => "Jetzt registrieren", - ], - ] + [ + "type" => "text", + "path" => ".getitbox-getit > h4", + "text" => "NICHT ANGEMELDET", + ], + [ + "type" => "anti-exi", + "path" => "#get-it-button", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => + "Sie müssen angemeldet sein, um Zugang zu diesem Titel zu erhalten.", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => "Noch keinen Account?", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => "Jetzt registrieren", + ], ]; - - public function testGetItDefault10() - { - $this->runGetItTest(self::RECORDS, self::RULES); - } } diff --git a/module/finc/tests/selenium/tests/adlr/Getit10ProfessorTest.php b/module/finc/tests/selenium/tests/adlr/Getit10ProfessorTest.php index 236b847a728..9e6bf0829d4 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit10ProfessorTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit10ProfessorTest.php @@ -1,43 +1,34 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** * @group adlr + * @group adlr-getit * @group adlr-getit-10 * @group adlr-getit-professor */ class Getit10ProfessorTest extends AdlrLoginBase { use ProfessorTrait; + use GetitTestBaseTrait; + public const RECORDS = Getit10DefaultTest::RECORDS; public const RULES = [ - "test_case_id" => "10", - "desc" => [ - [ - "type" => "text", - "path" => ".getitbox-getit > h4", - "text" => "GET IT", - ], - [ - "type" => "text", - "path" => "#get-it-button", - "text" => "LINKS ZUR RESSOURCE", - ], - [ - "type" => "text", - "path" => ".getitbox-notices", - "text" => - "Dieses E-Book ist für Sie über eine adlr.link-Lizenz freigeschaltet.", - ], - ] + [ + "type" => "text", + "path" => ".getitbox-getit > h4", + "text" => "GET IT", + ], + [ + "type" => "text", + "path" => "#get-it-button", + "text" => "LINKS ZUR RESSOURCE", + ], + [ + "type" => "text", + "path" => ".getitbox-notices", + "text" => + "Dieses E-Book ist für Sie über eine adlr.link-Lizenz freigeschaltet.", + ], ]; - - public function testGetItProfessor10() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit10DefaultTest::RECORDS, self::RULES); - } } diff --git a/module/finc/tests/selenium/tests/adlr/Getit10StudentTest.php b/module/finc/tests/selenium/tests/adlr/Getit10StudentTest.php index d03afd49c3b..7b7d987c5fb 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit10StudentTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit10StudentTest.php @@ -1,20 +1,17 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** + * @group adlr + * @group adlr-getit * @group adlr-getit-10 * @group adlr-getit-student */ class Getit10StudentTest extends AdlrLoginBase { use StudentTrait; + use GetitTestBaseTrait; - public function testGetItStudent10() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit10DefaultTest::RECORDS, Getit10ProfessorTest::RULES); - } + public const RECORDS = Getit10DefaultTest::RECORDS; + public const RULES = Getit10ProfessorTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit11DefaultTest.php b/module/finc/tests/selenium/tests/adlr/Getit11DefaultTest.php index e4a677d4af4..4d2da6d5a55 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit11DefaultTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit11DefaultTest.php @@ -3,47 +3,42 @@ namespace Selenium\adlr; /** * @group adlr + * @group adlr-getit * @group adlr-getit-11 * @group adlr-getit-default */ class Getit11DefaultTest extends AdlrBase { + use GetitTestBaseTrait; + public const RECORDS = [ - "/Record/127-HF000229647", // ok, if logged in - "/Record/finc-148-000766970", // ok, if logged in - "/Record/finc-109-KM000085902", // error: mehrbändiges Werk - "/Record/0-1678979260", // error: Links zur Ressource - "/Record/0-1668331306", // error: derzeit leider keine Infos - "/Record/0-1667284800", // error: derzeit leider keine Infos - "/Record/finc-117-BV040630682", // error: mehrbändiges Werk - "/Record/finc-142-08034201", // error: mehrbändiges Werk - "/Record/finc-119-321520181" // error: mehrbändiges Werk + "127-HF000229647", // ok, if logged in + "finc-148-000766970", // ok, if logged in + "finc-109-KM000085902", // error: mehrbändiges Werk + "0-1678979260", // error: Links zur Ressource + "0-1668331306", // error: derzeit leider keine Infos + "0-1667284800", // error: derzeit leider keine Infos + "finc-117-BV040630682", // error: mehrbändiges Werk + "finc-142-08034201", // error: mehrbändiges Werk + "finc-119-321520181" // error: mehrbändiges Werk ]; public const RULES = [ - "test_case_id" => "11", - "desc" => [ - [ - "type" => "text", - "path" => ".getitbox-getit > h4", - "text" => "GET IT", - ], - [ - "type" => "text", - "path" => "#get-it-button", - "text" => "INFOS ZUR RESSOURCE", - ], - [ - "type" => "text", - "path" => ".getitbox-notices", - "text" => - 'Dieser Titel ist ein mehrbändiges Werk. Einzeltitel sind unter "Zugehörige Bände" aufgeführt.', - ], - ] + [ + "type" => "text", + "path" => ".getitbox-getit > h4", + "text" => "GET IT", + ], + [ + "type" => "text", + "path" => "#get-it-button", + "text" => "INFOS ZUR RESSOURCE", + ], + [ + "type" => "text", + "path" => ".getitbox-notices", + "text" => + 'Dieser Titel ist ein mehrbändiges Werk. Einzeltitel sind unter "Zugehörige Bände" aufgeführt.', + ], ]; - - public function testGetItDefault11() - { - $this->runGetItTest(self::RECORDS, self::RULES); - } } diff --git a/module/finc/tests/selenium/tests/adlr/Getit11ProfessorTest.php b/module/finc/tests/selenium/tests/adlr/Getit11ProfessorTest.php index 6041ec06838..df8546f23e0 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit11ProfessorTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit11ProfessorTest.php @@ -1,21 +1,17 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** * @group adlr + * @group adlr-getit * @group adlr-getit-11 * @group adlr-getit-professor */ class Getit11ProfessorTest extends AdlrLoginBase { use ProfessorTrait; + use GetitTestBaseTrait; - public function testGetItProfessor11() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit11DefaultTest::RECORDS, Getit11DefaultTest::RULES); - } + public const RECORDS = Getit11DefaultTest::RECORDS; + public const RULES = Getit11DefaultTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit11StudentTest.php b/module/finc/tests/selenium/tests/adlr/Getit11StudentTest.php index 9e33fcba651..2340f4e2400 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit11StudentTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit11StudentTest.php @@ -1,20 +1,17 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** + * @group adlr + * @group adlr-getit * @group adlr-getit-11 * @group adlr-getit-student */ class Getit11StudentTest extends AdlrLoginBase { use StudentTrait; + use GetitTestBaseTrait; - public function testGetItStudent11() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit11DefaultTest::RECORDS, Getit11DefaultTest::RULES); - } + public const RECORDS = Getit11DefaultTest::RECORDS; + public const RULES = Getit11DefaultTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit12DefaultTest.php b/module/finc/tests/selenium/tests/adlr/Getit12DefaultTest.php index 11d301ce5ae..3133170f4da 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit12DefaultTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit12DefaultTest.php @@ -3,55 +3,50 @@ namespace Selenium\adlr; /** * @group adlr + * @group adlr-getit * @group adlr-getit-12 * @group adlr-getit-default */ class Getit12DefaultTest extends AdlrBase { + use GetitTestBaseTrait; + public const RECORDS = [ - "/Record/0-1603202374", - "/Record/0-1067543112", - "/Record/0-1027717349", + "0-1603202374", + "0-1067543112", + "0-1027717349", ]; public const RULES = [ - "test_case_id" => "12", - "desc" => [ - [ - "type" => "text", - "path" => ".getitbox-getit > h4", - "text" => "NICHT ANGEMELDET", - ], - [ - "type" => "anti-exi", - "path" => ".full-order", - "text" => "KOSTENLOS BESTELLEN", - ], - [ - "type" => "anti-exi", - "path" => ".part-order", - "text" => "TEILKOPIE BESORGEN", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => "Weitere Informationen sehen Sie, wenn Sie angemeldet sind.", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => "Noch keinen Account?", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => "Jetzt registrieren", - ], - ] + [ + "type" => "text", + "path" => ".getitbox-getit > h4", + "text" => "NICHT ANGEMELDET", + ], + [ + "type" => "anti-exi", + "path" => ".full-order", + "text" => "KOSTENLOS BESTELLEN", + ], + [ + "type" => "anti-exi", + "path" => ".part-order", + "text" => "TEILKOPIE BESORGEN", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => "Weitere Informationen sehen Sie, wenn Sie angemeldet sind.", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => "Noch keinen Account?", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => "Jetzt registrieren", + ], ]; - - public function testGetItDefault12() - { - $this->runGetItTest(self::RECORDS, self::RULES); - } } diff --git a/module/finc/tests/selenium/tests/adlr/Getit12ProfessorTest.php b/module/finc/tests/selenium/tests/adlr/Getit12ProfessorTest.php index 774780f3574..3faf38356d5 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit12ProfessorTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit12ProfessorTest.php @@ -1,49 +1,40 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** * @group adlr + * @group adlr-getit * @group adlr-getit-12 * @group adlr-getit-professor */ class Getit12ProfessorTest extends AdlrLoginBase { use ProfessorTrait; + use GetitTestBaseTrait; + public const RECORDS = Getit12DefaultTest::RECORDS; public const RULES = [ - "test_case_id" => "12", - "desc" => [ - [ - "type" => "text", - "path" => ".getitbox-getit > h4", - "text" => "GET IT", - ], - [ - "type" => "text", - "path" => ".full-order", - "text" => "KOSTENLOS BESTELLEN", - ], - [ - "type" => "text", - "path" => ".part-order", - "text" => "TEILKOPIE BESORGEN", - ], - /* should there be infos? - "type" => "text", - "path" => "#get-it-button", - "text" => "INFOS ZUR RESSOURCE", - "waitForId" => "get-it-button" - ], - */ - ] + [ + "type" => "text", + "path" => ".getitbox-getit > h4", + "text" => "GET IT", + ], + [ + "type" => "text", + "path" => ".full-order", + "text" => "KOSTENLOS BESTELLEN", + ], + [ + "type" => "text", + "path" => ".part-order", + "text" => "TEILKOPIE BESORGEN", + ], + /* should there be infos? + "type" => "text", + "path" => "#get-it-button", + "text" => "INFOS ZUR RESSOURCE", + "waitForId" => "get-it-button" + ], + */ ]; - - public function testGetItProfessor12() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit12DefaultTest::RECORDS, self::RULES); - } } diff --git a/module/finc/tests/selenium/tests/adlr/Getit12StudentTest.php b/module/finc/tests/selenium/tests/adlr/Getit12StudentTest.php index 42c4a307122..a17d52ac0c7 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit12StudentTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit12StudentTest.php @@ -1,20 +1,17 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** + * @group adlr + * @group adlr-getit * @group adlr-getit-12 * @group adlr-getit-student */ class Getit12StudentTest extends AdlrLoginBase { use StudentTrait; + use GetitTestBaseTrait; - public function testGetItStudent12() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit12DefaultTest::RECORDS, Getit12ProfessorTest::RULES); - } + public const RECORDS = Getit12DefaultTest::RECORDS; + public const RULES = Getit12ProfessorTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit13DefaultTest.php b/module/finc/tests/selenium/tests/adlr/Getit13DefaultTest.php index 8b1970813dd..c856ba38296 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit13DefaultTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit13DefaultTest.php @@ -3,61 +3,56 @@ namespace Selenium\adlr; /** * @group adlr + * @group adlr-getit * @group adlr-getit-13 * @group adlr-getit-default */ class Getit13DefaultTest extends AdlrBase { + use GetitTestBaseTrait; + public const RECORDS = [ - "/Record/finc-109-KM000089451", - "/Record/finc-117-BV043403677", - "/Record/finc-119-365350478", - "/Record/127-HF000221927", - "/Record/finc-148-000759109", + "finc-109-KM000089451", + "finc-117-BV043403677", + "finc-119-365350478", + "127-HF000221927", + "finc-148-000759109", /* https://projekte.ub.uni-leipzig.de/issues/22013#note-26 */ - /*"/Record/finc-142-11205879",*/ - /*"/Record/finc-151-000055718",*/ - "/Record/0-1667395157" // error: "GET IT" instead of "Nicht angemeldet" + /*"finc-142-11205879",*/ + /*"finc-151-000055718",*/ + "0-1667395157" // error: "GET IT" instead of "Nicht angemeldet" ]; public const RULES = [ - "test_case_id" => "13", - "desc" => [ - [ - "type" => "text", - "path" => ".getitbox-getit > h4", - "text" => "NICHT ANGEMELDET", - ], - [ - "type" => "anti-exi", - "path" => ".part-order", - "text" => "TEILKOPIE BESORGEN", - ], - [ - "type" => "text", - "path" => "#get-it-button", - "text" => "INFOS ZUR RESSOURCE", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => "Weitere Informationen sehen Sie, wenn Sie angemeldet sind.", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => "Noch keinen Account?", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => "Jetzt registrieren", - ], - ] + [ + "type" => "text", + "path" => ".getitbox-getit > h4", + "text" => "NICHT ANGEMELDET", + ], + [ + "type" => "anti-exi", + "path" => ".part-order", + "text" => "TEILKOPIE BESORGEN", + ], + [ + "type" => "text", + "path" => "#get-it-button", + "text" => "INFOS ZUR RESSOURCE", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => "Weitere Informationen sehen Sie, wenn Sie angemeldet sind.", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => "Noch keinen Account?", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => "Jetzt registrieren", + ], ]; - - public function testGetItDefault13() - { - $this->runGetItTest(self::RECORDS, self::RULES); - } } diff --git a/module/finc/tests/selenium/tests/adlr/Getit13ProfessorTest.php b/module/finc/tests/selenium/tests/adlr/Getit13ProfessorTest.php index 5f81fedb964..ef6c8c4aba5 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit13ProfessorTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit13ProfessorTest.php @@ -1,45 +1,36 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** * @group adlr + * @group adlr-getit * @group adlr-getit-13 * @group adlr-getit-professor */ class Getit13ProfessorTest extends AdlrLoginBase { use ProfessorTrait; + use GetitTestBaseTrait; + public const RECORDS = Getit13DefaultTest::RECORDS; public const RULES = [ - "test_case_id" => "13L", - "desc" => [ - [ - "type" => "text", - "path" => ".getitbox-getit > h4", - "text" => "GET IT", - ], - [ - "type" => "text", - "path" => ".part-order", - "text" => "TEILKOPIE BESORGEN", - ], - /* see https://projekte.ub.uni-leipzig.de/issues/22013#note-26 */ - /* - [ - "type" => "text", - "path" => "#get-it-button", - "text" => "INFOS ZUR RESSOURCE", - ], - */ - ] + [ + "type" => "text", + "path" => ".getitbox-getit > h4", + "text" => "GET IT", + ], + [ + "type" => "text", + "path" => ".part-order", + "text" => "TEILKOPIE BESORGEN", + ], + /* see https://projekte.ub.uni-leipzig.de/issues/22013#note-26 */ + /* + [ + "type" => "text", + "path" => "#get-it-button", + "text" => "INFOS ZUR RESSOURCE", + ], + */ ]; - - public function testGetItProfessor13() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit13DefaultTest::RECORDS, self::RULES); - } } diff --git a/module/finc/tests/selenium/tests/adlr/Getit13StudentTest.php b/module/finc/tests/selenium/tests/adlr/Getit13StudentTest.php index de34801c87c..942e13789d4 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit13StudentTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit13StudentTest.php @@ -1,20 +1,17 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** + * @group adlr + * @group adlr-getit * @group adlr-getit-13 * @group adlr-getit-student */ class Getit13StudentTest extends AdlrLoginBase { use StudentTrait; + use GetitTestBaseTrait; - public function testGetItStudent13() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit13DefaultTest::RECORDS, Getit13ProfessorTest::RULES); - } + public const RECORDS = Getit13DefaultTest::RECORDS; + public const RULES = Getit13ProfessorTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit14DefaultTest.php b/module/finc/tests/selenium/tests/adlr/Getit14DefaultTest.php index 6beb75904ab..045d47f9dca 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit14DefaultTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit14DefaultTest.php @@ -3,61 +3,56 @@ namespace Selenium\adlr; /** * @group adlr + * @group adlr-getit * @group adlr-getit-14 * @group adlr-getit-default */ class Getit14DefaultTest extends AdlrBase { + use GetitTestBaseTrait; + public const RECORDS = [ - "/Record/0-1670477886", - "/Record/0-1041254903", - "/Record/finc-109-KM000088077", - "/Record/finc-119-369836529", - "/Record/finc-119-321710606", - "/Record/finc-119-310607205", - "/Record/127-HF000223270", - "/Record/finc-142-08035064", - "/Record/finc-151-000055678", - "/Record/finc-148-000632095", // error: mehrbändiges Werk statt 'weitere informationen sehen sie..' - "/Record/finc-117-BV045542005", // error: 'GET IT' statt 'NICHT ANGEMELDET' - "/Record/finc-119-36435657X", // error: mehrbändiges Werk statt 'weitere informationen sehen sie..' + "0-1670477886", + "0-1041254903", + "finc-109-KM000088077", + "finc-119-369836529", + "finc-119-321710606", + "finc-119-310607205", + "127-HF000223270", + "finc-142-08035064", + "finc-151-000055678", + "finc-148-000632095", // error: mehrbändiges Werk statt 'weitere informationen sehen sie..' + "finc-117-BV045542005", // error: 'GET IT' statt 'NICHT ANGEMELDET' + "finc-119-36435657X", // error: mehrbändiges Werk statt 'weitere informationen sehen sie..' ]; public const RULES = [ - "test_case_id" => "14", - "desc" => [ - [ - "type" => "text", - "path" => ".getitbox-getit > h4", - "text" => "NICHT ANGEMELDET", - ], - /* https://projekte.ub.uni-leipzig.de/issues/22013#note-26 - [ - "type" => "text", - "path" => "#get-it-button", - "text" => "INFOS ZUR RESSOURCE", - ],*/ - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => - "Weitere Informationen sehen Sie, wenn Sie angemeldet sind.", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => "Noch keinen Account?", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => "Jetzt registrieren", - ] + [ + "type" => "text", + "path" => ".getitbox-getit > h4", + "text" => "NICHT ANGEMELDET", + ], + /* https://projekte.ub.uni-leipzig.de/issues/22013#note-26 + [ + "type" => "text", + "path" => "#get-it-button", + "text" => "INFOS ZUR RESSOURCE", + ],*/ + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => + "Weitere Informationen sehen Sie, wenn Sie angemeldet sind.", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => "Noch keinen Account?", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => "Jetzt registrieren", ] ]; - - public function testGetItDefault14() - { - $this->runGetItTest(self::RECORDS, self::RULES); - } } diff --git a/module/finc/tests/selenium/tests/adlr/Getit14ProfessorTest.php b/module/finc/tests/selenium/tests/adlr/Getit14ProfessorTest.php index 53667dc1e48..1b667ccb6de 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit14ProfessorTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit14ProfessorTest.php @@ -1,44 +1,35 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** * @group adlr + * @group adlr-getit * @group adlr-getit-14 * @group adlr-getit-professor */ class Getit14ProfessorTest extends AdlrLoginBase { use ProfessorTrait; + use GetitTestBaseTrait; + public const RECORDS = Getit14DefaultTest::RECORDS; public const RULES = [ - "test_case_id" => "14L", - "desc" => [ - [ - "type" => "text", - "path" => ".getitbox-getit > h4", - "text" => "GET IT", - ], - // https://projekte.ub.uni-leipzig.de/issues/22013#note-26 -/* [ - "type" => "text", - "path" => "#get-it-button", - "text" => "INFOS ZUR RESSOURCE", - ],*/ - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => - "Einige Medientypen (wie z. B. Manuskripte, Schallplatten, CDs, Videos) können von der Fernleihe ausgeschlossen sein.", - ], - ] + [ + "type" => "text", + "path" => ".getitbox-getit > h4", + "text" => "GET IT", + ], + // https://projekte.ub.uni-leipzig.de/issues/22013#note-26 + /*[ + "type" => "text", + "path" => "#get-it-button", + "text" => "INFOS ZUR RESSOURCE", + ],*/ + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => + "Einige Medientypen (wie z. B. Manuskripte, Schallplatten, CDs, Videos) können von der Fernleihe ausgeschlossen sein.", + ], ]; - - public function testGetItProfessor14() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit14DefaultTest::RECORDS, self::RULES); - } } diff --git a/module/finc/tests/selenium/tests/adlr/Getit14StudentTest.php b/module/finc/tests/selenium/tests/adlr/Getit14StudentTest.php index 537da44746c..252fa956c69 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit14StudentTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit14StudentTest.php @@ -1,20 +1,17 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** + * @group adlr + * @group adlr-getit * @group adlr-getit-14 * @group adlr-getit-student */ class Getit14StudentTest extends AdlrLoginBase { use StudentTrait; + use GetitTestBaseTrait; - public function testGetItStudent14() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit14DefaultTest::RECORDS, Getit14ProfessorTest::RULES); - } + public const RECORDS = Getit14DefaultTest::RECORDS; + public const RULES = Getit14ProfessorTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit15DefaultTest.php b/module/finc/tests/selenium/tests/adlr/Getit15DefaultTest.php index 3f80918e20a..f8b766b3d29 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit15DefaultTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit15DefaultTest.php @@ -3,56 +3,51 @@ namespace Selenium\adlr; /** * @group adlr + * @group adlr-getit * @group adlr-getit-15 * @group adlr-getit-default */ class Getit15DefaultTest extends AdlrBase { + use GetitTestBaseTrait; + public const RECORDS = [ - "/Record/0-1649918879", - "/Record/0-1668116529", - "/Record/finc-119-326140743", - "/Record/finc-119-320535185", - "/Record/finc-119-218381344", - "/Record/127-HF000220674", - "/Record/127-HF000224330", - "/Record/finc-142-10903814", - "/Record/finc-142-10891532", - "/Record/finc-151-000046616", - "/Record/finc-117-BV022883157", + "0-1649918879", + "0-1668116529", + "finc-119-326140743", + "finc-119-320535185", + "finc-119-218381344", + "127-HF000220674", + "127-HF000224330", + "finc-142-10903814", + "finc-142-10891532", + "finc-151-000046616", + "finc-117-BV022883157", ]; public const RULES = [ - "test_case_id" => "15", - "desc" => [ - [ - "type" => "text", - "path" => ".getitbox-getit > h4", - "text" => "GET IT", - ], - // https://projekte.ub.uni-leipzig.de/issues/22013#note-26 + [ + "type" => "text", + "path" => ".getitbox-getit > h4", + "text" => "GET IT", + ], + // https://projekte.ub.uni-leipzig.de/issues/22013#note-26 /* [ - "type" => "text", - "path" => "#get-it-button", - "text" => "INFOS ZUR RESSOURCE", - ],*/ - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => "Für diesen Titel können wir derzeit leider keine weiteren Informationen zur Verfügbarkeit bereitstellen.", - "wait" => "getitbox-notices" - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => "Ob der Titel per Fernleihe bestellbar ist, kann Ihnen Ihre Heimatbibliothek mitteilen.", - "wait" => "getitbox-notices" - ], - ] + "type" => "text", + "path" => "#get-it-button", + "text" => "INFOS ZUR RESSOURCE", + ],*/ + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => "Für diesen Titel können wir derzeit leider keine weiteren Informationen zur Verfügbarkeit bereitstellen.", + "wait" => "getitbox-notices" + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => "Ob der Titel per Fernleihe bestellbar ist, kann Ihnen Ihre Heimatbibliothek mitteilen.", + "wait" => "getitbox-notices" + ], ]; - - public function testGetItDefault15() - { - $this->runGetItTest(self::RECORDS, self::RULES); - } } diff --git a/module/finc/tests/selenium/tests/adlr/Getit15ProfessorTest.php b/module/finc/tests/selenium/tests/adlr/Getit15ProfessorTest.php index ef1c12e40ba..c6e76be07e0 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit15ProfessorTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit15ProfessorTest.php @@ -1,21 +1,17 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** * @group adlr + * @group adlr-getit * @group adlr-getit-15 * @group adlr-getit-professor */ class Getit15ProfessorTest extends AdlrLoginBase { use ProfessorTrait; + use GetitTestBaseTrait; - public function testGetItProfessor15() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit15DefaultTest::RECORDS, Getit15DefaultTest::RULES); - } + public const RECORDS = Getit15DefaultTest::RECORDS; + public const RULES = Getit15DefaultTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit15StudentTest.php b/module/finc/tests/selenium/tests/adlr/Getit15StudentTest.php index 85d7cdfc6cb..383bd9ba909 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit15StudentTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit15StudentTest.php @@ -1,20 +1,17 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** + * @group adlr + * @group adlr-getit * @group adlr-getit-15 * @group adlr-getit-student */ class Getit15StudentTest extends AdlrLoginBase { use StudentTrait; + use GetitTestBaseTrait; - public function testGetItStudent15() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit15DefaultTest::RECORDS, Getit15DefaultTest::RULES); - } + public const RECORDS = Getit15DefaultTest::RECORDS; + public const RULES = Getit15DefaultTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit16DefaultTest.php b/module/finc/tests/selenium/tests/adlr/Getit16DefaultTest.php index cf5f2877909..300a46f6edc 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit16DefaultTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit16DefaultTest.php @@ -3,45 +3,40 @@ namespace Selenium\adlr; /** * @group adlr + * @group adlr-getit * @group adlr-getit-16 * @group adlr-getit-default */ class Getit16DefaultTest extends AdlrBase { + use GetitTestBaseTrait; + public const RECORDS = [ - "/Record/0-1678956775", - "/Record/0-1678647268", - "/Record/0-1678675431", - "/Record/finc-117-BV045203253", - "/Record/finc-117-BV044707116", - "/Record/finc-119-339980966", - "/Record/finc-119-356913473", - "/Record/finc-119-22918670X", + "0-1678956775", + "0-1678647268", + "0-1678675431", + "finc-117-BV045203253", + "finc-117-BV044707116", + "finc-119-339980966", + "finc-119-356913473", + "finc-119-22918670X", ]; public const RULES = [ - "test_case_id" => "16", - "desc" => [ - [ - "type" => "text", - "path" => ".getitbox-getit > h4", - "text" => "GET IT", - ], - [ - "type" => "text", - "path" => "#get-it-button", - "text" => "LINKS ZUR RESSOURCE", - ], - [ - "type" => "text", - "path" => ".getitbox-notices", - "text" => "Diese Ressource ist frei verfügbar.", - ], - ] + [ + "type" => "text", + "path" => ".getitbox-getit > h4", + "text" => "GET IT", + ], + [ + "type" => "text", + "path" => "#get-it-button", + "text" => "LINKS ZUR RESSOURCE", + ], + [ + "type" => "text", + "path" => ".getitbox-notices", + "text" => "Diese Ressource ist frei verfügbar.", + ], ]; - - public function testGetItDefault16() - { - $this->runGetItTest(self::RECORDS, self::RULES); - } } diff --git a/module/finc/tests/selenium/tests/adlr/Getit16ProfessorTest.php b/module/finc/tests/selenium/tests/adlr/Getit16ProfessorTest.php index 721e8759f53..fe5f02b478e 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit16ProfessorTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit16ProfessorTest.php @@ -1,21 +1,17 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** * @group adlr + * @group adlr-getit * @group adlr-getit-16 * @group adlr-getit-professor */ class Getit16ProfessorTest extends AdlrLoginBase { use ProfessorTrait; + use GetitTestBaseTrait; - public function testGetItProfessor16() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit16DefaultTest::RECORDS, Getit16DefaultTest::RULES); - } + public const RECORDS = Getit16DefaultTest::RECORDS; + public const RULES = Getit16DefaultTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit16StudentTest.php b/module/finc/tests/selenium/tests/adlr/Getit16StudentTest.php index 8d74356e6b1..f7429425168 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit16StudentTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit16StudentTest.php @@ -1,20 +1,17 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** + * @group adlr + * @group adlr-getit * @group adlr-getit-16 * @group adlr-getit-student */ class Getit16StudentTest extends AdlrLoginBase { use StudentTrait; + use GetitTestBaseTrait; - public function testGetItStudent16() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit16DefaultTest::RECORDS, Getit16DefaultTest::RULES); - } + public const RECORDS = Getit16DefaultTest::RECORDS; + public const RULES = Getit16DefaultTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit17DefaultTest.php b/module/finc/tests/selenium/tests/adlr/Getit17DefaultTest.php index e6e6e97923e..a9a03a321a3 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit17DefaultTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit17DefaultTest.php @@ -3,52 +3,47 @@ namespace Selenium\adlr; /** * @group adlr + * @group adlr-getit * @group adlr-getit-17 * @group adlr-getit-default */ class Getit17DefaultTest extends AdlrBase { + use GetitTestBaseTrait; + public const RECORDS = [ - "/Record/0-1679317865", - "/Record/0-1678682802", - "/Record/finc-117-BV044276094", - "/Record/finc-117-BV045304712", - "/Record/finc-119-371587344", - "/Record/finc-119-377835137", - "/Record/127-HF000224597", - "/Record/127-HF000219912", + "0-1679317865", + "0-1678682802", + "finc-117-BV044276094", + "finc-117-BV045304712", + "finc-119-371587344", + "finc-119-377835137", + "127-HF000224597", + "127-HF000219912", ]; public const RULES = [ - "test_case_id" => "17", - "desc" => [ - [ - "type" => "text", - "path" => ".getitbox-getit > h4", - "text" => "GET IT", - ], - [ - "type" => "text", - "path" => "#get-it-button", - "text" => "LINKS ZUR RESSOURCE", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => - "Dieses E-Book ist nur mit einer Lizenz Ihrer Heimatbibliothek nutzbar. Wenn es als bei Ihrer Bibliothek vorhanden angezeigt wird, dann sollte der direkte Zugang über den obigen Link möglich sein.", - ], - [ - "type" => "contains", - "path" => ".getitbox-notices", - "text" => - "Teilkopien sind bei E-Books nicht möglich. Wenn Sie eine Teilkopie benötigen, suchen Sie bitte in unserem Portal nach der Printausgabe dieses Werkes.", - ], - ] + [ + "type" => "text", + "path" => ".getitbox-getit > h4", + "text" => "GET IT", + ], + [ + "type" => "text", + "path" => "#get-it-button", + "text" => "LINKS ZUR RESSOURCE", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => + "Dieses E-Book ist nur mit einer Lizenz Ihrer Heimatbibliothek nutzbar. Wenn es als bei Ihrer Bibliothek vorhanden angezeigt wird, dann sollte der direkte Zugang über den obigen Link möglich sein.", + ], + [ + "type" => "contains", + "path" => ".getitbox-notices", + "text" => + "Teilkopien sind bei E-Books nicht möglich. Wenn Sie eine Teilkopie benötigen, suchen Sie bitte in unserem Portal nach der Printausgabe dieses Werkes.", + ], ]; - - public function testGetItDefault17() - { - $this->runGetItTest(self::RECORDS, self::RULES); - } } diff --git a/module/finc/tests/selenium/tests/adlr/Getit17ProfessorTest.php b/module/finc/tests/selenium/tests/adlr/Getit17ProfessorTest.php index 8a0166bc839..932b3cef36a 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit17ProfessorTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit17ProfessorTest.php @@ -1,21 +1,17 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** * @group adlr + * @group adlr-getit * @group adlr-getit-17 * @group adlr-getit-professor */ class Getit17ProfessorTest extends AdlrLoginBase { use ProfessorTrait; + use GetitTestBaseTrait; - public function testGetItProfessor17() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit17DefaultTest::RECORDS, Getit17DefaultTest::RULES); - } + public const RECORDS = Getit17DefaultTest::RECORDS; + public const RULES = Getit17DefaultTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit17StudentTest.php b/module/finc/tests/selenium/tests/adlr/Getit17StudentTest.php index 14af504527c..13c4cd10262 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit17StudentTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit17StudentTest.php @@ -1,20 +1,17 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** + * @group adlr + * @group adlr-getit * @group adlr-getit-17 * @group adlr-getit-student */ class Getit17StudentTest extends AdlrLoginBase { use StudentTrait; + use GetitTestBaseTrait; - public function testGetItStudent17() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit17DefaultTest::RECORDS, Getit17DefaultTest::RULES); - } + public const RECORDS = Getit17DefaultTest::RECORDS; + public const RULES = Getit17DefaultTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit18DefaultTest.php b/module/finc/tests/selenium/tests/adlr/Getit18DefaultTest.php index 3e615e1946b..6797c05f6e1 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit18DefaultTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit18DefaultTest.php @@ -3,46 +3,41 @@ namespace Selenium\adlr; /** * @group adlr + * @group adlr-getit * @group adlr-getit-18 * @group adlr-getit-default */ class Getit18DefaultTest extends AdlrBase { + use GetitTestBaseTrait; + public const RECORDS = [ - "/Record/0-1666903302", - "/Record/0-1588294307", - "/Record/0-1040676065", - "/Record/0-1667282492", - "/Record/0-1667362062", - "/Record/finc-117-BV022365028", - "/Record/finc-119-334239729", - "/Record/127-HF000224884", - "/Record/127-HF000224896", + "0-1666903302", + "0-1588294307", + "0-1040676065", + "0-1667282492", + "0-1667362062", + "finc-117-BV022365028", + "finc-119-334239729", + "127-HF000224884", + "127-HF000224896", ]; public const RULES = [ - "test_case_id" => "18", - "desc" => [ - [ - "type" => "text", - "path" => ".getitbox-getit > h4", - "text" => "GET IT", - ], + [ + "type" => "text", + "path" => ".getitbox-getit > h4", + "text" => "GET IT", + ], /* [ - "type" => "text", - "path" => "#get-it-button", - "text" => "LINKS ZUR RESSOURCE", - ],*/ - [ - "type" => "text", - "path" => ".getitbox-notices", - "text" => "Online-Ressourcen können Lizenzen erfordern oder kostenpflichtig sein.", - ], - ] + "type" => "text", + "path" => "#get-it-button", + "text" => "LINKS ZUR RESSOURCE", + ],*/ + [ + "type" => "text", + "path" => ".getitbox-notices", + "text" => "Online-Ressourcen können Lizenzen erfordern oder kostenpflichtig sein.", + ], ]; - - public function testGetItDefault18() - { - $this->runGetItTest(self::RECORDS, self::RULES); - } } diff --git a/module/finc/tests/selenium/tests/adlr/Getit18ProfessorTest.php b/module/finc/tests/selenium/tests/adlr/Getit18ProfessorTest.php index 2273c316460..26669da1a69 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit18ProfessorTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit18ProfessorTest.php @@ -1,21 +1,17 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** * @group adlr + * @group adlr-getit * @group adlr-getit-18 * @group adlr-getit-professor */ class Getit18ProfessorTest extends AdlrLoginBase { use ProfessorTrait; + use GetitTestBaseTrait; - public function testGetItProfessor18() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit18DefaultTest::RECORDS, Getit18DefaultTest::RULES); - } + public const RECORDS = Getit18DefaultTest::RECORDS; + public const RULES = Getit18DefaultTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit18StudentTest.php b/module/finc/tests/selenium/tests/adlr/Getit18StudentTest.php index 3391a54b8fb..4d91f2e341e 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit18StudentTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit18StudentTest.php @@ -1,20 +1,17 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** + * @group adlr + * @group adlr-getit * @group adlr-getit-18 * @group adlr-getit-student */ class Getit18StudentTest extends AdlrLoginBase { use StudentTrait; + use GetitTestBaseTrait; - public function testGetItStudent18() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit18DefaultTest::RECORDS, Getit18DefaultTest::RULES); - } + public const RECORDS = Getit18DefaultTest::RECORDS; + public const RULES = Getit18DefaultTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit19DefaultTest.php b/module/finc/tests/selenium/tests/adlr/Getit19DefaultTest.php index 78f549ee0c5..5b9aaa1b3bc 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit19DefaultTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit19DefaultTest.php @@ -3,39 +3,34 @@ namespace Selenium\adlr; /** * @group adlr + * @group adlr-getit * @group adlr-getit-19 * @group adlr-getit-default */ class Getit19DefaultTest extends AdlrBase { + use GetitTestBaseTrait; + public const RECORDS = [ - "/Record/0-478507879" + "0-478507879" ]; public const RULES = [ - "test_case_id" => "19", - "desc" => [ - [ - "type" => "text", - "path" => ".getitbox-getit > h4", - "text" => "GET IT", - ], - [ - "type" => "text", - "path" => "#get-it-button", - "text" => "LINKS ZUR RESSOURCE", - ], - [ - "type" => "text", - "path" => ".getitbox-notices", - "text" => - "Online-Ressourcen können Lizenzen erfordern oder kostenpflichtig sein.", - ], - ] + [ + "type" => "text", + "path" => ".getitbox-getit > h4", + "text" => "GET IT", + ], + [ + "type" => "text", + "path" => "#get-it-button", + "text" => "LINKS ZUR RESSOURCE", + ], + [ + "type" => "text", + "path" => ".getitbox-notices", + "text" => + "Online-Ressourcen können Lizenzen erfordern oder kostenpflichtig sein.", + ], ]; - - public function testGetItDefault19() - { - $this->runGetItTest(self::RECORDS, self::RULES); - } } diff --git a/module/finc/tests/selenium/tests/adlr/Getit19ProfessorTest.php b/module/finc/tests/selenium/tests/adlr/Getit19ProfessorTest.php index 95b447e8875..f22436d7f58 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit19ProfessorTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit19ProfessorTest.php @@ -1,21 +1,17 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** * @group adlr + * @group adlr-getit * @group adlr-getit-19 * @group adlr-getit-professor */ class Getit19ProfessorTest extends AdlrLoginBase { use ProfessorTrait; + use GetitTestBaseTrait; - public function testGetItProfessor19() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit19DefaultTest::RECORDS, Getit19DefaultTest::RULES); - } + public const RECORDS = Getit19DefaultTest::RECORDS; + public const RULES = Getit19DefaultTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/Getit19StudentTest.php b/module/finc/tests/selenium/tests/adlr/Getit19StudentTest.php index 168df226ca3..e6827c15ba0 100755 --- a/module/finc/tests/selenium/tests/adlr/Getit19StudentTest.php +++ b/module/finc/tests/selenium/tests/adlr/Getit19StudentTest.php @@ -1,20 +1,17 @@ <?php namespace Selenium\adlr; -use Lmc\Steward\Test\AbstractTestCase; - /** + * @group adlr + * @group adlr-getit * @group adlr-getit-19 * @group adlr-getit-professor */ class Getit19StudentTest extends AdlrLoginBase { use StudentTrait; + use GetitTestBaseTrait; - public function testGetItStudent19() - { - $this->logout(); - $this->assertTrue($this->login("{$this->getUserName()}@adlr.link", $this->getPassword())); - $this->runGetItTest(Getit19DefaultTest::RECORDS, Getit19DefaultTest::RULES); - } + public const RECORDS = Getit19DefaultTest::RECORDS; + public const RULES = Getit19DefaultTest::RULES; } diff --git a/module/finc/tests/selenium/tests/adlr/GetitTestBaseTrait.php b/module/finc/tests/selenium/tests/adlr/GetitTestBaseTrait.php new file mode 100755 index 00000000000..05cbdf5969b --- /dev/null +++ b/module/finc/tests/selenium/tests/adlr/GetitTestBaseTrait.php @@ -0,0 +1,111 @@ +<?php +namespace Selenium\adlr; + +use Facebook\WebDriver\WebDriverBy; +use Facebook\WebDriver\WebDriverExpectedCondition; + +trait GetitTestBaseTrait +{ + /* + * open record url and test each rule set + */ + public function runGetItRecord($record): void + { + $this->log("object id of webdriver: " . spl_object_id($this->wd)); + $this->wd->get(self::$host . self::$port . '/Record/' . $record); + $this->wd->takeScreenshot("logs/adlr/info{$record}" . ($this->user ? '-' . $this->user : '') . ".png"); + + foreach (self::RULES ?? [] as $rule) { + if ($rule["waitForClass"]) { + $this->waitForClass($rule["waitForClass"], true); + } + if ($rule["waitForId"]) { + $this->waitForId($rule["waitForId"], true); + } + if ($rule["waitForLinkText"]) { + $this->waitForLinkText($rule["waitForLinkText"], true); + } + if ($rule["wait"]) { + try { + $this->wd->wait(5, 5000)->until( + WebDriverExpectedCondition::elementTextContains( + WebDriverBy::className($rule["wait"]), + $rule["text"] + ) + ); + } catch (\Facebook\WebDriver\Exception\NoSuchElementException $x) { + $this->log("Timeout for $record when fething {$rule["wait"]}."); + } + } + try { + $value = $this->findByCss($rule["path"])->getText(); + } catch (\Facebook\WebDriver\Exception\NoSuchElementException $x) { + $value = false; + } + switch ($rule["type"] ?? '') { + case 'text': + $this->assertEqualsIgnoringCase( + $rule["text"], + $value, + $rule["path"] . ($value === false ? " does not exists" : " is '" . $value . "' ") + . ", but should be '" . $rule["text"] . "'" + ); + break; + case 'contains': + $this->assertStringContainsStringIgnoringCase( + $rule["text"], + $value, + $record . ": " . + $rule["path"] . ($value === false ? " does not exists" : " is '" . $value . "' ") + . ", but should contain '" . $rule["text"] . "'" + ); + break; + case 'anti-exi': + $this->assertNotEqualsIgnoringCase( + $rule["text"], + $value, + $rule["path"] . " must not be equals to '" . $rule["text"] . "'" + ); + break; + } + } + } + + /* + * prepare records to fit in data provider array foramt + * test function iteself needs to be annotated by: @dataProvider provideRecords + * + * php unit test data provider: + * https://blog.martinhujer.cz/how-to-use-data-providers-in-phpunit/ + */ + public function provideRecords() + { + $data = []; + foreach (self::RECORDS as $record) { + $data[$record] = [$record]; + } + return $data; + /* $data will looks like: + * [ + * 'finc-87-14159' => ["finc-87-14159"], + * '0-1027717349' => ["0-1027717349"] + * ] + */ + } + + /** + * @dataProvider provideRecords + */ + public function testRecord($record) : void + { + $this->runGetItRecord($record); + } + + protected function setUp(): void + { + AdlrBase::setUp(); + if (method_exists($this, 'login')) { + $this->login("{$this->getUserName()}@adlr.link", $this->getPassword()); + } + } +} diff --git a/module/finc/tests/selenium/tests/adlr/Login.php b/module/finc/tests/selenium/tests/adlr/Login.php index 327aef76e55..6a7a6a93427 100644 --- a/module/finc/tests/selenium/tests/adlr/Login.php +++ b/module/finc/tests/selenium/tests/adlr/Login.php @@ -1,7 +1,9 @@ <?php namespace Selenium\adlr; + interface Login { public function getUserName(); + public function getPassword(); -} \ No newline at end of file +} -- GitLab