Skip to content

Commit

Permalink
set viewportSize in tests via member.
Browse files Browse the repository at this point in the history
  • Loading branch information
itaibh committed Jan 30, 2018
1 parent 90e12b8 commit 9a506d2
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions tests/eyes.selenium.php.tests/TestFluentApi_Chrome.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

require_once ('TestFluentApi.php');

use Applitools\RectangleSize;
use Facebook\WebDriver\Chrome\ChromeOptions;

class TestFluentApi_Chrome extends TestFluentApi
Expand All @@ -18,6 +19,8 @@ public static function setUpClass()

public function setUp()
{
$this->viewportSize = new RectangleSize(800, 599);

$options = new ChromeOptions();
$options->addArguments(["disable-infobars"]);
$this->desiredCapabilities = $options->toCapabilities();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

require_once ('TestFluentApi.php');

use Applitools\RectangleSize;
use Facebook\WebDriver\Chrome\ChromeOptions;

class TestFluentApi_Chrome_ForceFPS extends TestFluentApi
Expand All @@ -18,6 +19,8 @@ public static function setUpClass()

public function setUp()
{
$this->viewportSize = new RectangleSize(800, 599);

$options = new ChromeOptions();
$options->addArguments(["disable-infobars"]);
$this->desiredCapabilities = $options->toCapabilities();
Expand Down
3 changes: 3 additions & 0 deletions tests/eyes.selenium.php.tests/TestFluentApi_Firefox.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

require_once ('TestFluentApi.php');

use Applitools\RectangleSize;
use Facebook\WebDriver\Remote\DesiredCapabilities;

class TestFluentApi_Firefox extends TestFluentApi
Expand All @@ -18,6 +19,8 @@ public static function setUpClass()

public function setUp()
{
$this->viewportSize = new RectangleSize(800, 599);

$this->desiredCapabilities = DesiredCapabilities::firefox();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

require_once ('TestFluentApi.php');

use Applitools\RectangleSize;
use Facebook\WebDriver\Remote\DesiredCapabilities;

class TestFluentApi_Firefox_ForceFPS extends TestFluentApi
Expand All @@ -18,6 +19,8 @@ public static function setUpClass()

public function setUp()
{
$this->viewportSize = new RectangleSize(800, 599);

$this->desiredCapabilities = DesiredCapabilities::firefox();
}
}
7 changes: 6 additions & 1 deletion tests/eyes.selenium.php.tests/TestSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ abstract class TestSetup extends TestCase
/** @var WebDriver */
protected $webDriver;

protected $viewportSize = null;

protected $scaleRatio = 1.0;

public static function setUpClass()
{
self::$batchInfo = new BatchInfo(self::$testSuitName);
Expand Down Expand Up @@ -68,7 +72,8 @@ public function init($testName)
$webDriver = RemoteWebDriver::create($_SERVER['SELENIUM_SERVER_URL'], $this->desiredCapabilities);
$this->eyes->setBatch(self::$batchInfo);

$this->webDriver = $this->eyes->open($webDriver, self::$testSuitName, $testName, new RectangleSize(800, 599));
$this->eyes->setScaleRatio($this->scaleRatio);
$this->webDriver = $this->eyes->open($webDriver, self::$testSuitName, $testName, $this->viewportSize);
$this->webDriver->get('http://applitools.github.io/demo/TestPages/FramesTestPage/');
}

Expand Down

0 comments on commit 9a506d2

Please sign in to comment.