1f633efedd9a2653ec98d02300bcb26299ecc059
[civicrm-core.git] / tests / phpunit / WebTest / Contact / AddViaProfileTest.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_AddViaProfileTest extends CiviSeleniumTestCase {
30
31 protected function setUp() {
32 parent::setUp();
33 }
34
35 function testAddViaCreateProfile() {
36 $this->webtestLogin();
37
38 $this->openCiviPage('profile/create', 'reset=1&gid=1', '_qf_Edit_cancel');
39
40 $firstName = 'Jo' . substr(sha1(rand()), 0, 4);
41 $lastName = 'Ad' . substr(sha1(rand()), 0, 7);
42
43 //contact details section
44 //fill in first name
45 $this->type("first_name", $firstName);
46
47 //fill in last name
48 $this->type("last_name", $lastName);
49
50 //address section
51 $this->type("street_address-1", "902C El Camino Way SW");
52 $this->type("city-1", "Dumfries");
53 $this->type("postal_code-1", "1234");
54 $this->assertElementContainsText('country-1', "United States");
55 $this->select("state_province-1", "value=1019");
56
57 // Clicking save.
58 $this->click("_qf_Edit_next");
59 $this->waitForPageToLoad($this->getTimeoutMsec());
60
61 $this->assertElementContainsText('css=.msg-text', "Your information has been saved.");
62 }
63 }
64
65