* Select multiple options.
* @param $fieldid
* @param $params
+ * @param $isDate if multiple date is to be selected from datepicker
*/
- public function multiselect2($fieldid, $params) {
+ public function multiselect2($fieldid, $params, $isDate = FALSE) {
// 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->clickAt("xpath=//ul[@class='select2-results']//li/div[text()='$value']");
- $this->assertElementContainsText("xpath=//*[@id='$fieldid']/preceding-sibling::div[1]/", $value);
+ if ($isDate) {
+ $timeStamp = strtotime($value ? $value : '+1 month');
+ $year = date('Y', $timeStamp);
+ // -1 ensures month number is inline with calender widget's month
+ $mon = date('n', $timeStamp) - 1;
+ $day = date('j', $timeStamp);
+
+ $this->clickAt("xpath=//*[@id='$fieldid']/../div/ul//li/input");
+ $this->waitForElementPresent("css=div#ui-datepicker-div.ui-datepicker div.ui-datepicker-header div.ui-datepicker-title select.ui-datepicker-month");
+ $this->select("css=div#ui-datepicker-div.ui-datepicker div.ui-datepicker-header div.ui-datepicker-title select.ui-datepicker-month", "value=$mon");
+ $this->select("css=div#ui-datepicker-div div.ui-datepicker-header div.ui-datepicker-title select.ui-datepicker-year", "value=$year");
+ $this->click("link=$day");
+ }
+ else {
+ $this->clickAt("xpath=//*[@id='$fieldid']/../div/ul//li/input");
+ $this->waitForElementPresent("xpath=//ul[@class='select2-results']");
+ $this->clickAt("xpath=//ul[@class='select2-results']//li/div[text()='$value']");
+ $this->assertElementContainsText("xpath=//*[@id='$fieldid']/preceding-sibling::div[1]/", $value);
+ }
}
// Wait a sec for select2 to update the original element
sleep(1);
if (!$occurrences) {
$occurrences = 3;
}
- $this->type('start_action_offset', $occurrences);
- $this->webtestFillDate("exclude_date", "11/05/2015");
- $this->click('add_to_exclude_list');
- $this->webtestFillDate("exclude_date", "12/05/2015");
- $this->click('add_to_exclude_list');
+ $this->select('start_action_offset', $occurrences);
+ $this->multiselect2('exclude_date_list', array('05/11/2015', '05/12/2015'), TRUE);
$this->click('_qf_Repeat_submit-bottom');
- $this->waitForTextPresent('Based on your repeat configuration, here is the list of dates. Do you wish to create a recurring set with these dates?');
- $this->click("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Ok']");
+ $this->waitForTextPresent('A recurring set will be created with the following dates.');
+ $this->click("xpath=//button//span[text()='Continue']");
$this->waitForAjaxContent();
$this->checkCRMAlert('Repeat Configuration has been saved');
//Check if assertions are correct
- $count = $this->getXpathCount("xpath=//div[@id='event_status_id']/div[@class='crm-accordion-body']/div/table/tbody/tr");
- $count = $count - 1;
+ $this->waitForElementPresent("xpath=//div[@id='recurring-entity-block']/following-sibling::div//div[@class='crm-accordion-body']/div/table/tbody/tr");
+ $count = $this->getXpathCount("xpath=//div[@id='recurring-entity-block']/following-sibling::div//div[@class='crm-accordion-body']/div/table/tbody/tr");
$this->assertEquals($occurrences, $count);
//Lets go to find participant page and see our repetitive events there
$this->type('title', 'CiviCon');
$this->click('_qf_EventInfo_upload_done-top');
$this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Cancel']");
- $this->click("xpath=//div[@id='recurring-dialog']/div[@class='show-block']/div[@class='recurring-dialog-inner-wrapper']/div[@class='recurring-dialog-inner-left']/button[text()='All the entities']");
+ $this->click("recur-all-entity");
+ $this->click("xpath=//button//span[text()='Continue']");
$this->waitForAjaxContent();
$this->openCiviPage("event/manage", "reset=1");
$newEventTitle = "CiviCon";