Error performing test with Laravel Dusk

0

Good morning, someone who has had experience with Laravel Dusk who can help me? I can not make the Authentication through the Browser to be able to access the screens, in my case I have different guards, but according to the documentation what I'm doing should work out .. Follow Test code below:

public function testLogin ()    {        $ manager = factory (Manager :: class) -> create ();

   $this->browse(function (Browser $browser) use ($manager) {
       $browser->visit($this->getUrl().'manager/login')
           ->type('email', $manager->email)
           ->type('password', '123123')
           ->press('Entrar')
           ->assertPathIs('/manager/home')
           ->assertSee('Inicio');
   });

}

The error is as follows:

There was 1 error:

1) Tests \ Browser \ ManagerTest :: testLogin Unable to locate element: {"method": "css selector", "selector": "body textarea [name = 'email']"}  (Session info: headless chrome = 66.0.3359.181)  (Driver info: chromedriver = 2.35.528161 (5b82f2d2aae0ca24b877009200ced9065a772e73), platform = Windows NT 10.0.17134 x86_64) (edited)

    
asked by anonymous 24.05.2018 / 16:39

1 answer

0

I was able to find the error.

In my .env file I needed to put APP_URL = link because I noticed that it inserts the url in front. so the code looks like this.

   $this->browse(function (Browser $browser) use ($manager) {
        $browser->visit('/manager/login')
            ->type('email', $manager->email)
            ->type('password', '123123')
            ->press('Entrar')
            ->assertPathIs('/manager/home')
            ->assertSee('Inicio');
   });

I visited some references that form of great importance:

link

link

Vlw.

    
24.05.2018 / 21:51