// Also not sure how robust this is, but there isn't a good
// identifier for this link either.
$this->_ut->waitForElementPresent('xpath=//a[contains(text(), "View complete message")]');
- $this->_ut->clickAjaxLink('xpath=//a[contains(text(), "View complete message")]', NULL);
+ $this->_ut->clickAjaxLink('xpath=//a[contains(text(), "View complete message")]');
$msg = $this->_ut->getText('css=.ui-dialog-content.crm-ajax-container');
}
else {
}
/**
- * Click a link or button and wait for the ajax content to load
+ * Click a link or button and wait for an ajax dialog to load
* @param string $element
* @param string $waitFor
*/
- function clickAjaxLink($element, $waitFor = 'css=.ui-dialog') {
+ function clickPopupLink($element, $waitFor=NULL) {
+ $this->clickAjaxLink($element, 'css=.ui-dialog');
+ if ($waitFor) {
+ $this->waitForElementPresent($waitFor);
+ }
+ }
+
+ /**
+ * Click a link or button and wait for ajax content to load or refresh
+ * @param string $element
+ * @param string $waitFor
+ */
+ function clickAjaxLink($element, $waitFor=NULL) {
$this->click($element);
if ($waitFor) {
$this->waitForElementPresent($waitFor);
// 6 - Household profile
$profile = array('4' => 'New Individual', '5' => 'New Organization', '6' => 'New Household');
$this->clickAt("xpath=//div[@id='$selectId']/a");
- $this->clickAjaxLink("xpath=//li[@class='select2-no-results']//a[contains(text(),' $profile[$type]')]");
-
- $this->waitForElementPresent('_qf_Edit_next');
+ $this->clickPopupLink("xpath=//li[@class='select2-no-results']//a[contains(text(),' $profile[$type]')]", '_qf_Edit_next');
switch ($type) {
case 4:
$this->clickLink('_qf_Search_refresh-bottom');
$this->waitForElementPresent("xpath=//table[@class='caseSelector']/tbody//tr/td[3]/a[text()='{$lastName}, {$firstName}']");
- $this->clickAjaxLink("xpath=//table[@class='caseSelector']/tbody//tr/td[3]/a[text()='{$lastName}, {$firstName}']/../../td[11]/span[2]/ul/li/a[contains(text(),'Assign to Another Client')]");
+ $this->clickPopupLink("xpath=//table[@class='caseSelector']/tbody//tr/td[3]/a[text()='{$lastName}, {$firstName}']/../../td[11]/span[2]/ul/li/a[contains(text(),'Assign to Another Client')]");
$client = $this->createDialogContact("reassign_contact_id");
$this->clickLink('_qf_EditClient_done-bottom');
$this->assertElementContainsText('page-title', "{$client['display_name']} - $caseTypeLabel");
$this->select2("xpath=//tr[@class='addRow']/td[contains(text(),'Add activity:')]/span/div/a", $tActivityType, FALSE, TRUE);
}
- $this->clickAjaxLink("xpath=//div[@class='crm-submit-buttons']/span/input[@value='Save']", NULL);
+ $this->clickAjaxLink("xpath=//div[@class='crm-submit-buttons']/span/input[@value='Save']");
$this->openCiviPage('case/add', 'reset=1&action=add&atype=13&context=standalone', '_qf_Case_upload-bottom');
$client = $this->createDialogContact("client_id");
$this->checkCRMAlert("Case opened successfully.");
$this->clickLink("_qf_CaseView_cancel-bottom");
$this->openCiviPage('case', 'reset=1', "xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$client['sort_name']}']/../../td[8]/a[text()='Open Case']");
- $this->clickAjaxLink("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$client['sort_name']}']/../../td[8]/a[text()='Open Case']");
+ $this->clickPopupLink("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$client['sort_name']}']/../../td[8]/a[text()='Open Case']");
$openCaseData = array(
"Client" => $client['display_name'],
// go to group tab and add to new group
$this->clickAjaxLink("css=li#tab_group a", "_qf_GroupContact_next");
$this->select("group_id", "$groupName");
- $this->clickAjaxLink("_qf_GroupContact_next", NULL);
+ $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->checkCRMStatus();
// register for event ( auto add activity and contribution )
- $this->clickAjaxLink("link=Register for Event");
+ $this->clickPopupLink("link=Register for Event");
$this->waitForText('s2id_event_id', "- select event -");
$this->select2("event_id", "Fall Fundraiser Dinner");
$this->waitForElementPresent("receipt_text");
$this->waitForText('crm-notification-container', "Event registration for $firstName adv$firstName has been added");
// Add pledge
- $this->clickAjaxLink("link=Add Pledge");
+ $this->clickPopupLink("link=Add Pledge");
$this->waitForElementPresent("contribution_page_id");
$this->type("amount", "200");
$this->type("installments", "5");
$this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created.");
// Add membership
- $this->clickAjaxLink("link=Add Membership", "_qf_Membership_cancel-bottom");
+ $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->waitForText('crm-notification-container', "Student membership for $firstName adv$firstName has been added");
// Add relationship
- $this->clickAjaxLink("link=Add Relationship", "_qf_Relationship_cancel");
+ $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->waitForAjaxContent();
//create another custom field - Integer Radio
- $this->clickAjaxLink('newCustomField', '_qf_Field_cancel');
+ $this->clickPopupLink('newCustomField', '_qf_Field_cancel');
$this->click('data_type[0]');
$this->select('data_type[0]', 'value=1');
$this->click("//option[@value='1']");
$this->click('is_searchable');
//clicking save
- $this->clickAjaxLink('_qf_Field_done-bottom', NULL);
+ $this->clickAjaxLink('_qf_Field_done-bottom');
// Visit home page for a sec to give caches time to be cleared
$this->openCiviPage('');