From 5009a032991353a25aee8217b62ea46d6adbe4bf Mon Sep 17 00:00:00 2001 From: Web Access Date: Fri, 27 Nov 2015 18:48:56 +0530 Subject: [PATCH] Webtests --- .../AdvancedSearchedRelatedContactTest.php | 7 ++--- .../WebTest/Contact/RelationshipAddTest.php | 30 +++++++------------ .../OnlineMultiplePaymentProcessorTest.php | 1 + .../WebTest/Event/ParticipantCountTest.php | 2 ++ .../WebTest/Pledge/AddCancelPaymentTest.php | 4 +-- 5 files changed, 19 insertions(+), 25 deletions(-) diff --git a/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php b/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php index b4aaf4c3f2..d80c77a35e 100644 --- a/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php +++ b/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php @@ -92,7 +92,7 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes $this->openCiviPage('contact/search', 'reset=1', '_qf_Basic_refresh'); $this->type("sort_name", $sortName); $this->select("contact_type", "value=Individual"); - $this->clickLink("_qf_Basic_refresh", "xpath=//form[@id='Basic']//div/div//div/table/tbody/tr/", FALSE); + $this->clickLink("_qf_Basic_refresh", "//div[@class='crm-search-results']/table[@class='selector row-highlight']/tbody/tr/", FALSE); // click through to the Relationship view screen $this->click("xpath=//table[@class='selector row-highlight']/tbody//tr/td[11]/span/a[text()='View']"); @@ -240,10 +240,10 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes $this->openCiviPage('contact/search', 'reset=1', '_qf_Basic_refresh'); $this->type("sort_name", $ContactName); $this->select("contact_type", "value=Individual"); - $this->clickLink("_qf_Basic_refresh", "xpath=//form[@id='Basic']/div[3]/div/div[2]/table/tbody/tr/", FALSE); + $this->clickLink("_qf_Basic_refresh", "//div[@class='crm-search-results']/table[@class='selector row-highlight']/tbody/tr/", FALSE); // click through to the Contribution view screen - $this->click("xpath=//form[@id='Basic']/div[3]/div/div[2]/table/tbody/tr/td[11]/span/a[text()='View']"); + $this->click("xpath=//div[@class='crm-search-results']/table[@class='selector row-highlight']/tbody/tr/td[11]//span/a[text()='View']"); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->click("css=li#tab_rel a"); @@ -274,7 +274,6 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes //check the status message $this->waitForText('crm-notification-container', "Relationship created."); - $this->waitForElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']//table/tbody//tr/td[9]/span/a[text()='View']"); $this->click("xpath=//div[@class='dataTables_wrapper no-footer']//table/tbody//tr/td[9]/span/a[text()='View']"); diff --git a/tests/phpunit/WebTest/Contact/RelationshipAddTest.php b/tests/phpunit/WebTest/Contact/RelationshipAddTest.php index 89be1374c5..4cf059d331 100644 --- a/tests/phpunit/WebTest/Contact/RelationshipAddTest.php +++ b/tests/phpunit/WebTest/Contact/RelationshipAddTest.php @@ -92,9 +92,8 @@ class WebTest_Contact_RelationshipAddTest extends CiviSeleniumTestCase { //check the status message $this->waitForText('crm-notification-container', 'Relationship created.'); - - $this->waitForElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[9]/span/a[1][text()='View']"); - $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[9]/span/a[1][text()='View']"); + $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[9]//span//a[text()='View']"); + $this->click("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[9]//span//a[text()='View']"); $this->webtestVerifyTabularData( array( @@ -161,6 +160,7 @@ class WebTest_Contact_RelationshipAddTest extends CiviSeleniumTestCase { $this->select('relationship_type_id', "label={$params['label_b_a']}"); //fill in the individual + $this->waitForElementPresent("related_contact_id"); $this->select2('related_contact_id', $sortName, TRUE); //fill in the relationship start date @@ -173,8 +173,8 @@ class WebTest_Contact_RelationshipAddTest extends CiviSeleniumTestCase { //save the relationship $this->click('_qf_Relationship_upload-bottom'); - $this->waitForElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[9]/span/a[1][text()='View']"); - $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[9]/span/a[1][text()='View']"); + $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[9]//span//a[text()='View']"); + $this->click("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[9]//span//a[text()='View']"); $this->webtestVerifyTabularData( array( @@ -265,8 +265,8 @@ class WebTest_Contact_RelationshipAddTest extends CiviSeleniumTestCase { //save the relationship $this->click('_qf_Relationship_upload-bottom'); - $this->waitForElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[9]/span/a[1][text()='View']"); - $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[9]/span/a[1][text()='View']"); + $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[9]//span//a[text()='View']"); + $this->click("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[9]//span//a[text()='View']"); $this->webtestVerifyTabularData( array( @@ -306,11 +306,7 @@ class WebTest_Contact_RelationshipAddTest extends CiviSeleniumTestCase { //choose the created relationship type $this->waitForElementPresent("relationship_type_id"); $this->select('relationship_type_id', "label={$params['label_a_b']}"); - - // 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: wait until new contact dialog select is built - sleep(2); + $this->waitForAjaxContent(); // create a new organization $orgName = 'WestsideCoop' . substr(sha1(rand()), 0, 7); @@ -383,11 +379,7 @@ class WebTest_Contact_RelationshipAddTest extends CiviSeleniumTestCase { //choose the created relationship type $this->waitForElementPresent("relationship_type_id"); $this->select('relationship_type_id', "label=Employee of"); - - // 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: wait until new contact dialog select is built - sleep(2); + $this->waitForAjaxContent(); // create a new organization @@ -414,8 +406,8 @@ class WebTest_Contact_RelationshipAddTest extends CiviSeleniumTestCase { //check the status message $this->waitForText('crm-notification-container', 'Relationship created.'); - $this->waitForElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[9]/span/a[1][text()='View']"); - $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[9]/span/a[1][text()='View']"); + $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[9]//span//a[text()='View']"); + $this->click("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[9]//span//a[text()='View']"); $this->webtestVerifyTabularData( array( diff --git a/tests/phpunit/WebTest/Contribute/OnlineMultiplePaymentProcessorTest.php b/tests/phpunit/WebTest/Contribute/OnlineMultiplePaymentProcessorTest.php index 5913088d62..0f3f533e11 100644 --- a/tests/phpunit/WebTest/Contribute/OnlineMultiplePaymentProcessorTest.php +++ b/tests/phpunit/WebTest/Contribute/OnlineMultiplePaymentProcessorTest.php @@ -174,6 +174,7 @@ class WebTest_Contribute_OnlineMultiplePaymentProcessorTest extends CiviSelenium $xpath = "xpath=//label[text() = '{$payLaterText}']/preceding-sibling::input[1]"; $this->click($xpath); + $this->waitForAjaxContent(); $this->click("_qf_Main_upload-bottom"); $this->waitForElementPresent("xpath=//div[@class='bold pay_later_receipt-section']"); diff --git a/tests/phpunit/WebTest/Event/ParticipantCountTest.php b/tests/phpunit/WebTest/Event/ParticipantCountTest.php index 3b9a17de1e..3ea4182b65 100644 --- a/tests/phpunit/WebTest/Event/ParticipantCountTest.php +++ b/tests/phpunit/WebTest/Event/ParticipantCountTest.php @@ -291,6 +291,7 @@ class WebTest_Event_ParticipantCountTest extends CiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); // verify number of participants records and total participant count + $this->waitForAjaxContent(); $this->assertStringsPresent(array('2 Results', 'Actual participant count : 24')); // CRM-7953, check custom search Price Set Details for Event @@ -306,6 +307,7 @@ class WebTest_Event_ParticipantCountTest extends CiviSeleniumTestCase { $this->openCiviPage('admin/price', 'reset=1&action=add', '_qf_Set_next-bottom'); // Enter Priceset fields (Title, Used For ...) + $this->waitForElementPresent("title"); $this->type('title', $setTitle); $this->check('extends[1]'); $this->select("css=select.crm-form-select", "label={$financialType}"); diff --git a/tests/phpunit/WebTest/Pledge/AddCancelPaymentTest.php b/tests/phpunit/WebTest/Pledge/AddCancelPaymentTest.php index 4bed4df039..ff73036ef2 100644 --- a/tests/phpunit/WebTest/Pledge/AddCancelPaymentTest.php +++ b/tests/phpunit/WebTest/Pledge/AddCancelPaymentTest.php @@ -90,12 +90,12 @@ class WebTest_Pledge_AddCancelPaymentTest extends CiviSeleniumTestCase { //Check whether the next two payments are done or not $this->waitForAjaxContent(); - $this->waitForElementPresent("xpath=//form[@id='Search']//div/table/tbody//tr//td/table/tbody/tr[2]/td[8]/a[text()='View Payment']"); + $this->waitForElementPresent("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']//div/table/tbody//tr//td/table/tbody/tr[2]/td[8]/a[text()='View Payment']"); $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[7]", "Completed"); $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[4]/td[7]", "Completed"); //Cancel the contribution made for amount of 300.00 - $this->waitForElementPresent("xpath=//form[@id='Search']//div/table/tbody//tr//td/table/tbody/tr[2]/td[8]/a[text()='View Payment']"); + $this->waitForElementPresent("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']//div/table/tbody//tr//td/table/tbody/tr[2]/td[8]/a[text()='View Payment']"); $this->click("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a"); $this->waitForElementPresent("xpath=//form[@id='ContributionView']//div[2]/div/div/a"); $this->click("xpath=//form[@id='ContributionView']//div[2]/div/div/a"); -- 2.25.1