Merge pull request #4949 from eileenmcnaughton/minor-tidies
[civicrm-core.git] / tests / phpunit / WebTest / Event / ChangeParticipantStatus.php
index 9f0660519cf052b97f227b04af7a90c208b4b611..dfd694d12d7da54b58c55273434211ea56969dab 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
 */
 
 require_once 'CiviTest/CiviSeleniumTestCase.php';
+
+/**
+ * Class WebTest_Event_ChangeParticipantStatus
+ */
 class WebTest_Event_ChangeParticipantStatus extends CiviSeleniumTestCase {
 
   protected function setUp() {
     parent::setUp();
   }
 
-  function testParticipationAdd() {
+  public function testParticipationAdd() {
     // Log in using webtestLogin() method
     $this->webtestLogin();
 
@@ -50,13 +54,8 @@ class WebTest_Event_ChangeParticipantStatus extends CiviSeleniumTestCase {
     // Search the participants
     $this->openCiviPage("event/search", "reset=1", '_qf_Search_refresh');
 
-    $eventName = 'Rain';
-    $this->click("event_name");
-    $this->type("event_name", $eventName);
-    $this->typeKeys("event_name", $eventName);
-    $this->waitForElementPresent("css=div.ac_results-inner li");
-    $this->click("css=div.ac_results-inner li");
-    $this->assertContains($eventName, $this->getValue("event_name"), "autocomplete expected $eventName but didn’t find it in " . $this->getValue("event_name"));
+    $eventName = 'Rain-forest Cup Youth Soccer Tournament';
+    $this->select2("event_id", $eventName);
     $this->click('_qf_Search_refresh');
 
     $this->waitForElementPresent("xpath=//div[@id='participantSearch']/table/tbody//tr/td[3]/a[text()='$sortName1']");
@@ -70,12 +69,10 @@ class WebTest_Event_ChangeParticipantStatus extends CiviSeleniumTestCase {
 
     // Change participant status for selected participants
     $this->select('task', "label=Change Participant Status");
-    $this->click('Go');
     $this->waitForElementPresent('_qf_ParticipantStatus_next');
 
     $this->select('status_change', "label=Attended");
-    $this->click('_qf_ParticipantStatus_next');
-    $this->waitForElementPresent('Go');
+    $this->clickLink('_qf_ParticipantStatus_next');
     $this->assertTrue($this->isTextPresent('The updates have been saved.'),
       "Status message didn't show up after saving!"
     );
@@ -98,17 +95,20 @@ class WebTest_Event_ChangeParticipantStatus extends CiviSeleniumTestCase {
     $this->webtestVerifyTabularData(array('Status' => 'Attended'));
   }
 
-  function addParticipant($firstName) {
+  /**
+   * @param string $firstName
+   */
+  public function addParticipant($firstName) {
     $this->openCiviPage("participant/add", "reset=1&action=add&context=standalone", '_qf_Participant_upload-bottom');
 
     // Type contact last name in contact auto-complete, wait for dropdown and click first result
     $this->webtestFillAutocomplete($firstName);
 
     // Select event. Based on label for now.
-    $this->select('event_id', "label=regexp:Rain-forest Cup Youth Soccer Tournament.");
+    $this->select2('event_id', "Rain-forest Cup Youth Soccer Tournament");
 
     // Select role
-    $this->click('role_id[2]');
+    $this->multiselect2('role_id', array('Volunteer'));
 
     // Choose Registration Date.
     // Using helper webtestFillDate function.
@@ -127,7 +127,7 @@ class WebTest_Event_ChangeParticipantStatus extends CiviSeleniumTestCase {
     // Select an event fee
     $this->waitForElementPresent('priceset');
 
-    $this->click("xpath=//input[@class='form-radio']");
+    $this->click("xpath=//input[@class='crm-form-radio']");
     // Select 'Record Payment'
     $this->click('record_contribution');
 
@@ -148,9 +148,9 @@ class WebTest_Event_ChangeParticipantStatus extends CiviSeleniumTestCase {
       "Status message didn't show up after saving!"
     );
 
-    $this->waitForElementPresent("xpath=//div[@id='Events']//table//tbody/tr[1]/td[8]/span/a[text()='View']");
+    $this->waitForElementPresent("xpath=//*[@id='Search']//table//tbody/tr[1]/td[8]/span/a[text()='View']");
     //click through to the participant view screen
-    $this->click("xpath=//div[@id='Events']//table//tbody/tr[1]/td[8]/span/a[text()='View']");
+    $this->click("xpath=//*[@id='Search']//table//tbody/tr[1]/td[8]/span/a[text()='View']");
     $this->waitForElementPresent('_qf_ParticipantView_cancel-bottom');
 
     $this->webtestVerifyTabularData(
@@ -159,9 +159,8 @@ class WebTest_Event_ChangeParticipantStatus extends CiviSeleniumTestCase {
         'Participant Role' => 'Attendee',
         'Status' => 'Registered',
         'Event Source' => 'Event StandaloneAddTest Webtest',
-        'Event Fees' => '$ 800.00',
       )
     );
+    $this->verifyText("xpath=//td[text()='Selections']/following-sibling::td//div/div", preg_quote('Event Total: $ 800.00'));
   }
 }
-