Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
06a1bc01 | 4 | | CiviCRM version 4.5 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
06a1bc01 | 6 | | Copyright CiviCRM LLC (c) 2004-2014 | |
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 | +--------------------------------------------------------------------+ | |
25 | */ | |
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 | ||
38 | function testUpdateProfile() { | |
39 | // Create new via profile | |
40 | include_once ('WebTest/Contact/AddViaProfileTest.php'); | |
41 | WebTest_Contact_AddViaProfileTest::testAddViaCreateProfile(); | |
42 | ||
43 | // Open profile for editing | |
44 | $locationUrl = $this->getLocation(); | |
45 | $editUrl = str_replace('/view?', '/edit?', $locationUrl); | |
46 | $this->open($editUrl); | |
a471a3b6 | 47 | $this->waitForPageToLoad($this->getTimeoutMsec()); |
6a488035 TO |
48 | |
49 | // Modify profile field values | |
50 | // contact details section | |
51 | // name fields | |
52 | $firstName = 'Ma' . substr(sha1(rand()), 0, 4); | |
53 | $lastName = 'An' . substr(sha1(rand()), 0, 7); | |
54 | ||
55 | $this->type("first_name", $firstName); | |
56 | $this->type("last_name", $lastName); | |
57 | ||
58 | //Address Details | |
59 | $street = substr(sha1(rand()), 0, 4) . ' Main St.'; | |
60 | $this->type("street_address-1", $street); | |
61 | $city = 'Ci ' . substr(sha1(rand()), 0, 4); | |
62 | $this->type("city-1", $city); | |
63 | $postalCode = substr(sha1(rand()), 0, 4); | |
64 | $this->type("postal_code-1", $postalCode); | |
65 | // Hard-coding to Arkansas, not sure best way to get random state. | |
66 | $this->select("state_province-1", "value=1003"); | |
67 | ||
68 | // Clicking save. | |
69 | $this->click("_qf_Edit_next"); | |
70 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
71 | ||
72 | // Confirm save was done. | |
73 | $this->assertTrue($this->isTextPresent("Thank you. Your information has been saved."), 'In line ' . __LINE__); | |
74 | $this->assertTrue($this->isTextPresent($firstName), 'In line ' . __LINE__); | |
75 | $this->assertTrue($this->isTextPresent($lastName), 'In line ' . __LINE__); | |
76 | $this->assertTrue($this->isTextPresent($street), 'In line ' . __LINE__); | |
77 | $this->assertTrue($this->isTextPresent($city), 'In line ' . __LINE__); | |
78 | $this->assertTrue($this->isTextPresent($postalCode), 'In line ' . __LINE__); | |
b2a3d72f | 79 | $this->assertTrue($this->isElementPresent("//div[@id='profilewrap1']/div[@id='crm-container']/div/div[7]/div[2][contains(text(), 'AR')]")); |
6a488035 | 80 | } |
232624b1 | 81 | } |