Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into fix-tests-cleanup
Browse files Browse the repository at this point in the history
Conflicts:
	tests/TestBaseClass.php
	tests/TestBaseClassView.php
	tests/TestBaseClassWeb.php
	tests/questions/DateTimeValidationTest.php
  • Loading branch information
TonisOrmisson committed Nov 7, 2017
1 parent 817a359 commit ef27c11
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions tests/TestBaseClass.php
Expand Up @@ -26,6 +26,9 @@ class TestBaseClass extends TestCase
/** @var \Survey */
protected static $testSurvey;

/** @var integer */
protected static $surveyId;

public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
Expand Down
6 changes: 2 additions & 4 deletions tests/TestBaseClassView.php
Expand Up @@ -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';
}

Expand All @@ -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(
Expand Down
10 changes: 6 additions & 4 deletions tests/TestBaseClassWeb.php
Expand Up @@ -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'];
}

/**
Expand All @@ -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(
Expand All @@ -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 {
Expand All @@ -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,
Expand Down

0 comments on commit ef27c11

Please sign in to comment.