Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
81621fee | 4 | | CiviCRM version 4.7 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
e7112fa7 | 6 | | Copyright CiviCRM LLC (c) 2004-2015 | |
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_DupeContactTest | |
31 | */ | |
6a488035 TO |
32 | class WebTest_Contact_DupeContactTest extends CiviSeleniumTestCase { |
33 | ||
34 | protected function setUp() { | |
35 | parent::setUp(); | |
36 | } | |
37 | ||
00be9182 | 38 | public function testDuplicateContactAdd() { |
6a488035 TO |
39 | $this->webtestLogin(); |
40 | ||
d8bd5fb9 | 41 | $this->openCiviPage('contact/add', 'reset=1&ct=Individual'); |
6a488035 TO |
42 | |
43 | $firstName = substr(sha1(rand()), 0, 7); | |
44 | $lastName1 = substr(sha1(rand()), 0, 7); | |
92915c55 | 45 | $email = "{$firstName}@example.com"; |
6a488035 TO |
46 | $lastName2 = substr(sha1(rand()), 0, 7); |
47 | ||
48 | //contact details section | |
49 | //select prefix | |
50 | $this->click("prefix_id"); | |
51 | $this->select("prefix_id", "value=3"); | |
52 | ||
53 | //fill in first name | |
54 | $this->type("first_name", "$firstName"); | |
55 | ||
56 | //fill in last name | |
57 | $this->type("last_name", "$lastName1"); | |
58 | ||
59 | //fill in email | |
60 | $this->type("email_1_email", "$email"); | |
61 | ||
62 | //check for matching contact | |
63 | //$this->click("_qf_Contact_refresh_dedupe"); | |
64 | //$this->waitForPageToLoad($this->getTimeoutMsec()); | |
65 | ||
66 | // Clicking save. | |
67 | $this->click("_qf_Contact_upload_view"); | |
68 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
6c5f7368 | 69 | $this->waitForText('crm-notification-container', "Contact Saved"); |
6a488035 | 70 | |
6c6e6187 | 71 | $this->openCiviPage('contact/add', 'reset=1&ct=Individual'); |
6a488035 TO |
72 | |
73 | //contact details section | |
74 | ||
6a488035 TO |
75 | //fill in first name |
76 | $this->type("first_name", "$firstName"); | |
77 | ||
78 | //fill in last name | |
79 | $this->type("last_name", "$lastName1"); | |
80 | ||
81 | //fill in email | |
82 | $this->type("email_1_email", "$email"); | |
83 | ||
84 | // Clicking save. | |
85 | $this->click("_qf_Contact_upload_view"); | |
86 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
87 | ||
d8bd5fb9 | 88 | $this->assertElementContainsText("css=.notify-content", "Please correct the following errors in the form fields below: One matching contact was found. You can View or Edit the existing contact."); |
6a488035 | 89 | } |
96025800 | 90 | |
6a488035 | 91 | } |