0
votes

This is my test function

$this->browse(
    function (Browser $browser)
    {
        $browser->visit('/')->clickLink('Login')->value('#mobile', '9790772695')->value('#password', 'password')->check('remember')->click('#login')->assertPathIs('/dashboard');
        for ($i = 0; $i < 1024; $i++) {
            $browser->visit('/invoice/new')->assertPathIs('/invoice/new')->select('#ClientName');
            $browser->driver->executeScript('window.scrollTo(0, 100);');
            $browser->pause(1000)->check('#autoins')->keys('#item_1', 'freak')->keys('.qty', '1')->select('#invoiceStatus', 'paid')->value('#grand', 1251)->value('#amountPaid', 1251)->value('#amountPaid', 1251)->value('#amountDue', 0);
            $browser->driver->executeScript('window.scrollTo(0, 1000);');
            $browser->click('.invoice-save-btn')->pause(3000);
        }
    });

This is the error

1) Tests\Browser\InvoiceTest::testExample ErrorException: array_rand(): Array is empty

C:\xampp\htdocs\agashtyav1\vendor\laravel\dusk\src\Concerns\InteractsWithElemen>ts.php:201 C:\xampp\htdocs\agashtyav1\tests\Browser\InvoiceTest.php:23 C:\xampp\htdocs\agashtyav1\vendor\laravel\dusk\src\TestCase.php:91 C:\xampp\htdocs\agashtyav1\tests\Browser\InvoiceTest.php:29

What is weird is that I don't get any errors if I remove the

->select('#ClientName');

command on line 23.

1

1 Answers

0
votes

The issue is solved. The problem was not with dusk, but with a controller function which populates the drop down list