Commit | Line | Data |
---|---|---|
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 | ||
27 | ||
28 | require_once 'CiviTest/CiviSeleniumTestCase.php'; | |
29 | class WebTest_Profile_ProfileAddTest extends CiviSeleniumTestCase { | |
30 | ||
31 | protected function setUp() { | |
32 | parent::setUp(); | |
33 | } | |
34 | ||
35 | function testAddNewProfile() { | |
6a488035 TO |
36 | $this->webtestLogin(); |
37 | ||
42daf119 | 38 | // Add new profile. |
38bf8139 | 39 | $this->openCiviPage('admin/uf/group', 'reset=1'); |
6a488035 TO |
40 | |
41 | $this->click('newCiviCRMProfile-top'); | |
42 | ||
43 | $this->waitForElementPresent('_qf_Group_next-bottom'); | |
44 | ||
45 | //Name of profile | |
46 | $profileTitle = 'profile_' . substr(sha1(rand()), 0, 7); | |
47 | $this->type('title', $profileTitle); | |
48 | ||
49 | //profile Used for | |
50 | $this->click('uf_group_type_User Registration'); | |
51 | $this->click('uf_group_type_User Account'); | |
52 | ||
53 | //Profile Advance Settings | |
54 | $this->click("//form[@id='Group']/div[2]/div[2]/div[1]"); | |
55 | ||
56 | //Select a group if you are using this profile for search and listings. | |
57 | $this->select('group', 'value=1'); | |
58 | ||
59 | //Select a group if you are using this profile for adding new contacts. | |
60 | $this->select('add_contact_to_group', 'value=1'); | |
61 | ||
62 | //If you want member(s) of your organization to receive a | |
63 | //notification email whenever this Profile | |
64 | //form is used to enter or update contact information, enter one or more email addresses here. | |
65 | $this->type('notify', 'This is notify email'); | |
66 | ||
67 | //If you are using this profile as a contact signup or edit | |
68 | //form, and want to redirec the user to a static URL after | |
69 | //they've submitted the form - enter the complete URL here. | |
70 | $this->type('post_URL', 'This is Post Url'); | |
71 | ||
72 | // If you are using this profile as a contact signup or edit | |
73 | // form, and want to redirect the user to a | |
74 | //static URL if they click the Cancel button - enter the complete URL here. | |
75 | $this->type('cancel_URL', 'This is cancle Url'); | |
76 | ||
77 | //reCaptcha settings | |
78 | $this->click('add_captcha'); | |
79 | ||
80 | //Drupal user account registration option | |
81 | $this->click('CIVICRM_QFID_0_8'); | |
82 | ||
83 | //What to do upon duplicate match | |
84 | $this->click('CIVICRM_QFID_0_2'); | |
85 | ||
86 | //Proximity search options | |
87 | $this->click('CIVICRM_QFID_0_14'); | |
88 | ||
89 | // enable maping for contact | |
90 | $this->click('is_map'); | |
91 | ||
92 | // include a link in the listings to Edit profile fields | |
93 | $this->click('is_edit_link'); | |
94 | ||
95 | //to view contacts' Drupal user account information | |
96 | $this->click('is_uf_link'); | |
97 | ||
98 | //click on save | |
99 | $this->click('_qf_Group_next'); | |
100 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
101 | ||
102 | //check for profile create | |
38bf8139 | 103 | $this->assertElementContainsText('crm-notification-container', "Your CiviCRM Profile '{$profileTitle}' has been added. You can add fields to this profile now."); |
6a488035 TO |
104 | |
105 | //Add field to profile | |
106 | $this->click('field_name[0]'); | |
107 | $this->select('field_name[0]', 'value=Contact'); | |
108 | $this->click("//option[@value='Contact']"); | |
109 | $this->click('is_required'); | |
110 | $this->type('help_post', 'This is help for profile field'); | |
111 | ||
112 | //click on save | |
113 | $this->click('_qf_Field_next'); | |
114 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
115 | ||
116 | // delete the profile | |
38bf8139 | 117 | $this->openCiviPage('admin/uf/group', 'reset=1'); |
6a488035 TO |
118 | $this->_testdeleteProfile($profileTitle); |
119 | } | |
120 | ||
121 | function _testdeleteProfile($profileTitle) { | |
122 | //$this->waitForPageToLoad($this->getTimeoutMsec()); | |
123 | $this->waitForElementPresent("//div[@id='user-profiles']/div/div/table/tbody//tr/td[1]/span[text() = '$profileTitle']/../following-sibling::td[4]/span[2][text()='more']/ul/li[4]/a[text()='Delete']"); | |
124 | $this->click("//div[@id='user-profiles']/div/div/table/tbody//tr/td[1]/span[text() = '$profileTitle']/../following-sibling::td[4]/span[2][text()='more']/ul/li[4]/a[text()='Delete']"); | |
125 | ||
126 | $this->waitForElementPresent('_qf_Group_next-bottom'); | |
127 | $this->click('_qf_Group_next-bottom'); | |
128 | $this->waitForElementPresent('newCiviCRMProfile-bottom'); | |
38bf8139 | 129 | $this->assertElementContainsText('crm-notification-container', "Your CiviCRM Profile '{$profileTitle}' has been deleted."); |
6a488035 | 130 | } |
42daf119 | 131 | } |