Merge pull request #66 from colemanw/Webtests
[civicrm-core.git] / tests / phpunit / WebTest / Contact / AddContactsToEventAdvancedSearchTest.php
CommitLineData
6a488035
TO
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
28require_once 'CiviTest/CiviSeleniumTestCase.php';
29class 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->open($this->sboxPath . 'civicrm/contact/search/advanced?reset=1');
52
53 $this->waitForElementPresent('_qf_Advanced_refresh');
54 $this->click('_qf_Advanced_refresh');
55
56 $this->waitForElementPresent('CIVICRM_QFID_ts_all_8');
57 $this->click('CIVICRM_QFID_ts_all_8');
58
59 $this->select('task', "label=Add Contacts to Event");
60 $this->click('Go');
61
62 // Select event. Based on label for now.
63 $this->waitForElementPresent('event_id');
64 $this->select('event_id', "label=regexp:Rain-forest Cup Youth Soccer Tournament.");
65
66 // Select role
67 $this->click('role_id[2]');
68
69 // Select participant status
70 $this->select('status_id', 'value=1');
71
72 // Setting registration source
73 $this->type('source', 'Event StandaloneAddTest Webtest');
74
75 $this->assertTrue($this->isTextPresent('Source for this registration (if applicable).'));
76
77
78 // Clicking save.
79 $this->click('_qf_Participant_upload-bottom');
80 $this->waitForPageToLoad($this->getTimeoutMsec());
81 }
82}
83