Webtests fixes
authorWeb Access <rohan.katkar@webaccessglobal.com>
Fri, 6 Nov 2015 13:18:57 +0000 (18:48 +0530)
committerWeb Access <rohan.katkar@webaccessglobal.com>
Fri, 6 Nov 2015 13:18:57 +0000 (18:48 +0530)
12 files changed:
tests/phpunit/CiviTest/CiviSeleniumTestCase.php
tests/phpunit/WebTest/Campaign/OfflineContributionTest.php
tests/phpunit/WebTest/Campaign/OnlineEventRegistrationTest.php
tests/phpunit/WebTest/Case/CaseCustomFieldsTest.php
tests/phpunit/WebTest/Contact/AddViaProfileTest.php
tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php
tests/phpunit/WebTest/Contact/GroupAddTest.php
tests/phpunit/WebTest/Contact/SearchBuilderTest.php
tests/phpunit/WebTest/Contact/UpdateProfileTest.php
tests/phpunit/WebTest/Event/TellAFriendTest.php
tests/phpunit/WebTest/Pledge/ContactContextAddTest.php
tests/phpunit/WebTest/Profile/SearchTest.php

index 2d8cea4dfdbbd2e0f10b49b58c5f39e38facbdad..abe1651220672750e519bbb1fe02e723cf5aba05 100644 (file)
@@ -2504,4 +2504,36 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
     return $contact;
   }
 
+  /**
+   * Add a contact via profile
+   */
+  public function webtestAddViaCreateProfile() {
+    $this->webtestLogin();
+
+    $this->openCiviPage('profile/create', 'reset=1&gid=1', '_qf_Edit_next');
+
+    $firstName = 'Jo' . substr(sha1(rand()), 0, 4);
+    $lastName = 'Ad' . substr(sha1(rand()), 0, 7);
+
+    //contact details section
+    //fill in first name
+    $this->type("first_name", $firstName);
+
+    //fill in last name
+    $this->type("last_name", $lastName);
+
+    //address section
+    $this->type("street_address-1", "902C El Camino Way SW");
+    $this->type("city-1", "Dumfries");
+    $this->type("postal_code-1", "1234");
+    $this->assertSelected('country-1', "UNITED STATES");
+    $this->select("state_province-1", "value=1019");
+
+    // Clicking save.
+    $this->click("_qf_Edit_next");
+    $this->waitForPageToLoad($this->getTimeoutMsec());
+
+    $this->assertElementContainsText('css=.msg-text', "Your information has been saved.");
+  }
+
 }
index b9fa7aed0598450c4dab7257746fc49a2f8ca9cf..e4e9db75823a758bc751dcb49b05ca6d0b9d3f89 100644 (file)
@@ -221,8 +221,8 @@ class WebTest_Campaign_OfflineContributionTest extends CiviSeleniumTestCase {
 
       $this->type('sort_name', $firstName);
       $this->click("_qf_Search_refresh");
-      $this->waitForElementPresent("xpath=//div[@id='contributionSearch']/table/tbody/tr/td[11]/span/a[text()='Edit']");
-      $this->click("xpath=//div[@id='contributionSearch']/table/tbody/tr/td[11]/span/a[text()='Edit']");
+      $this->waitForElementPresent("xpath=//div[@id='contributionSearch']/table/tbody/tr/td[11]/span//a[text()='Edit']");
+      $this->click("xpath=//div[@id='contributionSearch']/table/tbody/tr/td[11]/span//a[text()='Edit']");
       $this->waitForElementPresent("_qf_Contribution_cancel-bottom");
       $this->assertTrue($this->isTextPresent("$campaignTitle"));
     }
index 5fde52f109e9ae9467f4f6cef286d2f0fd0233c5..791153271d225843b1992d4e8da20771bf2c8054 100644 (file)
@@ -130,7 +130,7 @@ class WebTest_Campaign_OnlineEventRegistrationTest extends CiviSeleniumTestCase
     $streetAddress = "100 Main Street";
     $this->_testAddLocation($streetAddress);
 
-    $this->_testAddFees(FALSE, FALSE, $paymentProcessorId);
+    $this->_testAddFees(FALSE, FALSE, $processorName);
 
     // intro text for registration page
     $registerIntro = "Fill in all the fields below and click Continue.";
@@ -212,12 +212,12 @@ class WebTest_Campaign_OnlineEventRegistrationTest extends CiviSeleniumTestCase
    * @param bool $priceSet
    * @param int $processorId
    */
