From e6c6db9456324c2fbcc3ebb3b3447f1aaa1ceadc Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Fri, 9 May 2014 17:40:07 +0530 Subject: [PATCH] Web Test Fix For 4.5 alpha1 --- .../phpunit/WebTest/Event/AddPricesetTest.php | 11 ++++---- .../Pledge/StandaloneAddDeleteTest.php | 25 ++++++++++--------- .../WebTest/Pledge/StandaloneAddTest.php | 2 +- .../WebTest/Profile/ProfileAddTest.php | 7 +++--- 4 files changed, 24 insertions(+), 21 deletions(-) diff --git a/tests/phpunit/WebTest/Event/AddPricesetTest.php b/tests/phpunit/WebTest/Event/AddPricesetTest.php index f42111c53c..3d433f436f 100644 --- a/tests/phpunit/WebTest/Event/AddPricesetTest.php +++ b/tests/phpunit/WebTest/Event/AddPricesetTest.php @@ -445,9 +445,9 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { $this->webtestFillAutocomplete($firstName); // Select event. Based on label for now. - $this->select2('s2id_event_id', "$eventTitle"); + $this->select2('event_id', "$eventTitle"); // Select role - $this->click('role_id[2]'); + $this->multiselect2('role_id', array('Volunteer')); $this->click("xpath=//input[@class='crm-form-radio']"); $this->click("xpath=//input[@class='crm-form-checkbox']"); @@ -464,7 +464,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { $this->click('_qf_Participant_upload-bottom'); $this->waitForPageToLoad($this->getTimeoutMsec()); // Is status message correct? - $this->assertElementContainsText("css=#crm-notification-container", "Event registration for $displayName has been added", "Status message didn't show up after saving!"); + $this->waitForText("crm-notification-container", "Event registration for $displayName has been added", "Status message didn't show up after saving!"); $this->waitForElementPresent("xpath=//*[@id='Search']//table//tbody/tr[1]/td[8]/span/a[text()='View']"); @@ -560,7 +560,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { $this->webtestFillAutocomplete($firstName); $this->select2('event_id', $eventTitle); // Select role - $this->click('role_id[2]'); + $this->multiselect2('role_id', array('Volunteer')); // Choose Registration Date. // Using helper webtestFillDate function. @@ -605,9 +605,10 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { 'Participant Role' => 'Attendee', 'Status' => 'Registered', 'Event Source' => 'Event StandaloneAddTest Webtest', - 'Fees' => 'Total Fee(s) Total Paid Balance $ 2,705.00', ) ); + $this->waitForElementPresent("xpath=//table/tbody/tr/td[text()='Fees']/following-sibling::td"); + $this->verifyText("xpath=//table/tbody/tr/td[text()='Fees']/following-sibling::td/table/tbody/tr[2]/td", preg_quote('$ 2,705.00'), 'In line ' . __LINE__); $expectedLineItems = array( 2 => array( 1 => 'Full Conference', diff --git a/tests/phpunit/WebTest/Pledge/StandaloneAddDeleteTest.php b/tests/phpunit/WebTest/Pledge/StandaloneAddDeleteTest.php index 24ba28136b..1d29b36e52 100644 --- a/tests/phpunit/WebTest/Pledge/StandaloneAddDeleteTest.php +++ b/tests/phpunit/WebTest/Pledge/StandaloneAddDeleteTest.php @@ -70,7 +70,8 @@ class WebTest_Pledge_StandaloneAddDeleteTest extends CiviSeleniumTestCase { 'Pledge Status' => 'Pending', ) ); - $this->clickLink('_qf_PledgeView_next-bottom', "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']", FALSE); + $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->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->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a"); @@ -106,16 +107,16 @@ class WebTest_Pledge_StandaloneAddDeleteTest extends CiviSeleniumTestCase { $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//tbody/tr[1]/td[10]/span/a[text()='View']"); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[10]/span/a[text()='View']"); $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()='View 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='ContributionView']//div[2]/div/div/a[2]"); - $this->click("xpath=//form[@id='ContributionView']//div[2]/div/div/a[2]"); - $this->waitForElementPresent("_qf_Contribution_next-bottom"); - $this->click("_qf_Contribution_next-bottom"); - $this->waitForElementPresent("ui-id-4"); - $this->click("ui-id-4"); + $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"); + $this->waitForElementPresent("xpath=//form[@id='ContributionView']//div[2]/div/div/a[2]/span[text()='Delete']"); + $this->click("xpath=//form[@id='ContributionView']//div[2]/div/div/a[2]/span[text()='Delete']"); + $this->waitForElementPresent("xpath=//form[@id='Contribution']/div[2]/div[2]/span/input[@value='Delete']"); + $this->click("xpath=//form[@id='Contribution']/div[2]/div[2]/span/input[@value='Delete']"); + $this->waitForElementPresent("ui-id-24"); + $this->click("ui-id-24"); $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[10]/span/a[text()='View']"); $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]"); @@ -126,8 +127,8 @@ class WebTest_Pledge_StandaloneAddDeleteTest extends CiviSeleniumTestCase { // verify that payment owed amount is correct (250.00) $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td","250.00"); // verify that Total Paid and Balance sums are correct - $this->verifyText("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[3]","470.00"); - $this->verifyText("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[4]","1,930.00"); + $this->verifyText("xpath=//div[@class='view-content' and contains(., 'view pledge payments')]/table[@class='selector row-highlight']//tbody/tr[1]/td[3]","470.00"); + $this->verifyText("xpath=//div[@class='view-content' and contains(., 'view pledge payments')]/table[@class='selector row-highlight']//tbody/tr[1]/td[4]","1,930.00"); } } diff --git a/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php b/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php index 24a8883dc6..02dddd851d 100644 --- a/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php +++ b/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php @@ -83,7 +83,7 @@ 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//tbody/tr[1]/td[10]/span/a[text()='View']", FALSE); + $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->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 ...)']"); } diff --git a/tests/phpunit/WebTest/Profile/ProfileAddTest.php b/tests/phpunit/WebTest/Profile/ProfileAddTest.php index ba37922251..9bca83c79a 100644 --- a/tests/phpunit/WebTest/Profile/ProfileAddTest.php +++ b/tests/phpunit/WebTest/Profile/ProfileAddTest.php @@ -190,8 +190,8 @@ class WebTest_Profile_ProfileAddTest extends CiviSeleniumTestCase { $this->openCiviPage('group', 'reset=1'); $this->type('title', $groupName); $this->click('_qf_Search_refresh'); - $this->waitForElementPresent("xpath=//table[@id='crm-group-selector']/tbody/tr/td[contains(., '$groupName')]/following-sibling::td[@class='crm-group-group_links']/span/a"); - $this->clickLink("xpath=//table[@id='crm-group-selector']/tbody/tr/td[1][contains(., '$groupName')]/following-sibling::td[@class='crm-group-group_links']/span/a"); + $this->waitForElementPresent("xpath=//table[@id='crm-group-selector']/tbody/tr/td/span[text() = '$groupName']/parent::td/following-sibling::td[@class=' crm-group-group_links']/span/a"); + $this->clickLink("xpath=//table[@id='crm-group-selector']/tbody/tr/td[1]/span[text() = '$groupName']/parent::td/following-sibling::td[@class=' crm-group-group_links']/span/a"); $contactEmails = array( 1 => "$lastName1, $firstName1", 2 => "$lastName2, $firstName2" @@ -294,11 +294,12 @@ class WebTest_Profile_ProfileAddTest extends CiviSeleniumTestCase { $this->assertEquals($this->getValue('description'), $profileDescription); // click on save button - $this->clickLink('_qf_Group_next-bottom'); + $this->clickLink('_qf_Group_next-bottom', "xpath=//div[@id='field_page']/div[3]/a[2]", FALSE); // Wait for "saved" status msg $this->waitForText('crm-notification-container', 'Profile Saved'); + $this->clickLink("xpath=//div[@id='breadcrumb']/div//a[text()='Profiles']"); $this->waitForElementPresent("xpath=//div[@class='crm-submit-buttons']/a[@id='newCiviCRMProfile-bottom']"); $this->waitForElementPresent("xpath=//div[@id='user-profiles']/div/div/table/tbody/tr[@id='UFGroup-$id']/td[2]/a"); $this->waitForElementPresent("xpath=//div[@id='user-profiles']/div/div/table/tbody/tr[@id='UFGroup-$id']/td[3]"); -- 2.25.1