-
Notifications
You must be signed in to change notification settings - Fork 87
/
Emulator.php
198 lines (174 loc) · 4.06 KB
/
Emulator.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<?php
namespace Laracasts\Integrated;
interface Emulator
{
/**
* Make a GET request to the given page.
*
* @param string $page
* @return static
*/
public function visit($page);
/**
* Search the DOM for the given text.
*
* @param string $text
* @return static
*/
public function see($text);
/**
* Ensure that the DOM does not contain the given text.
*
* @param string $text
* @return static
*/
public function notSee($text);
/**
* Assert that the page uri is.
*
* @param string $page
* @return static
*/
public function seePageIs($page);
/**
* Assert that the page uri does not match the given uri.
*
* @param string $page
* @return static
*/
public function notSeePageIs($page);
/**
* Assert that the current page is...
*
* @param string $page
* @return static
*/
public function onPage($page);
/**
* Click a link with the given body.
*
* @param string $text
* @return static
*/
public function click($text);
/**
* Alias that points to the click method.
*
* @param string $text
* @return static
*/
public function follow($text);
/**
* Submit a form on the page.
*
* @param string $buttonText
* @param array|null $formData
* @return static
*/
public function submitForm($buttonText, $formData = null);
/**
* Press the form submit button with the given text.
*
* @param string $buttonText
* @return static
*/
public function press($buttonText);
/**
* Fill in an input with the given text.
*
* @param string $text
* @param string $element
* @return static
*/
public function type($text, $element);
/**
* Conveience method that defers to type method.
*
* @param string $text
* @param string $element
* @return static
*/
public function fill($text, $element);
/**
* Check a checkbox.
*
* @param string $element
* @return static
*/
public function check($element);
/**
* Alias that defers to check method.
*
* @param string $element
* @return static
*/
public function tick($element);
/**
* Select an option from a dropdown.
*
* @param string $element
* @param string $option
* @return static
*/
public function select($element, $option);
/**
* Attach a file to a form.
*
* @param string $element
* @param string $absolutePath
* @return static
*/
public function attachFile($element, $absolutePath);
/**
* Ensure that the given file exists.
*
* @param string $path
* @return static
*/
public function seeFile($path);
/**
* Ensure that the given file does not exist.
*
* @param string $path
* @return static
*/
public function notSeeFile($path);
/**
* Ensure that a database table contains a row with the given data.
*
* @param string $table
* @param array $data
* @return static
*/
public function seeInDatabase($table, array $data);
/**
* Ensure that a database table does not contain a row with the given data.
*
* @param string $table
* @param array $data
* @return static
*/
public function notSeeInDatabase($table, array $data);
/**
* Convenience method that defers to seeInDatabase.
*
* @param string $table
* @param array $data
* @return static
*/
public function verifyInDatabase($table, array $data);
/**
* Convenience method that defers to notSeeInDatabase.
*
* @param string $table
* @param array $data
* @return static
*/
public function notVerifyInDatabase($table, array $data);
/**
* Dump the response content from the last request to the console.
*
* @return void
*/
public function dump();
}