Webtest fix
authorWeb Access <rohan.katkar@webaccessglobal.com>
Wed, 28 Oct 2015 13:23:34 +0000 (18:53 +0530)
committerWeb Access <rohan.katkar@webaccessglobal.com>
Wed, 28 Oct 2015 13:23:34 +0000 (18:53 +0530)
tests/phpunit/WebTest/Campaign/MailingTest.php
tests/phpunit/WebTest/Campaign/PledgeTest.php
tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php
tests/phpunit/WebTest/Financial/FinancialBatchExport.php
tests/phpunit/WebTest/Grant/ContactContextAddTest.php
tests/phpunit/WebTest/Mailing/MailingTest.php
tests/phpunit/WebTest/Pledge/ContactContextAddTest.php
tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php
tests/phpunit/WebTest/Report/AddTest.php

index fb1d8caffb8950023afe94fd7cd2d3eabafc162f..218032785b7288aa72503746099d721b191f6cf5 100644 (file)
@@ -158,13 +158,15 @@ class WebTest_Campaign_MailingTest extends CiviSeleniumTestCase {
     $this->click("xpath=//button[@title='Close']");
 
     //--------track and respond----------
-    $this->click("xpath=//ul/li/a[text()='Tracking']");
+    $this->waitForAjaxContent();
+    $this->click('link=Tracking');
     $this->assertChecked("url_tracking");
     $this->assertChecked("open_tracking");
     // no need tracking for this test
 
     // default header and footer ( with label )
-    $this->click("xpath=//ul/li/a[text()='Header and Footer']");
+    $this->waitForAjaxContent();
+    $this->click('link=Header and Footer');
     $this->select("header_id", "label=Mailing Header");
     $this->select("footer_id", "label=Mailing Footer");
 
index 1be3945b33dd74653283b110649d0696ea0b65a7..55ba5a7bdf0c45355058d64acf27d69348679b9c 100644 (file)
@@ -134,7 +134,8 @@ class WebTest_Campaign_PledgeTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent('crm-contact-actions-link');
 
     // now add pledge from contact summary
-    $this->click("//a[@id='crm-contact-actions-link']/span/div");
+    $this->click("xpath=//div[@class='crm-actions-ribbon']/ul[@id='actions']/li[@class='crm-contact-activity crm-summary-block']/div/a[@id='crm-contact-actions-link']");
+    $this->waitForElementPresent('crm-contact-actions-list');
 
     // wait for add plegde link
     $this->waitForElementPresent('link=Add Pledge');
index 7a87e9c8ac0588042c901b9f834aa3986a636364..69f98883320773b9cf7121309137422ed430b93d 100644 (file)
@@ -229,18 +229,14 @@ class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase {
     $this->click("_qf_Search_refresh");
 
     $this->waitForElementPresent('toggleSelect');
-    $this->click('toggleSelect');
+    $this->click("xpath=//table[@class='selector row-highlight']/thead/tr/th[1]/input[@id='toggleSelect']");
     $this->select('task', "Record Survey Responses");
     $this->waitForElementPresent("_qf_Interview_cancel_interview");
+    $this->select("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[1]/td[@class='result']/select", "value=Label $title 1");
+    $this->click("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[1]/td[8]/a");
 
-    $this->click("CIVICRM_QFID_1_2");
-    $this->select("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[1]/td[8]/select", "value=Label $title 1");
-    $this->click("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[1]/td[9]/a");
-
-    $this->click("CIVICRM_QFID_2_8");
-
-    $this->select("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[2]/td[8]/select", "value=Label $title 2");
-    $this->click("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[2]/td[9]/a");
+    $this->select("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[2]/td[@class='result']/select", "value=Label $title 2");
+    $this->click("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[2]/td[8]/a");
     $this->click("_qf_Interview_cancel_interview");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
index b9d85ad571c3b0a95cecdb876c8d1de9562d0d45..8e2bdc903a127c3c8e5880767179189f1bc637c5 100644 (file)
@@ -100,15 +100,15 @@ class WebTest_Financial_FinancialBatchExport extends CiviSeleniumTestCase {
    * @param $numberOfTrxn
    */
   public function _testAssignBatch($numberOfTrxn) {
-    $this->select("xpath=//div[@id='crm-transaction-selector-assign_length']/label/select[@name='crm-transaction-selector-assign_length']", "value=$numberOfTrxn");
+    $this->waitForAjaxContent();
+    $this->select("xpath=//div[@class='dataTables_length']/label/select", "value={$numberOfTrxn}");
     // 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(5);
+    $this->waitForAjaxContent();
     $this->click('toggleSelect');
     $this->select('trans_assign', 'value=Assign');
     $this->click('Go');
-    $this->waitForPageToLoad($this->getTimeoutMsec());
   }
 
   /**
@@ -119,7 +119,7 @@ class WebTest_Financial_FinancialBatchExport extends CiviSeleniumTestCase {
   public function _testExportBatch($setTitle, $batchId, $exportFormat) {
     $this->openCiviPage("financial/batch", "reset=1&action=export&id=$batchId");
     if ($exportFormat == 'CSV') {
-      $this->click("xpath=//form[@id='FinancialBatch']/div[2]/table[@class='form-layout']/tbody/tr/td/input[2]");
+      $this->click("xpath=//form[@id='FinancialBatch']/div[2]/table[@class='form-layout']/tbody/tr/td/input[1]");
       $this->click('_qf_FinancialBatch_next-botttom');
       $this->waitForPageToLoad($this->getTimeoutMsec());
     }
@@ -129,9 +129,7 @@ class WebTest_Financial_FinancialBatchExport extends CiviSeleniumTestCase {
       $this->waitForPageToLoad($this->getTimeoutMsec());
     }
     $this->openCiviPage("dashboard", "reset=1");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-
-    $this->clickLink("xpath=//div[@id='recently-viewed']/ul/li[1]/a", "_qf_Activity_cancel-bottom");
+    $this->clickLink("xpath=//div[@id='crm-recently-viewed']/ul/li[1]/a", "_qf_Activity_cancel-bottom");
     $this->webtestVerifyTabularData(
       array(
         'Current Attachment(s)' => 'Financial_Transactions_',
index dfbd677944c9178fab6c443f2019ae578718c99d..af65b6082cadc2a48757c55a520865c97a107146 100644 (file)
@@ -61,7 +61,8 @@ class WebTest_Grant_ContactContextAddTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent('crm-contact-actions-link');
 
     // now add grant from contact summary
-    $this->click("//a[@id='crm-contact-actions-link']/span/div");
+    $this->click("xpath=//div[@class='crm-actions-ribbon']/ul[@id='actions']/li[@class='crm-contact-activity crm-summary-block']/div/a[@id='crm-contact-actions-link']");
+    $this->waitForElementPresent('crm-contact-actions-list');
 
     // wait for add Grant link
     $this->waitForElementPresent('link=Add Grant');
index 7f067fc7f517d47a70d2336cc51d7c42448e959c..fbe077547bc0a3586266408c84552bf315956282 100644 (file)
@@ -117,14 +117,14 @@ class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase {
     $this->click("xpath=//button[@title='Close']");
 
     // select default header and footer ( with label )
-    $this->click("xpath=//ul/li/a[text()='Header and Footer']");
+    $this->click('link=Header and Footer');
     $this->select2("s2id_crmUiId_10", "Mailing Header");
     $this->select2("s2id_crmUiId_11", "Mailing Footer");
 
     //--------track and respond----------
 
     // check for default settings options
-    $this->click("xpath=//ul/li/a[text()='Tracking']");
+    $this->click('link=Tracking');
     $this->assertChecked("url_tracking");
     $this->assertChecked("open_tracking");
 
@@ -370,14 +370,14 @@ class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase {
     $this->click("xpath=//button[@title='Close']");
 
     // select default header and footer ( with label )
-    $this->click("xpath=//ul/li/a[text()='Header and Footer']");
+    $this->click('link=Header and Footer');
     $this->select2("s2id_crmUiId_10", "Mailing Header");
     $this->select2("s2id_crmUiId_11", "Mailing Footer");
 
     //--------track and respond----------
 
     // check for default settings options
-    $this->click("xpath=//ul/li/a[text()='Tracking']");
+    $this->click('link=Tracking');
     $this->assertChecked("url_tracking");
     $this->assertChecked("open_tracking");
 
index c4e309ff8ba294cd8b70385c23d1cc94e673791e..87addb7b2407af3cee175ba0da169c808fe58d04 100644 (file)
@@ -52,7 +52,8 @@ class WebTest_Pledge_ContactContextAddTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent('crm-contact-actions-link');
 
     // now add pledge from contact summary
-    $this->click("//a[@id='crm-contact-actions-link']/span/div");
+    $this->click("xpath=//div[@class='crm-actions-ribbon']/ul[@id='actions']/li[@class='crm-contact-activity crm-summary-block']/div/a[@id='crm-contact-actions-link']");
+    $this->waitForElementPresent('crm-contact-actions-list');
 
     // wait for add plegde link
     $this->waitForElementPresent('link=Add Pledge');
index 5cbb75932839e2cbb39ddc71884e65ca914305db..9401fd3f7b101fb0ce36c358853da02bd3a8f4e7 100644 (file)
@@ -38,7 +38,7 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest
   public function testAddPledgePaymentWithAdjustPledgePaymentSchedule() {
     $this->webtestLogin();
     $this->openCiviPage('admin/setting/localization', 'reset=1');
-    $this->select("currencyLimit-f", "value=FJD");
+    $this->select("currencyLimit", "value=FJD");
     $this->click("add");
     $this->click("_qf_Localization_next-bottom");
     $this->waitForPageToLoad($this->getTimeoutMsec());
@@ -58,7 +58,8 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest
     $this->waitForElementPresent('crm-contact-actions-link');
 
     // now add pledge from contact summary
-    $this->click("//a[@id='crm-contact-actions-link']/span/div");
+    $this->click("xpath=//div[@class='crm-actions-ribbon']/ul[@id='actions']/li[@class='crm-contact-activity crm-summary-block']/div/a[@id='crm-contact-actions-link']");
+    $this->waitForElementPresent('crm-contact-actions-list');
 
     // wait for add pledge link
     $this->waitForElementPresent('link=Add Pledge');
@@ -197,7 +198,7 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest
       )
     );
     $this->openCiviPage('admin/setting/localization', 'reset=1');
-    $this->select("currencyLimit-t", "value=FJD");
+    $this->select("currencyLimit", "value=FJD");
     $this->click("remove");
     $this->click("_qf_Localization_next-bottom");
     $this->waitForPageToLoad($this->getTimeoutMsec());
@@ -222,7 +223,8 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest
     $this->waitForElementPresent('crm-contact-actions-link');
 
     // now add pledge from contact summary
-    $this->click("//a[@id='crm-contact-actions-link']/span/div");
+    $this->click("xpath=//div[@class='crm-actions-ribbon']/ul[@id='actions']/li[@class='crm-contact-activity crm-summary-block']/div/a[@id='crm-contact-actions-link']");
+    $this->waitForElementPresent('crm-contact-actions-list');
 
     // wait for add plegde link
     $this->waitForElementPresent('link=Add Pledge');
@@ -367,7 +369,8 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest
     $this->waitForElementPresent('crm-contact-actions-link');
 
     // now add pledge from contact summary
-    $this->click("//a[@id='crm-contact-actions-link']/span/div");
+    $this->click("xpath=//div[@class='crm-actions-ribbon']/ul[@id='actions']/li[@class='crm-contact-activity crm-summary-block']/div/a[@id='crm-contact-actions-link']");
+    $this->waitForElementPresent('crm-contact-actions-list');
 
     // wait for add plegde link
     $this->waitForElementPresent('link=Add Pledge');
index 72e84e3bdf4287e3da48c00c79046d68a67c97ad..cb52bb823d78892560da7b9733231b9f3d92114e 100644 (file)
@@ -88,7 +88,6 @@ class WebTest_Report_AddTest extends CiviSeleniumTestCase {
     $reportDescription = "New Contact Summary Report";
     $emaiSubject = "Contact Summary Report";
     $emailCC = "tesmail@example.org";
-
     $this->click("xpath=//div[@id='mainTabContainer']/ul/li[4]/a");
     $this->waitForElementPresent("xpath=//div[@class='crm-submit-buttons']");
     $this->click("_qf_Summary_submit_save");
@@ -109,9 +108,11 @@ class WebTest_Report_AddTest extends CiviSeleniumTestCase {
     $this->type("email_subject", $emaiSubject);
 
     // Fill Email To
+    $this->waitForElementPresent('email_to');
     $this->type("email_to", $emailId);
 
     // Fill Email CC
+    $this->waitForElementPresent('email_cc');
     $this->type("email_cc", $emailCC);
 
     // We want navigation menu