<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.4 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
*/
require_once 'CiviTest/CiviSeleniumTestCase.php';
+
+/**
+ * Class WebTest_Event_AddParticipationTest
+ */
class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase {
protected function setUp() {
$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.
// Select an event fee
$this->waitForElementPresent('priceset');
- $this->click("xpath=//input[@class='form-radio']");
+ $this->click("xpath=//input[@class='crm-form-radio']");
// Enter amount to be paid (note: this should default to selected fee level amount, s/b fixed during 3.2 cycle)
$this->type('total_amount', '800');
// Is status message correct?
$this->waitForText('crm-notification-container', "Event registration for $displayName has been added");
- $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(
'Participant Role' => 'Attendee',
'Status' => 'Registered',
'Event Source' => 'Event StandaloneAddTest Webtest',
- 'Event Fees' => '$ 800.00',
+ 'Fees' => '$ 800.00',
)
);
// check contribution record as well
//click through to the contribution view screen
- $this->click("xpath=id('ParticipantView')/div[2]/table[@class='selector']/tbody/tr[1]/td[8]/span/a[text()='View']");
+ $this->click("xpath=id('ParticipantView')/div[2]/table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='View']");
$this->waitForElementPresent('_qf_ContributionView_cancel-bottom');
$this->webtestVerifyTabularData(
$this->click('is_searchable');
//clicking save
- $this->click('_qf_Field_next');
+ $this->click('_qf_Field_done-bottom');
$this->waitForPageToLoad($this->getTimeoutMsec());
//Is custom field created?
- $this->waitForText('crm-notification-container', "Your custom field '$checkboxFieldLabel' has been saved.");
+ $this->waitForText('crm-notification-container', "Custom field '$checkboxFieldLabel' has been saved.");
//create another custom field - Integer Radio
- $this->click("//a[@id='newCustomField']/span");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("//a[@id='newCustomField']/span", '_qf_Field_cancel', FALSE);
$this->click('data_type[0]');
$this->select('data_type[0]', 'value=1');
$this->click("//option[@value='1']");
$this->click('is_searchable');
//clicking save
- $this->click('_qf_Field_next');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->click('_qf_Field_done-bottom');
$this->openCiviPage("participant/add", "reset=1&action=add&context=standalone", "_qf_Participant_upload-bottom");
$this->select2('event_id', "Rain-forest Cup Youth Soccer Tournament");
// Select roles
- $this->click('role_id[2]');
- $this->click('role_id[3]');
+ $this->multiselect2('role_id', array('Volunteer', 'Host'));
- $this->waitForElementPresent("xpath=//div[@id='$customGroupTitle']//div");
- $this->click("xpath=//div[@id='$customGroupTitle']//div[1]");
- $this->click("xpath=//div[@id='$customGroupTitle']//div[2]//table//tbody//tr[2]//td[2]//table//tbody//tr[1]//td[1]//label");
- $this->click("xpath=//div[@id='$customGroupTitle']//div[2]//table//tbody//tr[4]//td[2]//table//tbody//tr[1]//td[1]//label");
+ $this->waitForElementPresent("xpath=//div[@class='crm-customData-block']//div[@class='custom-group custom-group-$customGroupTitle crm-accordion-wrapper collapsed']");
+ $this->click("xpath=//div[@class='crm-customData-block']//div[@class='custom-group custom-group-$customGroupTitle crm-accordion-wrapper collapsed']//div[1]");
+ $this->click("xpath=//div[@class='crm-customData-block']//div[@class='custom-group custom-group-$customGroupTitle crm-accordion-wrapper']//div[2]//table//tbody//tr[2]//td[2]//table//tbody//tr[1]//td[1]//label");
+ $this->click("xpath=//div[@class='crm-customData-block']//div[@class='custom-group custom-group-$customGroupTitle crm-accordion-wrapper']//div[2]//table//tbody//tr[4]//td[2]//table//tbody//tr[1]//td[1]//label");
// Choose Registration Date.
// Using helper webtestFillDate function.
// Select an event fee
$this->waitForElementPresent('priceset');
- $this->click("xpath=//input[@class='form-radio']");
+ $this->click("xpath=//input[@class='crm-form-radio']");
// Enter amount to be paid (note: this should default to selected fee level amount, s/b fixed during 3.2 cycle)
$this->type('total_amount', '800');
// Is status message correct?
$this->waitForText('crm-notification-container', "Event registration for $displayName has been added");
- $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(
'Participant Role' => 'Attendee, Volunteer, Host',
'Status' => 'Registered',
'Event Source' => 'Event StandaloneAddTest Webtest',
- 'Event Fees' => '$ 800.00',
+ 'Fees' => '$ 800.00',
)
);
// check contribution record as well
//click through to the contribution view screen
- $this->click("xpath=id('ParticipantView')/div[2]/table[@class='selector']/tbody/tr[1]/td[8]/span/a[text()='View']");
+ $this->click("xpath=id('ParticipantView')/div[2]/table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='View']");
$this->waitForElementPresent('_qf_ContributionView_cancel-bottom');
$this->webtestVerifyTabularData(
array(
'From' => $displayName,
'Financial Type' => 'Event Fee',
- 'Total Amount' => '$ 800.00',
'Contribution Status' => 'Completed',
'Paid By' => 'Check',
'Check Number' => '1044',
)
);
+ $this->verifyText("xpath=//table/tbody/tr/td[text()='Total Amount']/following-sibling::td/strong", preg_quote('$ 800.00'), 'In line ' . __LINE__);
}
function testEventAddMultipleParticipants() {
$this->openCiviPage("event/search", "reset=1");
$this->type('sort_name', $firstName);
$eventName = "Rain-forest Cup Youth Soccer Tournament";
- $this->type("event_name", $eventName);
- $this->click("event_name");
- $this->waitForElementPresent("css=div.ac_results-inner li");
- $this->click("css=div.ac_results-inner li");
+ $this->select2("event_id", $eventName, FALSE, FALSE);
$this->check('participant_test');
$this->click("_qf_Search_refresh");
$this->waitForElementPresent("participantSearch");
$customSets = array(
array('entity' => 'ParticipantEventName', 'subEntity' => 'Fall Fundraiser Dinner',
- 'triggerElement' => array('name' => "event_id", 'type' => "select")),
- array('entity' => 'ParticipantRole', 'subEntity' => 'Attendee','triggerElement' => array('type' => "checkbox"))
+ 'triggerElement' => array('name' => "event_id", 'type' => "select2")),
+ array('entity' => 'ParticipantRole', 'subEntity' => 'Attendee','triggerElement' => array('name' => 'role_id', 'type' => "select"))
);
$pageUrl = array('url' => "participant/add", 'args' => "reset=1&action=add&context=standalone");
$this->customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl);
$this->select2('event_id', "Rain-forest Cup Youth Soccer Tournament");
// Select role.
- $this->click('role_id[2]');
+ $this->multiselect2('role_id', array('Volunteer'));
foreach($return as $values) {
foreach ($values as $entityType => $customData) {
//checking for duplicate custom data present or not
- $this->assertElementPresent("xpath=//div[@id='{$customData['cgtitle']}'][@class='crm-accordion-wrapper ']");
- $this->assertEquals(1, $this->getXpathCount("//div[@id='{$customData['cgtitle']}'][@class='crm-accordion-wrapper ']"));
+ $this->assertElementPresent("xpath=//*[@class='crm-customData-block']/div[@class='custom-group custom-group-{$customData['cgtitle']} crm-accordion-wrapper ']");
+ $this->assertEquals(1, $this->getXpathCount("//*[@class='crm-customData-block']/div[@class='custom-group custom-group-{$customData['cgtitle']} crm-accordion-wrapper ']"));
}
}
}
+ /**
+ * @param $firstName
+ * @param $lastName
+ * @param $processorId
+ */
function _fillParticipantDetails($firstName, $lastName, $processorId) {
- $this->select("id=profiles_1", "label=New Individual");
- $this->waitForElementPresent('_qf_Edit_next');
+ $this->webtestNewDialogContact($firstName, $lastName);
- $this->type("id=first_name", $firstName);
- $this->type("id=last_name", $lastName);
- $this->click("id=_qf_Edit_next");
$this->select('payment_processor_id', "value={$processorId}");
- $this->verifySelectedValue("event_id", "3");
- $this->check("role_id[1]");
+ $event_id = $this->getAttribute("xpath=//*[@id='event_id']@value");
+ //check if it is the selected event
+ $this->assertEquals($event_id, 3);
+ $this->select("role_id", "value=1");
$this->webtestAddCreditCardDetails();
$this->webtestAddBillingDetails();
}