From 952cc48fb310173cb6a6d469b157fd93e9a91a43 Mon Sep 17 00:00:00 2001 From: Web Access Date: Wed, 28 Oct 2015 18:53:34 +0530 Subject: [PATCH] Webtest fix --- tests/phpunit/WebTest/Campaign/MailingTest.php | 6 ++++-- tests/phpunit/WebTest/Campaign/PledgeTest.php | 3 ++- .../WebTest/Campaign/SurveyUsageScenarioTest.php | 14 +++++--------- .../WebTest/Financial/FinancialBatchExport.php | 12 +++++------- .../WebTest/Grant/ContactContextAddTest.php | 3 ++- tests/phpunit/WebTest/Mailing/MailingTest.php | 8 ++++---- .../WebTest/Pledge/ContactContextAddTest.php | 3 ++- .../Pledge/ContactContextPledgePaymentAddTest.php | 13 ++++++++----- tests/phpunit/WebTest/Report/AddTest.php | 3 ++- 9 files changed, 34 insertions(+), 31 deletions(-) diff --git a/tests/phpunit/WebTest/Campaign/MailingTest.php b/tests/phpunit/WebTest/Campaign/MailingTest.php index fb1d8caffb..218032785b 100644 --- a/tests/phpunit/WebTest/Campaign/MailingTest.php +++ b/tests/phpunit/WebTest/Campaign/MailingTest.php @@ -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"); diff --git a/tests/phpunit/WebTest/Campaign/PledgeTest.php b/tests/phpunit/WebTest/Campaign/PledgeTest.php index 1be3945b33..55ba5a7bdf 100644 --- a/tests/phpunit/WebTest/Campaign/PledgeTest.php +++ b/tests/phpunit/WebTest/Campaign/PledgeTest.php @@ -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'); diff --git a/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php b/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php index 7a87e9c8ac..69f9888332 100644 --- a/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php +++ b/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php @@ -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()); diff --git a/tests/phpunit/WebTest/Financial/FinancialBatchExport.php b/tests/phpunit/WebTest/Financial/FinancialBatchExport.php index b9d85ad571..8e2bdc903a 100644 --- a/tests/phpunit/WebTest/Financial/FinancialBatchExport.php +++ b/tests/phpunit/WebTest/Financial/FinancialBatchExport.php @@ -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_', diff --git a/tests/phpunit/WebTest/Grant/ContactContextAddTest.php b/tests/phpunit/WebTest/Grant/ContactContextAddTest.php index dfbd677944..af65b6082c 100644 --- a/tests/phpunit/WebTest/Grant/ContactContextAddTest.php +++ b/tests/phpunit/WebTest/Grant/ContactContextAddTest.php @@ -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'); diff --git a/tests/phpunit/WebTest/Mailing/MailingTest.php b/tests/phpunit/WebTest/Mailing/MailingTest.php index 7f067fc7f5..fbe077547b 100644 --- a/tests/phpunit/WebTest/Mailing/MailingTest.php +++ b/tests/phpunit/WebTest/Mailing/MailingTest.php @@ -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"); diff --git a/tests/phpunit/WebTest/Pledge/ContactContextAddTest.php b/tests/phpunit/WebTest/Pledge/ContactContextAddTest.php index c4e309ff8b..87addb7b24 100644 --- a/tests/phpunit/WebTest/Pledge/ContactContextAddTest.php +++ b/tests/phpunit/WebTest/Pledge/ContactContextAddTest.php @@ -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'); diff --git a/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php b/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php index 5cbb759328..9401fd3f7b 100644 --- a/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php +++ b/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php @@ -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'); diff --git a/tests/phpunit/WebTest/Report/AddTest.php b/tests/phpunit/WebTest/Report/AddTest.php index 72e84e3bdf..cb52bb823d 100644 --- a/tests/phpunit/WebTest/Report/AddTest.php +++ b/tests/phpunit/WebTest/Report/AddTest.php @@ -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 -- 2.25.1