From: Coleman Watts Date: Sun, 28 Sep 2014 12:10:39 +0000 (-0400) Subject: Webtest fixes X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a40669b669c3c07c3490882385aa2575eb97d960;p=civicrm-core.git Webtest fixes --- diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index 87841500ba..fbd9b078ef 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -2086,6 +2086,9 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { * @return void */ function customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl, $beforeTriggering = NULL) { + // FIXME: Testing a theory that these failures have something to do with permissions + $this->webtestLogin('admin'); + //add the custom set $return = $this->addCustomGroupField($customSets); @@ -2134,9 +2137,9 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { // FIXME: Try to find out what the heck is going on with these tests $this->waitForAjaxContent(); $this->checkForErrorsOnPage(); - + //checking for proper custom data which is loading through ajax - $this->waitForElementPresent("xpath=//div[contains(@class, 'custom-group-{$customData['cgtitle']}')]"); + $this->waitForElementPresent("css=.custom-group-{$customData['cgtitle']}"); $this->assertElementPresent("xpath=//div[contains(@class, 'custom-group-{$customData['cgtitle']}')]/div[contains(@class, 'crm-accordion-body')]/table/tbody/tr/td[2]/input", "The on the fly custom group field is not present for entity : {$entity} => {$entityData}"); } diff --git a/tests/phpunit/WebTest/Case/ActivityToCaseTest.php b/tests/phpunit/WebTest/Case/ActivityToCaseTest.php index dc6b106d76..e2403c9e8d 100644 --- a/tests/phpunit/WebTest/Case/ActivityToCaseTest.php +++ b/tests/phpunit/WebTest/Case/ActivityToCaseTest.php @@ -82,11 +82,19 @@ class WebTest_Case_ActivityToCaseTest extends CiviSeleniumTestCase { } function testLinkCases() { - $this->webtestLogin(); + // Log in as admin first to verify permissions for CiviCase + $this->webtestLogin('admin'); // Enable CiviCase module if necessary $this->enableComponents("CiviCase"); + // let's give full CiviCase permissions to demo user (registered user). + $permission = array('edit-2-access-all-cases-and-activities', 'edit-2-access-my-cases-and-activities', 'edit-2-administer-civicase', 'edit-2-delete-in-civicase'); + $this->changePermissions($permission); + + // Log in as normal user + $this->webtestLogin(); + //Add Case 1 $this->openCiviPage('case/add', 'reset=1&action=add&atype=13&context=standalone', '_qf_Case_upload-bottom'); diff --git a/tests/phpunit/WebTest/Case/AddCaseTest.php b/tests/phpunit/WebTest/Case/AddCaseTest.php index d006267118..cf62e0c9fa 100644 --- a/tests/phpunit/WebTest/Case/AddCaseTest.php +++ b/tests/phpunit/WebTest/Case/AddCaseTest.php @@ -140,11 +140,19 @@ class WebTest_Case_AddCaseTest extends CiviSeleniumTestCase { } function testAjaxCustomGroupLoad() { - $this->webtestLogin(); + // Log in as admin first to verify permissions for CiviCase + $this->webtestLogin('admin'); // Enable CiviCase module if necessary $this->enableComponents("CiviCase"); + // let's give full CiviCase permissions to demo user (registered user). + $permission = array('edit-2-access-all-cases-and-activities', 'edit-2-access-my-cases-and-activities', 'edit-2-administer-civicase', 'edit-2-delete-in-civicase'); + $this->changePermissions($permission); + + // Log in as normal user + $this->webtestLogin(); + $triggerElement = array('name' => 'case_type_id', 'type' => 'select'); $customSets = array( array('entity' => 'Case', 'subEntity' => 'Housing Support', 'triggerElement' => $triggerElement), @@ -259,8 +267,7 @@ class WebTest_Case_AddCaseTest extends CiviSeleniumTestCase { $this->webtestFillDate("case_to_end_date_low", "-1 month"); $this->webtestFillDate("case_to_end_date_high", "+1 month"); } - $this->click("_qf_Advanced_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink("_qf_Advanced_refresh"); $this->assertElementContainsText('Advanced', "$lastName, $firstName"); }