Webtest fixes
authorColeman Watts <coleman@civicrm.org>
Mon, 22 Sep 2014 01:53:20 +0000 (21:53 -0400)
committerColeman Watts <coleman@civicrm.org>
Mon, 22 Sep 2014 01:53:20 +0000 (21:53 -0400)
tests/phpunit/CiviTest/CiviMailUtils.php
tests/phpunit/CiviTest/CiviSeleniumTestCase.php
tests/phpunit/WebTest/Member/OfflineAutoRenewMembershipTest.php

index 1c098de5a06e69922dc2bc525badf8172265b0d5..bd9a5e05843b66286678938d349647df09667f7f 100644 (file)
@@ -164,15 +164,12 @@ class CiviMailUtils extends PHPUnit_Framework_TestCase {
       $this->_ut->waitForElementPresent('css=td.crm-mailing-name');
 
       // This should select the first "Report" link in the table, which is sorted by Completion Date descending, so in theory is the most recent email. Not sure of a more robust way at the moment.
-      $this->_ut->click('xpath=//tr[contains(@id, "crm-mailing_")]//a[text()="Report"]');
+      $this->_ut->clickLink('xpath=//tr[contains(@id, "crm-mailing_")]//a[text()="Report"]');
 
       // Also not sure how robust this is, but there isn't a good
       // identifier for this link either.
       $this->_ut->waitForElementPresent('xpath=//a[contains(text(), "View complete message")]');
-      $this->_ut->click('xpath=//a[contains(text(), "View complete message")]');
-
-      $this->_ut->waitForPopUp(NULL, 30000);
-      $this->_ut->selectPopUp(NULL);
+      $this->_ut->clickLinkSuppressPopup('xpath=//a[contains(text(), "View complete message")]', NULL);
       /*
        * FIXME:
        *
@@ -184,8 +181,6 @@ class CiviMailUtils extends PHPUnit_Framework_TestCase {
        */
       //$msg = $this->_ut->getHtmlSource();
       $msg = $this->_ut->getBodyText();
-      $this->_ut->close();
-      $this->_ut->selectWindow(NULL);
 
     }
     else {
@@ -328,7 +323,7 @@ class CiviMailUtils extends PHPUnit_Framework_TestCase {
    * @return ezcMail
    */
   private function convertToEzc($msg) {
-    $set = new ezcMailVariableSet($msg);
+    $set = new ezcMailVariableSet($msg);print_r($msg);
     $parser = new ezcMailParser();
     $mail = $parser->parseMail($set);
     $this->_ut->assertNotEmpty($mail, 'Cannot parse mail');
index f6a105f3b4ac4a26fa21967e67a1043d5c59617a..967dd3d3a9a7f1e807706bb4c973929426a7a1c0 100644 (file)
@@ -862,10 +862,8 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
 
     $this->type('billing_street_address-5', '234 Lincoln Ave');
     $this->type('billing_city-5', 'San Bernadino');
-    $this->select('billing_country_id-5', 'value=1228');
-    $this->click('billing_state_province_id-5');
-    $this->waitForVisible('billing_state_province_id-5');
-    $this->select('billing_state_province_id-5', 'label=California');
+    $this->select2('billing_country_id-5', 'United States');
+    $this->select2('billing_state_province_id-5', 'California');
     $this->type('billing_postal_code-5', '93245');
 
     return array($firstName, $middleName, $lastName);
@@ -1558,8 +1556,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
     $this->waitForElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']//table/tbody/tr[2]/td[8]/span/a[text()='View']");
 
     // click through to the Activity view screen
-    $this->click("xpath=//div[@class='dataTables_wrapper no-footer']//table/tbody/tr[2]/td[8]/span/a[text()='View']");
-    $this->waitForElementPresent('_qf_Activity_cancel-bottom');
+    $this->clickLinkSuppressPopup("xpath=//div[@class='dataTables_wrapper no-footer']//table/tbody/tr[2]/td[8]/span/a[text()='View']", '_qf_Activity_cancel-bottom');
 
     // parse URL to grab the activity id
     // pass id back to any other tests that call this class
index 4233c31d9e34a875260b62d08f8448c61a323f7e..981455b1aa13e63e0ba6be2f8ce08a24a8058227 100644 (file)
@@ -84,18 +84,9 @@ class WebTest_Member_OfflineAutoRenewMembershipTest extends CiviSeleniumTestCase
 
     $this->webtestAddCreditCardDetails();
 
-    // since country is not pre-selected for offline mode
-    $this->select("billing_country_id-5", "label=United States");
-    //wait for states to populate the select box
-    // Because it tends to cause problems, all uses of sleep() must be justified in comments
-    // Sleep should never be used for wait for anything to load from the server
-    // Justification for this instance: FIXME
-    sleep(2);
-    $this->click('billing_state_province_id-5');
     $this->webtestAddBillingDetails($firstName, NULL, $lastName);
 
-    $this->click("_qf_Membership_upload-bottom");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->clickLink("_qf_Membership_upload-bottom");
 
     // Use Find Members to make sure membership exists
     $this->openCiviPage("member/search", "reset=1", "member_end_date_high");
@@ -103,8 +94,7 @@ class WebTest_Member_OfflineAutoRenewMembershipTest extends CiviSeleniumTestCase
     $this->type("sort_name", "$firstName $lastName");
     $this->click("member_test");
     $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='memberSearch']/table/tbody/tr[1]/td[11]/span/a[text()='View']");
-    $this->click("xpath=//div[@id='memberSearch']/table/tbody/tr[1]/td[11]/span/a[text()='View']");
-    $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
+    $this->clickAjaxLink("xpath=//div[@id='memberSearch']/table/tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_MembershipView_cancel-bottom");
 
     // View Membership Record
     $verifyData = array(
@@ -119,7 +109,6 @@ class WebTest_Member_OfflineAutoRenewMembershipTest extends CiviSeleniumTestCase
         preg_quote($value)
       );
     }
-    $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
   }
 }