3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
27 require_once 'CiviTest/CiviSeleniumTestCase.php';
30 * Class WebTest_Contact_EditContactTest
32 class WebTest_Contact_EditContactTest
extends CiviSeleniumTestCase
{
33 protected function setUp() {
37 public function testEditContact() {
38 // Log in using webtestLogin() method
39 $this->webtestLogin();
42 $firstName = 'WebTest' . substr(sha1(rand()), 0, 7);
43 $lastName = 'ContactEdit' . substr(sha1(rand()), 0, 7);
44 $this->openCiviPage("contact/add", "reset=1&ct=Individual");
45 $this->type("first_name", $firstName);
46 $this->type("last_name", $lastName);
49 $this->type("phone_1_phone", "111113333");
50 $this->type("phone_1_phone_ext", "101");
54 $this->click("//a[@id='addPhone']");
55 $this->type("phone_2_phone", "23213333");
56 $this->type("phone_2_phone_ext", "165");
57 $this->select('phone_2_location_type_id', 'value=2');
60 $this->click("//a[@id='addPhone']");
61 $this->type("phone_3_phone", "2321877699");
62 $this->type("phone_3_phone_ext", "195");
63 $this->select('phone_3_location_type_id', 'value=2');
66 $this->click("//a[@id='addPhone']");
67 $this->type("phone_4_phone", "2321398766");
68 $this->type("phone_4_phone_ext", "198");
69 $this->select('phone_4_location_type_id', 'value=2');
72 $this->click("_qf_Contact_upload_view-bottom");
73 $this->waitForElementPresent('css=.crm-inline-edit-container.crm-edit-ready');
76 $this->assertTextPresent("111113333 ext. 101");
77 $this->assertTextPresent("23213333 ext. 165");
78 $this->assertTextPresent("2321877699 ext. 195");
79 $this->assertTextPresent("2321398766 ext. 198");
82 $cid = $this->urlArg('cid');
83 $this->openCiviPage("contact/add", "reset=1&action=update&cid={$cid}");
86 $this->type("phone_1_phone", "12223333");
87 $this->type("phone_1_phone_ext", "100");
90 $this->type("phone_2_phone", "2321800000");
91 $this->type("phone_2_phone_ext", "111");
92 $this->select('phone_2_location_type_id', 'value=3');
95 $this->type("phone_3_phone", "777777699");
96 $this->type("phone_3_phone_ext", "197");
97 $this->select('phone_3_location_type_id', 'value=1');
100 $this->type("phone_4_phone", "2342322222");
101 $this->type("phone_4_phone_ext", "198");
102 $this->select('phone_4_location_type_id', 'value=3');
105 $this->click("_qf_Contact_upload_view-bottom");
106 $this->waitForElementPresent('css=.crm-inline-edit-container.crm-edit-ready');
109 $this->assertTextPresent("12223333 ext. 100");
110 $this->assertTextPresent("2321800000 ext. 111");
111 $this->assertTextPresent("777777699 ext. 197");
112 $this->assertTextPresent("2342322222 ext. 198");
119 public function testdisallowEditLocationType() {
120 $this->webtestLogin();
123 $firstName = 'WebTest' . substr(sha1(rand()), 0, 7);
124 $lastName = 'ContactEdit' . substr(sha1(rand()), 0, 7);
125 $this->openCiviPage("contact/add", "reset=1&ct=Individual");
126 $this->waitForElementPresent('_qf_Contact_cancel-bottom');
128 $this->type("first_name", $firstName);
129 $this->type("last_name", $lastName);
132 $this->type("email_1_email", substr(sha1(rand()), 0, 7) . "email1@gmail.com");
133 $this->click("xpath=//div[@id='contactDetails']/table[1]/tbody/tr[1]/td[1]/a[text()='add']");
134 $this->waitForElementPresent('email_2_email');
135 $this->type("email_2_email", substr(sha1(rand()), 0, 7) . "email2@gmail.com");
138 $this->type("phone_1_phone", "111113333");
139 $this->type("phone_1_phone_ext", "101");
142 $this->type("im_1_name", "testYahoo");
145 $this->click("addressBlock");
146 $this->waitForElementPresent("address_1_street_address");
148 $this->type("address_1_street_address", "902C El Camino Way SW");
149 $this->type("address_1_city", "Dumfries");
150 $this->type("address_1_postal_code", "1234");
153 $this->click("_qf_Contact_upload_view-top");
154 $this->waitForPageToLoad($this->getTimeoutMsec());
157 $cid = $this->urlArg('cid');
158 $this->openCiviPage("contact/add", "reset=1&action=update&cid=$cid");
160 $this->waitForElementPresent('_qf_Contact_cancel-bottom');
161 $this->waitForElementNotPresent("xpath=//div[@id='contactDetails']/table[1]/tbody/tr[@id='Email_Block_1']/td[1]/a/i");
162 $this->waitForElementNotPresent("xpath=//div[@id='contactDetails']/table[1]/tbody/tr[@id='Email_Block_2']/td[1]/a/i");
163 $this->waitForElementNotPresent("xpath=//div[@id='contactDetails']/table[1]/tbody/tr[@id='Phone_Block_1']/td[2]/a/i");
164 $this->waitForElementNotPresent("xpath=//div[@id='contactDetails']/table[1]/tbody/tr[@id='IM_Block_1']/td[2]/a/i");
166 $this->click("addressBlockId");
167 $this->waitForElementNotPresent("xpath=//div[@id='addressBlock']/div/table/tbody/tr[1]/td[1]/span[1]/a/i");