Change messages to wait instead of assert
[civicrm-core.git] / tests / phpunit / WebTest / Contact / UpdateProfileTest.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
6a488035
TO
27require_once 'CiviTest/CiviSeleniumTestCase.php';
28class WebTest_Contact_UpdateProfileTest extends CiviSeleniumTestCase {
29
30 protected function setUp() {
31 parent::setUp();
32 }
33
34 function testUpdateProfile() {
35 // Create new via profile
36 include_once ('WebTest/Contact/AddViaProfileTest.php');
37 WebTest_Contact_AddViaProfileTest::testAddViaCreateProfile();
38
39 // Open profile for editing
40 $locationUrl = $this->getLocation();
41 $editUrl = str_replace('/view?', '/edit?', $locationUrl);
42 $this->open($editUrl);
43
44 // Modify profile field values
45 // contact details section
46 // name fields
47 $firstName = 'Ma' . substr(sha1(rand()), 0, 4);
48 $lastName = 'An' . substr(sha1(rand()), 0, 7);
49
50 $this->type("first_name", $firstName);
51 $this->type("last_name", $lastName);
52
53 //Address Details
54 $street = substr(sha1(rand()), 0, 4) . ' Main St.';
55 $this->type("street_address-1", $street);
56 $city = 'Ci ' . substr(sha1(rand()), 0, 4);
57 $this->type("city-1", $city);
58 $postalCode = substr(sha1(rand()), 0, 4);
59 $this->type("postal_code-1", $postalCode);
60 // Hard-coding to Arkansas, not sure best way to get random state.
61 $this->select("state_province-1", "value=1003");
62
63 // Clicking save.
64 $this->click("_qf_Edit_next");
65 $this->waitForPageToLoad($this->getTimeoutMsec());
66
67 // Confirm save was done.
68 $this->assertTrue($this->isTextPresent("Thank you. Your information has been saved."), 'In line ' . __LINE__);
69 $this->assertTrue($this->isTextPresent($firstName), 'In line ' . __LINE__);
70 $this->assertTrue($this->isTextPresent($lastName), 'In line ' . __LINE__);
71 $this->assertTrue($this->isTextPresent($street), 'In line ' . __LINE__);
72 $this->assertTrue($this->isTextPresent($city), 'In line ' . __LINE__);
73 $this->assertTrue($this->isTextPresent($postalCode), 'In line ' . __LINE__);
74 $this->assertTrue($this->isElementPresent("//div[@id='profilewrap1']/div[@id='crm-container']/div[7]/div[2][contains(text(), 'AR')]"));
75 }
76}
77