}
}
+ /**
+ * Ensures the required currencies are enabled.
+ * @param $currencies
+ */
+ public function enableCurrency($currencies) {
+ $this->openCiviPage("admin/setting/localization", "reset=1", "_qf_Localization_next-bottom");
+ $enabledCurrency = $this->getSelectOptions("currencyLimit-t");
+ foreach ($enabledCurrency as $k => $val) {
+ $enabledCurrency[$k] = substr($val, 0, 3);
+ }
+ $added = FALSE;
+ foreach ((array) $currencies as $curr) {
+ if (!in_array($curr, $enabledCurrency)) {
+ $this->addSelection("currencyLimit-f", "value=$curr");
+ $this->click("//option[@value='$curr']");
+ $this->click("add");
+ $added = TRUE;
+ }
+ }
+ if ($added) {
+ $this->clickLink("_qf_Localization_next-bottom");
+ }
+ }
+
/**
* Add a contact with the given first and last names and either a given email.
* (when specified), a random email (when true) or no email (when unspecified or null).
$tableLocator = "[@id='$tableId']";
}
foreach ($expected as $label => $value) {
+ //assertContains() accepts param as string
+ $value = "$value";
if ($xpathPrefix) {
$this->waitForElementPresent("xpath=//table{$tableLocator}/tbody/tr/td{$xpathPrefix}[text()='{$label}']/../following-sibling::td");
- $this->verifyText("xpath=//table{$tableLocator}/tbody/tr/td{$xpathPrefix}[text()='{$label}']/../following-sibling::td", preg_quote($value));
+ $this->assertElementContainsText("xpath=//table{$tableLocator}/tbody/tr/td{$xpathPrefix}[text()='{$label}']/../following-sibling::td", $value);
}
else {
$this->waitForElementPresent("xpath=//table{$tableLocator}/tbody/tr/td[text()='{$label}']/following-sibling::td");
- $this->verifyText("xpath=//table{$tableLocator}/tbody/tr/td[text()='{$label}']/following-sibling::td", preg_quote($value));
+ $this->assertElementContainsText("xpath=//table{$tableLocator}/tbody/tr/td[text()='{$label}']/following-sibling::td", $value);
}
}
}
}
$this->type("option_label_{$oIndex}", $oValue['label']);
$this->type("option_amount_{$oIndex}", $oValue['amount']);
- $this->click('link=another choice');
+ $this->click('link=add another choice');
}
}
/**
* Select multiple options.
- * @param $fieldid
- * @param $params
+ * @param $fieldId
+ * @param $options
* @param $isDate if multiple date is to be selected from datepicker
*/
- public function multiselect2($fieldid, $params, $isDate = FALSE) {
+ public function multiselect2($fieldId, $options, $isDate = FALSE) {
// In the case of chainSelect, wait for options to load
$this->waitForElementNotPresent('css=select.loading');
- foreach ($params as $value) {
+ foreach ($options as $value) {
if ($isDate) {
- $this->clickAt("xpath=//*[@id='$fieldid']/../div/ul//li/input");
- $this->webtestFillDate($fieldid, $value, TRUE);
+ $this->clickAt("xpath=//*[@id='$fieldId']/../div/ul//li/input");
+ $this->webtestFillDate($fieldId, $value, TRUE);
}
else {
- $this->clickAt("xpath=//*[@id='$fieldid']/../div/ul//li/input");
+ $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);
+ $this->assertElementContainsText("xpath=//*[@id='$fieldId']/preceding-sibling::div[1]/", $value);
}
}
// Wait a sec for select2 to update the original element