Thursday, April 13, 2017

Laravel functional testing ajax control

In laravel 5.4, I can see that there are methods such as:

$browser->pause(1000);
$browser->waitFor('.selector');
$browser->waitForLink('Create');

But I don't see these in Laravel 5.3.

We have two chained select boxes where second select box values are loaded through ajax based on selection from first select box. The problem is that when we run test, laravel doesn't wait for second selectbox/ajax to load which makes the test fail because it could not select any value from second select box.

$this->visit('/department');
$this->select('1', 'country_id');
$this->select('1', 'region_id'); // problem here
// rest of code

I also tried using sleep() but it didn't work.

Any idea of how to functional test such scenario in 5.3 please ? Thanks



via dev02

Advertisement