$this->createDetailContact($firstName);
// go to group tab and add to new group
- $this->click("css=li#tab_group a");
- $this->waitForElementPresent("_qf_GroupContact_next");
+ $this->clickAjaxLink("css=li#tab_group a", "_qf_GroupContact_next");
$this->select("group_id", "$groupName");
- $this->click("_qf_GroupContact_next");
+ $this->clickAjaxLink("_qf_GroupContact_next");
+ $this->waitForText('crm-notification-container', "Contact has been added to '$groupName'");
// go to tag tab and add to new tag
- $this->click("css=li#tab_tag a");
- $this->waitForElementPresent("css=div#tagtree");
- $this->click("xpath=//ul/li/label[text()=\"$tagName\"]");
- $this->waitForElementPresent("css=.success");
-
- // is status message correct?
- $this->waitForTextPresent("Saved");
- $this->waitForText('crm-notification-container', "Saved");
-
- // go to event tab and register for event ( auto add activity and contribution )
- $this->click("css=li#tab_participant a");
- $this->waitForElementPresent("link=Add Event Registration");
- $this->click("link=Add Event Registration");
+ $this->clickAjaxLink("css=li#tab_tag a", "css=div#tagtree");
+ $this->click("xpath=//ul/li/span/label[text()=\"$tagName\"]");
+ $this->checkCRMStatus();
+
+ // register for event ( auto add activity and contribution )
+ $this->clickPopupLink("link=Register for Event");
$this->waitForText('s2id_event_id', "- select event -");
- // fall fundraiser dinner event label is variable
$this->select2("event_id", "Fall Fundraiser Dinner");
$this->waitForElementPresent("receipt_text");
$this->multiselect2("role_id", array('Volunteer'));
- $this->click("CIVICRM_QFID_17_4");
+ // Select $100 fee
+ $this->click("css=input[data-amount=100]");
$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->waitForElementPresent("link=Add Event Registration");
+ $this->clickAjaxLink("_qf_Participant_upload-bottom", "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
- $this->click("css=li#tab_pledge a");
- $this->waitForElementPresent("link=Add Pledge");
- $this->click("link=Add Pledge");
+ // Add pledge
+ $this->clickPopupLink("link=Add Pledge");
$this->waitForElementPresent("contribution_page_id");
$this->type("amount", "200");
$this->type("installments", "5");
$this->type("frequency_interval", "1");
$this->select("frequency_unit", "month(s)");
- $this->click("_qf_Pledge_upload-bottom");
- $this->waitForElementPresent("link=Add Pledge");
-
+ $this->clickAjaxLink("_qf_Pledge_upload-bottom", "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", "_qf_Membership_cancel-bottom", FALSE);
+ // Add membership
+ $this->clickPopupLink("link=Add Membership", "_qf_Membership_cancel-bottom");
//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", "link=Add Membership", FALSE);
-
+ $this->clickAjaxLink("_qf_Membership_upload-bottom");
$this->waitForText('crm-notification-container', "Student membership for $firstName adv$firstName has been added");
- // go to relationship tab and add relationship
- $this->click("css=li#tab_rel a");
- $this->waitForElementPresent("link=Add Relationship");
- $this->click("link=Add Relationship");
- $this->waitForElementPresent("_qf_Relationship_cancel");
+ // Add relationship
+ $this->clickPopupLink("link=Add Relationship", "_qf_Relationship_cancel");
$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->click('_qf_Relationship_upload-bottom');
+ $this->clickAjaxLink('_qf_Relationship_upload-bottom', NULL);
$this->waitForText('crm-notification-container', "Relationship created.");
//-------------- advance search --------------
function testActivitySearchByTypeTest() {
$this->webtestLogin();
$this->openCiviPage('contact/search/advanced', 'reset=1');
- $this->click("activity");
- $this->waitForElementPresent('activity_subject');
+ $this->clickAjaxLink("activity", 'activity_subject');
$this->check("xpath=//div[@id='Activity']//div/label[text()='Tell a Friend']/../input");
- $this->click("_qf_Advanced_refresh");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("_qf_Advanced_refresh");
$count = explode(" ", trim($this->getText("xpath=//div[@id='search-status']/table/tbody/tr/td")));
$count = $count[0];
$this->assertTrue(is_numeric($count), "The total count of search results not found");
//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->waitForElementPresent("Go");
+ $this->waitForElementPresent("task");
$j = $j + $subTotal;
}
//function to check match for sumbit Advance Search
/**
- * @param $firstName
+ * @param string $firstName
*/
function submitSearch($firstName) {
$this->clickLink("_qf_Advanced_refresh");
$this->click("xpath=//form[@id='Advanced']//div[2]/div/div[1]");
}
- // function to fill auto complete
- /**
- * @param $text
- * @param $elementId
+ /*
+ * Check for CRM-14952
*/
- function fillAutoComplete($text, $elementId) {
- $this->click("$elementId");
- $this->type("$elementId", "$text");
- $this->typeKeys("$elementId", "$text");
- $this->waitForElementPresent("css=div.ac_results li");
- $this->click("css=div.ac_results li");
- $this->assertContains($text, $this->getValue("$elementId"),
- "autocomplete expected $text but didn’t find it in " . $this->getValue("$elementId")
- );
+ function testStateSorting() {
+ $this->webtestLogin();
+ $this->openCiviPage('contact/search/advanced', 'reset=1', 'group');
+ $this->select2("group", "Newsletter", TRUE);
+ $this->select2("group", "Summer", TRUE);
+ $this->select2("group", "Advisory", TRUE);
+ $this->clickAjaxLink("location", 'country');
+ $this->select2("country", "United States", False);
+ $this->waitForElementPresent('state_province');
+ $this->multiselect2("state_province", array("Ohio", "New York", "New Mexico", "Connecticut", "Georgia", "New Jersey", "Texas"));
+ $this->clickLink("_qf_Advanced_refresh", "xpath=//div[@class='crm-search-results']//table/tbody/tr[1]/td[6]");
+
+ $stateBeforeSort = $this->getText("xpath=//div[@class='crm-search-results']//table/tbody/tr[1]/td[6]");
+ $this->click("xpath=//div[@class='crm-search-results']//table/thead/tr//th/a[contains(text(),'State')]");
+ $this->waitForElementPresent("xpath=//div[@class='crm-search-results']//table/thead/tr//th/a[contains(text(),'State')]");
+ $this->assertElementNotContainsText("xpath=//div[@class='crm-search-results']//table/tbody/tr[1]/td[6]", $stateBeforeSort);
}
// function to fill basic search detail
/**
- * @param $firstName
- * @param $groupName
+ * @param string $firstName
+ * @param string $groupName
* @param $tagName
*/
function addBasicSearchDetail($firstName, $groupName, $tagName) {
*/
function addAddressSearchDetail($firstName) {
// select location type (home and main)
- $this->click("xpath=//div[@id='location']/table/tbody/tr[1]/td[1]//label[text()='Home']");
- $this->click("xpath=//div[@id='location']/table/tbody/tr[1]/td[1]//label[text()='Main']");
+ $this->multiselect2('location_type', array('Home', 'Main'));
// fill street address
$this->type("street_address", "street 1 $firstName");
// fill city
// select country
$this->select("country", "United States");
// select state-province
- $this->select("state_province", "Alaska");
+ $this->waitForElementPresent('state_province');
+ $this->select2("state_province", "Alaska", TRUE);
}
// function to fill activity search block in advance search
$this->webtestFillDate("deceased_date", "now");
// save contact
- $this->click("_qf_Contact_upload_view");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("_qf_Contact_upload_view", 'css=.crm-summary-display_name');
$this->assertElementContainsText('css=.crm-summary-display_name', "$firstName adv$firstName");
}
}