Skip to content

Commit

Permalink
Enable running all tests in the admin. Apparently get feature tests w…
Browse files Browse the repository at this point in the history
…orking. Closes #4.
  • Loading branch information
rick-c committed Mar 25, 2013
1 parent 7cd6abc commit e08db84
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,7 @@ public static function register_step($comment, $class, $value)
// @todo Re-defined a step! Throw an error!
}
else {
$class = "Habari\\" . $class;
self::$steps[$matches[2]] = array($class, $value);
}
}
Expand Down
17 changes: 9 additions & 8 deletions features/step_definitions/selenium.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ class SeleniumFeatureContext extends FeatureContext

public function init_webdriver() {
if(empty($this->webdriver)) {
$this->webdriver = new WebDriver('localhost', '4444');
$this->webdriver->connect('firefox');
$this->webdriver = new \WebDriver('localhost', '4444');
// $this->webdriver->connect('firefox');
$this->webdriver->connect('chromium');
}
}

Expand Down Expand Up @@ -42,9 +43,9 @@ function i_visit_the_url($url) {
*/
function i_type_into_the_field($text, $field) {
$this->init_webdriver();
$element = $this->webdriver->findElementBy(LocatorStrategy::name, $field);
$element = $this->webdriver->findElementBy(\LocatorStrategy::name, $field);
if(empty($element)) {
$element = $this->webdriver->findElementBy(LocatorStrategy::id, $field);
$element = $this->webdriver->findElementBy(\LocatorStrategy::id, $field);
if(empty($element)) {
$this->assert_true(false, sprintf('{step}Could not find the element with the id "%s"', $field));
return;
Expand All @@ -57,9 +58,9 @@ function i_type_into_the_field($text, $field) {
*/
function i_submit_the_form($form) {
$this->init_webdriver();
$element = $this->webdriver->findElementBy(LocatorStrategy::name, $form);
$element = $this->webdriver->findElementBy(\LocatorStrategy::name, $form);
if(empty($element)) {
$element = $this->webdriver->findElementBy(LocatorStrategy::id, $form);
$element = $this->webdriver->findElementBy(\LocatorStrategy::id, $form);
if(empty($element)) {
$this->assert_true(false, sprintf('{step}Could not find the form with the id "%s"', $form));
return;
Expand All @@ -73,7 +74,7 @@ function i_submit_the_form($form) {
*/
function i_should_see($thing) {
$this->init_webdriver();
$element = $this->webdriver->findElementBy(LocatorStrategy::id, $thing);
$element = $this->webdriver->findElementBy(\LocatorStrategy::id, $thing);
$this->assert_not_empty($element, '{step}');
}

Expand All @@ -82,7 +83,7 @@ function i_should_see($thing) {
*/
function i_click($thing) {
$this->init_webdriver();
$element = $this->webdriver->findElementBy(LocatorStrategy::id, $thing);
$element = $this->webdriver->findElementBy(\LocatorStrategy::id, $thing);
if(empty($element)) {
$this->assert_true(false, sprintf('{step}Could not find the element with the id "%s"', $thing));
}
Expand Down
4 changes: 4 additions & 0 deletions tests.plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ public function action_admin_theme_get_tests( AdminHandler $handler, Theme $them
}
$url = $this->get_url($url);
}
else {
$url = '/index.php?c=symbolic&o=1';
$url = $this->get_url( $url );
}
if($_GET['run'] == 'Dry Run') {
$url .= '&d=1';
$dryrun = true;
Expand Down

0 comments on commit e08db84

Please sign in to comment.