mercredi 28 juin 2017

Why are my Laravel Dusk tests failing to access my site using Jenkins?

I currently have a few browser tests using Laravel Dusk and they run fine on homestead. I'm using Jenkins for continuous integration and while my unit tests run fine, all the Dusk tests fail.

I made sure to run Xvfb before, so I got a screenshot of what Jenkins is "seeing" while trying to run the tests:

enter image description here

What could be the issue? Is it something related to the .env file or maybe DuskTestCase.php?

This is my DuskTestCase.php:

abstract class DuskTestCase extends BaseTestCase
{
    use CreatesApplication;

    /**
     * Prepare for Dusk test execution.
     *
     * @beforeClass
     * @return void
     */
    public static function prepare()
    {
        static::startChromeDriver();
    }

    /**
     * Create the RemoteWebDriver instance.
     *
     * @return \Facebook\WebDriver\Remote\RemoteWebDriver
     */
    protected function driver()
    {
        return RemoteWebDriver::create(
            'http://localhost:9515', DesiredCapabilities::chrome()
        );
    }
}

And this is an example of a test I'm trying to run:

    /** @test */
    public function see_login_page()
    {
        $this->browse(function (Browser $browser) {
            $browser->visit('/')
                ->assertSee('Register Now!');
        });
    }

Aucun commentaire:

Enregistrer un commentaire