From ef27c11b2e67e298ce9423531d65b761f754a385 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B5nis=20Ormisson?= Date: Tue, 7 Nov 2017 02:44:59 +0200 Subject: [PATCH] Merge remote-tracking branch 'upstream/develop' into fix-tests-cleanup Conflicts: tests/TestBaseClass.php tests/TestBaseClassView.php tests/TestBaseClassWeb.php tests/questions/DateTimeValidationTest.php --- tests/TestBaseClass.php | 3 +++ tests/TestBaseClassView.php | 6 ++---- tests/TestBaseClassWeb.php | 10 ++++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/tests/TestBaseClass.php b/tests/TestBaseClass.php index f1430771488..398d1c6f05b 100644 --- a/tests/TestBaseClass.php +++ b/tests/TestBaseClass.php @@ -26,6 +26,9 @@ class TestBaseClass extends TestCase /** @var \Survey */ protected static $testSurvey; + /** @var integer */ + protected static $surveyId; + public static function setUpBeforeClass() { parent::setUpBeforeClass(); diff --git a/tests/TestBaseClassView.php b/tests/TestBaseClassView.php index 14e2a55f4d1..9175d709c16 100644 --- a/tests/TestBaseClassView.php +++ b/tests/TestBaseClassView.php @@ -34,12 +34,12 @@ public function setUp() parent::setUp(); $username = getenv('USERNAME'); - if (empty($username)) { + if (!$username) { $username = 'admin'; } $password = getenv('PASSWORD'); - if (empty($password)) { + if (!$password) { $password = 'password'; } @@ -61,8 +61,6 @@ protected function findViewTag($name, $view) try { $element = self::$webDriver->findElement(WebDriverBy::id('action::'.$name)); } catch (\Exception $e) { - $screenshot = self::$webDriver->takeScreenshot(); - file_put_contents(__DIR__ . '/_output/'.$name.'.png', $screenshot); //throw new Exception($e->getMessage()); } $this->assertNotEmpty( diff --git a/tests/TestBaseClassWeb.php b/tests/TestBaseClassWeb.php index c6888e23f6f..ec0a8da44b4 100644 --- a/tests/TestBaseClassWeb.php +++ b/tests/TestBaseClassWeb.php @@ -80,8 +80,7 @@ public function getUrl(array $view) if (empty($domain)) { $domain = ''; } - $url = "http://{$domain}/index.php/admin/".$view['route']; - return self::$webDriver->get($url); + return "http://{$domain}/index.php/admin/".$view['route']; } /** @@ -91,7 +90,9 @@ public function getUrl(array $view) */ public function adminLogin($userName, $password) { - $url = $this->getUrl(['route'=>'authentication/sa/login']); + + + $url = $this->getUrl(['login', 'route'=>'authentication/sa/login']); $this->openView($url); try { self::$webDriver->wait(2)->until( @@ -115,6 +116,7 @@ public function adminLogin($userName, $password) $userNameField->clear()->sendKeys($userName); $passWordField = self::$webDriver->findElement(WebDriverBy::id("password")); $passWordField->clear()->sendKeys($password); + $submit = self::$webDriver->findElement(WebDriverBy::name('login_submit')); $submit->click(); try { @@ -124,7 +126,7 @@ public function adminLogin($userName, $password) ) ); } catch (TimeOutException $ex) { - $screenshot = $this->webDriver->takeScreenshot(); + $screenshot = self::$webDriver->takeScreenshot(); file_put_contents(self::$screenshotsFolder .'/tmp.png', $screenshot); $this->assertTrue( false,