Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
81621fee | 4 | | CiviCRM version 4.7 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
15a4309a | 6 | | Copyright CiviCRM LLC (c) 2004-2017 | |
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_Admin_Form_ScheduleReminderTest | |
31 | */ | |
6a488035 TO |
32 | class WebTest_Admin_Form_ScheduleReminderTest extends CiviSeleniumTestCase { |
33 | ||
34 | protected function setUp() { | |
35 | parent::setUp(); | |
36 | } | |
37 | ||
00be9182 | 38 | public function testScheduleReminder() { |
6a488035 TO |
39 | $this->webtestLogin(); |
40 | ||
41 | // Add new Schedule Reminder | |
42daf119 | 42 | $this->openCiviPage("admin/scheduleReminders", "action=add&reset=1", '_qf_ScheduleReminders_cancel-bottom'); |
6a488035 TO |
43 | |
44 | // Fill Title | |
45 | $title = 'Title' . substr(sha1(rand()), 0, 4); | |
e684c1ae | 46 | $htmlMessage = "Schedule Reminder Test"; |
6a488035 TO |
47 | $this->type('title', $title); |
48 | ||
49 | // Fill Entity Details | |
50 | $this->click('entity_0'); | |
51 | $this->select('entity_0', 'label=Activity'); | |
52 | $this->addSelection('entity_1', 'label=Meeting'); | |
53 | $this->addSelection('entity_2', 'label=Completed'); | |
54 | $this->select('start_action_offset', 'label=1'); | |
55 | $this->select('start_action_condition', 'label=after'); | |
56 | $this->click('is_repeat'); | |
57 | $this->select('repetition_frequency_interval', 'label=1'); | |
58 | $this->click('recipient'); | |
59 | $this->select('recipient', 'label=Activity Assignees'); | |
60 | ||
61 | // Fill Subject | |
62 | $subject = 'subject' . substr(sha1(rand()), 0, 4); | |
63 | $this->type('subject', $subject); | |
e684c1ae WA |
64 | $this->waitForElementPresent("html_message"); |
65 | $this->fillRichTextField("html_message", $htmlMessage); | |
6a488035 TO |
66 | |
67 | //click on save | |
68 | $this->click('_qf_ScheduleReminders_next-bottom'); | |
fb93fc39 | 69 | $this->waitForElementPresent("xpath=//div[@id='reminder']/div/table/tbody//tr/td[1]/div[text()='{$title}']/../../td[7]/span/a[text()='Edit']"); |
4a058f26 | 70 | $this->click("xpath=//div[@id='reminder']/div/table/tbody//tr/td[1]/div[text()='{$title}']/../../td[7]/span/a[text()='Edit']"); |
6a488035 TO |
71 | $this->waitForElementPresent('_qf_ScheduleReminders_cancel-bottom'); |
72 | ||
73 | $this->assertEquals($title, $this->getValue('id=title')); | |
74 | $this->removeSelection('entity_1', 'label=Meeting'); | |
75 | $this->addSelection('entity_1', 'label=Phone Call'); | |
76 | $this->addSelection('entity_1', 'label=Interview'); | |
77 | $this->removeSelection('entity_2', 'label=Completed'); | |
78 | $this->addSelection('entity_2', 'label=Scheduled'); | |
79 | $this->addSelection('entity_2', 'label=Completed'); | |
80 | ||
81 | $this->assertEquals('1', $this->getSelectedValue('id=start_action_offset')); | |
82 | $this->assertEquals('hour', $this->getSelectedValue('id=start_action_unit')); | |
83 | $this->assertEquals('after', $this->getSelectedValue('id=start_action_condition')); | |
84 | $this->assertEquals('activity_date_time', $this->getSelectedValue('id=start_action_date')); | |
85 | ||
86 | $this->assertChecked('is_repeat'); | |
87 | ||
88 | $this->assertEquals('1', $this->getSelectedValue('id=recipient')); | |
89 | $this->assertChecked('is_active'); | |
90 | } | |
96025800 | 91 | |
6a488035 | 92 | } |