From 3c926399710b92512b4231847c7214068e06bd06 Mon Sep 17 00:00:00 2001 From: Web Access Date: Thu, 5 Nov 2015 18:41:45 +0530 Subject: [PATCH] Fix for webtests --- tests/phpunit/WebTest/Contact/AddTest.php | 9 ++++++--- tests/phpunit/WebTest/Contact/ContactTagTest.php | 2 +- tests/phpunit/WebTest/Contact/RelationshipAddTest.php | 5 ++--- tests/phpunit/WebTest/Event/AddEventTest.php | 1 - tests/phpunit/WebTest/Event/AddPricesetTest.php | 4 ++-- tests/phpunit/WebTest/Event/AdditionalPaymentTest.php | 7 ++++--- tests/phpunit/WebTest/Event/PCPAddTest.php | 4 ++-- .../Pledge/ContactContextPledgePaymentAddTest.php | 7 +++---- .../WebTest/Profile/ProfileGroupSubscriptionTest.php | 1 + 9 files changed, 21 insertions(+), 19 deletions(-) diff --git a/tests/phpunit/WebTest/Contact/AddTest.php b/tests/phpunit/WebTest/Contact/AddTest.php index 05cd1fbabb..f2d546c68e 100644 --- a/tests/phpunit/WebTest/Contact/AddTest.php +++ b/tests/phpunit/WebTest/Contact/AddTest.php @@ -42,7 +42,8 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase { // go to display preferences to enable Open ID field $this->openCiviPage('admin/setting/preferences/display', "reset=1", "_qf_Display_next-bottom"); - $this->check("xpath=//ul[@id='contactEditBlocks']//li/span[2]/label[text()='Open ID']/../input"); + $this->waitForAjaxContent(); + $this->click("xpath=//ul[@id='contactEditBlocks']//li/span/label[text()='Open ID']"); $this->click("_qf_Display_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->openCiviPage('contact/add', 'reset=1&ct=Individual'); @@ -178,7 +179,8 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase { // go to display preferences to enable Open ID field $this->openCiviPage('admin/setting/preferences/display', "reset=1", "_qf_Display_next-bottom"); - $this->check("xpath=//ul[@id='contactEditBlocks']//li/span[2]/label[text()='Open ID']/../input"); + $this->waitForAjaxContent(); + $this->click("xpath=//ul[@id='contactEditBlocks']//li/span/label[text()='Open ID']"); $this->click("_qf_Display_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -289,7 +291,8 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase { // go to display preferences to enable Open ID field $this->openCiviPage('admin/setting/preferences/display', "reset=1", "_qf_Display_next-bottom"); - $this->check("xpath=//ul[@id='contactEditBlocks']//li/span[2]/label[text()='Open ID']/../input"); + $this->waitForAjaxContent(); + $this->click("xpath=//ul[@id='contactEditBlocks']//li/span/label[text()='Open ID']"); $this->click("_qf_Display_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); diff --git a/tests/phpunit/WebTest/Contact/ContactTagTest.php b/tests/phpunit/WebTest/Contact/ContactTagTest.php index ada9094fc6..de73039ffc 100644 --- a/tests/phpunit/WebTest/Contact/ContactTagTest.php +++ b/tests/phpunit/WebTest/Contact/ContactTagTest.php @@ -145,7 +145,7 @@ class WebTest_Contact_ContactTagTest extends CiviSeleniumTestCase { // Visit contact summary page. $this->click("css=ul.ui-autocomplete li"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForAjaxContent(); $this->waitForText('tags', "tagset1, tagset2"); } diff --git a/tests/phpunit/WebTest/Contact/RelationshipAddTest.php b/tests/phpunit/WebTest/Contact/RelationshipAddTest.php index 88a44b359b..89be1374c5 100644 --- a/tests/phpunit/WebTest/Contact/RelationshipAddTest.php +++ b/tests/phpunit/WebTest/Contact/RelationshipAddTest.php @@ -336,9 +336,8 @@ class WebTest_Contact_RelationshipAddTest extends CiviSeleniumTestCase { //check the status message $this->waitForText('crm-notification-container', 'Relationship created.'); - - $this->waitForElementPresent("xpath=//div[@id='contact-summary-relationship-tab']/div[2]/div[1]/table/tbody/tr/td[9]/span[1]/a[1]"); - $this->click("xpath=//div[@id='contact-summary-relationship-tab']/div[2]/div[1]/table/tbody/tr/td[9]/span[1]/a[1]"); + $this->waitForElementPresent("xpath=//div[@id='contact-summary-relationship-tab']/div[2]/div[1]/table/tbody/tr/td[9]/span[1]//a[text()='View']"); + $this->click("xpath=//div[@id='contact-summary-relationship-tab']/div[2]/div[1]/table/tbody/tr/td[9]/span[1]//a[text()='View']"); $this->webtestVerifyTabularData( array( diff --git a/tests/phpunit/WebTest/Event/AddEventTest.php b/tests/phpunit/WebTest/Event/AddEventTest.php index 10f2bd6884..5cad373435 100644 --- a/tests/phpunit/WebTest/Event/AddEventTest.php +++ b/tests/phpunit/WebTest/Event/AddEventTest.php @@ -798,7 +798,6 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { //unselect the payment processor configured $this->openCiviPage("event/manage/fee", "reset=1&action=update&id={$eventId}", '_qf_Fee_upload-bottom'); - $this->click("xpath=//tr[@class='crm-event-manage-fee-form-block-payment_processor']/td[2]/label[text()='Test Processor']"); $this->click("_qf_Fee_upload-bottom"); $this->waitForText('crm-notification-container', "'Fees' information has been saved."); diff --git a/tests/phpunit/WebTest/Event/AddPricesetTest.php b/tests/phpunit/WebTest/Event/AddPricesetTest.php index f0b63916e7..4043f06345 100644 --- a/tests/phpunit/WebTest/Event/AddPricesetTest.php +++ b/tests/phpunit/WebTest/Event/AddPricesetTest.php @@ -745,14 +745,14 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { //check the delete for price field $this->openCiviPage("admin/price/field", "reset=1&action=browse&sid={$sid}"); $this->waitForElementPresent("xpath=//table[@id='options']/tbody/tr/td[9]/span[2]"); - $this->click("xpath=//table[@id='options']/tbody/tr/td[9]/span[2]/ul/li[2]/a"); + $this->click("xpath=//table[@id='options']/tbody/tr/td[9]/span[2]/ul[@class='panel']/li[2]//a[text()='Delete']"); //assert the message $this->waitForText('price_set_used_by', "it is currently in use by one or more active events or contribution pages or contributions or event templates. If you no longer want to use this price set, click the event title below, and modify the fees for that event."); //check the delete for priceset $this->openCiviPage("admin/price", "reset=1"); $this->waitForElementPresent("xpath=//table[@class='display crm-price-set-listing dataTable no-footer']/tbody/tr/td[4]/span[2]"); - $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[4]/span[2]/ul/li[3]/a"); + $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[4]/span[2]/ul/li[3]//a[text()='Delete']"); // Check confirmation alert. $this->assertTrue((bool) preg_match("/^Are you sure you want to delete this price set?/", $this->getConfirmation() diff --git a/tests/phpunit/WebTest/Event/AdditionalPaymentTest.php b/tests/phpunit/WebTest/Event/AdditionalPaymentTest.php index 5b870e7ea0..bab05ca745 100644 --- a/tests/phpunit/WebTest/Event/AdditionalPaymentTest.php +++ b/tests/phpunit/WebTest/Event/AdditionalPaymentTest.php @@ -66,6 +66,7 @@ class WebTest_Event_AdditionalPaymentTest extends CiviSeleniumTestCase { $this->select('status_id', 'value=1'); // Setting registration source + $this->waitForElementPresent('source'); $this->type('source', 'Event Partially Paid Webtest'); // Since we're here, let's check of screen help is being displayed properly @@ -75,7 +76,7 @@ class WebTest_Event_AdditionalPaymentTest extends CiviSeleniumTestCase { $this->waitForElementPresent('priceset'); $this->click("xpath=//input[@class='crm-form-radio']"); - sleep(1); + $this->waitForAjaxContent(); // record payment total amount // amount populated after fee selection $amtTotalOwed = (int) $this->getValue('id=total_amount'); @@ -110,9 +111,9 @@ class WebTest_Event_AdditionalPaymentTest extends CiviSeleniumTestCase { // Is status message correct? $this->waitForText('crm-notification-container', "Event registration for $displayName has been added"); - $this->waitForElementPresent("xpath=//form[@class='CRM_Event_Form_Search crm-search-form']/table//tbody/tr[1]/td[8]/span//a[text()='View']"); + $this->waitForElementPresent("xpath=//form[@class='CRM_Event_Form_Search crm-search-form']/table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span//a[text()='View']"); //click through to the participant view screen - $this->click("xpath=//form[@class='CRM_Event_Form_Search crm-search-form']/table/tbody/tr[1]/td[8]/span//a[text()='View']"); + $this->click("xpath=//form[@class='CRM_Event_Form_Search crm-search-form']/table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span//a[text()='View']"); $this->waitForElementPresent("xpath=//button//span[contains(text(),'Done')]"); $this->webtestVerifyTabularData( diff --git a/tests/phpunit/WebTest/Event/PCPAddTest.php b/tests/phpunit/WebTest/Event/PCPAddTest.php index bd214b3fec..b89624faff 100644 --- a/tests/phpunit/WebTest/Event/PCPAddTest.php +++ b/tests/phpunit/WebTest/Event/PCPAddTest.php @@ -214,7 +214,7 @@ class WebTest_Event_PCPAddTest extends CiviSeleniumTestCase { $this->click("link=Fees"); $this->waitForElementPresent("_qf_Fee_upload-bottom"); $this->click("CIVICRM_QFID_1_is_monetary"); - $this->click("xpath=//tr[@class='crm-event-manage-fee-form-block-payment_processor']/td[2]/label[text()='$processorName']"); + $this->select2('payment_processor', $processorName, TRUE); if ($priceSet) { // get one - TBD } @@ -256,7 +256,7 @@ class WebTest_Event_PCPAddTest extends CiviSeleniumTestCase { $this->assertChecked("is_multiple_registrations"); } - $this->click('intro_text-plain'); + $this->click('intro_text'); $this->fillRichTextField("intro_text", $registerIntro); // enable confirmation email diff --git a/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php b/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php index 9401fd3f7b..34d0f76f49 100644 --- a/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php +++ b/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php @@ -276,11 +276,10 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest 'Send additional reminders' => '4 days after the last one sent', ) ); - $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']", FALSE); - $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); - $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); - $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); + $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[1]/span/a"); + $this->waitForElementPresent("xpath=//table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); + $this->click("xpath=//table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); $this->click("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); $this->waitForElementPresent("adjust-option-type"); diff --git a/tests/phpunit/WebTest/Profile/ProfileGroupSubscriptionTest.php b/tests/phpunit/WebTest/Profile/ProfileGroupSubscriptionTest.php index bb154f487c..6863f3b270 100644 --- a/tests/phpunit/WebTest/Profile/ProfileGroupSubscriptionTest.php +++ b/tests/phpunit/WebTest/Profile/ProfileGroupSubscriptionTest.php @@ -93,6 +93,7 @@ class WebTest_Profile_ProfileGroupSubscriptionTest extends CiviSeleniumTestCase $this->select('field_name[0]', 'value=Contact'); $this->click("//option[@value='Contact']"); + $this->waitForElementPresent("field_name[1]"); $this->select('field_name[1]', 'value=group'); $this->click("//option[@value='group']"); -- 2.25.1