-- webtest fixes and improvement
authorRavish Nair <ravish@ravish.(none)>
Mon, 18 Mar 2013 14:47:48 +0000 (20:17 +0530)
committerRavish Nair <ravish@ravish.(none)>
Mon, 18 Mar 2013 14:47:48 +0000 (20:17 +0530)
tests/phpunit/WebTest/Import/AddressImportTest.php
tests/phpunit/WebTest/Import/MatchExternalIdTest.php
tests/phpunit/WebTest/Import/ParticipantTest.php
tests/phpunit/WebTest/Report/RolePermissionReportTest.php

index dc92be397327ad269df135fdfc669cbf2ce92b6e..cc2e8d33e8c6e6584aa2ef7c657628552ab01850 100644 (file)
@@ -68,7 +68,7 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase {
   
     foreach($customDataParams['customFields'] as $key => $value){
       $this->assertTrue($this->isElementPresent("xpath=//div[@class='crm-summary-row']/div[@class='crm-label'][contains(text(), '$key')]"));
-      $this->assertTrue($this->isTextPresent("$value"));
+      $this->assertElementContainsText('address-block-1', "$value");
     }
   }
 
@@ -110,7 +110,7 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase {
   
   function _addCustomData() {
     // Go directly to the URL of the screen that you will be testing (New Custom Group).
-    $this->open($this->sboxPath . "civicrm/admin/custom/group?reset=1");
+    $this->openCiviPage('admin/custom/group', 'reset=1');
 
     //add new custom data
     $this->click("//a[@id='newCustomDataGroup']/span");
@@ -129,7 +129,7 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase {
     $this->waitForElementPresent('_qf_Field_cancel-bottom');
 
     //Is custom group created?
-    $this->assertTrue($this->isTextPresent("Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now."));
+    $this->assertElementContainsText('crm-notification-container', "Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now.");
     $url = explode('gid=', $this->getLocation());
     $gid = $url[1];
 
@@ -141,7 +141,7 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase {
     $this->click('_qf_Field_next-bottom');
     $this->waitForElementPresent('newCustomField');
     
-    $this->assertTrue($this->isTextPresent("Your custom field '{$customField}' has been saved."));
+    $this->assertElementContainsText('crm-notification-container',"Your custom field '{$customField}' has been saved.");
     $customFieldId = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody//tr/td/span[text()='$customField']/../../td[8]/span/a@href"));
     $customFieldId = $customFieldId[1];
 
@@ -155,7 +155,7 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase {
     // clicking save
     $this->click('_qf_Field_next-bottom');
     $this->waitForElementPresent('newCustomField');
-    $this->assertTrue($this->isTextPresent("Your custom field '{$customField1}' has been saved."));
+    $this->assertElementContainsText('crm-notification-container', "Your custom field '{$customField1}' has been saved.");
     $customFieldId1 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody//tr/td/span[text()='$customField1']/../../td[8]/span/a@href"));
     $customFieldId1 = $customFieldId1[1];
 
@@ -170,7 +170,7 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase {
     // clicking save
     $this->click('_qf_Field_next-bottom');
     $this->waitForElementPresent('newCustomField');
-    $this->assertTrue($this->isTextPresent("Your custom field '{$customField2}' has been saved."));
+    $this->assertElementContainsText('crm-notification-container', "Your custom field '{$customField2}' has been saved.");
     $customFieldId2 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody//tr/td/span[text()='$customField2']/../../td[8]/span/a@href"));
     $customFieldId2 = $customFieldId2[1];
 
@@ -220,7 +220,7 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase {
     // clicking save
     $this->click('_qf_Field_next-bottom');
     $this->waitForElementPresent('newCustomField');
-    $this->assertTrue($this->isTextPresent("Your custom field '{$customField9}' has been saved."));
+    $this->assertElementContainsText('crm-notification-container', "Your custom field '{$customField9}' has been saved.");
     $customFieldId9 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody//tr/td/span[text()='$customField9']/../../td[8]/span/a@href"));
     $customFieldId9 = $customFieldId9[1];
 
@@ -235,7 +235,7 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase {
     // clicking save
     $this->click('_qf_Field_next-bottom');
     $this->waitForElementPresent('newCustomField');
-    $this->assertTrue($this->isTextPresent("Your custom field '{$customField10}' has been saved."));
+    $this->assertElementContainsText('crm-notification-container', "Your custom field '{$customField10}' has been saved.");
     $customFieldId10 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody//tr/td/span[text()='$customField10']/../../td[8]/span/a@href"));
     $customFieldId10 = $customFieldId10[1];
 
@@ -294,7 +294,7 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase {
     // clicking save
     $this->click('_qf_Field_next-bottom');
     $this->waitForElementPresent('newCustomField');
-    $this->assertTrue($this->isTextPresent("Your custom field '{$customFieldName}' has been saved."));
+    $this->assertElementContainsText('crm-notification-container', "Your custom field '{$customFieldName}' has been saved.");
     $customFieldId = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody//tr/td/span[text()='$customFieldName']/../../td[8]/span/a@href"));
     $customFieldId = $customFieldId[1];
     return $customFieldId;
index d4faa7d348e77aef8b4ddc890a41960485480c66..2fbb6ccf50435c46c912b0bad23555f8155f9a22 100644 (file)
@@ -246,7 +246,7 @@ class WebTest_Import_MatchExternalIdTest extends ImportCiviSeleniumTestCase {
      * @return int external id
      */
   function _addContact($firstName, $lastName, $externalId) {
-    $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Individual");
+    $this->openCiviPage('contact/add', 'reset=1&ct=Individual');
 
     //fill in first name
     $this->type("first_name", $firstName);
@@ -294,9 +294,7 @@ class WebTest_Import_MatchExternalIdTest extends ImportCiviSeleniumTestCase {
       );
     }
 
-    $this->open($this->sboxPath . "civicrm/event/add?reset=1&action=add");
-
-    $this->waitForElementPresent("_qf_EventInfo_upload-bottom");
+    $this->openCiviPage('event/add', 'reset=1&action=add', '_qf_EventInfo_upload-bottom');
 
     // Let's start filling the form with values.
     $this->select("event_type_id", "value={$params['event_type_id']}");
@@ -358,7 +356,7 @@ class WebTest_Import_MatchExternalIdTest extends ImportCiviSeleniumTestCase {
 
     // verify event input on info page
     // start at Manage Events listing
-    $this->open($this->sboxPath . "civicrm/event/manage?reset=1");
+    $this->openCiviPage('event/manage', 'reset=1');
     $this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input",$params['title']);
     $this->click("_qf_SearchEvent_refresh");
     $this->waitForPageToLoad($this->getTimeoutMsec());
index a55a3b9b9bb73139b3f2ba705c9ddab50f53d8e0..a3d144fa5b426400736d872fa25187e1209c5cfd 100644 (file)
@@ -271,9 +271,7 @@ class WebTest_Import_ParticipantTest extends ImportCiviSeleniumTestCase {
       );
     }
 
-    $this->open($this->sboxPath . "civicrm/event/add?reset=1&action=add");
-
-    $this->waitForElementPresent("_qf_EventInfo_upload-bottom");
+    $this->openCiviPage('event/add', 'reset=1&action=add', '_qf_EventInfo_upload-bottom');
 
     // Let's start filling the form with values.
     $this->select("event_type_id", "value={$params['event_type_id']}");
@@ -305,10 +303,9 @@ class WebTest_Import_ParticipantTest extends ImportCiviSeleniumTestCase {
 
     // select newly created processor
     $xpath = "xpath=//label[text() = '{$processorName}']/preceding-sibling::input[1]";
-    $this->assertTrue($this->isTextPresent($processorName));
+    $this->assertElementContainsText('paymentProcessor', $processorName);
     $this->check($xpath);
-
-        $this->select("financial_type_id", "value=4");
+    $this->select("financial_type_id", "value=4");
 
     $counter = 1;
     foreach ($params['fee_level'] as $label => $amount) {
@@ -340,7 +337,7 @@ class WebTest_Import_ParticipantTest extends ImportCiviSeleniumTestCase {
 
     // verify event input on info page
     // start at Manage Events listing
-    $this->open($this->sboxPath . "civicrm/event/manage?reset=1");
+    $this->openCiviPage('event/manage', 'reset=1');
     $this->click("link=" . $params['title']);
 
     $this->waitForPageToLoad($this->getTimeoutMsec());
index 6f70183cef8d6c1e76e5af64cb3938b5ea9808f4..17b36d3d711d28ea33fc92319e7f5680e4987768 100644 (file)
@@ -92,7 +92,7 @@ class WebTest_Report_RolePermissionReportTest extends CiviSeleniumTestCase {
     $this->click("add");
     $this->click("_qf_Summary_submit_save");
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->openCiviPage('logout','reset=1');
+    $this->openCiviPage('logout', 'reset=1', NULL);
     $this->open($this->sboxPath);
     $this->waitForElementPresent('edit-submit');
     $this->type('edit-name', $user2);
@@ -102,7 +102,7 @@ class WebTest_Report_RolePermissionReportTest extends CiviSeleniumTestCase {
     $this->openCiviPage('report/instance/1', 'reset=1');
     $this->assertElementContainsText('crm-container', 'You do not have permission to access this report.');
     $this->openCiviPage('report/list', 'reset=1');
-    $this->openCiviPage('logout', 'reset=1');
+    $this->openCiviPage('logout', 'reset=1', NULL);
 
     //delete roles
     $this->webtestLogin(TRUE);
@@ -155,7 +155,7 @@ class WebTest_Report_RolePermissionReportTest extends CiviSeleniumTestCase {
     );
     $this->changePermissions($permissions);
 
-    $this->openCiviPage('logout', 'reset=1');
+    $this->openCiviPage('logout', 'reset=1', NULL);
     $this->open($this->sboxPath);
     $this->waitForElementPresent('edit-submit');
     $this->type('edit-name', $user);
@@ -167,7 +167,7 @@ class WebTest_Report_RolePermissionReportTest extends CiviSeleniumTestCase {
     //check if the reserved report field is frozen
     $this->assertTrue($this->isElementPresent("xpath=//div[@id='instanceForm']//table[3]/tbody//tr/td[2]/tt[text()='[ ]']"));
 
-    $this->openCiviPage('logout', 'reset=1');
+    $this->openCiviPage('logout', 'reset=1', NULL);
     $this->open($this->sboxPath);
     $this->webtestLogin(TRUE);
     // let's give full CiviReport permissions.
@@ -187,7 +187,7 @@ class WebTest_Report_RolePermissionReportTest extends CiviSeleniumTestCase {
     $this->click("_qf_Summary_submit_save");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    $this->openCiviPage('logout', 'reset=1');
+    $this->openCiviPage('logout', 'reset=1', NULL);
     $this->open($this->sboxPath);
     $this->waitForElementPresent('edit-submit');
     $this->type('edit-name', $user);
@@ -201,7 +201,7 @@ class WebTest_Report_RolePermissionReportTest extends CiviSeleniumTestCase {
     $this->assertTrue($this->isElementPresent("xpath=//form[@id='Summary']//div[@id='instanceForm']/table//input[@id='title']"));
 
     //login as admin and remove reserved permission
-    $this->openCiviPage('logout', 'reset=1');
+    $this->openCiviPage('logout', 'reset=1', NULL);
     $this->open($this->sboxPath);
     $this->webtestLogin(TRUE);
     $this->open($this->sboxPath . "admin/people/permissions");
@@ -216,7 +216,7 @@ class WebTest_Report_RolePermissionReportTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     //login as user and check for absence of report criteria and settings
-    $this->openCiviPage('logout', 'reset=1');
+    $this->openCiviPage('logout', 'reset=1', NULL);
     $this->open($this->sboxPath);
     $this->waitForElementPresent('edit-submit');
     $this->type('edit-name', $user);
@@ -235,7 +235,7 @@ class WebTest_Report_RolePermissionReportTest extends CiviSeleniumTestCase {
     $this->assertFalse($this->isElementPresent("xpath=//form[@id='Summary']//div[@id='instanceForm']//input[@id='title']"));
 
     //login as admin and turn the is_reserved flag off for the instance
-    $this->openCiviPage('logout', 'reset=1');
+    $this->openCiviPage('logout', 'reset=1', NULL);
     $this->open($this->sboxPath);
     $this->webtestLogin(TRUE);
     $this->openCiviPage('report/instance/1', 'reset=1');
@@ -243,7 +243,7 @@ class WebTest_Report_RolePermissionReportTest extends CiviSeleniumTestCase {
     $this->click("_qf_Summary_submit_save");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    $this->openCiviPage('logout', 'reset=1');
+    $this->openCiviPage('logout', 'reset=1', NULL);
     $this->open($this->sboxPath);
     $this->waitForElementPresent('edit-submit');
     $this->type('edit-name', $user);
@@ -256,7 +256,7 @@ class WebTest_Report_RolePermissionReportTest extends CiviSeleniumTestCase {
     $this->assertTrue($this->isElementPresent("xpath=//form[@id='Summary']//div[@id='instanceForm']//input[@id='title']"));
 
     //login as admin and delete the role
-    $this->openCiviPage('logout', 'reset=1');
+    $this->openCiviPage('logout', 'reset=1', NULL);
     $this->open($this->sboxPath);
     $this->webtestLogin(TRUE);
     $this->open($this->sboxPath . "admin/people/permissions/roles");