| 1 | <?php |
| 2 | /* |
| 3 | +--------------------------------------------------------------------+ |
| 4 | | CiviCRM version 4.6 | |
| 5 | +--------------------------------------------------------------------+ |
| 6 | | Copyright CiviCRM LLC (c) 2004-2014 | |
| 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'; |
| 28 | |
| 29 | /** |
| 30 | * Class WebTest_Generic_GeneralClickAroundTest |
| 31 | */ |
| 32 | class WebTest_Generic_GeneralClickAroundTest extends CiviSeleniumTestCase { |
| 33 | |
| 34 | protected function setUp() { |
| 35 | parent::setUp(); |
| 36 | } |
| 37 | |
| 38 | function login() { |
| 39 | $this->webtestLogin(); |
| 40 | $this->openCiviPage(''); |
| 41 | } |
| 42 | |
| 43 | function testSearchMenu() { |
| 44 | $this->login(); |
| 45 | // click Search -> Find Contacts |
| 46 | // Use class names for menu items since li array can change based on which components are enabled |
| 47 | $this->click("css=ul#civicrm-menu li.crm-Search"); |
| 48 | $this->click("css=ul#civicrm-menu li.crm-Find_Contacts a"); |
| 49 | $this->waitForElementPresent('tag'); |
| 50 | |
| 51 | $this->click('contact_type'); |
| 52 | $this->select('contact_type', 'label=Individual'); |
| 53 | $this->select('tag', 'label=Major Donor'); |
| 54 | $this->click('_qf_Basic_refresh'); |
| 55 | $this->waitForElementPresent('search-status'); |
| 56 | $this->assertText('search-status', "Contact Type - 'Individual'"); |
| 57 | $this->assertText('search-status', 'Tagged IN Major Donor'); |
| 58 | |
| 59 | // Advanced Search by Tag |
| 60 | $this->click("css=ul#civicrm-menu li.crm-Search"); |
| 61 | $this->click("css=ul#civicrm-menu li.crm-Advanced_Search a"); |
| 62 | $this->waitForElementPresent('contact_tags'); |
| 63 | $this->select('contact_tags', 'label=Major Donor'); |
| 64 | $this->click('_qf_Advanced_refresh'); |
| 65 | $this->waitForElementPresent('search-status'); |
| 66 | $this->assertText('search-status', 'Tagged IN Major Donor'); |
| 67 | } |
| 68 | |
| 69 | function testNewIndividual() { |
| 70 | $this->login(); |
| 71 | |
| 72 | // Create New → Individual |
| 73 | $this->click("crm-create-new-link"); |
| 74 | $this->click("link=Individual"); |
| 75 | $this->waitForPageToLoad($this->getTimeoutMsec()); |
| 76 | |
| 77 | $this->assertElementPresent("first_name"); |
| 78 | $this->assertElementPresent("email_1_email"); |
| 79 | $this->assertElementPresent("phone_1_phone"); |
| 80 | $this->assertElementPresent("contact_source"); |
| 81 | $this->assertTextPresent("Constituent Information"); |
| 82 | $this->click("//form[@id='Contact']/div[2]/div[4]/div[1]"); |
| 83 | $this->click("//div[@id='customData1']/table/tbody/tr[1]/td[1]/label"); |
| 84 | $this->assertTextPresent("Most Important Issue"); |
| 85 | $this->click("//form[@id='Contact']/div[2]/div[6]/div[1]"); |
| 86 | $this->assertTextPresent("Communication Preferences"); |
| 87 | $this->assertTextPresent("Do not phone"); |
| 88 | } |
| 89 | |
| 90 | function testManageGroups() { |
| 91 | $this->login(); |
| 92 | |
| 93 | // Contacts → Manage Groups |
| 94 | $this->click("//ul[@id='civicrm-menu']/li[4]"); |
| 95 | $this->clickLink("xpath=//div[@id='root-menu-div']//div/ul//li/div/a[text()='Manage Groups']"); |
| 96 | |
| 97 | $this->assertTextPresent("Find Groups"); |
| 98 | $this->assertElementPresent("title"); |
| 99 | $this->assertTextPresent("Access Control"); |
| 100 | $this->waitForElementPresent('link=Settings'); |
| 101 | $this->assertTextPresent("Administrators"); |
| 102 | $this->assertTextPresent("Add Group"); |
| 103 | } |
| 104 | |
| 105 | function testContributionDashboard() { |
| 106 | $this->webtestLogin(); |
| 107 | // Enable CiviContribute module if necessary |
| 108 | $this->enableComponents("CiviContribute"); |
| 109 | |
| 110 | // Contributions → Dashboard |
| 111 | $this->click("css=ul#civicrm-menu li.crm-Contributions"); |
| 112 | $this->clickLink("css=ul#civicrm-menu li.crm-Contributions li.crm-Dashboard a"); |
| 113 | |
| 114 | $this->waitForElementPresent("xpath=//*[@id='chart_view']/a"); |
| 115 | $this->waitForElementPresent("xpath=//*[@id='ContributionCharts']/div[4]/div[3]"); |
| 116 | $this->assertTextPresent("Contribution Summary"); |
| 117 | $this->assertTextPresent("Recent Contributions"); |
| 118 | } |
| 119 | |
| 120 | function testEventDashboard() { |
| 121 | $this->webtestLogin(); |
| 122 | |
| 123 | // Enable CiviEvent module if necessary |
| 124 | $this->enableComponents("CiviEvent"); |
| 125 | |
| 126 | // Events → Dashboard |
| 127 | $this->click("css=ul#civicrm-menu li.crm-Events"); |
| 128 | $this->clickLink("css=ul#civicrm-menu li.crm-Events li.crm-Dashboard a"); |
| 129 | |
| 130 | $this->assertTextPresent("Event Summary"); |
| 131 | $this->assertTextPresent("Counted:"); |
| 132 | $this->assertTextPresent("Not Counted:"); |
| 133 | $this->assertTextPresent("Not Counted Due To Status:"); |
| 134 | $this->assertTextPresent("Not Counted Due To Role:"); |
| 135 | $this->assertTextPresent("Registered:"); |
| 136 | $this->assertTextPresent("Attended:"); |
| 137 | $this->assertTextPresent("No-show:"); |
| 138 | $this->assertTextPresent("Cancelled:"); |
| 139 | $this->assertTextPresent("Recent Registrations"); |
| 140 | $this->assertTextPresent("Find more event participants..."); |
| 141 | $this->assertTextPresent("Configure"); |
| 142 | } |
| 143 | |
| 144 | function testMembershipsDashboard() { |
| 145 | $this->webtestLogin(); |
| 146 | |
| 147 | // Enable CiviMember module if necessary |
| 148 | $this->enableComponents("CiviMember"); |
| 149 | |
| 150 | // Memberships → Dashboard |
| 151 | $this->click("css=ul#civicrm-menu li.crm-Memberships"); |
| 152 | $this->click("css=ul#civicrm-menu li.crm-Memberships li.crm-Dashboard a"); |
| 153 | $this->waitForPageToLoad($this->getTimeoutMsec()); |
| 154 | |
| 155 | $this->assertTextPresent("Membership Summary"); |
| 156 | $this->assertTextPresent("Members by Type"); |
| 157 | $this->assertTextPresent("Recent Memberships"); |
| 158 | $this->assertTextPresent("Find more members..."); |
| 159 | } |
| 160 | |
| 161 | function testFindContributions() { |
| 162 | $this->webtestLogin(); |
| 163 | |
| 164 | // Enable CiviContribute module if necessary |
| 165 | $this->enableComponents("CiviContribute"); |
| 166 | |
| 167 | // Search → Find Contributions |
| 168 | // Use class names for menu items since li array can change based on which components are enabled |
| 169 | $this->click("css=ul#civicrm-menu li.crm-Search"); |
| 170 | $this->clickLink("css=ul#civicrm-menu li.crm-Find_Contributions a"); |
| 171 | |
| 172 | $this->assertTextPresent("Edit Search Criteria"); |
| 173 | $this->assertElementPresent("sort_name"); |
| 174 | $this->assertElementPresent("contribution_date_low"); |
| 175 | $this->assertElementPresent("contribution_amount_low"); |
| 176 | $this->assertElementPresent("contribution_check_number"); |
| 177 | $this->assertTextPresent("Financial Type"); |
| 178 | $this->assertTextPresent("Contribution Page"); |
| 179 | $this->assertElementPresent("s2id_contribution_or_softcredits"); |
| 180 | $this->assertElementPresent("contribution_source"); |
| 181 | $this->assertTextPresent("Personal Campaign Page"); |
| 182 | $this->assertTextPresent("Personal Campaign Page Honor Roll"); |
| 183 | $this->assertTextPresent("Currency"); |
| 184 | } |
| 185 | |
| 186 | function testNewMailing() { |
| 187 | $this->webtestLogin(); |
| 188 | |
| 189 | // Enable CiviMail module if necessary |
| 190 | $this->enableComponents("CiviMail"); |
| 191 | |
| 192 | // configure default mail-box |
| 193 | $this->setupDefaultMailbox(); |
| 194 | |
| 195 | // New Mailing Form |
| 196 | // Use class names for menu items since li array can change based on which components are enabled |
| 197 | $this->click("css=ul#civicrm-menu li.crm-Mailings"); |
| 198 | $this->clickLink("css=ul#civicrm-menu li.crm-New_Mailing a"); |
| 199 | |
| 200 | $this->assertTextPresent("New Mailing"); |
| 201 | $this->assertElementPresent("name"); |
| 202 | $this->assertElementPresent("includeGroups"); |
| 203 | $this->assertElementPresent("excludeGroups"); |
| 204 | } |
| 205 | |
| 206 | function testConstituentReportSummary() { |
| 207 | $this->login(); |
| 208 | |
| 209 | // Constituent Report Summary |
| 210 | $this->click("css=ul#civicrm-menu li.crm-Reports"); |
| 211 | $this->clickLink("css=ul#civicrm-menu li.crm-Contact_Reports a"); |
| 212 | |
| 213 | $this->clickLink("xpath=//div[@id='Contact']/table/tbody/tr/td[1]/a"); |
| 214 | |
| 215 | $this->assertTextPresent("Constituent Summary"); |
| 216 | $this->click("xpath=//div[@id='mainTabContainer']/ul/li[3]/a"); |
| 217 | $this->waitForElementPresent("xpath=//div[@id='report-tab-set-filters']"); |
| 218 | $this->assertTextPresent("Contact Name"); |
| 219 | $this->assertTextPresent("Contact Source"); |
| 220 | $this->assertTextPresent("Country"); |
| 221 | $this->assertTextPresent("State/Province"); |
| 222 | $this->assertTextPresent("Group"); |
| 223 | $this->assertTextPresent("Tag"); |
| 224 | $this->clickLink("_qf_Summary_submit"); |
| 225 | |
| 226 | $this->assertTextPresent("Row(s) Listed"); |
| 227 | $this->assertTextPresent("Total Row(s)"); |
| 228 | } |
| 229 | |
| 230 | function testCustomData() { |
| 231 | $this->login(); |
| 232 | |
| 233 | // Use class names for menu items since li array can change based on which components are enabled |
| 234 | $this->click("css=ul#civicrm-menu li.crm-Administer"); |
| 235 | $this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Custom Fields']"); |
| 236 | |
| 237 | $this->assertTextPresent("Custom Data"); |
| 238 | $this->assertTextPresent("Constituent Information"); |
| 239 | $this->assertTextPresent("Donor Information"); |
| 240 | $this->assertTextPresent("Food Preference"); |
| 241 | |
| 242 | // Verify create form |
| 243 | $this->clickLink("//span[contains(text(), 'Add Set of Custom Fields')]"); |
| 244 | |
| 245 | $this->assertElementPresent("title"); |
| 246 | $this->assertElementPresent("extends[0]"); |
| 247 | $this->assertElementPresent("weight"); |
| 248 | $this->assertTextPresent("Pre-form Help"); |
| 249 | $this->assertTextPresent("Post-form Help"); |
| 250 | } |
| 251 | |
| 252 | function testProfile() { |
| 253 | $this->login(); |
| 254 | |
| 255 | // Use class names for menu items since li array can change based on which components are enabled |
| 256 | $this->click("css=ul#civicrm-menu li.crm-Administer"); |
| 257 | $this->click("css=ul#civicrm-menu li.crm-Customize_Data_and_Screens"); |
| 258 | $this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Profiles']"); |
| 259 | |
| 260 | |
| 261 | $this->assertTextPresent("CiviCRM Profile"); |
| 262 | // Verify Reserved Profiles |
| 263 | |
| 264 | $this->click("xpath=//div[@id='mainTabContainer']/ul/li[2]/a"); |
| 265 | $this->waitForElementPresent("newCiviCRMProfile-bottom"); |
| 266 | $this->assertTextPresent("New Household"); |
| 267 | $this->assertTextPresent("New Individual"); |
| 268 | $this->assertTextPresent("New Organization"); |
| 269 | $this->assertTextPresent("Participant Status"); |
| 270 | $this->assertTextPresent("Shared Address"); |
| 271 | $this->assertTextPresent("Summary Overlay"); |
| 272 | |
| 273 | // Verify profiles that are not reserved |
| 274 | $this->click("xpath=//div[@id='mainTabContainer']/ul/li[1]/a"); |
| 275 | $this->assertTextPresent("Name and Address"); |
| 276 | $this->assertTextPresent("Supporter Profile"); |
| 277 | |
| 278 | // Verify create form |
| 279 | $this->click("//span[contains(text(), 'Add Profile')]"); |
| 280 | $this->waitForPageToLoad($this->getTimeoutMsec()); |
| 281 | $this->assertElementPresent("title"); |
| 282 | $this->assertElementPresent("uf_group_type[Profile]"); |
| 283 | $this->assertElementPresent("weight"); |
| 284 | $this->assertTextPresent("Pre-form Help"); |
| 285 | $this->assertTextPresent("Post-form Help"); |
| 286 | $this->click("//form[@id='Group']/div[2]/div[2]/div/div"); |
| 287 | $this->assertElementPresent("group"); |
| 288 | $this->assertElementPresent("post_URL"); |
| 289 | $this->assertTextPresent("Drupal user account registration option?"); |
| 290 | $this->assertTextPresent("What to do upon duplicate match"); |
| 291 | $this->assertTextPresent("Proximity Search"); |
| 292 | } |
| 293 | |
| 294 | function testTags() { |
| 295 | $this->login(); |
| 296 | |
| 297 | // Use class names for menu items since li array can change based on which components are enabled |
| 298 | $this->click("css=ul#civicrm-menu li.crm-Administer"); |
| 299 | $this->click("css=ul#civicrm-menu li.crm-Customize_Data_and_Screens"); |
| 300 | $this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Tags (Categories)']"); |
| 301 | |
| 302 | // Verify tags |
| 303 | $this->assertTextPresent("Non-profit"); |
| 304 | $this->assertTextPresent("Company"); |
| 305 | $this->assertTextPresent("Government Entity"); |
| 306 | $this->assertTextPresent("Major Donor"); |
| 307 | $this->assertTextPresent("Volunteer"); |
| 308 | } |
| 309 | |
| 310 | function testActivityTypes() { |
| 311 | $this->login(); |
| 312 | |
| 313 | // Use class names for menu items since li array can change based on which components are enabled |
| 314 | $this->click("css=ul#civicrm-menu li.crm-Administer"); |
| 315 | $this->click("css=ul#civicrm-menu li.crm-Customize_Data_and_Screens"); |
| 316 | $this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Activity Types']"); |
| 317 | |
| 318 | |
| 319 | // Verify activity types |
| 320 | $this->assertTextPresent("Meeting"); |
| 321 | $this->assertTextPresent("Print PDF Letter"); |
| 322 | $this->assertTextPresent("Event Registration"); |
| 323 | $this->assertTextPresent("Contribution"); |
| 324 | $this->assertTextPresent("Membership Signup"); |
| 325 | } |
| 326 | |
| 327 | function testRelationshipTypes() { |
| 328 | $this->login(); |
| 329 | |
| 330 | // Use class names for menu items since li array can change based on which components are enabled |
| 331 | $this->click("css=ul#civicrm-menu li.crm-Administer"); |
| 332 | $this->click("css=ul#civicrm-menu li.crm-Customize_Data_and_Screens"); |
| 333 | |
| 334 | $this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Relationship Types']"); |
| 335 | |
| 336 | // Verify relationship types |
| 337 | $this->assertTextPresent("Child of"); |
| 338 | $this->assertTextPresent("Head of Household for"); |
| 339 | $this->assertTextPresent("Sibling of"); |
| 340 | $this->assertTextPresent("Spouse of"); |
| 341 | $this->assertTextPresent("Supervised by"); |
| 342 | $this->assertTextPresent("Volunteer for"); |
| 343 | } |
| 344 | |
| 345 | function testMessageTemplates() { |
| 346 | $this->login(); |
| 347 | |
| 348 | // Use class names for menu items since li array can change based on which components are enabled |
| 349 | $this->click("css=ul#civicrm-menu li.crm-Administer"); |
| 350 | $this->click("css=ul#civicrm-menu li.crm-Communications"); |
| 351 | $this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Message Templates']"); |
| 352 | |
| 353 | // Verify message templates |
| 354 | $this->click("//a[contains(text(),'System Workflow Messages')]"); |
| 355 | $this->assertTextPresent("Contributions - Receipt (on-line)"); |
| 356 | $this->assertTextPresent("Events - Registration Confirmation and Receipt (off-line)"); |
| 357 | $this->assertTextPresent("Memberships - Signup and Renewal Receipts (off-line)"); |
| 358 | $this->assertTextPresent("Personal Campaign Pages - Supporter Status Change Notification"); |
| 359 | $this->assertTextPresent("Profiles - Admin Notification"); |
| 360 | $this->assertTextPresent("Tell-a-Friend Email"); |
| 361 | } |
| 362 | } |
| 363 | |