-  public function _testAddFees($discount = FALSE, $priceSet = FALSE, $processorId) {
+  public function _testAddFees($discount = FALSE, $priceSet = FALSE, $processorName) {
     // Go to Fees tab
     $this->click("link=Fees");
     $this->waitForElementPresent("_qf_Fee_upload-bottom");
     $this->click("CIVICRM_QFID_1_is_monetary");
-    $this->check("payment_processor[$processorId]");
+    $this->select2('payment_processor', $processorName, TRUE);
     $this->select("financial_type_id", "value=4");
     if ($priceSet) {
       // get one - TBD
@@ -257,8 +257,8 @@ class WebTest_Campaign_OnlineEventRegistrationTest extends CiviSeleniumTestCase
       $this->assertChecked("is_multiple_registrations");
     }
 
-    $this->click('intro_text-plain');
-    $this->fillRichTextField("intro_text", $registerIntro);
+    $this->click("xpath=//div[@id='registration_screen']/table/tbody/tr[1]/td[2]/div[@class='replace-plain']");
+    $this->fillRichTextField("cke_wysiwyg_frame", $registerIntro);
 
     // enable confirmation email
     $this->click("CIVICRM_QFID_1_is_email_confirm");
index 85871e0917980e04437f48432a9def0db1fe34c3..6501cfc44ef9d7902e41a661dc802504458f37a5 100644 (file)
@@ -138,7 +138,7 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase {
       "Priority" => "Normal",
     );
     $this->webtestVerifyTabularData($openCaseData);
-    $this->click("xpath=//span[@class='ui-button-icon-primary ui-icon ui-icon-closethick']");
+    $this->click("xpath=//span[@class='ui-button-icon-primary ui-icon fa-times']");
 
     // verify if custom data is present
     $this->openCiviPage('case', 'reset=1');
index 31f9901546998f3bf95d4f53cbbc8c146d9df71b..f6064013459d272620f9ece3288e91a862157fbf 100644 (file)
@@ -35,33 +35,11 @@ class WebTest_Contact_AddViaProfileTest extends CiviSeleniumTestCase {
     parent::setUp();
   }
 
+  /**
+   * Add a contact via profile
+   */
   public function testAddViaCreateProfile() {
-    $this->webtestLogin();
-
-    $this->openCiviPage('profile/create', 'reset=1&gid=1', '_qf_Edit_next');
-
-    $firstName = 'Jo' . substr(sha1(rand()), 0, 4);
-    $lastName = 'Ad' . substr(sha1(rand()), 0, 7);
-
-    //contact details section
-    //fill in first name
-    $this->type("first_name", $firstName);
-
-    //fill in last name
-    $this->type("last_name", $lastName);
-
-    //address section
-    $this->type("street_address-1", "902C El Camino Way SW");
-    $this->type("city-1", "Dumfries");
-    $this->type("postal_code-1", "1234");
-    $this->assertSelected('country-1', "UNITED STATES");
-    $this->select("state_province-1", "value=1019");
-
-    // Clicking save.
-    $this->click("_qf_Edit_next");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-
-    $this->assertElementContainsText('css=.msg-text', "Your information has been saved.");
+    $this->webtestAddViaCreateProfile();
   }
 
 }
index ca80dee5b7a98b2e11ce77a1513a2165bd9004e5..3f8ffeae4f3c5dfa70fa350e409f42219b92f898 100644 (file)
@@ -52,7 +52,7 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes
     $streetAddress = "100 Main Street";
     $this->_testAddLocation($streetAddress);
 
-    $this->_testAddFees(FALSE, FALSE, $paymentProcessorId);
+    $this->_testAddFees(FALSE, FALSE, $processorName);
     $this->openCiviPage('event/manage', 'reset=1');
     $this->type('title', $eventTitle);
     $this->click('_qf_SearchEvent_refresh');
@@ -200,12 +200,12 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes
    * @param bool $priceSet
    * @param int $processorId
    */
-  public function _testAddFees($discount = FALSE, $priceSet = FALSE, $processorId) {
+  public function _testAddFees($discount = FALSE, $priceSet = FALSE, $processorName) {
     // Go to Fees tab
     $this->click("link=Fees");
     $this->waitForElementPresent("_qf_Fee_upload-bottom");
     $this->click("CIVICRM_QFID_1_is_monetary");
-    $this->check("payment_processor[{$processorId}]");
+    $this->select2('payment_processor', $processorName, TRUE);
     $this->select("financial_type_id", "value=4");
     if ($priceSet) {
       // get one - TBD
index 36852c317256caa855bbf833eb18c6c50aa17a2a..d6e64fe617c5869fdf8a9ffc97ddc11d1b67ec05 100644 (file)
@@ -74,9 +74,10 @@ class WebTest_Contact_GroupAddTest extends CiviSeleniumTestCase {
     $this->openCiviPage('group', 'reset=1');
     $this->type('title', $params['name']);
     $this->click('_qf_Search_refresh');
+    $this->waitForAjaxContent();
     $this->waitForElementPresent("xpath=//table[@class='crm-group-selector no-footer dataTable']/tbody/tr/td/span[contains(text(), '{$params['name']}')]");
     $createdBy = $this->getText("xpath=//table[@class='crm-group-selector no-footer dataTable']/tbody/tr/td[3]/a");
-    $this->click("xpath=//table[@class='crm-group-selector no-footer dataTable']/tbody/tr/td[7]/span/a[2]");
+    $this->click("xpath=//table[@class='crm-group-selector no-footer dataTable']/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 7b350e01314a7e6139ee39fe3693f978e762dbba..075f0e18a6c51e893558a1286d8d58901c0cf09f 100644 (file)
@@ -523,7 +523,7 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase {
 
     // Find Membership
     $this->openCiviPage("member/search", "reset=1", "_qf_Search_refresh");
-    $this->multiselect2("membership_type_id", array($membershipTypes['membership_type']));
+    $this->select2('membership_type_id', $membershipTypes['membership_type'], TRUE);
     $this->clickLink('_qf_Search_refresh');
     $this->waitForText('search-status', "2 Results");
 
@@ -534,7 +534,7 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase {
 
     $this->openCiviPage("member/search", "reset=1", "_qf_Search_refresh");
     $this->click("xpath=//div[@class='crm-accordion-header crm-master-accordion-header']");
-    $this->multiselect2("membership_type_id", array($membershipTypes['membership_type']));
+    $this->select2('membership_type_id', $membershipTypes['membership_type'], TRUE);
     $this->multiselect2("membership_status_id", array("New"));
     $this->clickLink('_qf_Search_refresh');
     $this->waitForText('search-status', "1 Result");
index f99f5b295a46fa96decc7cc724d16e80d02dda0c..cfcf5071f2a1d57522acbd92769b7d08a5b1f323 100644 (file)
@@ -37,8 +37,7 @@ class WebTest_Contact_UpdateProfileTest extends CiviSeleniumTestCase {
 
   public function testUpdateProfile() {
     // Create new via profile
-    include_once 'WebTest/Contact/AddViaProfileTest.php';
-    WebTest_Contact_AddViaProfileTest::testAddViaCreateProfile();
+    $this->webtestAddViaCreateProfile();
 
     // Open profile for editing
     $locationUrl = $this->getLocation();
index 95636761125c6d5e0da71adac227585dc4e3ca2d..71854be7c99b7da7372f247acc511a793318b19d 100644 (file)
@@ -238,8 +238,8 @@ class WebTest_Event_TellAFriendTest extends CiviSeleniumTestCase {
       $this->assertChecked("is_multiple_registrations");
     }
 
-    $this->click('intro_text');
-    $this->fillRichTextField("intro_text", $registerIntro);
+    $this->click("xpath=//div[@id='registration_screen']/table/tbody/tr[1]/td[2]/div[@class='replace-plain']");
+    $this->fillRichTextField("cke_wysiwyg_frame", $registerIntro);
 
     // enable confirmation email
     $this->click('xpath=//fieldset[@id="mail"]/div/table/tbody/tr/td[2]/label[contains(text(), "Yes")]');
index 87addb7b2407af3cee175ba0da169c808fe58d04..28bab7a985766f00146e4566247f09b2a131886e 100644 (file)
@@ -109,7 +109,7 @@ class WebTest_Pledge_ContactContextAddTest extends CiviSeleniumTestCase {
       $this->verifyText("xpath=//form[@id='PledgeView']//table/tbody/tr/td[text()='{$label}']/following-sibling::td", preg_quote($value));
     }
 
-    $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span[1]/a[text()='View']", FALSE);
+    $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div/table/tbody/tr[1]/td[10]/span[1]/a[text()='View']", FALSE);
 
     $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a");
     $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a");
index 14b29f67890f67d880dcb8e60f3bd54d81aaddf9..a1a62869534d1f0702b70d1086fbc58fc06e0204 100644 (file)
@@ -86,6 +86,7 @@ class WebTest_Profile_SearchTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent("field_name[0]");
     $this->click('field_name[0]');
     $this->select('field_name[0]', 'value=Contact');
+    $this->waitForElementPresent('field_name[1]');
     $this->click('field_name[1]');
     $this->select('field_name[1]', 'value=email');
     $this->click("//option[@value='Contact']");