From 08f17a9fbddfe3f21efd5522e3a6b8959618f759 Mon Sep 17 00:00:00 2001 From: Rohan Katkar Date: Fri, 19 Sep 2014 18:46:19 +0530 Subject: [PATCH] Webtest fix for failure --- .../phpunit/WebTest/Contribute/AddBatchesTest.php | 4 ++-- .../phpunit/WebTest/Event/PricesetMaxCountTest.php | 3 ++- .../WebTest/Pledge/StandaloneAddDeleteTest.php | 14 ++++++++------ tests/phpunit/WebTest/Pledge/StandaloneAddTest.php | 9 ++++++--- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/tests/phpunit/WebTest/Contribute/AddBatchesTest.php b/tests/phpunit/WebTest/Contribute/AddBatchesTest.php index 7f08522cd6..a2cfc591f1 100644 --- a/tests/phpunit/WebTest/Contribute/AddBatchesTest.php +++ b/tests/phpunit/WebTest/Contribute/AddBatchesTest.php @@ -216,8 +216,8 @@ class WebTest_Contribute_AddBatchesTest extends CiviSeleniumTestCase { $this->verifyText("xpath=id('MembershipView')/div[2]/div/table[1]/tbody/tr[$label]/td[2]", preg_quote($value)); } //View Contribution - $this->waitForElementPresent("xpath=//div[@class='crm-block crm-content-block crm-membership-view-form-block']/table[2]/tbody/tr[1]/td[8]/span/a[text()='View']"); - $this->click("xpath=//div[@class='crm-block crm-content-block crm-membership-view-form-block']/table[2]/tbody/tr[1]/td[8]/span/a[text()='View']"); + $this->waitForElementPresent("xpath=//form[@id='MembershipView']/div[2]/div/div[2]/div[2]/table/tbody/tr[1]/td[8]/span/a[1][text()='View']"); + $this->click("xpath=//form[@id='MembershipView']/div[2]/div/div[2]/div[2]/table/tbody/tr[1]/td[8]/span/a[1][text()='View']"); $this->waitForElementPresent("_qf_ContributionView_cancel-bottom"); $expected = array( 'From' => "{$data['first_name']} {$data['last_name']}", diff --git a/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php b/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php index 9e81951942..3cdea2324a 100644 --- a/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php +++ b/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php @@ -117,7 +117,7 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase { $pricesetLoc = $this->getLocation(); // get text field Id. - $textFieldId = explode('&id=', $this->getAttribute("xpath=//div[@class='crm-main-content-wrapper']//div[@id='field_page']//table/tbody/tr[1]/td[9]/span[1]/a[2]@href")); + $textFieldId = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']/table/tbody/tr[1]/td[9]/span[1]/a[2]@href")); $textFieldId = explode('&', $textFieldId[0]); $textFieldId = explode('=', $textFieldId[3]); $textFieldId = $textFieldId[1]; @@ -1060,6 +1060,7 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase { $count = 1; $this->waitForElementPresent('label'); foreach ($fields as $label => $field) { + $this->waitForElementPresent('label'); $this->type('label', $label); $this->select('html_type', "value={$field['type']}"); diff --git a/tests/phpunit/WebTest/Pledge/StandaloneAddDeleteTest.php b/tests/phpunit/WebTest/Pledge/StandaloneAddDeleteTest.php index 6f84c5ca2d..dd16d80a39 100644 --- a/tests/phpunit/WebTest/Pledge/StandaloneAddDeleteTest.php +++ b/tests/phpunit/WebTest/Pledge/StandaloneAddDeleteTest.php @@ -76,42 +76,43 @@ class WebTest_Pledge_StandaloneAddDeleteTest extends CiviSeleniumTestCase { ); $this->click('_qf_PledgeView_next-bottom'); $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); + $this->waitForAjaxContent(); $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 (Check, Cash, EFT ...)']"); + $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"); $this->waitForElementPresent("xpath=//form[@id='Contribution']//div[2]/table/tbody/tr[3]/td[2]/a"); $this->click("xpath=//form[@id='Contribution']//div[2]/table/tbody/tr[3]/td[2]/a"); $this->type('total_amount', '300.00'); $this->click('_qf_Contribution_upload-bottom'); - $this->waitForPageToLoad("30000"); $this->waitForText('crm-notification-container', "The contribution record has been saved."); $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); + $this->waitForAjaxContent(); $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[3]/td[8]/a[text()='Record Payment (Check, Cash, EFT ...)']"); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); $this->click("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[8]/a"); $this->waitForElementPresent("xpath=//form[@id='Contribution']//div[2]/table/tbody/tr[3]/td[2]/a"); $this->click("xpath=//form[@id='Contribution']//div[2]/table/tbody/tr[3]/td[2]/a"); $this->type('total_amount', '250.00'); $this->click('_qf_Contribution_upload-bottom'); - $this->waitForPageToLoad("30000"); $this->waitForText('crm-notification-container', "The contribution record has been saved."); $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); + $this->waitForAjaxContent(); $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[4]/td[8]/a[text()='Record Payment (Check, Cash, EFT ...)']"); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); $this->click("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[4]/td[8]/a"); $this->waitForElementPresent("xpath=//form[@id='Contribution']//div[2]/table/tbody/tr[3]/td[2]/a"); $this->click("xpath=//form[@id='Contribution']//div[2]/table/tbody/tr[3]/td[2]/a"); $this->type('total_amount', '170.00'); $this->click('_qf_Contribution_upload-bottom'); - $this->waitForPageToLoad("30000"); $this->waitForText('crm-notification-container', "The contribution record has been saved."); // delete the contribution associated with the 2nd payment $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[10]/span/a[text()='View']"); + $this->waitForAjaxContent(); $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[@class='selector row-highlight']/tbody/tr[2]/td[2]/table[@class='nestedSelector']/tbody/tr[3]/td[8]/a[text()='View Payment']"); $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[2]/td[2]/table[@class='nestedSelector']/tbody/tr[3]/td[8]/a"); @@ -122,6 +123,7 @@ class WebTest_Pledge_StandaloneAddDeleteTest extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//li[@id='tab_pledge']/a"); $this->click("xpath=//li[@id='tab_pledge']/a"); $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[10]/span/a[text()='View']"); + $this->waitForAjaxContent(); $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[3]/td[7]"); diff --git a/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php b/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php index d6198c3748..a2368ec270 100644 --- a/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php +++ b/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php @@ -70,9 +70,6 @@ class WebTest_Pledge_StandaloneAddTest extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); //click through to the Pledge view screen - $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); - $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[1]/td[10]/span/a[text()='View']"); $this->waitForElementPresent('_qf_PledgeView_next-bottom'); $pledgeDate = date('F jS, Y', strtotime('now')); @@ -90,6 +87,12 @@ class WebTest_Pledge_StandaloneAddTest extends CiviSeleniumTestCase { 'Send additional reminders' => '4 days after the last one sent', ) ); + $this->clickLink('_qf_PledgeView_next-bottom', "xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a", FALSE); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); + $this->waitForAjaxContent(); + $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[@class='selector row-highlight']//tbody/tr[1]/td[1]/span[2]/a"); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); } } -- 2.25.1