Web Tests Fix
authorjitendrapurohit <jitendra.purohit@webaccess.co.in>
Mon, 14 Apr 2014 13:57:25 +0000 (19:27 +0530)
committerjitendrapurohit <jitendra.purohit@webaccess.co.in>
Mon, 14 Apr 2014 13:57:25 +0000 (19:27 +0530)
tests/phpunit/CiviTest/CiviSeleniumTestCase.php
tests/phpunit/WebTest/Contact/SearchTest.php
tests/phpunit/WebTest/Contribute/OfflineContributionTest.php
tests/phpunit/WebTest/Event/AddPricesetTest.php
tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php

index 5e82d8f44b1a27178d971891fb2b130188659fff..f0528d8682bdbdd8c170308c42a15fede4ece90d 100644 (file)
@@ -641,6 +641,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
     }
     $this->open($this->sboxPath . 'civicrm/admin/paymentProcessor?action=add&reset=1&pp=' . $pid);
     $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->waitForElementPresent('name');
     $this->type('name', $processorName);
     $this->select('financial_account_id', "label={$financialAccount}");
 
index ada09a8ea82022dbab55b4e3b2e9a478e8dcce47..8f42d352211bfe8162e5cb99bee7f0281b473ef3 100644 (file)
@@ -50,10 +50,10 @@ class WebTest_Contact_SearchTest extends CiviSeleniumTestCase {
     $this->typeKeys("css=input#sort_name_navigation", $sortName);
 
     // wait for result list
-    $this->waitForElementPresent("css=div.ac_results-inner li");
+    $this->waitForElementPresent("xpath=//*[@id='ui-id-1']/li");
 
     // visit contact summary page
-    $this->click("css=div.ac_results-inner li");
+    $this->click("xpath=//*[@id='ui-id-1']/li");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // Is contact present?
index 807315657111e44705f1d992b5f80c4e45951f18..81ce6e861a3ddd3e577101454f0d9bac5cef078b 100644 (file)
@@ -43,7 +43,7 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase {
 
     //financial account for check
     $this->openCiviPage("admin/options/payment_instrument", "reset=1");
-    $financialAccount = $this->getText("xpath=//div[@id='payment_instrument']/div[2]/table/tbody//tr/td[1][text()='Check']/../td[3]");
+    $financialAccount = $this->getText("xpath=//div[@id='payment_instrument']/div/table/tbody//tr/td[1][text()='Check']/../td[3]");
 
     // Add new Financial Account
     $orgName = 'Alberta ' . substr(sha1(rand()), 0, 7);
@@ -81,8 +81,7 @@ class WebTest_Contribute_OfflineContributionTest 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->click("link=Record Contribution (Check, Cash, EFT ...)");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->clickLink("link=Record Contribution (Check, Cash, EFT ...)", "_qf_Contribution_cancel-bottom", FALSE);
 
     // select financial type
     $this->select("financial_type_id", "value=1");
@@ -104,7 +103,9 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase {
     $this->type("trxn_id", "P20901X1" . rand(100, 10000));
 
     // create first soft credit
-    $this->webtestFillAutocomplete("{$softCreditLname}, {$softCreditFname}", 'soft_credit_contact_1');
+    $this->click("softCredit");
+    $this->waitForElementPresent("soft_credit_amount_1");
+    $this->webtestFillAutocomplete("{$softCreditLname}, {$softCreditFname}", 's2id_soft_credit_contact_id_1');
     $this->type("soft_credit_amount_1", "50");
 
     // add second soft credit field
@@ -113,7 +114,7 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase {
     // create new individual via soft credit
     $softCreditSecondFname = substr(sha1(rand()), 0, 7);
     $softCreditSecondLname = substr(sha1(rand()), 0, 7);
-    $this->webtestNewDialogContact($softCreditSecondFname, $softCreditSecondLname, NULL, 4, 'soft_credit_profiles_2', 'soft_credit_1');
+    $this->webtestNewDialogContact($softCreditSecondFname, $softCreditSecondLname, NULL, 4, 's2id_soft_credit_contact_id_2', 'soft_credit_1');
     // enter the second soft credit
     $this->verifyText("soft_credit_amount_2", ""); // it should be blank cause first soft credit != total_amount
     $this->type("soft_credit_amount_2", "100"); //the sum of the soft credit amounts can exceed total_amount
@@ -133,15 +134,7 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase {
     $this->type("invoice_id", time());
     $this->webtestFillDate('thankyou_date');
 
-    //Honoree section
-    $this->click("Honoree");
-    $this->waitForElementPresent("honor_email");
 
-    $this->click("CIVICRM_QFID_1_2");
-    $this->select("honor_prefix_id", "label=Ms.");
-    $this->type("honor_first_name", "Foo");
-    $this->type("honor_last_name", "Bar");
-    $this->type("honor_email", "foo@bar.com");
 
     //Premium section
     $this->click("Premium");
@@ -152,16 +145,15 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase {
 
     // Clicking save.
     $this->click("_qf_Contribution_upload");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // Is status message correct?
     //$this->assertTrue($this->isTextPresent("The contribution record has been saved."), "Status message didn't show up after saving!");
 
     // verify if Contribution is created
-    $this->waitForElementPresent("xpath=//div[@id='Contributions']//table//tbody/tr[1]/td[8]/span/a[text()='View']");
+    $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']");
 
     //click through to the Contribution view screen
-    $this->click("xpath=//div[@id='Contributions']//table/tbody/tr[1]/td[8]/span/a[text()='View']");
+    $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']");
     $this->waitForElementPresent("_qf_ContributionView_cancel-bottom");
 
     $expected = array(
@@ -174,9 +166,9 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase {
       'Received Into' => $financialAccount,
     );
 
-    $this->waitForElementPresent("xpath=/html/body/div[3]/div/div[2]/div/div[3]/div/div[2]/div/div/div/form/div[2]");
+    $this->waitForElementPresent("xpath=//*[@id='ContributionView']/div[2]");
     foreach ($expected as $value) {
-      $this->verifyText("xpath=/html/body/div[3]/div/div[2]/div/div[3]/div/div[2]/div/div/div/form/div[2]", preg_quote($value));
+      $this->verifyText("xpath=//*[@id='ContributionView']/div[2]", preg_quote($value));
     }
 
     // verify if soft credit was created successfully
@@ -192,10 +184,9 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase {
     }
 
     // go to first soft creditor contact view page
-    $this->click("css=table.crm-soft-credit-listing tbody tr td a");
+    $this->clickLink("xpath=//*[@id='ContributionView']/div[2]/div[2]/div[2]/table/tbody/tr[1]/td[1]/a", "css=li#tab_contribute a");
 
     // go to contribution tab
-    $this->waitForElementPresent("css=li#tab_contribute a");
     $this->click("css=li#tab_contribute a");
     $this->waitForElementPresent("link=Record Contribution (Check, Cash, EFT ...)");
 
@@ -208,7 +199,7 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase {
       1 => "{$firstName} {$lastName}"
     );
     foreach ($expected as $value => $label) {
-      $this->verifyText("xpath=id('Search')/div[2]/table[2]/tbody/tr[2]/td[$value]", preg_quote($label));
+      $this->verifyText("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[2]/td[$value]", preg_quote($label));
     }
   }
 
@@ -322,11 +313,10 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent("css=li#tab_contribute a");
     $this->click("css=li#tab_contribute a");
     $this->waitForElementPresent("link=Submit Credit Card Contribution");
-    $this->click("link=Submit Credit Card Contribution");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->clickLink("link=Submit Credit Card Contribution", "_qf_Contribution_cancel-bottom", FALSE);
 
     // since we don't have live credentials we will switch to test mode
-    $url = $this->getLocation();
+    $url = $this->getAttribute("xpath=//*[@id='Search']/div[2]/div[2]/a[2]@href");
     $url = str_replace('mode=live', 'mode=test', $url);
     $this->open($url);
     $this->waitForPageToLoad($this->getTimeoutMsec());
@@ -378,7 +368,7 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase {
     // select show test contributions
     $this->click("contribution_test", "value=1");
     $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']");
-    $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom");
+    $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom", FALSE);
 
     foreach ($verifyData as $label => $value) {
       if ( $label == 'sort_name' ) {
@@ -396,7 +386,7 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase {
       "xpath=//form[@id='Basic']/div[3]/div[1]/div[2]/table/tbody/tr[1]/td[11]/span/a[text()='View']");
 
     $this->clickLink("xpath=//form[@id='Basic']/div[3]/div[1]/div[2]/table/tbody/tr[1]/td[11]/span/a[text()='View']",
-    'crm-contact-actions-link');
+    'crm-contact-actions-link', FALSE);
   }
 
   function testOnlineContributionWithZeroAmount() {
@@ -409,7 +399,7 @@ class WebTest_Contribute_OfflineContributionTest 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->clickLink("link=Record Contribution (Check, Cash, EFT ...)");
+    $this->clickLink("link=Record Contribution (Check, Cash, EFT ...)", "_qf_Contribution_cancel-bottom", FALSE);
 
     // select financial type
     $this->select("financial_type_id", "value=1");
@@ -421,11 +411,11 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase {
     $this->select("payment_instrument_id", "value=1");
 
     $this->type("trxn_id", "X20901X1" . rand(100, 10000));
-    $this->clickLink('_qf_Contribution_upload-bottom');
+    $this->click('_qf_Contribution_upload-bottom');
     $this->waitForText("crm-notification-container", "The contribution record has been saved.");
 
-    $this->waitForElementPresent("xpath=//div[@id='Contributions']//table//tbody/tr[1]/td[8]/span/a[text()='View']");
-    $this->clickLink("xpath=//div[@id='Contributions']//table/tbody/tr[1]/td[8]/span/a[text()='View']");
+    $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']");
+    $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom", FALSE);
     $expected = array(
       'Financial Type' => 'Donation',
       'Total Amount' => '0.00',
index 369dc43909ccbac99d57f73335098168f889aeee..f42111c53c8e739c9fb92afc1a6a89d3a62bbedc 100644 (file)
@@ -576,11 +576,11 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase {
 
     // Select an event fee
     $this->waitForElementPresent('priceset');
-    $this->type("//div[@id='priceset']//div[@class='crm-section Full_Conference-section']/div[2]/input", '5');
-    $this->fireEvent("//div[@id='priceset']//div[@class='crm-section Full_Conference-section']/div[2]/input", 'blur');
-    $this->click("xpath=//div[@id='priceset']//div[@class='crm-section Pre_conference_Meetup_-section']/div[2]/div[1]/span/input");
-    $this->click("xpath=//div[@id='priceset']//div[@class='crm-section Evening_Sessions-section']/div[2]/div[1]/span/input");
-    $this->click("xpath=//div[@id='priceset']//div[@class='crm-section Evening_Sessions-section']/div[2]/div[2]/span/input");
+    $this->type("//div[@id='priceset']/div[2]/div[2]/input", '5');
+    $this->fireEvent("//div[@id='priceset']/div[2]/div[2]/input", 'blur');
+    $this->click("xpath=//div[@id='priceset']/div[3]/div[2]/div[1]/span/input");
+    $this->click("xpath=//div[@id='priceset']/div[4]/div[2]/div[1]/span/input");
+    $this->click("xpath=//div[@id='priceset']/div[4]/div[2]/div[2]/span/input");
 
     // Select payment method = Check and enter chk number
     $this->select('payment_instrument_id', 'value=4');
@@ -681,7 +681,6 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase {
     // Wait for event type to be filled in (since page reloads)
     $this->waitForElementPresent("template_id");
     // Enter Event Title, Summary and Description
-    $this->type('template_title', "Test Template");
     $this->select("event_type_id", "value=4");
     $this->select("default_role_id", "value=1");
     $this->type("title", "Test Event");
index 350f5b4459be74a61ad4f7d961dffc8e215299a9..eb38a6fef97e4b0c2fb0fc67980d10c79a57ac55 100644 (file)
@@ -67,6 +67,7 @@ class WebTest_Generic_GeneralClickAroundTest extends CiviSeleniumTestCase {
     $this->login();
 
     // Create New → Individual
+    $this->waitForElementPresent("xpath=//*[@id='crm-create-new-link']");
     $this->click("crm-create-new-link");
     $this->click("link=Individual");
     $this->waitForPageToLoad($this->getTimeoutMsec());