From a92081334b3a7ce1457c617a6b2108ee9537dfcf Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Sun, 7 Jan 2018 19:01:30 +0100 Subject: [PATCH 1/2] Rewrite the capability test to be compatible with lazy-starting The session is not started anymore when getting it in the test. It requires starting it explicitly to test the case of setting capabilities after starting. --- tests/Custom/DesiredCapabilitiesTest.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/Custom/DesiredCapabilitiesTest.php b/tests/Custom/DesiredCapabilitiesTest.php index f62768e1..ae613fc9 100644 --- a/tests/Custom/DesiredCapabilitiesTest.php +++ b/tests/Custom/DesiredCapabilitiesTest.php @@ -44,7 +44,9 @@ public function testSetDesiredCapabilities() 'deviceType' => 'tablet', 'selenium-version' => '2.45.0' ); - $driver = $this->getSession()->getDriver(); + $session = $this->getSession(); + $session->start(); + $driver = $session->getDriver(); $driver->setDesiredCapabilities($caps); } -} \ No newline at end of file +} From 7fa8a11c98c76088d52cb41552f975b2e0685bd5 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Sun, 7 Jan 2018 19:13:37 +0100 Subject: [PATCH 2/2] Fix more tests relying on the session being started --- tests/Custom/WebDriverTest.php | 4 +++- tests/Custom/WindowNameTest.php | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/Custom/WebDriverTest.php b/tests/Custom/WebDriverTest.php index 13734e99..a6f71e6d 100644 --- a/tests/Custom/WebDriverTest.php +++ b/tests/Custom/WebDriverTest.php @@ -9,8 +9,10 @@ class WebDriverTest extends TestCase { public function testGetWebDriverSessionId() { + $session = $this->getSession(); + $session->start(); /** @var Selenium2Driver $driver */ - $driver = $this->getSession()->getDriver(); + $driver = $session->getDriver(); $this->assertNotEmpty($driver->getWebDriverSessionId(), 'Started session has an ID'); $driver = new Selenium2Driver(); diff --git a/tests/Custom/WindowNameTest.php b/tests/Custom/WindowNameTest.php index fe2c94f0..bb6c2739 100644 --- a/tests/Custom/WindowNameTest.php +++ b/tests/Custom/WindowNameTest.php @@ -11,6 +11,7 @@ class WindowNameTest extends TestCase public function testPatternGetWindowNames() { $session = $this->getSession(); + $session->start(); $windowNames = $session->getWindowNames(); $this->assertArrayHasKey(0, $windowNames); @@ -23,6 +24,7 @@ public function testPatternGetWindowNames() public function testGetWindowName() { $session = $this->getSession(); + $session->start(); $this->assertRegExp(self::WINDOW_NAME_REGEXP, $session->getWindowName()); }