| @@ 49-56 (lines=8) @@ | ||
| 46 | * @throws \Exception |
|
| 47 | * If region or button within it cannot be found. |
|
| 48 | */ |
|
| 49 | public function assertRegionButton($button, $region) { |
|
| 50 | $regionObj = $this->getRegion($region); |
|
| 51 | ||
| 52 | $buttonObj = $regionObj->findButton($button); |
|
| 53 | if (empty($buttonObj)) { |
|
| 54 | throw new \Exception(sprintf("The button '%s' was not found in the region '%s' on the page %s", $button, $region, $this->getSession()->getCurrentUrl())); |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||
| 58 | /** |
|
| 59 | * @Then I( should) see the :tag element in the :region( region) |
|
| @@ 61-68 (lines=8) @@ | ||
| 58 | /** |
|
| 59 | * @Then I( should) see the :tag element in the :region( region) |
|
| 60 | */ |
|
| 61 | public function assertRegionElement($tag, $region) { |
|
| 62 | $regionObj = $this->getRegion($region); |
|
| 63 | $elements = $regionObj->findAll('css', $tag); |
|
| 64 | if (!empty($elements)) { |
|
| 65 | return; |
|
| 66 | } |
|
| 67 | throw new \Exception(sprintf('The element "%s" was not found in the "%s" region on the page %s', $tag, $region, $this->getSession()->getCurrentUrl())); |
|
| 68 | } |
|
| 69 | ||
| 70 | /** |
|
| 71 | * @Then I( should) not see the :tag element in the :region( region) |
|
| @@ 73-79 (lines=7) @@ | ||
| 70 | /** |
|
| 71 | * @Then I( should) not see the :tag element in the :region( region) |
|
| 72 | */ |
|
| 73 | public function assertNotRegionElement($tag, $region) { |
|
| 74 | $regionObj = $this->getRegion($region); |
|
| 75 | $result = $regionObj->findAll('css', $tag); |
|
| 76 | if (!empty($result)) { |
|
| 77 | throw new \Exception(sprintf('The element "%s" was found in the "%s" region on the page %s', $tag, $region, $this->getSession()->getCurrentUrl())); |
|
| 78 | } |
|
| 79 | } |
|
| 80 | ||
| 81 | /** |
|
| 82 | * @Then I( should) not see :text in the :tag element in the :region( region) |
|
| @@ 303-309 (lines=7) @@ | ||
| 300 | * @Then I (should ) see the button :button |
|
| 301 | * @Then I (should ) see the :button button |
|
| 302 | */ |
|
| 303 | public function assertButton($button) { |
|
| 304 | $element = $this->getSession()->getPage(); |
|
| 305 | $buttonObj = $element->findButton($button); |
|
| 306 | if (empty($buttonObj)) { |
|
| 307 | throw new \Exception(sprintf("The button '%s' was not found on the page %s", $button, $this->getSession()->getCurrentUrl())); |
|
| 308 | } |
|
| 309 | } |
|
| 310 | ||
| 311 | /** |
|
| 312 | * @Then I should not see the button :button |
|
| @@ 315-321 (lines=7) @@ | ||
| 312 | * @Then I should not see the button :button |
|
| 313 | * @Then I should not see the :button button |
|
| 314 | */ |
|
| 315 | public function assertNotButton($button) { |
|
| 316 | $element = $this->getSession()->getPage(); |
|
| 317 | $buttonObj = $element->findButton($button); |
|
| 318 | if (!empty($buttonObj)) { |
|
| 319 | throw new \Exception(sprintf("The button '%s' was found on the page %s", $button, $this->getSession()->getCurrentUrl())); |
|
| 320 | } |
|
| 321 | } |
|
| 322 | ||
| 323 | /** |
|
| 324 | * @When I follow/click :link in the :region( region) |
|
| @@ 329-338 (lines=10) @@ | ||
| 326 | * @throws \Exception |
|
| 327 | * If region or link within it cannot be found. |
|
| 328 | */ |
|
| 329 | public function assertRegionLinkFollow($link, $region) { |
|
| 330 | $regionObj = $this->getRegion($region); |
|
| 331 | ||
| 332 | // Find the link within the region |
|
| 333 | $linkObj = $regionObj->findLink($link); |
|
| 334 | if (empty($linkObj)) { |
|
| 335 | throw new \Exception(sprintf('The link "%s" was not found in the region "%s" on the page %s', $link, $region, $this->getSession()->getCurrentUrl())); |
|
| 336 | } |
|
| 337 | $linkObj->click(); |
|
| 338 | } |
|
| 339 | ||
| 340 | /** |
|
| 341 | * Checks, if a button with id|name|title|alt|value exists or not and pressess the same |
|
| @@ 353-361 (lines=9) @@ | ||
| 350 | * @throws \Exception |
|
| 351 | * If region or button within it cannot be found. |
|
| 352 | */ |
|
| 353 | public function assertRegionPressButton($button, $region) { |
|
| 354 | $regionObj = $this->getRegion($region); |
|
| 355 | ||
| 356 | $buttonObj = $regionObj->findButton($button); |
|
| 357 | if (empty($buttonObj)) { |
|
| 358 | throw new \Exception(sprintf("The button '%s' was not found in the region '%s' on the page %s", $button, $region, $this->getSession()->getCurrentUrl())); |
|
| 359 | } |
|
| 360 | $regionObj->pressButton($button); |
|
| 361 | } |
|
| 362 | ||
| 363 | /** |
|
| 364 | * Fills in a form field with id|name|title|alt|value in the specified region. |
|
| @@ 411-418 (lines=8) @@ | ||
| 408 | * @throws \Exception |
|
| 409 | * If region or link within it cannot be found. |
|
| 410 | */ |
|
| 411 | public function assertLinkRegion($link, $region) { |
|
| 412 | $regionObj = $this->getRegion($region); |
|
| 413 | ||
| 414 | $result = $regionObj->findLink($link); |
|
| 415 | if (empty($result)) { |
|
| 416 | throw new \Exception(sprintf('No link to "%s" in the "%s" region on the page %s', $link, $region, $this->getSession()->getCurrentUrl())); |
|
| 417 | } |
|
| 418 | } |
|
| 419 | ||
| 420 | /** |
|
| 421 | * @Then I should not see the link :link in the :region( region) |
|
| @@ 426-433 (lines=8) @@ | ||
| 423 | * @throws \Exception |
|
| 424 | * If region or link within it cannot be found. |
|
| 425 | */ |
|
| 426 | public function assertNotLinkRegion($link, $region) { |
|
| 427 | $regionObj = $this->getRegion($region); |
|
| 428 | ||
| 429 | $result = $regionObj->findLink($link); |
|
| 430 | if (!empty($result)) { |
|
| 431 | throw new \Exception(sprintf('Link to "%s" in the "%s" region on the page %s', $link, $region, $this->getSession()->getCurrentUrl())); |
|
| 432 | } |
|
| 433 | } |
|
| 434 | ||
| 435 | /** |
|
| 436 | * @Then I should see( the text) :text in the :region( region) |
|
| @@ 441-449 (lines=9) @@ | ||
| 438 | * @throws \Exception |
|
| 439 | * If region or text within it cannot be found. |
|
| 440 | */ |
|
| 441 | public function assertRegionText($text, $region) { |
|
| 442 | $regionObj = $this->getRegion($region); |
|
| 443 | ||
| 444 | // Find the text within the region |
|
| 445 | $regionText = $regionObj->getText(); |
|
| 446 | if (strpos($regionText, $text) === FALSE) { |
|
| 447 | throw new \Exception(sprintf("The text '%s' was not found in the region '%s' on the page %s", $text, $region, $this->getSession()->getCurrentUrl())); |
|
| 448 | } |
|
| 449 | } |
|
| 450 | ||
| 451 | /** |
|
| 452 | * @Then I should not see( the text) :text in the :region( region) |
|
| @@ 457-465 (lines=9) @@ | ||
| 454 | * @throws \Exception |
|
| 455 | * If region or text within it cannot be found. |
|
| 456 | */ |
|
| 457 | public function assertNotRegionText($text, $region) { |
|
| 458 | $regionObj = $this->getRegion($region); |
|
| 459 | ||
| 460 | // Find the text within the region. |
|
| 461 | $regionText = $regionObj->getText(); |
|
| 462 | if (strpos($regionText, $text) !== FALSE) { |
|
| 463 | throw new \Exception(sprintf('The text "%s" was found in the region "%s" on the page %s', $text, $region, $this->getSession()->getCurrentUrl())); |
|
| 464 | } |
|
| 465 | } |
|
| 466 | ||
| 467 | /** |
|
| 468 | * @Then I (should )see the text :text |
|