1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace BeyondCode\DuskDashboard\Dusk\Concerns; |
4
|
|
|
|
5
|
|
|
trait InteractsWithElements |
6
|
|
|
{ |
7
|
|
|
/** {@inheritdoc} */ |
8
|
|
|
public function elements($selector) |
9
|
|
|
{ |
10
|
|
|
$this->actionCollector->collect(__FUNCTION__, func_get_args(), $this); |
|
|
|
|
11
|
|
|
|
12
|
|
|
return parent::elements($selector); |
13
|
|
|
} |
14
|
|
|
|
15
|
|
|
/** {@inheritdoc} */ |
16
|
|
|
public function element($selector) |
17
|
|
|
{ |
18
|
|
|
$this->actionCollector->collect(__FUNCTION__, func_get_args(), $this); |
19
|
|
|
|
20
|
|
|
return parent::element($selector); |
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
/** {@inheritdoc} */ |
24
|
|
View Code Duplication |
public function clickLink($link, $element = 'a') |
|
|
|
|
25
|
|
|
{ |
26
|
|
|
$previousHtml = $this->getCurrentPageSource(); |
|
|
|
|
27
|
|
|
|
28
|
|
|
$browser = parent::clickLink($link, $element); |
29
|
|
|
|
30
|
|
|
$this->actionCollector->collect(__FUNCTION__, func_get_args(), $this, $previousHtml); |
31
|
|
|
|
32
|
|
|
return $browser; |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** {@inheritdoc} */ |
36
|
|
|
public function value($selector, $value = null) |
37
|
|
|
{ |
38
|
|
|
$this->actionCollector->collect(__FUNCTION__, func_get_args(), $this); |
39
|
|
|
|
40
|
|
|
return parent::value($selector, $value); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** {@inheritdoc} */ |
44
|
|
|
public function text($selector) |
45
|
|
|
{ |
46
|
|
|
$this->actionCollector->collect(__FUNCTION__, func_get_args(), $this); |
47
|
|
|
|
48
|
|
|
return parent::text($selector); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** {@inheritdoc} */ |
52
|
|
|
public function attribute($selector, $attribute) |
53
|
|
|
{ |
54
|
|
|
$this->actionCollector->collect(__FUNCTION__, func_get_args(), $this); |
55
|
|
|
|
56
|
|
|
return parent::attribute($selector, $attribute); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** {@inheritdoc} */ |
60
|
|
View Code Duplication |
public function keys($selector, ...$keys) |
|
|
|
|
61
|
|
|
{ |
62
|
|
|
$previousHtml = $this->getCurrentPageSource(); |
|
|
|
|
63
|
|
|
|
64
|
|
|
$browser = parent::keys($selector, $keys); |
65
|
|
|
|
66
|
|
|
$this->actionCollector->collect(__FUNCTION__, func_get_args(), $this, $previousHtml); |
67
|
|
|
|
68
|
|
|
return $browser; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** {@inheritdoc} */ |
72
|
|
View Code Duplication |
public function type($field, $value) |
|
|
|
|
73
|
|
|
{ |
74
|
|
|
$previousHtml = $this->getCurrentPageSource(); |
|
|
|
|
75
|
|
|
|
76
|
|
|
$browser = parent::type($field, $value); |
77
|
|
|
|
78
|
|
|
$this->actionCollector->collect(__FUNCTION__, func_get_args(), $this, $previousHtml); |
79
|
|
|
|
80
|
|
|
return $browser; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** {@inheritdoc} */ |
84
|
|
View Code Duplication |
public function append($field, $value) |
|
|
|
|
85
|
|
|
{ |
86
|
|
|
$previousHtml = $this->getCurrentPageSource(); |
|
|
|
|
87
|
|
|
|
88
|
|
|
$browser = parent::append($field, $value); |
89
|
|
|
|
90
|
|
|
$this->actionCollector->collect(__FUNCTION__, func_get_args(), $this, $previousHtml); |
91
|
|
|
|
92
|
|
|
return $browser; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** {@inheritdoc} */ |
96
|
|
View Code Duplication |
public function clear($field) |
|
|
|
|
97
|
|
|
{ |
98
|
|
|
$previousHtml = $this->getCurrentPageSource(); |
|
|
|
|
99
|
|
|
|
100
|
|
|
$browser = parent::clear($field); |
101
|
|
|
|
102
|
|
|
$this->actionCollector->collect(__FUNCTION__, func_get_args(), $this, $previousHtml); |
103
|
|
|
|
104
|
|
|
return $browser; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** {@inheritdoc} */ |
108
|
|
View Code Duplication |
public function select($field, $value = null) |
|
|
|
|
109
|
|
|
{ |
110
|
|
|
$previousHtml = $this->getCurrentPageSource(); |
|
|
|
|
111
|
|
|
|
112
|
|
|
$browser = parent::select($field, $value); |
113
|
|
|
|
114
|
|
|
$this->actionCollector->collect(__FUNCTION__, func_get_args(), $this, $previousHtml); |
115
|
|
|
|
116
|
|
|
return $browser; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** {@inheritdoc} */ |
120
|
|
View Code Duplication |
public function radio($field, $value) |
|
|
|
|
121
|
|
|
{ |
122
|
|
|
$previousHtml = $this->getCurrentPageSource(); |
|
|
|
|
123
|
|
|
|
124
|
|
|
$browser = parent::radio($field, $value); |
125
|
|
|
|
126
|
|
|
$this->actionCollector->collect(__FUNCTION__, func_get_args(), $this, $previousHtml); |
127
|
|
|
|
128
|
|
|
return $browser; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** {@inheritdoc} */ |
132
|
|
View Code Duplication |
public function check($field, $value = null) |
|
|
|
|
133
|
|
|
{ |
134
|
|
|
$previousHtml = $this->getCurrentPageSource(); |
|
|
|
|
135
|
|
|
|
136
|
|
|
$browser = parent::check($field, $value); |
137
|
|
|
|
138
|
|
|
$this->actionCollector->collect(__FUNCTION__, func_get_args(), $this, $previousHtml); |
139
|
|
|
|
140
|
|
|
return $browser; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** {@inheritdoc} */ |
144
|
|
View Code Duplication |
public function uncheck($field, $value = null) |
|
|
|
|
145
|
|
|
{ |
146
|
|
|
$previousHtml = $this->getCurrentPageSource(); |
|
|
|
|
147
|
|
|
|
148
|
|
|
$browser = parent::uncheck($field, $value); |
149
|
|
|
|
150
|
|
|
$this->actionCollector->collect(__FUNCTION__, func_get_args(), $this, $previousHtml); |
151
|
|
|
|
152
|
|
|
return $browser; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** {@inheritdoc} */ |
156
|
|
View Code Duplication |
public function attach($field, $path) |
|
|
|
|
157
|
|
|
{ |
158
|
|
|
$previousHtml = $this->getCurrentPageSource(); |
|
|
|
|
159
|
|
|
|
160
|
|
|
$browser = parent::attach($field, $path); |
161
|
|
|
|
162
|
|
|
$this->actionCollector->collect(__FUNCTION__, func_get_args(), $this, $previousHtml); |
163
|
|
|
|
164
|
|
|
return $browser; |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
/** {@inheritdoc} */ |
168
|
|
View Code Duplication |
public function press($button) |
|
|
|
|
169
|
|
|
{ |
170
|
|
|
$previousHtml = $this->getCurrentPageSource(); |
|
|
|
|
171
|
|
|
|
172
|
|
|
$browser = parent::press($button); |
173
|
|
|
|
174
|
|
|
$this->actionCollector->collect(__FUNCTION__, func_get_args(), $this, $previousHtml); |
175
|
|
|
|
176
|
|
|
return $browser; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
/** {@inheritdoc} */ |
180
|
|
View Code Duplication |
public function pressAndWaitFor($button, $seconds = 5) |
|
|
|
|
181
|
|
|
{ |
182
|
|
|
$previousHtml = $this->getCurrentPageSource(); |
|
|
|
|
183
|
|
|
|
184
|
|
|
$browser = parent::pressAndWaitFor($button, $seconds); |
185
|
|
|
|
186
|
|
|
$this->actionCollector->collect(__FUNCTION__, func_get_args(), $this, $previousHtml); |
187
|
|
|
|
188
|
|
|
return $browser; |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
/** {@inheritdoc} */ |
192
|
|
View Code Duplication |
public function drag($from, $to) |
|
|
|
|
193
|
|
|
{ |
194
|
|
|
$previousHtml = $this->getCurrentPageSource(); |
|
|
|
|
195
|
|
|
|
196
|
|
|
$browser = parent::drag($from, $to); |
197
|
|
|
|
198
|
|
|
$this->actionCollector->collect(__FUNCTION__, func_get_args(), $this, $previousHtml); |
199
|
|
|
|
200
|
|
|
return $browser; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** {@inheritdoc} */ |
204
|
|
View Code Duplication |
public function dragUp($selector, $offset) |
|
|
|
|
205
|
|
|
{ |
206
|
|
|
$previousHtml = $this->getCurrentPageSource(); |
|
|
|
|
207
|
|
|
|
208
|
|
|
$browser = parent::dragUp($selector, $offset); |
209
|
|
|
|
210
|
|
|
$this->actionCollector->collect(__FUNCTION__, func_get_args(), $this, $previousHtml); |
211
|
|
|
|
212
|
|
|
return $browser; |
213
|
|
|
} |
214
|
|
|
|
215
|
|
|
/** {@inheritdoc} */ |
216
|
|
View Code Duplication |
public function dragDown($selector, $offset) |
|
|
|
|
217
|
|
|
{ |
218
|
|
|
$previousHtml = $this->getCurrentPageSource(); |
|
|
|
|
219
|
|
|
|
220
|
|
|
$browser = parent::dragDown($selector, $offset); |
221
|
|
|
|
222
|
|
|
$this->actionCollector->collect(__FUNCTION__, func_get_args(), $this, $previousHtml); |
223
|
|
|
|
224
|
|
|
return $browser; |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
/** {@inheritdoc} */ |
228
|
|
View Code Duplication |
public function dragLeft($selector, $offset) |
|
|
|
|
229
|
|
|
{ |
230
|
|
|
$previousHtml = $this->getCurrentPageSource(); |
|
|
|
|
231
|
|
|
|
232
|
|
|
$browser = parent::dragLeft($selector, $offset); |
233
|
|
|
|
234
|
|
|
$this->actionCollector->collect(__FUNCTION__, func_get_args(), $this, $previousHtml); |
235
|
|
|
|
236
|
|
|
return $browser; |
237
|
|
|
} |
238
|
|
|
|
239
|
|
|
/** {@inheritdoc} */ |
240
|
|
View Code Duplication |
public function dragRight($selector, $offset) |
|
|
|
|
241
|
|
|
{ |
242
|
|
|
$previousHtml = $this->getCurrentPageSource(); |
|
|
|
|
243
|
|
|
|
244
|
|
|
$browser = parent::dragRight($selector, $offset); |
245
|
|
|
|
246
|
|
|
$this->actionCollector->collect(__FUNCTION__, func_get_args(), $this, $previousHtml); |
247
|
|
|
|
248
|
|
|
return $browser; |
249
|
|
|
} |
250
|
|
|
|
251
|
|
|
/** {@inheritdoc} */ |
252
|
|
View Code Duplication |
public function dragOffset($selector, $x = 0, $y = 0) |
|
|
|
|
253
|
|
|
{ |
254
|
|
|
$previousHtml = $this->getCurrentPageSource(); |
|
|
|
|
255
|
|
|
|
256
|
|
|
$browser = parent::dragOffset($selector, $x, $y); |
257
|
|
|
|
258
|
|
|
$this->actionCollector->collect(__FUNCTION__, func_get_args(), $this, $previousHtml); |
259
|
|
|
|
260
|
|
|
return $browser; |
261
|
|
|
} |
262
|
|
|
|
263
|
|
|
/** {@inheritdoc} */ |
264
|
|
|
public function acceptDialog() |
265
|
|
|
{ |
266
|
|
|
$browser = parent::acceptDialog(); |
267
|
|
|
|
268
|
|
|
$this->actionCollector->collect(__FUNCTION__, func_get_args(), $this); |
269
|
|
|
|
270
|
|
|
return $browser; |
271
|
|
|
} |
272
|
|
|
|
273
|
|
|
/** {@inheritdoc} */ |
274
|
|
|
public function typeInDialog($value) |
275
|
|
|
{ |
276
|
|
|
$browser = parent::typeInDialog($value); |
277
|
|
|
|
278
|
|
|
$this->actionCollector->collect(__FUNCTION__, func_get_args(), $this); |
279
|
|
|
|
280
|
|
|
return $browser; |
281
|
|
|
} |
282
|
|
|
|
283
|
|
|
/** {@inheritdoc} */ |
284
|
|
|
public function dismissDialog() |
285
|
|
|
{ |
286
|
|
|
$browser = parent::dismissDialog(); |
287
|
|
|
|
288
|
|
|
$this->actionCollector->collect(__FUNCTION__, func_get_args(), $this); |
289
|
|
|
|
290
|
|
|
return $browser; |
291
|
|
|
} |
292
|
|
|
} |
293
|
|
|
|
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: