CRM-18454: Webtests Fix
authorWeb Access <rohan.katkar@webaccessglobal.com>
Tue, 10 May 2016 13:08:55 +0000 (18:38 +0530)
committerWeb Access <rohan.katkar@webaccessglobal.com>
Tue, 10 May 2016 13:08:55 +0000 (18:38 +0530)
tests/phpunit/CiviTest/CiviSeleniumTestCase.php
tests/phpunit/WebTest/Campaign/OnlineContributionTest.php
tests/phpunit/WebTest/Case/AddCaseTest.php
tests/phpunit/WebTest/Case/AddCaseTypeTest.php
tests/phpunit/WebTest/Contact/GroupAddTest.php
tests/phpunit/WebTest/Contact/SearchBuilderTest.php
tests/phpunit/WebTest/Contribute/OnlineContributionTest.php

index c719f503e4289b35c907d4b228e2466a504bba0c..234b36abecd7ac7e639236313a9892d648e7027e 100644 (file)
@@ -1526,17 +1526,17 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
     // select the radio first since the element id changes after membership org search results are loaded
     switch ($auto_renew) {
       case 'optional':
-        $this->click("xpath=//div[@id='membership_type_form']//table/tbody/tr[6]/td/label[contains(text(), 'Auto-renew Option')]/../../td[2]/label[contains(text(), 'Give option, but not required')]");
+        $this->click("xpath=//table[@class='form-layout-compressed']/tbody/tr[6]/td/label[contains(text(), 'Auto-renew Option')]/../../td[2]/label[contains(text(), 'Give option, but not required')]");
         break;
 
       case 'required':
-        $this->click("xpath=//div[@id='membership_type_form']//table/tbody/tr[6]/td/label[contains(text(), 'Auto-renew Option')]/../../td[2]/label[contains(text(), 'Auto-renew required')]");
+        $this->click("xpath=//table[@class='form-layout-compressed']/tbody/tr[6]/td/label[contains(text(), 'Auto-renew Option')]/../../td[2]/label[contains(text(), 'Auto-renew required')]");
         break;
 
       default:
         //check if for the element presence (the Auto renew options can be absent when proper payment processor not configured)
         if ($this->isElementPresent("xpath=//div[@id='membership_type_form']//table/tbody/tr[6]/td/label[contains(text(), 'Auto-renew Option')]/../../td[2]/label[contains(text(), 'No auto-renew option')]")) {
-          $this->click("xpath=//div[@id='membership_type_form']//table/tbody/tr[6]/td/label[contains(text(), 'Auto-renew Option')]/../../td[2]/label[contains(text(), 'No auto-renew option')]");
+          $this->click("xpath=//table[@class='form-layout-compressed']/tbody/tr[6]/td/label[contains(text(), 'Auto-renew Option')]/../../td[2]/label[contains(text(), 'No auto-renew option')]");
         }
         break;
     }
@@ -1547,6 +1547,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
     $this->select('financial_type_id', "label={$memTypeParams['financial_type']}");
 
     $this->type('duration_interval', $duration_interval);
+    $this->waitForElementPresent('duration_unit');
     $this->select('duration_unit', "label={$duration_unit}");
     $this->waitForElementPresent('period_type');
     $this->select('period_type', "value={$period_type}");
@@ -1591,7 +1592,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
     }
 
     // Clicking save.
-    $this->clickLink('_qf_Edit_upload-bottom');
+    $this->click('_qf_Edit_upload-bottom');
 
     // Is status message correct?
     $this->waitForText('crm-notification-container', "The Group '$groupName' has been saved.");
@@ -2498,8 +2499,8 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
     );
     $this->clickLink('_qf_PledgeView_next-bottom', "xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a", FALSE);
     $this->waitForAjaxContent();
-    $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a");
-    $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[2]/td[8]/a[text()='Record Payment']");
+    $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a");
+    $this->waitForElementPresent("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[2]/td[8]/a[text()='Record Payment']");
     return $contact;
   }
 
index 09ec9e4a1686e92aad19da7ab4b6ac432576d7ce..8e664a3d37ad335e3f6defcc683365b478a73fda 100644 (file)
@@ -301,7 +301,7 @@ class WebTest_Campaign_OnlineContributionTest extends CiviSeleniumTestCase {
     $this->clickLink("_qf_Search_refresh", "xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[10]/span//a[text()='View']", FALSE);
     $this->clickLink("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[10]/span//a[text()='View']", "_qf_ContributionView_cancel-bottom", FALSE);
     //View Contribution Record
-    $this->assertElementContainsText("xpath=//table[@class='crm-info-panel']/tbody/tr[11]/td[2]", $campaignTitle);
+    $this->assertElementContainsText("xpath=//form[@class='CRM_Contribute_Form_ContributionView']/div[2]//table[1]/tbody/tr[10]/td[2]", $campaignTitle);
   }
 
 }
