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.
assertUrlIs Asserts that the current URL (without the query string) matches the given string:
$browser->assertUrlIs($url);
There is no method provided by Laravel Dusk to match the URL with the query string.
You can do something like this
$this->assertEquals($browser->driver->getCurrentURL() , 'your-url');