1 | <?php |
||
15 | class GenericFeatureContext extends MinkContext |
||
16 | { |
||
17 | /** @var int UI generic delay duration in milliseconds */ |
||
18 | const DELAY = 1000; |
||
19 | /** @var int UI javascript generic delay duration in milliseconds */ |
||
20 | const JS_DELAY = self::DELAY / 5; |
||
21 | |||
22 | /** @var mixed */ |
||
23 | protected $session; |
||
24 | |||
25 | /** |
||
26 | * Initializes context. |
||
27 | * |
||
28 | * Every scenario gets its own context instance. |
||
29 | * You can also pass arbitrary arguments to the |
||
30 | * context constructor through behat.yml. |
||
31 | * |
||
32 | * @param mixed $session |
||
33 | */ |
||
34 | public function __construct($session = null) |
||
40 | |||
41 | /** |
||
42 | * @AfterStep |
||
43 | * |
||
44 | * @param AfterStepScope $scope |
||
45 | */ |
||
46 | public function takeScreenShotAfterFailedStep(AfterStepScope $scope) |
||
60 | |||
61 | /** |
||
62 | * Find all elements by CSS selector. |
||
63 | * |
||
64 | * @param string $selector CSS selector |
||
65 | * |
||
66 | * @throws \InvalidArgumentException If element not found |
||
67 | * |
||
68 | * @return \Behat\Mink\Element\NodeElement[] |
||
69 | */ |
||
70 | protected function findAllByCssSelector(string $selector) |
||
83 | |||
84 | /** |
||
85 | * Find element by CSS selector. |
||
86 | * |
||
87 | * @param string $selector CSS selector |
||
88 | * |
||
89 | * @throws \InvalidArgumentException If element not found |
||
90 | * |
||
91 | * @return \Behat\Mink\Element\NodeElement |
||
92 | */ |
||
93 | protected function findByCssSelector(string $selector) : NodeElement |
||
97 | |||
98 | /** |
||
99 | * @Given /^I set browser window size to "([^"]*)" x "([^"]*)"$/ |
||
100 | * |
||
101 | * @param int $width Browser window width |
||
102 | * @param int $height Browser window height |
||
103 | */ |
||
104 | public function iSetBrowserWindowSizeToX($width, $height) |
||
108 | |||
109 | /** |
||
110 | * @Given /^I wait "([^"]*)" milliseconds for response$/ |
||
111 | * |
||
112 | * @param int $delay Amount of milliseconds to wait |
||
113 | */ |
||
114 | public function iWaitMillisecondsForResponse($delay = self::DELAY) |
||
118 | |||
119 | /** |
||
120 | * Click on the element with the provided xpath query. |
||
121 | * |
||
122 | * @When I click on the element :arg1 |
||
123 | * |
||
124 | * @param string $selector CSS element selector |
||
125 | * |
||
126 | * @throws \InvalidArgumentException |
||
127 | */ |
||
128 | public function iClickOnTheElement(string $selector) |
||
133 | |||
134 | /** |
||
135 | * @When /^I hover over the element "([^"]*)"$/ |
||
136 | * |
||
137 | * @param string $selector CSS element selector |
||
138 | * |
||
139 | * @throws \InvalidArgumentException |
||
140 | */ |
||
141 | public function iHoverOverTheElement(string $selector) |
||
145 | |||
146 | /** |
||
147 | * Fill in input with the provided info. |
||
148 | * |
||
149 | * @When I fill in the input :arg1 with :arg2 |
||
150 | * |
||
151 | * @param string $selector CSS element selector |
||
152 | * @param string $value Element value for filling in |
||
153 | * |
||
154 | * @throws \InvalidArgumentException |
||
155 | */ |
||
156 | public function iFillInTheElement(string $selector, string $value) |
||
160 | |||
161 | /** |
||
162 | * @When I scroll vertically to :arg1 px |
||
163 | * |
||
164 | * @param mixed $yPos Vertical scrolling position in pixels |
||
165 | */ |
||
166 | public function iScrollVerticallyToPx($yPos) |
||
170 | |||
171 | /** |
||
172 | * @When I scroll horizontally to :arg1 px |
||
173 | * |
||
174 | * @param mixed $xPos Horizontal scrolling position in pixels |
||
175 | */ |
||
176 | public function iScrollHorizontallyToPx($xPos) |
||
180 | |||
181 | /** |
||
182 | * @Given /^I fill hidden field "([^"]*)" with "([^"]*)"$/ |
||
183 | * |
||
184 | * @param string $field Field name |
||
185 | * @param string $value Field value |
||
186 | */ |
||
187 | public function iFillHiddenFieldWith(string $field, string $value) |
||
194 | |||
195 | /** |
||
196 | * @Then I check custom checkbox with :id |
||
197 | * |
||
198 | * @param string $id Checkbox identifier |
||
199 | * |
||
200 | * @throws \InvalidArgumentException If checkbox with provided identifier does not exists |
||
201 | */ |
||
202 | public function iCheckCustomCheckboxWith(string $id) |
||
215 | |||
216 | /** |
||
217 | * @Then I drag element :selector to :target |
||
218 | * |
||
219 | * @param string $selector Source element for dragging |
||
220 | * @param string $target Target element to drag to |
||
221 | * |
||
222 | * @throws \InvalidArgumentException |
||
223 | */ |
||
224 | public function dragElementTo(string $selector, string $target) |
||
230 | |||
231 | /** |
||
232 | * Fill in input with the provided info |
||
233 | * |
||
234 | * @When I fill in the element :arg1 with value :arg2 using js |
||
235 | * |
||
236 | * @param string $selector CSS element selector |
||
237 | * @param string $value Element value for filling in |
||
238 | */ |
||
239 | public function iFillInTheElementUsingJs(string $selector, string $value) |
||
243 | } |
||
244 |