index 6c4bb2d6be1749ec37c81fe357faf0425193493a..e93f205abc90baf8b201fefff25e3883d9c58862 100644 (file)
@@ -198,7 +198,7 @@ class WebTest_Case_AddCaseTest extends CiviSeleniumTestCase {
       $this->assertElementContainsText("css=div.crm-case-roles-block", $role);
     }
     // check that case creator role has been assigned to logged in user
-    $this->assertElementContainsText("xpath=//table[@id='caseRoles-selector-$id']/tbody/tr[4]/td[2]", $creatorName);
+    $this->assertElementContainsText("xpath=//table[@id='caseRoles-selector-$id']/tbody/tr[1]/td[2]", $creatorName);
   }
 
   /**
index 8be86fbefebc95a9959c1f0a7297a2f208496a42..9390781246ca877f489535546c61912048bc40f5 100644 (file)
@@ -91,10 +91,9 @@ class WebTest_Case_AddCaseTypeTest extends CiviSeleniumTestCase {
     $this->fillRichTextField("activity_details", $details, 'CKEditor');
     $this->type("activity_subject", $subject);
     $this->waitForElementPresent('case_type_id');
-    $this->select("case_type_id", "label=$caseTypeLabel");
     $this->waitForElementPresent('status_id');
+    $this->select("case_type_id", "label=$caseTypeLabel");
     $this->select("status_id", "label={$caseStatusLabel}");
-
     $this->webtestFillDate('start_date', 'now');
     $today = date('F jS, Y', strtotime('now'));
 
index 1eb8ad4dde9375de249f83aa1fc28722f11be077..8a127f90842450192cad0a1d5e967fe84d82576c 100644 (file)
@@ -75,9 +75,9 @@ class WebTest_Contact_GroupAddTest extends CiviSeleniumTestCase {
     $this->type('title', $params['name']);
     $this->click('title');
     $this->waitForAjaxContent();
-    $this->waitForElementPresent("xpath=//table/tbody/tr/td/div[contains(text(), '{$params['name']}')]");
-    $createdBy = $this->getText("xpath=//table/tbody/tr/td[3]/a");
-    $this->click("xpath=//table/tbody/tr/td[7]//span/a[text()='Settings']");
+    $this->waitForElementPresent("xpath=//table/tbody//tr/td/div[contains(text(), '{$params['name']}')]");
+    $createdBy = $this->getText("xpath=//table/tbody//tr/td[3]/a");
+    $this->click("xpath=//table/tbody//tr/td[7]//span/a[text()='Settings']");
     $this->waitForElementPresent("xpath=//form[@id='Edit']/div[2]/div/table[1]/tbody/tr[2]/td[contains(text(), '{$createdBy}')]");
     $this->openCiviPage('group', 'reset=1');
 
index 1763cbf68aa141e5f498dd9f7c7dfa5abc8d98ae..76e1c85b5b39eb355a85f7d6257c91b152054c37 100644 (file)
@@ -166,8 +166,6 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase {
     $this->click("_qf_Contact_upload_view");
     $this->waitForPageToLoad($this->getTimeoutMsec());
     $this->_searchBuilder('Email', NULL, NULL, 'IS NULL');
-    $this->type('CRM_Contact_Form_Search_Builder-rows-per-page-select', '100');
-    $this->waitForElementPresent('CRM_Contact_Form_Search_Builder-rows-per-page-select');
     $names = array(
       1 => $firstName1,
       2 => $firstName2,
@@ -183,8 +181,6 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase {
     }
     //searching contacts whose phone field is not empty
     $this->_searchBuilder('Phone', NULL, $firstName, 'IS NOT EMPTY');
-    $this->type('CRM_Contact_Form_Search_Builder-rows-per-page-select', '100');
-    $this->waitForElementPresent('CRM_Contact_Form_Search_Builder-rows-per-page-select');
     $this->assertTrue($this->isTextPresent($firstName));
 
     $firstName4 = "AB" . substr(sha1(rand()), 0, 7);
index 93bcb4f1ed9a675baba5b377cb22b799f2123ce7..59f40ca743ae888d758ab92380182c6fb22aa783 100644 (file)
@@ -151,7 +151,7 @@ class WebTest_Contribute_OnlineContributionTest extends CiviSeleniumTestCase {
     $this->openCiviPage("contribute/search", "reset=1", "contribution_date_low");
     $this->type("sort_name", "$lastName $firstName");
     $this->click("xpath=//tr/td[1]/label[contains(text(), 'Contribution is a Test?')]/../../td[2]/label[contains(text(), 'Yes')]/preceding-sibling::input[1]");
-    $this->clickLink("_qf_Search_refresh", "xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[10]/span//a[text()='View']");
+    $this->clickLink("_qf_Search_refresh", "xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[10]/span//a[text()='View']", FALSE);
     $this->clickLink("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[10]/span//a[text()='View']", "_qf_ContributionView_cancel-bottom", FALSE);
 
     //View Contribution Record and verify data