3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.3 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
28 require_once 'CiviTest/CiviSeleniumTestCase.php';
29 class WebTest_Admin_Form_ScheduleReminderTest
extends CiviSeleniumTestCase
{
31 protected function setUp() {
35 function testScheduleReminder() {
37 // This is the path where our testing install resides.
38 // The rest of URL is defined in CiviSeleniumTestCase base class, in
40 $this->open($this->sboxPath
);
42 // Logging in. Remember to wait for page to load. In most cases,
43 // you can rely on 30000 as the value that allows your test to pass, however,
44 // sometimes your test might fail because of this. In such cases, it's better to pick one element
45 // somewhere at the end of page and use waitForElementPresent on it - this assures you, that whole
46 // page contents loaded and you can continue your test execution.
47 $this->webtestLogin();
49 // Add new Schedule Reminder
50 $this->open($this->sboxPath
. 'civicrm/admin/scheduleReminders?reset=1');
51 $this->open($this->sboxPath
. 'civicrm/admin/scheduleReminders?action=add&reset=1');
52 $this->waitForElementPresent('_qf_ScheduleReminders_cancel-bottom');
55 $title = 'Title' . substr(sha1(rand()), 0, 4);
56 $this->type('title', $title);
58 // Fill Entity Details
59 $this->click('entity_0');
60 $this->select('entity_0', 'label=Activity');
61 $this->addSelection('entity_1', 'label=Meeting');
62 $this->addSelection('entity_2', 'label=Completed');
63 $this->select('start_action_offset', 'label=1');
64 $this->select('start_action_condition', 'label=after');
65 $this->click('is_repeat');
66 $this->select('repetition_frequency_interval', 'label=1');
67 $this->click('recipient');
68 $this->select('recipient', 'label=Activity Assignees');
71 $subject = 'subject' . substr(sha1(rand()), 0, 4);
72 $this->type('subject', $subject);
75 $this->click('_qf_ScheduleReminders_next-bottom');
76 $this->waitForPageToLoad($this->getTimeoutMsec());
78 $this->click("//div[@id='reminder']//div[@class='dataTables_wrapper']/table/tbody//tr/td[1][text()='{$title}']/../td[7]/span/a[text()='Edit']");
79 $this->waitForElementPresent('_qf_ScheduleReminders_cancel-bottom');
81 $this->assertEquals($title, $this->getValue('id=title'));
82 $this->removeSelection('entity_1', 'label=Meeting');
83 $this->addSelection('entity_1', 'label=Phone Call');
84 $this->addSelection('entity_1', 'label=Interview');
85 $this->removeSelection('entity_2', 'label=Completed');
86 $this->addSelection('entity_2', 'label=Scheduled');
87 $this->addSelection('entity_2', 'label=Completed');
89 $this->assertEquals('1', $this->getSelectedValue('id=start_action_offset'));
90 $this->assertEquals('hour', $this->getSelectedValue('id=start_action_unit'));
91 $this->assertEquals('after', $this->getSelectedValue('id=start_action_condition'));
92 $this->assertEquals('activity_date_time', $this->getSelectedValue('id=start_action_date'));
94 $this->assertChecked('is_repeat');
96 $this->assertEquals('1', $this->getSelectedValue('id=recipient'));
97 $this->assertChecked('is_active');