Webtests fix: CRM-18454
authorWeb Access <rohan.katkar@webaccessglobal.com>
Tue, 26 Apr 2016 13:25:43 +0000 (18:55 +0530)
committerWeb Access <rohan.katkar@webaccessglobal.com>
Tue, 26 Apr 2016 13:25:43 +0000 (18:55 +0530)
tests/phpunit/WebTest/Case/CaseCustomFieldsTest.php
tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php
tests/phpunit/WebTest/Contact/SearchBuilderTest.php
tests/phpunit/WebTest/Contact/SignatureTest.php
tests/phpunit/WebTest/Contribute/StandaloneAddTest.php

index ab1be6e74173317c36da53e789473a8918e0bc4a..7fbede4277248b4850953287989651c63d395421 100644 (file)
@@ -78,7 +78,7 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase {
     $testUserLastName = "Testuserlast";
     $this->type("first_name", $testUserFirstName);
     $this->type("last_name", $testUserLastName);
-    $this->clickLink("_qf_Edit_next", "profilewrap4");
+    $this->clickLink("_qf_Edit_next", "profilewrap4", FALSE);
 
     $this->openCiviPage('case/add', 'reset=1&action=add&atype=13&context=standalone', '_qf_Case_upload-bottom');
 
@@ -114,11 +114,11 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase {
     $this->type("{$cusId_1}", $custFname);
     $this->type("{$cusId_2}", $custMname);
     $this->type("{$cusId_3}", $custLname);
-    $this->clickLink("_qf_Case_upload-bottom", "_qf_CaseView_cancel-bottom");
+    $this->clickLink("_qf_Case_upload-bottom", "_qf_CaseView_cancel-bottom", FALSE);
 
     // Is status message correct?
     $this->checkCRMAlert("Case opened successfully.");
-    $this->clickLink("_qf_CaseView_cancel-bottom");
+    $this->click("_qf_CaseView_cancel-bottom");
     $this->openCiviPage('case', 'reset=1', "xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$client['sort_name']}']/../../td[8]/a[text()='Open Case']");
     $this->clickPopupLink("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$client['sort_name']}']/../../td[8]/a[text()='Open Case']");
 
@@ -135,6 +135,7 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase {
       "Priority" => "Normal",
     );
     $this->webtestVerifyTabularData($openCaseData);
+    $this->waitForElementPresent("xpath=//span[@class='ui-button-icon-primary ui-icon fa-times']");
     $this->click("xpath=//span[@class='ui-button-icon-primary ui-icon fa-times']");
 
     // verify if custom data is present
@@ -325,7 +326,7 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase {
     $testUserLastName = "Testuserlast";
     $this->type("first_name", $testUserFirstName);
     $this->type("last_name", $testUserLastName);
-    $this->clickLink("_qf_Edit_next", "profilewrap4");
+    $this->clickLink("_qf_Edit_next", "profilewrap4", FALSE);
 
     $this->openCiviPage('case/add', 'reset=1&action=add&atype=13&context=standalone', '_qf_Case_upload-bottom');
 
@@ -358,11 +359,11 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase {
     $this->type("duration", "20");
     $this->type("{$cusId_1}", $custFname);
     $this->type("{$cusId_2}", $custLname);
-    $this->clickLink("_qf_Case_upload-bottom", "_qf_CaseView_cancel-bottom");
+    $this->clickLink("_qf_Case_upload-bottom", "_qf_CaseView_cancel-bottom", FALSE);
 
     // Is status message correct?
     $this->checkCRMAlert("Case opened successfully.");
-    $this->clickLink("_qf_CaseView_cancel-bottom");
+    $this->click("_qf_CaseView_cancel-bottom");
 
     $this->openCiviPage('case', 'reset=1');
     $this->waitForElementPresent("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$client['sort_name']}']/../../td[8]/a[text()='Open Case']");
@@ -389,7 +390,7 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase {
 
     // verify if custom data is present
     $this->openCiviPage('case', 'reset=1');
-    $this->clickLink("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$client['sort_name']}']/../../td[9]/span/a[text()='Manage']", "css=#{$customGrp1} .crm-accordion-header");
+    $this->clickLink("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$client['sort_name']}']/../../td[9]/span/a[text()='Manage']", "css=#{$customGrp1} .crm-accordion-header", FALSE);
 
     $this->click("css=#{$customGrp1} .crm-accordion-header");
 
index d5147de305f01c627ab3fa83e1c16b51dc689001..0321ac540f5ccb16696d9aeb4dba8defa752001a 100644 (file)
@@ -277,8 +277,8 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes
 
     //check the status message
     $this->waitForText('crm-notification-container', "Relationship created.");
-    $this->waitForElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']//table/tbody//tr/td[9]/span/a[text()='View']");
-    $this->click("xpath=//div[@class='dataTables_wrapper no-footer']//table/tbody//tr/td[9]/span/a[text()='View']");
+    $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']//div[@class='dataTables_wrapper no-footer']//table/tbody//tr/td[9]/span/a[text()='View']");
+    $this->click("xpath=//div[@class='crm-contact-relationship-current']//div[@class='dataTables_wrapper no-footer']//table/tbody//tr/td[9]/span/a[text()='View']");
 
     $this->waitForElementPresent("xpath=//table[@class='crm-info-panel']");
     $this->webtestVerifyTabularData(
index 4ec3d6318f39b1505e44841c83f27ddeb5414571..c2723e417c0fd334819c7ce25955673f0a479ee5 100644 (file)
@@ -459,6 +459,7 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase {
     $this->webtestFillAutocomplete($firstName1);
 
     // fill in Membership Organization
+    $this->waitForElementPresent("membership_type_id[0]");
     $this->select("membership_type_id[0]", "label={$membershipTypes['member_of_contact']}");
 
     // select membership type
@@ -471,7 +472,7 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase {
     $this->webtestFillDate('start_date');
 
     // Clicking save.
-    $this->clickLink("_qf_Membership_upload");
+    $this->click("_qf_Membership_upload");
 
     // page was loaded
     $this->waitForTextPresent("Membership StandaloneAddTest Webtest");
@@ -498,15 +499,18 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase {
     $this->enterValues(1, 1, 'Membership', 'Membership Type', NULL, '=', array($membershipTypes['membership_type']));
 
     $this->clickLink('_qf_Builder_refresh');
+    $this->waitForAjaxContent();
     $this->waitForText('search-status', "2 Contacts");
 
     $this->click("xpath=//div[@class='crm-accordion-header crm-master-accordion-header']");
     $this->enterValues(1, 2, 'Membership', 'Membership Status', NULL, '=', array('New'));
     $this->clickLink('_qf_Builder_refresh');
+    $this->waitForAjaxContent();
     $this->waitForText('search-status', "1 Contact");
 
     $this->enterValues(1, 2, 'Membership', 'Membership Status', NULL, '=', array('Grace'));
     $this->clickLink('_qf_Builder_refresh');
+    $this->waitForAjaxContent();
     $this->waitForText('search-status', "1 Contact");
 
     $this->click("xpath=//div[@class='crm-accordion-header crm-master-accordion-header']");
@@ -514,6 +518,7 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase {
     $this->click("xpath=//div[@id='map-field']/div[1]/table/tbody/tr[2]/td/a");
     $this->enterValues(1, 2, 'Membership', 'Membership Status', NULL, 'IN', array('New', 'Grace'));
     $this->clickLink('_qf_Builder_refresh');
+    $this->waitForAjaxContent();
     $this->waitForText('search-status', "2 Contacts");
 
     $this->click("xpath=//div[@class='crm-accordion-header crm-master-accordion-header']");
@@ -532,6 +537,7 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase {
     $this->click("xpath=//div[@class='crm-accordion-header crm-master-accordion-header']");
     $this->multiselect2("membership_status_id", array("New", "Grace"));
     $this->clickLink('_qf_Search_refresh');
+    $this->waitForAjaxContent();
     $this->waitForText('search-status', "2 Results");
 
     $this->openCiviPage("member/search", "reset=1", "_qf_Search_refresh");
@@ -540,6 +546,7 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase {
     $this->select2('membership_type_id', $membershipTypes['membership_type'], TRUE);
     $this->multiselect2("membership_status_id", array("New"));
     $this->click('_qf_Search_refresh');
+    $this->waitForAjaxContent();
     $this->waitForText('search-status', "1 Result");
   }
 
index 6c7498cb463730f222ad194fa371bd236d598a66..4b49fac91721c1c82b139a13c7a9671d8deb0f0c 100644 (file)
@@ -117,7 +117,7 @@ class WebTest_Contact_SignatureTest extends CiviSeleniumTestCase {
       $this->selectFrame("xpath=//iframe[@id='{$fieldName}_ifr']");
     }
 
-    $this->verifyText('//html/body', preg_quote("{$signature}"));
+    $this->assertElementContainsText("//html/body", "$signature");
     $this->selectFrame('relative=top');
   }
 
index 5b67c6c1c0590e82a016df582a93a34fac6be136..e74b70d8d75419d00b776d245f5048dec6457029 100644 (file)
@@ -77,6 +77,7 @@ class WebTest_Contribute_StandaloneAddTest extends CiviSeleniumTestCase {
     $this->addeditFinancialType($financialType);
 
     // Assign the created Financial Account $financialAccountTitle to $financialType
+    $this->waitForElementPresent("xpath=id('ltype')");
     $this->click("xpath=id('ltype')/div/table/tbody/tr/td[1]/div[text()='$financialType[name]']/../../td[7]//span//a[text()='Accounts']");
     $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']//button//span[contains(text(), 'Assign Account')]");
     $this->click("xpath=//div[@class='ui-dialog-buttonset']//button//span[contains(text(), 'Assign Account')]");
@@ -160,7 +161,7 @@ class WebTest_Contribute_StandaloneAddTest extends CiviSeleniumTestCase {
     );
 
     foreach ($expected as $label => $value) {
-      $this->verifyText("xpath=id('ContributionView')/div[2]/table[1]/tbody//tr/td[1][text()='$label']/../td[2]", preg_quote($value));
+      $this->assertElementContainsText("xpath=id('ContributionView')/div[2]/table[1]/tbody//tr/td[1][text()='$label']/../td[2]", $value);
     }
 
     // verify if soft credit was created successfully
@@ -170,7 +171,7 @@ class WebTest_Contribute_StandaloneAddTest extends CiviSeleniumTestCase {
     );
 
     foreach ($expected as $value) {
-      $this->verifyText("css=table.crm-soft-credit-listing", preg_quote($value));
+      $this->assertElementContainsText("css=table.crm-soft-credit-listing", $value);
     }
 
     // go to first soft creditor contact view page
@@ -180,7 +181,7 @@ class WebTest_Contribute_StandaloneAddTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent("css=li#tab_contribute a");
     $this->click("css=li#tab_contribute a");
     $this->waitForElementPresent("link=Record Contribution (Check, Cash, EFT ...)");
-    $this->verifyText("xpath=id('Search')/div[2]/table[2]/tbody/tr[2]/td[1]/a", preg_quote($contact['display_name']));
+    $this->assertElementContainsText("xpath=id('Search')/div[2]/table[2]/tbody/tr[2]/td[1]/a", $contact['display_name']);
     // verify soft credit details
     $expected = array(
       4 => $financialType['name'],
@@ -188,7 +189,7 @@ class WebTest_Contribute_StandaloneAddTest extends CiviSeleniumTestCase {
       6 => 'Completed',
     );
     foreach ($expected as $value => $label) {
-      $this->verifyText("xpath=id('Search')/div[2]/table[2]/tbody/tr[2]/td[$value]", preg_quote($label));
+      $this->assertElementContainsText("xpath=id('Search')/div[2]/table[2]/tbody/tr[2]/td[$value]", $label);
     }
 
     // CRM-17418 fix: Now cancel the contribution
@@ -300,7 +301,7 @@ class WebTest_Contribute_StandaloneAddTest extends CiviSeleniumTestCase {
     );
 
     foreach ($expected as $label => $value) {
-      $this->verifyText("xpath=id('ContributionView')/div[2]/table[1]/tbody//tr/td[1][text()='$label']/../td[2]", preg_quote($value));
+      $this->assertElementContainsText("xpath=id('ContributionView')/div[2]/table[1]/tbody//tr/td[1][text()='$label']/../td[2]", $value);
     }
   }