Merge pull request #7578 from seamuslee001/CRM-17802-master
[civicrm-core.git] / tests / phpunit / WebTest / Event / ParticipantCountTest.php
index e7831b6b52f1b12ab3280727d1b8c9bab929aeae..da22922aeccdf37ba185113385a3358d9a8a13b5 100644 (file)
@@ -176,10 +176,8 @@ class WebTest_Event_ParticipantCountTest extends CiviSeleniumTestCase {
     );
 
     foreach ($fields as $label => $field) {
-      $this->type('label', $label);
       $this->waitForAjaxContent();
       $this->select('html_type', "value={$field['type']}");
-
       if ($field['type'] == 'Text') {
         $this->type('price', $field['amount']);
         //yash
@@ -190,6 +188,7 @@ class WebTest_Event_ParticipantCountTest extends CiviSeleniumTestCase {
       else {
         $this->_testAddMultipleChoiceOptions($field['options']);
       }
+      $this->type('label', $label);
       $this->clickLink('_qf_Field_next_new-bottom', '_qf_Field_next-bottom', FALSE);
       $this->waitForText("crm-notification-container", "Price Field '$label' has been saved.");
     }
@@ -220,7 +219,7 @@ class WebTest_Event_ParticipantCountTest extends CiviSeleniumTestCase {
     $this->click('link=Register Now');
     $this->waitForElementPresent('_qf_Register_upload-bottom');
 
-    $this->type("xpath=//input[@class='four crm-form-text required']", '1');
+    $this->type("xpath=//div[@id='priceset']/div[@class='crm-section full_conference-section']//div/input[@class='four crm-form-text required']", '1');
 
     $email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
     $participants[1] = array(
@@ -254,8 +253,7 @@ class WebTest_Event_ParticipantCountTest extends CiviSeleniumTestCase {
     // register for event
     $this->click('link=Register Now');
     $this->waitForElementPresent('_qf_Register_upload-bottom');
-
-    $this->type("xpath=//input[@class='four crm-form-text required']", '2');
+    $this->type("xpath=//div[@id='priceset']/div[@class='crm-section full_conference-section']//div/input[@class='four crm-form-text required']", '2');
     $email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
 
     $participants[2] = array(
@@ -287,11 +285,13 @@ class WebTest_Event_ParticipantCountTest extends CiviSeleniumTestCase {
 
     // Find Participant
     $this->openCiviPage('event/search', 'reset=1', 'participant_fee_amount_low');
+    $this->waitForElementPresent('event_id');
     $this->select2("event_id", $eventTitle);
     $this->click('_qf_Search_refresh');
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // verify number of participants records and total participant count
+    $this->waitForAjaxContent();
     $this->assertStringsPresent(array('2 Results', 'Actual participant count : 24'));
 
     // CRM-7953, check custom search Price Set Details for Event
@@ -307,9 +307,11 @@ class WebTest_Event_ParticipantCountTest extends CiviSeleniumTestCase {
     $this->openCiviPage('admin/price', 'reset=1&action=add', '_qf_Set_next-bottom');
 
     // Enter Priceset fields (Title, Used For ...)
+    $this->waitForElementPresent("title");
     $this->type('title', $setTitle);
     $this->check('extends[1]');
     $this->select("css=select.crm-form-select", "label={$financialType}");
+    $this->waitForElementPresent("help_pre");
     $this->type('help_pre', 'This is test priceset.');
 
     $this->assertChecked('is_active', 'Verify that Is Active checkbox is set.');
@@ -366,7 +368,8 @@ class WebTest_Event_ParticipantCountTest extends CiviSeleniumTestCase {
     $this->click('link=Fees');
     $this->waitForElementPresent('_qf_Fee_upload-bottom');
     $this->click('CIVICRM_QFID_1_is_monetary');
-    $this->click("xpath=//tr[@class='crm-event-manage-fee-form-block-payment_processor']/td[2]/label[text()='" . $params['payment_processor'] . "']");
+    $this->select2('payment_processor', $params['payment_processor'], TRUE);
+
     $this->select('financial_type_id', 'Event Fee');
     if (array_key_exists('price_set', $params)) {
       $this->select('price_set_id', 'label=' . $params['price_set']);
@@ -390,8 +393,8 @@ class WebTest_Event_ParticipantCountTest extends CiviSeleniumTestCase {
     $this->check('is_online_registration');
     $this->assertChecked('is_online_registration');
 
-    $this->click('intro_text-plain');
-    $this->fillRichTextField('intro_text', 'Fill in all the fields below and click Continue.');
+    $this->click('intro_text');
+    $this->fillRichTextField('intro_text', 'Fill in all the fields below and click Continue.', 'CKEditor', TRUE);
 
     // enable confirmation email
     $this->click('CIVICRM_QFID_1_is_email_confirm');
@@ -429,7 +432,7 @@ class WebTest_Event_ParticipantCountTest extends CiviSeleniumTestCase {
     $this->select('billing_state_province_id-5', 'value=1004');
     $this->type('billing_postal_code-5', '94129');
 
-    $this->clickLink('_qf_Register_upload-bottom', '_qf_Confirm_next-bottom');
+    $this->clickLink('_qf_Register_upload-bottom', '_qf_Confirm_next-bottom', FALSE);
     $confirmStrings = array('Event Fee(s)', 'Billing Name and Address', 'Credit Card Information');
     $this->assertStringsPresent($confirmStrings);
     $this->click('_qf_Confirm_next-bottom');