Commit | Line | Data |
---|---|---|
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 | ||
6a488035 TO |
27 | require_once 'CiviTest/CiviSeleniumTestCase.php'; |
28 | class WebTest_Contact_AddCmsUserTest extends CiviSeleniumTestCase { | |
29 | ||
30 | protected function setUp() { | |
31 | parent::setUp(); | |
32 | } | |
33 | ||
34 | function testAuthenticAddUser() { | |
6a488035 | 35 | |
42daf119 | 36 | $this->webtestLogin('admin'); |
6a488035 | 37 | |
6a488035 TO |
38 | $this->open($this->sboxPath . "admin/people/create"); |
39 | ||
6a488035 TO |
40 | $this->waitForElementPresent("edit-submit"); |
41 | ||
42 | $name = "TestUserAuthenticated" . substr(sha1(rand()), 0, 4); | |
43 | $this->type("edit-name", $name); | |
44 | ||
45 | $emailId = substr(sha1(rand()), 0, 7) . '@web.com'; | |
46 | $this->type("edit-mail", $emailId); | |
47 | $this->type("edit-pass-pass1", "Test12345"); | |
48 | $this->type("edit-pass-pass2", "Test12345"); | |
49 | ||
50 | //Add profile Details | |
51 | $firstName = 'Ma' . substr(sha1(rand()), 0, 4); | |
52 | $lastName = 'An' . substr(sha1(rand()), 0, 7); | |
53 | ||
54 | $this->type("first_name", $firstName); | |
55 | $this->type("last_name", $lastName); | |
56 | ||
57 | //Address Details | |
58 | $this->type("street_address-1", "902C El Camino Way SW"); | |
59 | $this->type("city-1", "Dumfries"); | |
60 | $this->type("postal_code-1", "1234"); | |
61 | $this->select("state_province-1", "value=1019"); | |
62 | ||
63 | $this->click("edit-submit"); | |
64 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
65 | } | |
66 | ||
67 | function testAnonymousAddUser() { | |
6a488035 TO |
68 | // Make sure Drupal account settings allow visitors to register for account w/o admin approval |
69 | // login as admin | |
42daf119 | 70 | $this->webtestLogin('admin'); |
6a488035 TO |
71 | $this->open($this->sboxPath . "admin/config/people/accounts"); |
72 | $this->waitForElementPresent("edit-submit"); | |
73 | ||
74 | $this->click('edit-user-register-1'); | |
79d6583c | 75 | $this->check('edit-user-email-verification'); |
6a488035 TO |
76 | $this->click('edit-submit'); |
77 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
78 | // logout | |
42daf119 | 79 | $this->webtestLogout(); |
6a488035 | 80 | |
6a488035 TO |
81 | $this->open($this->sboxPath . "user/register"); |
82 | ||
83 | $this->waitForElementPresent("edit-submit"); | |
84 | $name = "TestUserAnonymous" . substr(sha1(rand()), 0, 7); | |
85 | $this->type("edit-name", $name); | |
86 | $emailId = substr(sha1(rand()), 0, 7) . '@web.com'; | |
87 | $this->type("edit-mail", $emailId); | |
88 | ||
6a488035 TO |
89 | //Add profile Details |
90 | $firstName = 'Ma' . substr(sha1(rand()), 0, 4); | |
91 | $lastName = 'An' . substr(sha1(rand()), 0, 7); | |
92 | $this->type("first_name", $firstName); | |
93 | $this->type("last_name", $lastName); | |
94 | ||
95 | //Address Details | |
96 | $this->type("street_address-1", "902C El Camino Way SW"); | |
97 | $this->type("city-1", "Dumfries"); | |
98 | $this->type("postal_code-1", "1234"); | |
99 | $this->assertTrue($this->isTextPresent("United States")); | |
100 | $this->select("state_province-1", "value=1019"); | |
101 | ||
102 | $this->click("edit-submit"); | |
103 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
0bd37c06 CW |
104 | |
105 | // In case the site is set up to login immediately upon registration | |
42daf119 | 106 | $this->webtestLogout(); |
6a488035 TO |
107 | |
108 | $this->webtestLogin(); | |
109 | ||
0bd37c06 | 110 | $this->openCiviPage("contact/search", "reset=1", "_qf_Basic_refresh"); |
6a488035 TO |
111 | $this->type("sort_name", $emailId); |
112 | $this->click("_qf_Basic_refresh"); | |
113 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
114 | ||
b9715b8a CW |
115 | $this->assertElementContainsText('css=.crm-search-results', $emailId); |
116 | $this->assertElementContainsText('css=.crm-search-results', $lastName . ', ' . $firstName); | |
117 | $this->assertElementContainsText('css=.crm-search-results', "902C El Camino Way SW"); | |
118 | $this->assertElementContainsText('css=.crm-search-results', "Dumfries"); | |
119 | $this->assertElementContainsText('css=.crm-search-results', "1234"); | |
6a488035 TO |
120 | } |
121 | } | |
122 |