}
/**
- * Click on a link and have it open full-page
- * @param $element
+ * Click a popup link and wait for the ajax content to load
+ * @param string $element
+ * @param string $waitFor
+ */
+ function clickPopupLink($element, $waitFor) {
+ $this->click($element);
+ $this->waitForElementPresent('css=.ui-dialog');
+ $this->waitForAjaxContent();
+ if ($waitFor) {
+ $this->waitForElementPresent($waitFor);
+ }
+ }
+
+ /**
+ * Force a link to open full-page, even if it would normally open in a popup
+ * @param string $element
* @param string $waitFor
*/
function clickLinkSuppressPopup($element, $waitFor = 'civicrm-footer') {
}
}
+ /**
+ * Wait for ajax snippets to finish loading
+ */
+ function waitForAjaxContent() {
+ // Add sleep to prevent condition where we click an ajax button and call this function before the content has even started loading
+ sleep(1);
+ $this->waitForElementNotPresent('css=.blockOverlay');
+ }
+
/**
* Call the API on the local server
* (kind of defeats the point of a webtest - see CRM-11889)
$fieldLabel = "custom_field_for_{$customSet['entity']}_{$customSet['subEntity']}" . substr(sha1(rand()), 0, 4);
$this->type('label', $fieldLabel);
- $this->click('_qf_Field_next_new-bottom');
+ $this->click('_qf_Field_done-bottom');
$customGroupTitle = preg_replace('/\s/', '_', trim($customGroupTitle));
$return[] = array(
* function to select multiple options
*/
function multiselect2($fieldid, $params) {
+ // In the case of chainSelect, wait for options to load
+ $this->waitForElementNotPresent('css=select.loading');
foreach($params as $value) {
$this->clickAt("xpath=//*[@id='$fieldid']/../div/ul//li/input");
$this->waitForElementPresent("xpath=//ul[@class='select2-results']");
$this->assertChecked('is_pay_later');
$this->click("CIVICRM_QFID_0_is_monetary");
- $this->clickLink("_qf_Fee_upload-bottom", "_qf_Fee_upload-bottom");
+ $this->click("_qf_Fee_upload-bottom");
+ $this->waitForText('crm-notification-container', "'Fees' information has been saved.");
+ $this->waitForAjaxContent();
//check if pay later option is disabled
$this->click('CIVICRM_QFID_1_is_monetary');
$this->type("max_participants", "50");
$this->click("is_map");
$this->click("is_public");
- $this->click("_qf_EventInfo_upload-bottom");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("_qf_EventInfo_upload-bottom");
}
/**
// Select event template. Use option value, not label - since labels can be translated and test would fail
$this->select("template_id", "value={$templateID}");
- // Wait for event type to be filled in (since page reloads)
- $this->waitForElementPresent("event_type_id");
+ // Wait for event type to be filled in (since page refreshes)
+ $this->waitForAjaxContent();
$this->verifySelectedValue("event_type_id", $eventTypeID);
// Attendee role s/b selected now.
$this->type("max_participants", "50");
$this->click("is_map");
- $this->click("_qf_EventInfo_upload-bottom");
-
+ $this->clickLink("_qf_EventInfo_upload-bottom");
}
/**
*/
function _testAddLocation($streetAddress) {
// Wait for Location tab form to load
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->waitForAjaxContent();
$this->waitForElementPresent("_qf_Location_upload-bottom");
// Fill in address fields
$this->_testOnlineRegistration($registerUrl, 2, $anonymous, FALSE, $participantEmails, "Test Processor");
$primaryDisplayName = "{$primaryParticipantInfo['first_name']} {$primaryParticipantInfo['last_name']}";
$this->webtestLogin();
- $this->openCiviPage("event/search?reset=1", "reset=1");
+ $this->openCiviPage("event/search", "reset=1");
$this->select2("event_id", $eventTitle, FALSE);
$this->clickLink('_qf_Search_refresh');
$this->verifyText("xpath=//div[@id='participantSearch']/table/tbody//tr/td[3]/a[contains(text(),
//CRM-12618 check edit screen of additional participant and ensuring record_contribution not present
foreach ($addtlPart as $value) {
- $this->clickLink("xpath=//div[@id='participantSearch']/table/tbody//tr/td[3]/a[contains(text(),
+ $this->clickPopupLink("xpath=//div[@id='participantSearch']/table/tbody//tr/td[3]/a[contains(text(),
'{$value['last_name']}, {$value['first_name']}')]/../../td[11]/span/a[2][contains(text(), 'Edit')]",
- '_qf_Participant_upload-bottom', FALSE);
+ '_qf_Participant_upload-bottom');
$this->assertTrue(
$this->isElementPresent("xpath=//tr[@class='crm-participant-form-block-registered-by']/td[2]/a[contains(text(),
'$primaryDisplayName')]"), 'Registered By info is wrong on additional participant edit form');
$sid = $this->urlArg('sid');
$this->assertType('numeric', $sid);
- $validStrings = array();
+ $validateStrings = array();
$fields = array(
'Full Conference' => 'Text',
'Evening Sessions' => 'CheckBox',
);
$this->_testAddPriceFields($fields, $validateStrings);
- // var_dump($validateStrings);
// load the Price Set Preview and check for expected values
$this->_testVerifyPriceSet($validateStrings, $sid);
* @param bool $dateSpecificFields
*/
function _testAddPriceFields(&$fields, &$validateStrings, $dateSpecificFields = FALSE) {
- $this->waitForElementPresent('_qf_Field_cancel-bottom');
+ $this->clickLinkSuppressPopup('newPriceField');
foreach ($fields as $label => $type) {
$validateStrings[] = $label;
default:
break;
}
- $this->clickLink('_qf_Field_next_new-bottom', '_qf_Field_next-bottom', FALSE);
+ $this->clickLink('_qf_Field_next_new-bottom', '_qf_Field_next-bottom');
$this->waitForText('crm-notification-container', "Price Field '".$label."' has been saved.");
}
}