mardi 29 janvier 2019

Which function to be used for URL assertion in Dusk?

public function testPagination()
{
    $this->browse(function($first)
    {
        $first->loginAs(\App\User::find(1))
              ->visit('http://mettledlp.in.linuxense.com/user');
    });
    $this->browse(function(Browser $browser)
    {
        $browser->visit('http://mettledlp.in.linuxense.com/mailLog?page=1')
                ->clickLink('2')
                ->assertUrlIs('http://mettledlp.in.linuxense.com/mailLog?page=2');
    });
}

Error 1) Tests\Browser\MessageTest::testPagination Actual URL [http://mettledlp.in.linuxense.com/mailLog?page=2] does not equal expected URL [http://mettledlp.in.linuxense.com/mailLog?page=2]. Failed asserting that 'http://mettledlp.in.linuxense.com/mailLog' matches PCRE pattern "/^http://mettledlp.in.linuxense.com/mailLog\?page\=2$/u".

Both URL seems to be the same for me. I am trying to click "2" resulting from pagination. The screenshot shows that click has been successfully done. When i run command php artisan dusk. Error i have given pops up and testing fails.

Aucun commentaire:

Enregistrer un commentaire