Merge pull request #159 from lcdservices/master
[civicrm-core.git] / tests / phpunit / WebTest / Contact / AddContactsToEventAdvancedSearchTest.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.3 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License along with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
25 */
26
27
28 require_once 'CiviTest/CiviSeleniumTestCase.php';
29 class WebTest_Contact_AddContactsToEventAdvancedSearchTest extends CiviSeleniumTestCase {
30
31 protected function setUp() {
32 parent::setUp();
33 }
34
35 function testAddContactsToEventAdvanceSearch() {
36 // This is the path where our testing install resides.
37 // The rest of URL is defined in CiviSeleniumTestCase base class, in
38 // class attributes.
39 $this->open($this->sboxPath);
40
41 // Logging in. Remember to wait for page to load. In most cases,
42 // you can rely on 30000 as the value that allows your test to pass, however,
43 // sometimes your test might fail because of this. In such cases, it's better to pick one element
44 // somewhere at the end of page and use waitForElementPresent on it - this assures you, that whole
45 // page contents loaded and you can continue your test execution.
46 $this->webtestLogin();
47 $this->waitForPageToLoad($this->getTimeoutMsec());
48
49
50 // Advanced Search
51 $this->openCiviPage('contact/search/advanced', 'reset=1', '_qf_Advanced_refresh');
52 $this->click('_qf_Advanced_refresh');
53
54 $this->waitForElementPresent('CIVICRM_QFID_ts_all_8');
55 $this->click('CIVICRM_QFID_ts_all_8');
56
57 $this->select('task', "label=Add Contacts to Event");
58 $this->click('Go');
59
60 // Select event. Based on label for now.
61 $this->waitForElementPresent('event_id');
62 $this->select('event_id', "label=regexp:Rain-forest Cup Youth Soccer Tournament.");
63
64 // Select role
65 $this->click('role_id[2]');
66
67 // Select participant status
68 $this->select('status_id', 'value=1');
69
70 // Setting registration source
71 $this->type('source', 'Event StandaloneAddTest Webtest');
72
73 $this->assertElementContainsText('css=tr.crm-participant-form-block-source span.description', 'Source for this registration (if applicable).');
74
75
76 // Clicking save.
77 $this->click('_qf_Participant_upload-bottom');
78 $this->waitForPageToLoad($this->getTimeoutMsec());
79 }
80 }
81