From de0eb1dceb86a40a374880dc7a699fa44ee726e5 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 8 Oct 2020 14:36:12 +0100 Subject: [PATCH] make desired cap's env as json --- src/BrowserTest.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/BrowserTest.php b/src/BrowserTest.php index a7e6a25..7fedd78 100644 --- a/src/BrowserTest.php +++ b/src/BrowserTest.php @@ -15,11 +15,15 @@ abstract class BrowserTest extends \PHPUnit_Extensions_Selenium2TestCase{ if(! $port=(int)getenv('SeleniumPort')){ $port=4444; } + if($dcj=getenv('SeleniumDesiredCapabilities')){ + $dc=json_decode($dcj,true); + if($dc===null){ + throw new \Exception("Invalid JSON: $dcj"); + } + $this->setDesiredCapabilities($dc); + } $this->setHost($host); $this->setPort($port); - $args=explode(' ',getenv('SeleniumBrowserArgsVal')); - $args[]='screenshot'; - $this->setDesiredCapabilities([getenv('SeleniumBrowserArgsKey')=>['args'=>$args]]); if($url=getenv('SeleniumBrowserUrl')){ $this->setBrowserUrl($url); }