*/
require_once 'CiviTest/CiviSeleniumTestCase.php';
+
+/**
+ * Class WebTest_Event_PricesetMaxCountTest
+ */
class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase {
protected function setUp() {
// Log in using webtestLogin() method
$this->webtestLogin();
- // We need a payment processor
- $processorName = 'Webtest Dummy' . substr(sha1(rand()), 0, 7);
+ // Use default payment processor
+ $processorName = 'Test Processor';
$this->webtestAddPaymentProcessor($processorName);
// create priceset
$pricesetLoc = $this->getLocation();
// get text field Id.
- $textFieldId = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[9]/span[1]/a[2]@href"));
- $textFieldId = explode('&', $textFieldId[0]);
- $textFieldId = explode('=', $textFieldId[3]);
- $textFieldId = $textFieldId[1];
+ $this->waitForElementPresent("xpath=//div[@id='crm-main-content-wrapper']/div/a[1]");
+ $textFieldIdURL = $this->getAttribute("xpath=//div[@id='field_page']/table/tbody/tr[1]/td[9]/span[1]/a[2]@href");
+ $textFieldId = $this->urlArg('fid', $textFieldIdURL);
$this->open($pricesetLoc);
$this->waitForPageToLoad($this->getTimeoutMsec());
// get select field id
$this->click("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[8]/a");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button[2]/span[2]");
$selectFieldLoc = $this->getLocation();
- $selectFieldId = $this->urlArg('fid');
+ $selectFieldURL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[9]/span[1]/a[2]@href");
+ $selectFieldId = $this->urlArg('fid', $selectFieldURL);
// get select field ids
// get select field option1
- $selectFieldOp1 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[7]/span[1]/a[1]@href"));
- $selectFieldOp1 = explode('&', $selectFieldOp1[0]);
- $selectFieldOp1 = explode('=', $selectFieldOp1[2]);
- $selectFieldOp1 = $selectFieldOp1[1];
-
- $this->open($selectFieldLoc);
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $selectFieldOp1URL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[7]/span[1]/a[1]@href");
+ $selectFieldOp1 = $this->urlArg('oid', $selectFieldOp1URL);
// get select field option2
- $selectFieldOp2 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[7]/span[1]/a[1]@href"));
- $selectFieldOp2 = explode('&', $selectFieldOp2[0]);
- $selectFieldOp2 = explode('=', $selectFieldOp2[2]);
- $selectFieldOp2 = $selectFieldOp2[1];
+ $selectFieldOp2URL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[7]/span[1]/a[1]@href");
+ $selectFieldOp2 = $this->urlArg('oid', $selectFieldOp2URL);
// create event.
$eventTitle = 'Meeting - ' . substr(sha1(rand()), 0, 7);
// Log in using webtestLogin() method
$this->webtestLogin();
- // We need a payment processor
- $processorName = 'Webtest Dummy' . substr(sha1(rand()), 0, 7);
+ // Use default payment processor
+ $processorName = 'Test Processor';
$this->webtestAddPaymentProcessor($processorName);
// create priceset
$pricesetLoc = $this->getLocation();
// get text field Id.
- $textFieldId = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[9]/span[1]/a[2]@href"));
- $textFieldId = explode('&', $textFieldId[0]);
- $textFieldId = explode('=', $textFieldId[3]);
- $textFieldId = $textFieldId[1];
+ $this->waitForElementPresent("xpath=//div[@id='crm-main-content-wrapper']/div/a[1]");
+ $textFieldIdURL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[9]/span[1]/a[2]@href");
+ $textFieldId = $this->urlArg('fid', $textFieldIdURL);
$this->open($pricesetLoc);
$this->waitForPageToLoad($this->getTimeoutMsec());
// get select field id
$this->click("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[8]/a");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button[2]/span[2]");
$selectFieldLoc = $this->getLocation();
- $selectFieldId = $this->urlArg('fid');
+ $selectFieldURL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[9]/span[1]/a[2]@href");
+ $selectFieldId = $this->urlArg('fid', $selectFieldURL);
// get select field ids
// get select field option1
- $selectFieldOp1 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[7]/span[1]/a[1]@href"));
- $selectFieldOp1 = explode('&', $selectFieldOp1[0]);
- $selectFieldOp1 = explode('=', $selectFieldOp1[2]);
- $selectFieldOp1 = $selectFieldOp1[1];
-
- $this->open($selectFieldLoc);
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $selectFieldOp1URL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[7]/span[1]/a[1]@href");
+ $selectFieldOp1 = $this->urlArg('oid', $selectFieldOp1URL);
// get select field option2
- $selectFieldOp2 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[7]/span[1]/a[1]@href"));
- $selectFieldOp2 = explode('&', $selectFieldOp2[0]);
- $selectFieldOp2 = explode('=', $selectFieldOp2[2]);
- $selectFieldOp2 = $selectFieldOp2[1];
+ $selectFieldOp2URL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[7]/span[1]/a[1]@href");
+ $selectFieldOp2 = $this->urlArg('oid', $selectFieldOp2URL);
// create event.
$eventTitle = 'Meeting - ' . substr(sha1(rand()), 0, 7);
// Log in using webtestLogin() method
$this->webtestLogin();
- // We need a payment processor
- $processorName = 'Webtest Dummy' . substr(sha1(rand()), 0, 7);
+ // Use default payment processor
+ $processorName = 'Test Processor';
$this->webtestAddPaymentProcessor($processorName);
// create priceset
$pricesetLoc = $this->getLocation();
// get text field Id.
- $textFieldId = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[9]/span[1]/a[2]@href"));
- $textFieldId = explode('&', $textFieldId[0]);
- $textFieldId = explode('=', $textFieldId[3]);
- $textFieldId = $textFieldId[1];
+ $this->waitForElementPresent("xpath=//div[@id='crm-main-content-wrapper']/div/a[1]");
+ $textFieldURL = $this->getAttribute("xpath=//div[@id='field_page']/table/tbody/tr[1]/td[9]/span[1]/a[2]@href");
+ $textFieldId = $this->urlArg('fid', $textFieldURL);
$this->open($pricesetLoc);
$this->waitForPageToLoad($this->getTimeoutMsec());
// get select field id
$this->click("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[8]/a");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button[2]/span[2]");
$selectFieldLoc = $this->getLocation();
- $selectFieldId = $this->urlArg('fid');
+ $selectFieldURL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[9]/span[1]/a[2]@href");
+ $selectFieldId = $this->urlArg('fid', $selectFieldURL);
// get select field ids
// get select field option1
- $selectFieldOp1 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[7]/span[1]/a[1]@href"));
- $selectFieldOp1 = explode('&', $selectFieldOp1[0]);
- $selectFieldOp1 = explode('=', $selectFieldOp1[2]);
- $selectFieldOp1 = $selectFieldOp1[1];
-
- $this->open($selectFieldLoc);
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $selectFieldOp1URL = $this->getAttribute("xpath=//div[@id='field_page']/table/tbody/tr[1]/td[7]/span[1]/a[1]@href");
+ $selectFieldOp1 = $this->urlArg('oid', $selectFieldOp1URL);
// get select field option2
- $selectFieldOp2 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[7]/span[1]/a[1]@href"));
- $selectFieldOp2 = explode('&', $selectFieldOp2[0]);
- $selectFieldOp2 = explode('=', $selectFieldOp2[2]);
- $selectFieldOp2 = $selectFieldOp2[1];
+ $selectFieldOp2URL = $this->getAttribute("xpath=//div[@id='field_page']/table/tbody/tr[2]/td[7]/span[1]/a[1]@href");
+ $selectFieldOp2 = $this->urlArg('oid', $selectFieldOp2URL);
// create event.
$eventTitle = 'Meeting - ' . substr(sha1(rand()), 0, 7);
// Log in using webtestLogin() method
$this->webtestLogin();
- // We need a payment processor
- $processorName = 'Webtest Dummy' . substr(sha1(rand()), 0, 7);
+ // Use default payment processor
+ $processorName = 'Test Processor';
$this->webtestAddPaymentProcessor($processorName);
// create priceset
$pricesetLoc = $this->getLocation();
// get text field Id.
- $textFieldId = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[9]/span[1]/a[2]@href"));
- $textFieldId = explode('&', $textFieldId[0]);
- $textFieldId = explode('=', $textFieldId[3]);
- $textFieldId = $textFieldId[1];
+ $this->waitForElementPresent("xpath=//div[@id='crm-main-content-wrapper']/div/a[1]");
+ $textFieldIdURL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[9]/span[1]/a[2]@href");
+ $textFieldId = $this->urlArg('fid', $textFieldIdURL);
$this->open($pricesetLoc);
$this->waitForPageToLoad($this->getTimeoutMsec());
// get select field id
$this->click("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[8]/a");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button[2]/span[2]");
$selectFieldLoc = $this->getLocation();
- $selectFieldId = $this->urlArg('fid');
+ $selectFieldURL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[9]/span[1]/a[2]@href");
+ $selectFieldId = $this->urlArg('fid', $selectFieldURL);
// get select field ids
// get select field option1
- $selectFieldOp1 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[7]/span[1]/a[1]@href"));
- $selectFieldOp1 = explode('&', $selectFieldOp1[0]);
- $selectFieldOp1 = explode('=', $selectFieldOp1[2]);
- $selectFieldOp1 = $selectFieldOp1[1];
-
- $this->open($selectFieldLoc);
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $selectFieldOp1URL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[7]/span[1]/a[1]@href");
+ $selectFieldOp1 = $this->urlArg('oid', $selectFieldOp1URL);
// get select field option2
- $selectFieldOp2 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[7]/span[1]/a[1]@href"));
- $selectFieldOp2 = explode('&', $selectFieldOp2[0]);
- $selectFieldOp2 = explode('=', $selectFieldOp2[2]);
- $selectFieldOp2 = $selectFieldOp2[1];
+ $selectFieldOp2URL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[7]/span[1]/a[1]@href");
+ $selectFieldOp2 = $this->urlArg('oid', $selectFieldOp2URL);
// create event.
$eventTitle = 'Meeting - ' . substr(sha1(rand()), 0, 7);
$this->_checkConfirmationAndRegister();
}
+ /**
+ * @param $setTitle
+ * @param null $financialType
+ */
function _testAddSet($setTitle, $financialType = NULL) {
$this->openCiviPage('admin/price', 'reset=1&action=add', '_qf_Set_next-bottom');
$this->type('help_pre', 'This is test priceset.');
$this->assertChecked('is_active', 'Verify that Is Active checkbox is set.');
- $this->clickLink('_qf_Set_next-bottom', '_qf_Field_next-bottom');
+ $this->clickLink('_qf_Set_next-bottom');
}
+ /**
+ * @param $fields
+ */
function _testAddPriceFields($fields) {
$fieldCount = count($fields);
$count = 1;
+ $this->waitForElementPresent('label');
foreach ($fields as $label => $field) {
+ $this->waitForElementPresent('label');
$this->type('label', $label);
$this->select('html_type', "value={$field['type']}");
else {
$this->click('_qf_Field_next-bottom');
}
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->waitForAjaxContent();
+ $this->waitForText('crm-notification-container', "Price Field '$label' has been saved.");
$count++;
}
}
+ /**
+ * @param $options
+ * @param $fieldType
+ */
function _testAddMultipleChoiceOptions($options, $fieldType) {
foreach ($options as $oIndex => $oValue) {
$this->type("option_label_{$oIndex}", $oValue['label']);
}
}
+ /**
+ * @param $params
+ *
+ * @return string
+ */
function _testAddEvent($params) {
$this->openCiviPage('event/add', 'reset=1&action=add', '_qf_EventInfo_upload-bottom');
$this->click('is_multiple_registrations');
}
+ $this->click('intro_text-plain');
$this->fillRichTextField('intro_text', 'Fill in all the fields below and click Continue.');
// enable confirmation email