Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
81621fee | 4 | | CiviCRM version 4.7 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
fa938177 | 6 | | Copyright CiviCRM LLC (c) 2004-2016 | |
6a488035 TO |
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 | +--------------------------------------------------------------------+ | |
d25dd0ee | 25 | */ |
6a488035 | 26 | |
6a488035 | 27 | require_once 'CiviTest/CiviSeleniumTestCase.php'; |
e9479dcf EM |
28 | |
29 | /** | |
30 | * Class WebTest_Contact_UpdateProfileTest | |
31 | */ | |
6a488035 TO |
32 | class WebTest_Contact_UpdateProfileTest extends CiviSeleniumTestCase { |
33 | ||
34 | protected function setUp() { | |
35 | parent::setUp(); | |
36 | } | |
37 | ||
00be9182 | 38 | public function testUpdateProfile() { |
6a488035 | 39 | // Create new via profile |
b9fdba0a | 40 | $this->webtestAddViaCreateProfile(); |
6a488035 TO |
41 | |
42 | // Open profile for editing | |
43 | $locationUrl = $this->getLocation(); | |
44 | $editUrl = str_replace('/view?', '/edit?', $locationUrl); | |
45 | $this->open($editUrl); | |
a471a3b6 | 46 | $this->waitForPageToLoad($this->getTimeoutMsec()); |
6a488035 TO |
47 | |
48 | // Modify profile field values | |
49 | // contact details section | |
50 | // name fields | |
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 | $street = substr(sha1(rand()), 0, 4) . ' Main St.'; | |
59 | $this->type("street_address-1", $street); | |
60 | $city = 'Ci ' . substr(sha1(rand()), 0, 4); | |
61 | $this->type("city-1", $city); | |
62 | $postalCode = substr(sha1(rand()), 0, 4); | |
63 | $this->type("postal_code-1", $postalCode); | |
64 | // Hard-coding to Arkansas, not sure best way to get random state. | |
65 | $this->select("state_province-1", "value=1003"); | |
66 | ||
67 | // Clicking save. | |
68 | $this->click("_qf_Edit_next"); | |
69 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
70 | ||
71 | // Confirm save was done. | |
ba4a1892 TM |
72 | $this->assertTrue($this->isTextPresent("Thank you. Your information has been saved.")); |
73 | $this->assertTrue($this->isTextPresent($firstName)); | |
74 | $this->assertTrue($this->isTextPresent($lastName)); | |
75 | $this->assertTrue($this->isTextPresent($street)); | |
76 | $this->assertTrue($this->isTextPresent($city)); | |
77 | $this->assertTrue($this->isTextPresent($postalCode)); | |
b2a3d72f | 78 | $this->assertTrue($this->isElementPresent("//div[@id='profilewrap1']/div[@id='crm-container']/div/div[7]/div[2][contains(text(), 'AR')]")); |
6a488035 | 79 | } |
96025800 | 80 | |
232624b1 | 81 | } |