From 673c74180b372ab4a7ab4e36c121ef90bb65bd9d Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Tue, 6 May 2014 20:00:31 +0530 Subject: [PATCH] Web Test Fix --- .../WebTest/Contact/AdvancedSearchTest.php | 46 +++++++++---------- .../WebTest/Event/AddParticipationTest.php | 11 ++--- .../phpunit/WebTest/Event/TellAFriendTest.php | 6 ++- .../Member/OfflineAutoRenewMembershipTest.php | 4 +- 4 files changed, 33 insertions(+), 34 deletions(-) diff --git a/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php b/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php index a1c3eabe4d..f9b193f060 100644 --- a/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php +++ b/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php @@ -56,7 +56,6 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { $this->waitForElementPresent("_qf_GroupContact_next"); $this->select("group_id", "$groupName"); $this->click("_qf_GroupContact_next"); - $this->waitForPageToLoad($this->getTimeoutMsec()); // go to tag tab and add to new tag $this->click("css=li#tab_tag a"); @@ -72,18 +71,19 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { $this->click("css=li#tab_participant a"); $this->waitForElementPresent("link=Add Event Registration"); $this->click("link=Add Event Registration"); - $this->waitForElementPresent("note"); + $this->waitForText('s2id_event_id', "- select event -"); // fall fundraiser dinner event label is variable - $this->select("event_id", "value=1"); + $this->select2("event_id", "Fall Fundraiser Dinner"); $this->waitForElementPresent("receipt_text"); - $this->click("role_id[2]"); + $this->multiselect2("role_id", array('Volunteer')); + $this->click("CIVICRM_QFID_17_4"); $this->check("record_contribution"); $this->waitForElementPresent("contribution_status_id"); $this->select("payment_instrument_id", "Check"); $this->type("check_number", "chqNo$firstName"); $this->type("trxn_id", "trid$firstName"); $this->click("_qf_Participant_upload-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForElementPresent("link=Add Event Registration"); $this->waitForText('crm-notification-container', "Event registration for $firstName adv$firstName has been added"); // go to pledge tab and add pledge @@ -96,20 +96,20 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { $this->type("frequency_interval", "1"); $this->select("frequency_unit", "month(s)"); $this->click("_qf_Pledge_upload-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForElementPresent("link=Add Pledge"); $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created."); // go to Membership tab and add membership $this->click("css=li#tab_member a"); $this->waitForElementPresent("link=Add Membership"); - $this->clickLink("link=Add Membership"); + $this->clickLink("link=Add Membership", "_qf_Membership_cancel-bottom", FALSE); //let the organisation be default (Default Organization) $this->select("membership_type_id[0]", "value=1"); $this->click("membership_type_id[1]"); $this->select("membership_type_id[1]", "Student"); $this->type("source", "membership source$firstName"); - $this->clickLink("_qf_Membership_upload-bottom"); + $this->clickLink("_qf_Membership_upload-bottom", "link=Add Membership", FALSE); $this->waitForText('crm-notification-container', "Student membership for $firstName adv$firstName has been added"); @@ -118,13 +118,13 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { $this->waitForElementPresent("link=Add Relationship"); $this->click("link=Add Relationship"); $this->waitForElementPresent("_qf_Relationship_cancel"); - $this->select("relationship_type_id", "Employee of"); - $this->webtestFillAutocomplete("Default"); //default organization is provided as employer contact - $this->waitForElementPresent("details-save"); + $this->select2("relationship_type_id", "Employee of"); + $this->waitForElementPresent("xpath=//input[@id='related_contact_id'][@placeholder='- select organization -']"); + $this->select2("related_contact_id", "Default", TRUE); $this->webtestFillDate("start_date", "-1 day"); $this->webtestFillDate("end_date", "+1 day"); - $this->clickLink("details-save"); - $this->waitForText('crm-notification-container', "New relationship created."); + $this->click('_qf_Relationship_upload-bottom'); + $this->waitForText('crm-notification-container', "Relationship created."); //-------------- advance search -------------- @@ -143,7 +143,7 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { 'CiviContribute' => array('contribution_currency_type', 'addContributionSearchDetail'), 'CiviEvent' => array('participant_fee_amount_high', 'addParticipantSearchDetail'), 'CiviMember' => array('member_end_date_high', 'addMemberSearchDetail'), - 'CiviPledge' => array('pledge_in_honor_of', 'addPledgeSearchDetail'), + 'CiviPledge' => array('pledge_frequency_interval', 'addPledgeSearchDetail'), 'relationship' => array("xpath=//div[@id='relationship']/table/tbody/tr//td/label[text()='Relationship Status']/../label[text()='All']", ''), ); @@ -213,7 +213,7 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { //go to next page $this->click("xpath=//div[@class='crm-search-results']/div[@class='crm-pager']/span[@class='crm-pager-nav']/a[@title='next page']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForElementPresent("Go"); $j = $j + $subTotal; } @@ -254,11 +254,11 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { // fill partial sort name $this->type("sort_name", "$firstName"); // select subtype - $this->select("crmasmSelect0", "value=IndividualStudent"); + $this->select("contact_type", "value=IndividualStudent"); // select group - $this->select("crmasmSelect1", "label=$groupName"); + $this->select("group", "label=$groupName"); // select tag - $this->select("crmasmSelect3", "label=$tagName"); + $this->select("contact_tags", "label=$tagName"); // select prefered language $this->select("preferred_language", "value=en_US"); // select privacy @@ -294,7 +294,7 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { // check activity types $checkActivityTypes = array("Contribution", "Event Registration", "Membership Signup"); foreach ($checkActivityTypes as $labels) { - $this->click("xpath=//div[@id='activity']/table/tbody/tr[1]/td[1]/div[1]//div/label[text()=\"$labels\"]"); + $this->click("xpath=//div[@id='activity']/table/tbody/tr[2]/td[1]/div[1]//div/label[text()=\"$labels\"]"); } // fill date range $this->select("activity_date_relative","value=0"); @@ -347,15 +347,15 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { // function to fill participant search details function addParticipantSearchDetail() { // fill event name - $this->fillAutoComplete("Fall Fundraiser Dinner", "event_name"); + $this->select2("event_id", "Fall Fundraiser Dinner"); // fill event type - $this->fillAutoComplete("Fundraiser", "event_type"); + $this->select2("event_type_id", "Fundraiser"); // check participant status (registered) $this->click("xpath=//div[@id='participantForm']/table/tbody//tr/td/label[text()='Participant Status']/../div//div/label[text()='Registered']"); // check participant role (Volunteer) $this->click("xpath=//div[@id='participantForm']/table/tbody//tr/td/label[text()='Participant Role']/../div//div/label[text()='Volunteer']"); // fill participant fee level (couple) - $this->fillAutoComplete("Couple", "participant_fee_level"); + $this->select2("participant_fee_id", "Couple"); // fill amount range $this->type("participant_fee_amount_low", "1"); $this->type("participant_fee_amount_high", "150"); @@ -425,7 +425,7 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { $this->type("first_name", "$firstName"); $this->type("middle_name", "mid$firstName"); $this->type("last_name", "adv$firstName"); - $this->select("contact_sub_type", "label=- $Subtype"); + $this->select("contact_sub_type", "label=$Subtype"); $this->type("email_1_email", "$firstName@advsearch.co.in"); $this->type("phone_1_phone", "123456789"); $this->type("external_identifier", "extid$firstName"); diff --git a/tests/phpunit/WebTest/Event/AddParticipationTest.php b/tests/phpunit/WebTest/Event/AddParticipationTest.php index 44d9c80161..db5390566f 100644 --- a/tests/phpunit/WebTest/Event/AddParticipationTest.php +++ b/tests/phpunit/WebTest/Event/AddParticipationTest.php @@ -51,7 +51,7 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase { $this->select2('event_id', "Rain-forest Cup Youth Soccer Tournament"); // Select role - $this->click('role_id[2]'); + $this->multiselect2('role_id', array('Volunteer')); // Choose Registration Date. // Using helper webtestFillDate function. @@ -243,8 +243,7 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase { $this->select2('event_id', "Rain-forest Cup Youth Soccer Tournament"); // Select roles - $this->click('role_id[2]'); - $this->click('role_id[3]'); + $this->multiselect2('role_id', array('Volunteer', 'Host')); $this->waitForElementPresent("xpath=//*[@id='2_chk']//div[@class='custom-group custom-group-$customGroupTitle crm-accordion-wrapper collapsed']"); $this->click("xpath=//*[@id='2_chk']/div[@class='custom-group custom-group-$customGroupTitle crm-accordion-wrapper collapsed']//div[1]"); @@ -408,13 +407,13 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase { $this->select2('event_id', "Rain-forest Cup Youth Soccer Tournament"); // Select role. - $this->click('role_id[2]'); + $this->multiselect2('role_id', array('Volunteer')); foreach($return as $values) { foreach ($values as $entityType => $customData) { //checking for duplicate custom data present or not - $this->assertElementPresent("xpath=//*[@id='customData']/div[@class='custom-group custom-group-{$customData['cgtitle']} crm-accordion-wrapper ']"); - $this->assertEquals(1, $this->getXpathCount("//*[@id='customData']/div[@class='custom-group custom-group-{$customData['cgtitle']} crm-accordion-wrapper ']")); + $this->assertElementPresent("xpath=//*[@class='crm-customData-block']/div[@class='custom-group custom-group-{$customData['cgtitle']} crm-accordion-wrapper ']"); + $this->assertEquals(1, $this->getXpathCount("//*[@class='crm-customData-block']/div[@class='custom-group custom-group-{$customData['cgtitle']} crm-accordion-wrapper ']")); } } } diff --git a/tests/phpunit/WebTest/Event/TellAFriendTest.php b/tests/phpunit/WebTest/Event/TellAFriendTest.php index aba084c2ca..8b01cd7430 100644 --- a/tests/phpunit/WebTest/Event/TellAFriendTest.php +++ b/tests/phpunit/WebTest/Event/TellAFriendTest.php @@ -55,7 +55,7 @@ class WebTest_Event_TellAFriendTest extends CiviSeleniumTestCase { $this->_testAddTellAFriend($subject, $thankYouMsg, $eventTitle); // get the url for registration - $this->waitForElementPresent("xpath=//div[@id='event_status_id']//div[@class='dataTables_wrapper']/table/tbody//tr/td[1]/a[text()='$eventTitle']"); + $this->waitForElementPresent("xpath=//div[@id='event_status_id']//div[@id='option11_wrapper']/table/tbody//tr/td[1]/a[text()='$eventTitle']"); $this->click("link=$eventTitle"); $this->waitForElementPresent("link=Register Now"); $this->click("link=Register Now"); @@ -78,6 +78,8 @@ class WebTest_Event_TellAFriendTest extends CiviSeleniumTestCase { $this->type('email-Primary', "$firstName@$lastName.com"); $this->click('_qf_Register_upload-bottom'); $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->click('_qf_Confirm_next-bottom'); + $this->waitForPageToLoad($this->getTimeoutMsec()); $this->click("css=div.crm-event-thankyou-form-block div#tell-a-friend a"); $this->waitForElementPresent('_qf_Form_cancel'); @@ -250,7 +252,7 @@ class WebTest_Event_TellAFriendTest extends CiviSeleniumTestCase { $this->type('tf_thankyou_text', $thankYouMsg); $this->click('_qf_Event_upload_done-bottom'); - $this->waitForElementPresent("xpath=//div[@id='event_status_id']//div[@class='dataTables_wrapper']/table/tbody//tr/td[1]/a[text()='$eventTitle']"); + $this->waitForElementPresent("xpath=//div[@id='event_status_id']//div[@id='option11_wrapper']/table/tbody//tr/td[1]/a[text()='$eventTitle']"); } } diff --git a/tests/phpunit/WebTest/Member/OfflineAutoRenewMembershipTest.php b/tests/phpunit/WebTest/Member/OfflineAutoRenewMembershipTest.php index 0665ae6bf0..c7c51787bf 100644 --- a/tests/phpunit/WebTest/Member/OfflineAutoRenewMembershipTest.php +++ b/tests/phpunit/WebTest/Member/OfflineAutoRenewMembershipTest.php @@ -55,11 +55,9 @@ class WebTest_Member_OfflineAutoRenewMembershipTest extends CiviSeleniumTestCase $this->click('css=li#tab_member a'); $this->waitForElementPresent('link=Submit Credit Card Membership'); - $this->click('link=Submit Credit Card Membership'); - $this->waitForPageToLoad($this->getTimeoutMsec()); // since we don't have live credentials we will switch to test mode - $url = $this->getLocation(); + $url = $this->getAttribute("xpath=//div[@class='view-content']//div[@class='action-link']/a[2]@href"); $url = str_replace('mode=live', 'mode=test', $url); $this->open($url); $this->waitForPageToLoad($this->getTimeoutMsec()); -- 2.25.1