@@ -195,6 +195,24 @@ public function test_wait_until_missing()
195
195
$ browser ->waitUntilMissing ('foo ' );
196
196
}
197
197
198
+ public function test_wait_until_missing_text_failure_message_containing_a_percent_character ()
199
+ {
200
+ $ element = m::mock (stdClass::class);
201
+ $ element ->shouldReceive ('getText ' )->andReturn ('Discount: 20% ' );
202
+
203
+ $ resolver = m::mock (stdClass::class);
204
+ $ resolver ->shouldReceive ('findOrFail ' )->with ('' )->andReturn ($ element );
205
+
206
+ $ browser = new Browser (new stdClass , $ resolver );
207
+
208
+ try {
209
+ $ browser ->waitUntilMissingText ('Discount: 20% ' , 1 );
210
+ $ this ->fail ('waitUntilMissingText() did not timeout. ' );
211
+ } catch (TimeOutException $ e ) {
212
+ $ this ->assertSame ('Waited 1 seconds for removal of text [Discount: 20%]. ' , $ e ->getMessage ());
213
+ }
214
+ }
215
+
198
216
public function test_wait_for_text_failure_message_containing_a_percent_character ()
199
217
{
200
218
$ element = m::mock (stdClass::class);
@@ -213,6 +231,57 @@ public function test_wait_for_text_failure_message_containing_a_percent_characte
213
231
}
214
232
}
215
233
234
+ public function test_wait_for_text_in_failure_message_containing_a_percent_character ()
235
+ {
236
+ $ element = m::mock (stdClass::class);
237
+ $ element ->shouldReceive ('getText ' )->andReturn ('Discount: None ' );
238
+
239
+ $ resolver = m::mock (stdClass::class);
240
+ $ resolver ->shouldReceive ('format ' )->with ('foo ' )->andReturn ('body foo ' );
241
+ $ resolver ->shouldReceive ('findOrFail ' )->with ('foo ' )->andReturn ($ element );
242
+
243
+ $ browser = new Browser (new stdClass , $ resolver );
244
+
245
+ try {
246
+ $ browser ->waitForTextIn ('foo ' , 'Discount: 20% ' , 1 );
247
+ $ this ->fail ('waitForTextIn() did not timeout. ' );
248
+ } catch (TimeOutException $ e ) {
249
+ $ this ->assertSame ('Waited 1 seconds for text "Discount: 20%" in selector foo ' , $ e ->getMessage ());
250
+ }
251
+ }
252
+
253
+ public function test_wait_for_link_failure_message_containing_a_percent_character ()
254
+ {
255
+ $ driver = m::mock (stdClass::class);
256
+ $ driver ->shouldReceive ('executeScript ' )
257
+ ->andReturnFalse ();
258
+
259
+ $ browser = new Browser ($ driver );
260
+
261
+ try {
262
+ $ browser ->waitForLink ('https://laravel.com?q=foo%20bar ' , 1 );
263
+ $ this ->fail ('waitForLink() did not timeout. ' );
264
+ } catch (TimeOutException $ e ) {
265
+ $ this ->assertSame ('Waited 1 seconds for link [https://laravel.com?q=foo%20bar]. ' , $ e ->getMessage ());
266
+ }
267
+ }
268
+
269
+ public function test_wait_for_location_failure_message_containing_a_percent_character ()
270
+ {
271
+ $ driver = m::mock (stdClass::class);
272
+ $ driver ->shouldReceive ('executeScript ' )
273
+ ->andReturnFalse ();
274
+
275
+ $ browser = new Browser ($ driver );
276
+
277
+ try {
278
+ $ browser ->waitForLocation ('https://laravel.com?q=foo%20bar ' , 1 );
279
+ $ this ->fail ('waitForLocation() did not timeout. ' );
280
+ } catch (TimeOutException $ e ) {
281
+ $ this ->assertSame ('Waited 1 seconds for location [https://laravel.com?q=foo%20bar]. ' , $ e ->getMessage ());
282
+ }
283
+ }
284
+
216
285
public function test_wait_for_an_element_to_be_enabled ()
217
286
{
218
287
$ element = m::mock (stdClass::class);
0 commit comments