lundi 3 juillet 2017

Skipped all tests on phpunit with chromedriver

I have installed selenium 3.01, chromedriver 2.27 and chrome 59 on an Ubuntu 16.04.

I started the Selenium with the next command (I don't have a GUI on this machine):

xvfb-run java -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver -jar /usr/local/bin/selenium-server-standalone-3.0.1.jar -debug

I checked with telnet that it starts on port 4444:

root@xxx:~# telnet localhost 4444
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

f
HTTP/1.1 400 No URI
Content-Length: 0
Connection: close
Server: Jetty(9.2.15.v20160210)

Connection closed by foreign host.

But when running the tests with phpunit they fail:

root@xxx:/var/www/dev.xxx.tt-laravel/site# "vendor/phpunit/phpunit/phpunit" tests/General/NotAuth.php --verbose
PHPUnit 5.7.21 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.0.18-0ubuntu0.16.04.1
Configuration: /var/www/dev.domain-laravel/site/phpunit.xml

SS                                                                  2 / 2 (100%)

Time: 2 minutes, Memory: 12.00MB

There were 2 skipped tests:

1) NotAuth::test_shops_index_load
The Selenium Server is not active on host localhost at port 4444.

/var/www/dev.domain-laravel/site/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:299
/var/www/dev.domain-laravel/site/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:337
/var/www/dev.domain-laravel/site/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:314

2) NotAuth::test_shops_categories_load
The Selenium Server is not active on host localhost at port 4444.

/var/www/dev.domain-laravel/site/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:299
/var/www/dev.domain-laravel/site/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:337
/var/www/dev.domain-laravel/site/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:314

OK, but incomplete, skipped, or risky tests!
Tests: 2, Assertions: 0, Skipped: 2.

and the output from the selenium tab:

2017-07-02 17:18:00.738:INFO::main: Logging initialized @497ms
2017-07-02 17:18:00.870:INFO:osjs.Server:main: jetty-9.2.15.v20160210
2017-07-02 17:18:00.917:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@5158b42f{/,null,AVAILABLE}
2017-07-02 17:18:00.938:INFO:osjs.ServerConnector:main: Started ServerConnector@6771beb3{HTTP/1.1}{0.0.0.0:4444}
2017-07-02 17:18:00.939:INFO:osjs.Server:main: Started @698ms
Starting ChromeDriver 2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320) on port 6589
Only local connections are allowed.
Starting ChromeDriver 2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320) on port 16531
Only local connections are allowed.

Any help is appreciated. Thank you!

PS : This is one of the tests:

<?php

use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Modelizer\Selenium\SeleniumTestCase;

// http://ift.tt/2si8IwB
// http://ift.tt/2tASnqR

require_once(__DIR__.'/../../vendor/hacks/load_env.php');

class NotAuth extends SeleniumTestCase
{

    /**
     * SHOPS MODULES START
     */

    public function test_shops_index_load()
    {
        $url = trim(route('shops_index', [], FALSE));
        $this->visit($url)
            ->see('Top Shops')
            ->see('Help Center3')
            ->seePageIs($url)
        ;
    }

    public function test_shops_categories_load()
    {
        $url = trim(route('shops_categories', [], FALSE));
        $this->visit($url)
            ->see('Automotive')
            ->see('Baby')
            ->seePageIs($url)
        ;
    }

    /**
     * SHOPS MODULES END
     */
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire