commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-new / civicrm / tests / phpunit / WebTest / Admin / Form / ScheduleReminderTest.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
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_Admin_Form_ScheduleReminderTest
31 */
32 class WebTest_Admin_Form_ScheduleReminderTest extends CiviSeleniumTestCase {
33
34 protected function setUp() {
35 parent::setUp();
36 }
37
38 public function testScheduleReminder() {
39 $this->webtestLogin();
40
41 // Add new Schedule Reminder
42 $this->openCiviPage("admin/scheduleReminders", "action=add&reset=1", '_qf_ScheduleReminders_cancel-bottom');
43
44 // Fill Title
45 $title = 'Title' . substr(sha1(rand()), 0, 4);
46 $this->type('title', $title);
47
48 // Fill Entity Details
49 $this->click('entity_0');
50 $this->select('entity_0', 'label=Activity');
51 $this->addSelection('entity_1', 'label=Meeting');
52 $this->addSelection('entity_2', 'label=Completed');
53 $this->select('start_action_offset', 'label=1');
54 $this->select('start_action_condition', 'label=after');
55 $this->click('is_repeat');
56 $this->select('repetition_frequency_interval', 'label=1');
57 $this->click('recipient');
58 $this->select('recipient', 'label=Activity Assignees');
59
60 // Fill Subject
61 $subject = 'subject' . substr(sha1(rand()), 0, 4);
62 $this->type('subject', $subject);
63
64 //click on save
65 $this->click('_qf_ScheduleReminders_next-bottom');
66 $this->waitForPageToLoad($this->getTimeoutMsec());
67
68 $this->click("xpath=//div[@id='reminder']/div/table/tbody//tr/td[1]/div[text()='{$title}']/../../td[7]/span/a[text()='Edit']");
69 $this->waitForElementPresent('_qf_ScheduleReminders_cancel-bottom');
70
71 $this->assertEquals($title, $this->getValue('id=title'));
72 $this->removeSelection('entity_1', 'label=Meeting');
73 $this->addSelection('entity_1', 'label=Phone Call');
74 $this->addSelection('entity_1', 'label=Interview');
75 $this->removeSelection('entity_2', 'label=Completed');
76 $this->addSelection('entity_2', 'label=Scheduled');
77 $this->addSelection('entity_2', 'label=Completed');
78
79 $this->assertEquals('1', $this->getSelectedValue('id=start_action_offset'));
80 $this->assertEquals('hour', $this->getSelectedValue('id=start_action_unit'));
81 $this->assertEquals('after', $this->getSelectedValue('id=start_action_condition'));
82 $this->assertEquals('activity_date_time', $this->getSelectedValue('id=start_action_date'));
83
84 $this->assertChecked('is_repeat');
85
86 $this->assertEquals('1', $this->getSelectedValue('id=recipient'));
87 $this->assertChecked('is_active');
88 }
89
90 }