Commit | Line | Data |
---|---|---|
41e555ba | 1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
39de6fd5 | 4 | | CiviCRM version 4.6 | |
41e555ba | 5 | +--------------------------------------------------------------------+ |
06a1bc01 | 6 | | Copyright CiviCRM LLC (c) 2004-2014 | |
41e555ba | 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 | ||
27 | require_once 'CiviTest/CiviSeleniumTestCase.php'; | |
e9479dcf EM |
28 | |
29 | /** | |
30 | * Class WebTest_Contact_EditContactTest | |
31 | */ | |
41e555ba | 32 | class WebTest_Contact_EditContactTest extends CiviSeleniumTestCase { |
33 | protected function setUp() { | |
34 | parent::setUp(); | |
35 | } | |
36 | ||
37 | function testEditContact() { | |
38 | // Log in using webtestLogin() method | |
39 | $this->webtestLogin(); | |
40 | ||
41 | // create contact | |
fd655174 | 42 | $firstName = 'WebTest' . substr(sha1(rand()), 0, 7); |
43 | $lastName = 'ContactEdit' . substr(sha1(rand()), 0, 7); | |
41e555ba | 44 | $this->openCiviPage("contact/add", "reset=1&ct=Individual"); |
fd655174 | 45 | $this->type("first_name",$firstName); |
46 | $this->type("last_name",$lastName); | |
41e555ba | 47 | |
48 | //fill in phone 1 | |
49 | $this->type("phone_1_phone", "111113333"); | |
50 | $this->type("phone_1_phone_ext", "101"); | |
51 | ||
52 | //fill in phone 2 | |
fd655174 | 53 | |
41e555ba | 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'); | |
58 | ||
59 | //fill in phone 3 | |
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'); | |
64 | ||
65 | //fill in phone 4 | |
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'); | |
70 | ||
71 | // Submit form | |
72 | $this->click("_qf_Contact_upload_view-bottom"); | |
73 | $this->waitForElementPresent('css=.crm-inline-edit-container.crm-edit-ready'); | |
74 | ||
fd655174 | 75 | //assert |
76 | $this->assertTextPresent("111113333 ext. 101"); | |
77 | $this->assertTextPresent("23213333 ext. 165"); | |
78 | $this->assertTextPresent("2321877699 ext. 195"); | |
79 | $this->assertTextPresent("2321398766 ext. 198"); | |
80 | ||
41e555ba | 81 | //Edit COntact |
82 | $cid = $this->urlArg('cid'); | |
83 | $this->openCiviPage("contact/add", "reset=1&action=update&cid={$cid}"); | |
84 | ||
fd655174 | 85 | //Edit in phone 1 |
86 | $this->type("phone_1_phone", "12223333"); | |
87 | $this->type("phone_1_phone_ext", "100"); | |
88 | ||
41e555ba | 89 | //Edit in phone 2 |
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'); | |
93 | ||
94 | //Edit in phone 3 | |
95 | $this->type("phone_3_phone", "777777699"); | |
fd655174 | 96 | $this->type("phone_3_phone_ext", "197"); |
41e555ba | 97 | $this->select('phone_3_location_type_id', 'value=1'); |
98 | ||
99 | //Edit in phone 4 | |
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'); | |
103 | ||
104 | // Submit form | |
105 | $this->click("_qf_Contact_upload_view-bottom"); | |
106 | $this->waitForElementPresent('css=.crm-inline-edit-container.crm-edit-ready'); | |
107 | ||
108 | //assert | |
fd655174 | 109 | $this->assertTextPresent("12223333 ext. 100"); |
41e555ba | 110 | $this->assertTextPresent("2321800000 ext. 111"); |
fd655174 | 111 | $this->assertTextPresent("777777699 ext. 197"); |
41e555ba | 112 | $this->assertTextPresent("2342322222 ext. 198"); |
113 | ||
114 | } | |
115 | } |