Commit | Line | Data |
---|---|---|
eac2f71b | 1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
2fe49090 | 4 | | CiviCRM version 5 | |
eac2f71b | 5 | +--------------------------------------------------------------------+ |
8c9251b3 | 6 | | Copyright CiviCRM LLC (c) 2004-2018 | |
eac2f71b | 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 | */ |
eac2f71b | 26 | |
27 | /** | |
28 | * Description of AddRecurringEventTest | |
29 | * | |
30 | * @author Priyanka | |
31 | */ | |
32 | ||
33 | require_once 'CiviTest/CiviSeleniumTestCase.php'; | |
34 | ||
7fe37828 EM |
35 | /** |
36 | * Class WebTest_Event_AddRecurringEventTest | |
37 | */ | |
eac2f71b | 38 | class WebTest_Event_AddRecurringEventTest extends CiviSeleniumTestCase { |
39 | ||
40 | protected function setUp() { | |
41 | parent::setUp(); | |
42 | } | |
43 | ||
00be9182 | 44 | public function testRecurringEvent() { |
eac2f71b | 45 | $this->webtestLogin(); |
46 | ||
47 | //Add repeat configuration for an event | |
48 | $this->openCiviPage("event/manage/repeat", "reset=1&action=update&id=1", '_qf_Repeat_cancel-bottom'); | |
49 | ||
50 | $this->click('repetition_frequency_unit'); | |
df519dcf | 51 | $this->select('repetition_frequency_unit', 'label=week'); |
eac2f71b | 52 | $this->click('repetition_frequency_interval'); |
53 | $this->select('repetition_frequency_interval', 'label=1'); | |
54 | $this->click('start_action_condition_monday'); | |
55 | $this->click('start_action_condition_tuesday'); | |
56 | $this->click('CIVICRM_QFID_1_ends'); | |
57 | ||
58 | $occurrences = rand(3, 5); | |
59 | if (!$occurrences) { | |
60 | $occurrences = 3; | |
61 | } | |
06dfe3b5 | 62 | $this->select('start_action_offset', $occurrences); |
63 | $this->multiselect2('exclude_date_list', array('05/11/2015', '05/12/2015'), TRUE); | |
eac2f71b | 64 | $this->click('_qf_Repeat_submit-bottom'); |
b303b743 | 65 | $this->waitForTextPresent('A repeating set will be created with the following dates.'); |
06dfe3b5 | 66 | $this->click("xpath=//button//span[text()='Continue']"); |
eac2f71b | 67 | $this->waitForAjaxContent(); |
68 | $this->checkCRMAlert('Repeat Configuration has been saved'); | |
69 | ||
70 | //Check if assertions are correct | |
06dfe3b5 | 71 | $this->waitForElementPresent("xpath=//div[@id='recurring-entity-block']/following-sibling::div//div[@class='crm-accordion-body']/div/table/tbody/tr"); |
72 | $count = $this->getXpathCount("xpath=//div[@id='recurring-entity-block']/following-sibling::div//div[@class='crm-accordion-body']/div/table/tbody/tr"); | |
eac2f71b | 73 | $this->assertEquals($occurrences, $count); |
74 | ||
75 | //Lets go to find participant page and see our repetitive events there | |
76 | $this->openCiviPage("event/manage", "reset=1"); | |
77 | $eventTitle = "Fall Fundraiser Dinner"; | |
78 | $this->type("title", $eventTitle); | |
79 | $this->click("_qf_SearchEvent_refresh"); | |
04374d9d | 80 | $this->assertTrue($this->isTextPresent("Repeating")); |
eac2f71b | 81 | |
82 | //Update Mode Cascade Changes | |
83 | $this->click('event-configure-1'); | |
84 | $this->waitForElementPresent("xpath=//span[@id='event-configure-1']/ul[@class='panel']/li/a[text()='Info and Settings']"); | |
85 | $this->click("xpath=//span[@id='event-configure-1']/ul[@class='panel']/li/a[text()='Info and Settings']"); | |
38653166 | 86 | $this->waitForTextPresent("Event Title"); |
eac2f71b | 87 | $this->type('title', 'CiviCon'); |
88 | $this->click('_qf_EventInfo_upload_done-top'); | |
89 | $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Cancel']"); | |
06dfe3b5 | 90 | $this->click("recur-all-entity"); |
91 | $this->click("xpath=//button//span[text()='Continue']"); | |
eac2f71b | 92 | $this->waitForAjaxContent(); |
93 | $this->openCiviPage("event/manage", "reset=1"); | |
94 | $newEventTitle = "CiviCon"; | |
95 | $this->type("title", $newEventTitle); | |
96 | $this->click("_qf_SearchEvent_refresh"); | |
97 | $this->waitForPageToLoad(); | |
98 | $countOfEvents = $this->getXpathCount("xpath=//div[@id='option11_wrapper']/table[@id='option11']/tbody/tr"); | |
99 | if ($countOfEvents) { | |
100 | for ($i = 0; $i <= $countOfEvents; $i++) { | |
f78f9745 | 101 | $this->verifyText("xpath=//div[@id='option11_wrapper']/table[@id='option11']/tbody/tr/td[1]/a", 'CiviCon'); |
eac2f71b | 102 | } |
103 | } | |
104 | } | |
105 | ||
106 | } |