<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
parent::setUp();
}
- function testWithoutFieldCount() {
+ public function testWithoutFieldCount() {
// Log in using webtestLogin() method
$this->webtestLogin();
$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->select("price_{$selectFieldId}", "value={$selectFieldOp1}");
$this->type('first_name', 'Mary');
- $this->type('last_name', 'Jones'. substr(sha1(rand()), 0, 5));
+ $this->type('last_name', 'Jones' . substr(sha1(rand()), 0, 5));
$email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
$this->type('email-Primary', $email);
// exceed maximun count for text field, check for form rule
$this->type("xpath=//input[@id='price_{$textFieldId}']", '2');
$this->type('first_name', 'Mary');
- $this->type('last_name', 'Jane'. substr(sha1(rand()), 0, 5));
+ $this->type('last_name', 'Jane' . substr(sha1(rand()), 0, 5));
$email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
$this->type('email-Primary', $email);
// fill correct available option for select field
$this->select("price_{$selectFieldId}", "value={$selectFieldOp2}");
+ $this->click("css=input[data-amount=10]");
$this->click('_qf_Register_upload-bottom');
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->_checkConfirmationAndRegister();
}
- function testWithFieldCount() {
+ public function testWithFieldCount() {
// Log in using webtestLogin() method
$this->webtestLogin();
$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->type("xpath=//input[@id='price_{$textFieldId}']", '3');
$this->type('first_name', 'Mary');
- $this->type('last_name', 'Jane'. substr(sha1(rand()), 0, 5));
+ $this->type('last_name', 'Jane' . substr(sha1(rand()), 0, 5));
$email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
$this->type('email-Primary', $email);
// check for form rule
$this->type("xpath=//input[@id='price_{$textFieldId}']", '2');
$this->type('first_name', 'Mary');
- $this->type('last_name', 'Jane'. substr(sha1(rand()), 0, 5));
+ $this->type('last_name', 'Jane' . substr(sha1(rand()), 0, 5));
$email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
$this->type('email-Primary', $email);
$this->_checkConfirmationAndRegister();
}
- function testAdditionalParticipantWithoutFieldCount() {
+ public function testAdditionalParticipantWithoutFieldCount() {
// Log in using webtestLogin() method
$this->webtestLogin();
$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);
$this->type("xpath=//input[@id='price_{$textFieldId}']", '7');
$this->type('first_name', 'Mary');
- $this->type('last_name', 'Jane'. substr(sha1(rand()), 0, 5));
+ $this->type('last_name', 'Jane' . substr(sha1(rand()), 0, 5));
$email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
$this->type('email-Primary', $email);
$this->type("xpath=//input[@id='price_{$textFieldId}']", '6');
$this->type('first_name', 'Mary Add 2');
- $this->type('last_name', 'Jane'. substr(sha1(rand()), 0, 5));
+ $this->type('last_name', 'Jane' . substr(sha1(rand()), 0, 5));
$email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
$this->type('email-Primary', $email);
$this->type("xpath=//input[@id='price_{$textFieldId}']", '3');
$this->type('first_name', 'Mary Add 2');
- $this->type('last_name', 'Jane'. substr(sha1(rand()), 0, 5));
+ $this->type('last_name', 'Jane' . substr(sha1(rand()), 0, 5));
$email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
$this->type('email-Primary', $email);
$this->type("xpath=//input[@id='price_{$textFieldId}']", '3');
$this->type('first_name', 'Mary');
- $this->type('last_name', 'Jane'. substr(sha1(rand()), 0, 5));
+ $this->type('last_name', 'Jane' . substr(sha1(rand()), 0, 5));
$email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
$this->type('email-Primary', $email);
$this->type("xpath=//input[@id='price_{$textFieldId}']", '2');
$this->type('first_name', 'Mary Add 1');
- $this->type('last_name', 'Jane'. substr(sha1(rand()), 0, 5));
+ $this->type('last_name', 'Jane' . substr(sha1(rand()), 0, 5));
$email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
$this->type('email-Primary', $email);
$this->_checkConfirmationAndRegister();
}
- function testAdditionalParticipantWithFieldCount() {
+ public function testAdditionalParticipantWithFieldCount() {
// Log in using webtestLogin() method
$this->webtestLogin();
$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->type("xpath=//input[@id='price_{$textFieldId}']", '7');
$this->type('first_name', 'Mary');
- $this->type('last_name', 'Jane'. substr(sha1(rand()), 0, 5));
+ $this->type('last_name', 'Jane' . substr(sha1(rand()), 0, 5));
$email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
$this->type('email-Primary', $email);
$this->type("xpath=//input[@id='price_{$textFieldId}']", '6');
$this->type('first_name', 'Mary Add 1');
- $this->type('last_name', 'Jane'. substr(sha1(rand()), 0, 5));
+ $this->type('last_name', 'Jane' . substr(sha1(rand()), 0, 5));
$email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
$this->type('email-Primary', $email);
$this->type("xpath=//input[@id='price_{$textFieldId}']", '3');
$this->type('first_name', 'Mary Add 2');
- $this->type('last_name', 'Jane'. substr(sha1(rand()), 0, 5));
+ $this->type('last_name', 'Jane' . substr(sha1(rand()), 0, 5));
$email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
$this->type('email-Primary', $email);
$this->click('_qf_Participant_2_next-Array');
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertStringsPresent(array('Sorry, currently only 4 seats are available for this option.'));
+ $this->assertStringsPresent(array('Sorry, this option is currently sold out.'));
// Skip participant3 and register
$this->click('_qf_Participant_2_next_skip-Array');
$this->type("xpath=//input[@id='price_{$textFieldId}']", '3');
$this->type('first_name', 'Mary');
- $this->type('last_name', 'Jane'. substr(sha1(rand()), 0, 5));
+ $this->type('last_name', 'Jane' . substr(sha1(rand()), 0, 5));
$email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
$this->type('email-Primary', $email);
$this->type("xpath=//input[@id='price_{$textFieldId}']", '2');
$this->type('first_name', 'Mary Add 1');
- $this->type('last_name', 'Jane'. substr(sha1(rand()), 0, 5));
+ $this->type('last_name', 'Jane' . substr(sha1(rand()), 0, 5));
$email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
$this->type('email-Primary', $email);
* @param $setTitle
* @param null $financialType
*/
- function _testAddSet($setTitle, $financialType = NULL) {
+ public function _testAddSet($setTitle, $financialType = NULL) {
$this->openCiviPage('admin/price', 'reset=1&action=add', '_qf_Set_next-bottom');
// Enter Priceset fields (Title, Used For ...)
/**
* @param $fields
*/
- function _testAddPriceFields($fields) {
+ public function _testAddPriceFields($fields) {
$fieldCount = count($fields);
$count = 1;
$this->waitForElementPresent('label');
else {
$this->click('_qf_Field_next-bottom');
}
+ $this->waitForAjaxContent();
$this->waitForText('crm-notification-container', "Price Field '$label' has been saved.");
$count++;
* @param $options
* @param $fieldType
*/
- function _testAddMultipleChoiceOptions($options, $fieldType) {
+ public function _testAddMultipleChoiceOptions($options, $fieldType) {
foreach ($options as $oIndex => $oValue) {
$this->type("option_label_{$oIndex}", $oValue['label']);
$this->type("option_amount_{$oIndex}", $oValue['amount']);
}
/**
- * @param $params
+ * @param array $params
*
* @return string
*/
- function _testAddEvent($params) {
+ public function _testAddEvent($params) {
$this->openCiviPage('event/add', 'reset=1&action=add', '_qf_EventInfo_upload-bottom');
$this->select('event_type_id', "value={$params['event_type_id']}");
return $this->getLocation();
}
- function _fillRegisterWithBillingInfo() {
+ public function _fillRegisterWithBillingInfo() {
$this->waitForElementPresent('credit_card_type');
$this->select('credit_card_type', 'value=Visa');
$this->type('credit_card_number', '4111111111111111');
$this->waitForPageToLoad($this->getTimeoutMsec());
}
- function _checkConfirmationAndRegister() {
+ public function _checkConfirmationAndRegister() {
$confirmStrings = array('Event Fee(s)', 'Billing Name and Address', 'Credit Card Information');
$this->assertStringsPresent($confirmStrings);
+ $this->waitForElementPresent("_qf_Confirm_next-bottom");
$this->click('_qf_Confirm_next-bottom');
$this->waitForPageToLoad($this->getTimeoutMsec());
$thankStrings = array('Thank You for Registering', 'Event Total', 'Transaction Date');