-
Notifications
You must be signed in to change notification settings - Fork 1
/
FeatureContext.php
48 lines (38 loc) · 1.05 KB
/
FeatureContext.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
namespace Drupal;
use Drupal\DrupalExtension\Context\RawDrupalContext;
use Symfony\Component\Config\Definition\Exception\Exception;
/**
* FeatureContext class defines custom step definitions for Behat.
*/
class FeatureContext extends RawDrupalContext {
/**
* Every scenario gets its own context instance.
*
* You can also pass arbitrary arguments to the
* context constructor through behat.yml.
*/
public function __construct() {
}
/**
* Wait for page to load for 15 seconds.
*
* @Given /^I wait for the page to load$/
*/
public function iWaitForThePageToLoad() {
$this->getSession()->wait(3600000, "document.readyState === 'complete'");
}
/**
* @When /^I click on "([^"]*)" element$/
*/
public function iClickOnElement($css_selector) {
$session = $this->getSession();
$element = $session->getPage()->find("css", $css_selector);
if ($element) {
$element->click();
}
else {
throw new Exception("Element $css_selector not found on " . $session->getCurrentUrl());
}
}
}