How Can configure webdriver with travis in PHP?

Hi, I want to make the tests I do in selenium can be automated in travis, but I have no idea how I have to configure the travis.yml for this, I tried several configurations that I found but none worked. I have been testing the code directly with the default localhost and only with chrome.
Currently my test is as follows

<?php

use PHPUnit\Framework\TestCase;
use Facebook\WebDriver;
require_once('vendor/autoload.php');

class ProbandoIngresarDatosTest extends TestCase
{
    /**
     * @var WebDriver\Remote\RemoteWebDriver
     */
    private $webDriver;

    /**
     * @var string
     */
    private $baseUrl;

    /**
     * init webdriver
     */
    public function setUp():void
    {
        $desiredCapabilities = WebDriver\Remote\DesiredCapabilities::chrome();
        $desiredCapabilities->setCapability('trustAllSSLCertificates', true);
        $this->webDriver = WebDriver\Remote\RemoteWebDriver::create('http://localhost:4444/wd/hub', $desiredCapabilities);
    }

    /**
     * Method testProbandoIngresarDatos
     * @test
     */
    public function testProbandoIngresarDatosYMandarEmail()
    {
        $this->webDriver->get("http://turismonacionaleinternacional/index.php");
		
		$this->webDriver->findElement(WebDriver\WebDriverBy::linkText("Contacto"))->click();
		
        $this->webDriver->findElement(WebDriver\WebDriverBy::id("nombre"))->click();
		
        $this->webDriver->findElement(WebDriver\WebDriverBy::id("nombre"))->sendKeys("Ezequiel");
		
        $this->webDriver->findElement(WebDriver\WebDriverBy::id("apellido"))->sendKeys("Ledesma");
		
        $this->webDriver->findElement(WebDriver\WebDriverBy::id("email"))->sendKeys("ezequiel.ledesma026@gmail.com");
		
        $this->webDriver->findElement(WebDriver\WebDriverBy::id("telefono"))->click();
		
        $this->webDriver->findElement(WebDriver\WebDriverBy::id("telefono"))->sendKeys("47347866");
		
        $this->webDriver->findElement(WebDriver\WebDriverBy::id("mensaje"))->click();
		
        $this->webDriver->findElement(WebDriver\WebDriverBy::id("mensaje"))->sendKeys("Estoy probando ingresar datos en el formulario");
		
        $this->webDriver->findElement(WebDriver\WebDriverBy::name("submit"))->click();
		
		$this->webDriver->switchTo()->alert()->dismiss();	
		
		$this->assertStringContainsString('Ezequiel',  $this->webDriver->getTitle());
	
		}
		


    /**
     * Close the current window.
     */
    public function tearDown():void
    {
        $this->webDriver->close();
    }

		
    /**
     * @param WebDriver\Remote\RemoteWebElement $element
     *
     * @return WebDriver\WebDriverSelect
     * @throws WebDriver\Exception\UnexpectedTagNameException
     */
    private function getSelect(WebDriver\Remote\RemoteWebElement $element): WebDriver\WebDriverSelect
    {
        return new WebDriver\WebDriverSelect($element);
    }
}

The travis configuration for

language: php
php:

* 7.3
env:
global:
  * DISPLAY=:99.0
  * BROWSER_NAME="turismonacionaleinternacional"
  * SELENIUM_SERVER="https://selenium-release.storage.googleapis.com/3.14/selenium-server-standalone-3.14.0.jar" # Latest version including HtmlUnit
services:
* mysql
* xvfb
install:
* "composer install"
script: phpunit --configuration phpunit.xml --coverage-text
before_script:
  * wget https://chromedriver.storage.googleapis.com/79.0.3945.36/chromedriver_win32.zip;
  * unzip chromedriver_win32.zip;
  * "wget https://selenium-release.storage.googleapis.com/3.14/selenium-server-standalone-3.14.0.jar"
  * "java -Dwebdriver.chrome.driver=chromedriver -jar selenium-server-standalone-3.14.0.jar "
  * php -S localhost:4444 -t test/funcional/ &>>./logs/php-server.log &
  * until $(echo | nc localhost 4444); do sleep 1; echo waiting for PHP server on port 4444...; done; echo "PHP server started"
  * sleep 30

and now it is stuck in this way and does not take into account the tests

14:15:27.361 INFO [GridLauncherV3$1.launch] - Launching a standalone Selenium Server on port 4444
2020-02-09 14:15:27.702:INFO::main: Logging initialized @811ms to org.seleniumhq.jetty9.util.log.StdErrLog
14:15:27.995 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444

No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#build-times-out-because-no-output-was-received

From what I can see, you need to run the Selenium server in background (and terminate it at the end) so that you can do something else while it’s running.

It’s probably best to find a sample/tutorial by someone who walked this road before. Travis doesn’t endorse or promote any particular ways of doing things beyond what the stock functionality provides.

Existing functionality for GUI and browser testing is described at https://docs.travis-ci.com/user/gui-and-headless-browsers/.

Yes, I managed to run in the background by adding &, but now I’m throwing another error that I don’t know why

Make that change and now I’m throwing a different error for missing binaries of google, how could I add that?

Facebook\WebDriver\Exception\SessionNotCreatedException: Unable to create new service: ChromeDriverService
Build info: version: ‘3.14.0’, revision: ‘aacccce0’, time: ‘2018-08-02T20:13:22.693Z’
System info: host: ‘travis-job-8491317f-10fa-4728-9098-8fd05105686a’, ip: ‘127.0.0.1’, os.name: ‘Linux’, os.arch: ‘amd64’, os.version: ‘4.15.0-1028-gcp’, java.version: ‘11.0.2’
Driver info: driver.version: unknown

https://travis-ci.org/eze92/PhpPrueba/builds/648387901?utm_medium=notification&utm_source=github_status

I am experiencing the same error when running Selenium server in the background.
Server starts on port 4444, but travis build complains about service ChromeDriverService.

I tried to download the ChromeDriverService in the same directory as Selenium and I tried to run Se jar with and without that parameter passed, but no success.

I also tried to configure my tests to run with a headless chrome

window_size: false #disabled for Chrome driver
capabilities:
chromeOptions:
args: [“–headless”, “–disable-gpu”, “–proxy-server=‘direct://’”, “–proxy-bypass-list=*”]

Locally the tests work, they connect to Se server. I don’t really know what to do.
I think I need to configure the connection with the third party Travis collaborates with for Selenium GUI tests.

As far as I can see, you managed to make the build work in build 159, I see tests pass, but I couldn’t see no difference in the config between build 159 and previous ones.

My build fails here

Found it. I was using the windows chromedriver…
It is fixed in this build, although the GUI-less thing throws some other errors

I leave this as a reference for other comrades facing this issue