mardi 3 mars 2020

Is there a way to have assertPathIs() ignore part of the url?

While making a Laravel Dusk test function, I am trying to check the path in my application. However the URL in my application changes, depending on the user or what they are looking at (e.g. /Test/123/testing: in this case the 123 could be any combination of numbers.)

Is it possible to ignore the middle portion?

$this->browse(function (Browser $browser) {
    $browser->loginAs('email@email.com')
            ->visit('/test')
            ->assertPathIs('/test')
            ->assertSee('LinkText')
            ->clickLink('LinkText')
            ->assertPathIs('/test/(CanBeAnything)/testing');
});

Aucun commentaire:

Enregistrer un commentaire