| @@ 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 | * @When I follow/click :link in the :region( region) |
|
| @@ 317-326 (lines=10) @@ | ||
| 314 | * @throws \Exception |
|
| 315 | * If region or link within it cannot be found. |
|
| 316 | */ |
|
| 317 | public function assertRegionLinkFollow($link, $region) { |
|
| 318 | $regionObj = $this->getRegion($region); |
|
| 319 | ||
| 320 | // Find the link within the region |
|
| 321 | $linkObj = $regionObj->findLink($link); |
|
| 322 | if (empty($linkObj)) { |
|
| 323 | throw new \Exception(sprintf('The link "%s" was not found in the region "%s" on the page %s', $link, $region, $this->getSession()->getCurrentUrl())); |
|
| 324 | } |
|
| 325 | $linkObj->click(); |
|
| 326 | } |
|
| 327 | ||
| 328 | /** |
|
| 329 | * Checks, if a button with id|name|title|alt|value exists or not and pressess the same |
|
| @@ 341-349 (lines=9) @@ | ||
| 338 | * @throws \Exception |
|
| 339 | * If region or button within it cannot be found. |
|
| 340 | */ |
|
| 341 | public function assertRegionPressButton($button, $region) { |
|
| 342 | $regionObj = $this->getRegion($region); |
|
| 343 | ||
| 344 | $buttonObj = $regionObj->findButton($button); |
|
| 345 | if (empty($buttonObj)) { |
|
| 346 | throw new \Exception(sprintf("The button '%s' was not found in the region '%s' on the page %s", $button, $region, $this->getSession()->getCurrentUrl())); |
|
| 347 | } |
|
| 348 | $regionObj->pressButton($button); |
|
| 349 | } |
|
| 350 | ||
| 351 | /** |
|
| 352 | * Fills in a form field with id|name|title|alt|value in the specified region. |
|
| @@ 399-406 (lines=8) @@ | ||
| 396 | * @throws \Exception |
|
| 397 | * If region or link within it cannot be found. |
|
| 398 | */ |
|
| 399 | public function assertLinkRegion($link, $region) { |
|
| 400 | $regionObj = $this->getRegion($region); |
|
| 401 | ||
| 402 | $result = $regionObj->findLink($link); |
|
| 403 | if (empty($result)) { |
|
| 404 | throw new \Exception(sprintf('No link to "%s" in the "%s" region on the page %s', $link, $region, $this->getSession()->getCurrentUrl())); |
|
| 405 | } |
|
| 406 | } |
|
| 407 | ||
| 408 | /** |
|
| 409 | * @Then I should not see the link :link in the :region( region) |
|
| @@ 414-421 (lines=8) @@ | ||
| 411 | * @throws \Exception |
|
| 412 | * If region or link within it cannot be found. |
|
| 413 | */ |
|
| 414 | public function assertNotLinkRegion($link, $region) { |
|
| 415 | $regionObj = $this->getRegion($region); |
|
| 416 | ||
| 417 | $result = $regionObj->findLink($link); |
|
| 418 | if (!empty($result)) { |
|
| 419 | throw new \Exception(sprintf('Link to "%s" in the "%s" region on the page %s', $link, $region, $this->getSession()->getCurrentUrl())); |
|
| 420 | } |
|
| 421 | } |
|
| 422 | ||
| 423 | /** |
|
| 424 | * @Then I should see( the text) :text in the :region( region) |
|
| @@ 429-437 (lines=9) @@ | ||
| 426 | * @throws \Exception |
|
| 427 | * If region or text within it cannot be found. |
|
| 428 | */ |
|
| 429 | public function assertRegionText($text, $region) { |
|
| 430 | $regionObj = $this->getRegion($region); |
|
| 431 | ||
| 432 | // Find the text within the region |
|
| 433 | $regionText = $regionObj->getText(); |
|
| 434 | if (strpos($regionText, $text) === FALSE) { |
|
| 435 | throw new \Exception(sprintf("The text '%s' was not found in the region '%s' on the page %s", $text, $region, $this->getSession()->getCurrentUrl())); |
|
| 436 | } |
|
| 437 | } |
|
| 438 | ||
| 439 | /** |
|
| 440 | * @Then I should not see( the text) :text in the :region( region) |
|
| @@ 445-453 (lines=9) @@ | ||
| 442 | * @throws \Exception |
|
| 443 | * If region or text within it cannot be found. |
|
| 444 | */ |
|
| 445 | public function assertNotRegionText($text, $region) { |
|
| 446 | $regionObj = $this->getRegion($region); |
|
| 447 | ||
| 448 | // Find the text within the region. |
|
| 449 | $regionText = $regionObj->getText(); |
|
| 450 | if (strpos($regionText, $text) !== FALSE) { |
|
| 451 | throw new \Exception(sprintf('The text "%s" was found in the region "%s" on the page %s', $text, $region, $this->getSession()->getCurrentUrl())); |
|
| 452 | } |
|
| 453 | } |
|
| 454 | ||
| 455 | /** |
|
| 456 | * @Then I (should )see the text :text |
|