$this->waitForTextPresent("'Online Registration' information has been saved.");
}
+ /**
+ * CRM-16777: Allow to add schedule reminder for event through ACLs 'edit' permission
+ */
+ public function testACLforReminders() {
+ $this->webtestLogin('admin');
+
+ //Details for ACLUser1
+ $ACLrole1 = 'ACLrole1' . substr(sha1(rand()), 0, 7);
+ $ACLUser1 = "ACLUser1" . substr(sha1(rand()), 0, 4);
+ $emailId1 = substr(sha1(rand()), 0, 7) . '@web.com';
+
+ //create ACLrole1 (with 'Access CiviCRM' and 'Access CiviEvent' permissions only).
+ $this->open($this->sboxPath . "admin/people/permissions/roles");
+ $this->type("edit-name", $ACLrole1);
+ $this->waitForElementPresent("edit-add");
+ $this->click("edit-add");
+ $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->open($this->sboxPath . "admin/people/permissions/roles");
+ $this->waitForElementPresent("xpath=//table[@id='user-roles']/tbody//tr/td[1][text()='{$ACLrole1}']");
+ $roleId = explode('/', $this->getAttribute("xpath=//table[@id='user-roles']/tbody//tr/td[1][text()='{$ACLrole1}']/../td[4]/a[text()='edit permissions']/@href"));
+ $permissions = array(
+ "edit-{$roleId[5]}-access-civicrm",
+ "edit-{$roleId[5]}-access-civievent",
+ );
+ $this->changePermissions($permissions);
+
+ //Create ACLUser1
+ $this->open($this->sboxPath . "admin/people/create");
+ $this->waitForElementPresent("edit-submit");
+ $this->type("edit-name", $ACLUser1);
+ $this->type("edit-mail", $emailId1);
+ $this->type("edit-pass-pass1", "Test12345");
+ $this->type("edit-pass-pass2", "Test12345");
+ $this->click("xpath=//div[@class='form-item form-type-checkboxes form-item-roles']/div//div/label[contains(text(), '{$ACLrole1}')]");
+ $firstName = 'Ma' . substr(sha1(rand()), 0, 4);
+ $lastName = 'An' . substr(sha1(rand()), 0, 7);
+ $this->type("first_name", $firstName);
+ $this->type("last_name", $lastName);
+ $this->type("street_address-1", "902C El Camino Way SW");
+ $this->type("city-1", "Dumfries");
+ $this->type("postal_code-1", "1234");
+ $this->select("state_province-1", "value=1019");
+ $this->click("edit-submit");
+ $this->waitForPageToLoad($this->getTimeoutMsec());
+
+ //Create group and add contact.
+ $this->openCiviPage('group/add', 'reset=1', '_qf_Edit_upload-bottom');
+ $groupTitle = 'ACLGroup' . substr(sha1(rand()), 0, 7);
+ $this->type("title", $groupTitle);
+ $this->click("group_type_1");
+ $this->click("_qf_Edit_upload-bottom");
+ $this->waitForElementPresent('_qf_Basic_refresh');
+ $this->type("sort_name", $firstName);
+ $this->click('_qf_Basic_refresh');
+ $this->waitForElementPresent('toggleSelect');
+ $this->click('_qf_Basic_next_action');
+ $this->waitForElementPresent('_qf_AddToGroup_back-bottom');
+ $this->click('_qf_AddToGroup_next-bottom');
+ $this->waitForTextPresent("1 contact added to group");
+
+ //Add the ACLs
+ $this->openCiviPage("admin/options/acl_role", "action=add&reset=1", "_qf_Options_cancel-bottom");
+ $label = "TestAclRole" . substr(sha1(rand()), 0, 4);
+ $this->type("label", $label);
+ $this->type("value", "Acl value" . $label);
+ $this->click("_qf_Options_next-bottom");
+ $this->waitForText('crm-notification-container', "The ACL Role '{$label}' has been saved.");
+ $this->waitForAjaxContent();
+ $this->openCiviPage("acl/entityrole", "action=add&reset=1");
+ $this->waitForAjaxContent();
+ $this->select("acl_role_id", "label=" . $label);
+ $this->waitForAjaxContent();
+ $this->select("entity_id", "label={$groupTitle}");
+ $this->clickLink("_qf_EntityRole_next-botttom");
+ $this->openCiviPage("acl", "action=add&reset=1");
+ $this->type("name", "Edit Events{$label}");
+ $this->select("operation", "label=Edit");
+ $this->select("entity_id", "label={$label}");
+ $this->click("xpath=//tr[@class='crm-acl-form-block-object_type']/td[2]/label[contains(text(), 'Events')]");
+ $this->select("event_id", "label=All Events");
+ $this->clickLink("_qf_ACL_next-bottom");
+ $this->webtestLogout();
+ $this->webtestLogin($ACLUser1, 'Test12345');
+
+ //Add scheduled reminder
+ $this->openCiviPage("event/manage/reminder", "reset=1&action=browse&setTab=1&id=1");
+ $reminderTitle = "Fall Fundraiser Dinner" . substr(sha1(rand()), 0, 4);
+ $this->waitForElementPresent('newScheduleReminder');
+ $this->click("newScheduleReminder");
+ $this->waitForElementPresent("_qf_ScheduleReminders_next-bottom");
+ $this->type("title", $reminderTitle);
+ $this->select('entity', 'label=Registered');
+ $this->select('start_action_offset', 'label=1');
+ $this->select('start_action_condition', 'label=after');
+ $this->click('is_repeat');
+ $this->select('repetition_frequency_interval', 'label=2');
+ $this->select('end_date', 'label=Event End Date');
+ $this->click('recipient');
+ $this->select('recipient', 'label=Participant Role');
+ $subject = 'subject' . substr(sha1(rand()), 0, 4);
+ $this->type('subject', $subject);
+ $this->fillRichTextField("html_message", "This is the test HTML version here!!!", 'CKEditor');
+ $this->type("text_message", "This is the test text version here!!!");
+ $this->click('_qf_ScheduleReminders_next-bottom');
+ $this->webtestLogout();
+
+ //Disable the ACLs
+ $this->webtestLogin('admin');
+ $this->openCiviPage("acl", "reset=1");
+ $this->waitForAjaxContent();
+ $this->click("xpath=//div[contains(text(), 'Edit Events{$label}')]/../../td[7]/span/a[2][contains(text(), 'Disable')]");
+ $this->waitForTextPresent("Are you sure you want to disable this ACL?");
+ $this->click("xpath=//button//span[contains(text(), 'Yes')]");
+
+ //Login with same test-user created above
+ $this->webtestLogin($ACLUser1, 'Test12345');
+ $this->openCiviPage("event/manage", "reset=1");
+ $this->waitForElementPresent("xpath=//div[@id='event_status_id']/div[@class='dataTables_wrapper no-footer']");
+ $this->verifyText("xpath=//div[@id='event_status_id']/div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td", "None found.");
+ }
+
}
*/
public function _testAddReminder($eventTitle) {
// Go to Schedule Reminders tab
- $this->click('css=li#tab_reminder a');
+ $this->click("link=Schedule Reminders");
$this->waitForElementPresent("newScheduleReminder");
$this->click("newScheduleReminder");
$this->waitForElementPresent("_qf_ScheduleReminders_next-bottom");
$this->waitForElementPresent("xpath=//form[@id='ScheduleReminders']//div[@id='option11_wrapper']");
//verify the fields for Event Reminder selector
foreach ($verifyText as $key => $value) {
- $this->verifyText("xpath=//form[@id='ScheduleReminders']//div['option11_wrapper']/table/tbody/tr/td[$key]", $value);
+ $this->verifyText("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody//tr/td[$key]", $value);
}
}
}
}
+ /**
+ * CRM-16777: Allow to add schedule reminder for event with 'edit all event' permission
+ */
+ public function testConfigureScheduleReminder() {
+ // Log in using webtestLogin() method
+ $this->webtestLogin('admin');
+
+ //Details for TestUser1
+ $role1 = 'role1' . substr(sha1(rand()), 0, 7);
+ $TestUser1 = "TestUser1" . substr(sha1(rand()), 0, 4);
+ $emailId1 = substr(sha1(rand()), 0, 7) . '@web.com';
+
+ //create Role1 with permission 'Access CiviCRM', 'edit all events' and 'Access CiviEvent' permissions.
+ $this->open($this->sboxPath . "admin/people/permissions/roles");
+ $this->type("edit-name", $role1);
+ $this->waitForElementPresent("edit-add");
+ $this->click("edit-add");
+ $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->open($this->sboxPath . "admin/people/permissions/roles");
+ $this->waitForElementPresent("xpath=//table[@id='user-roles']/tbody//tr/td[1][text()='{$role1}']");
+ $roleId = explode('/', $this->getAttribute("xpath=//table[@id='user-roles']/tbody//tr/td[1][text()='{$role1}']/../td[4]/a[text()='edit permissions']/@href"));
+ $permissions = array(
+ "edit-{$roleId[5]}-access-civicrm",
+ "edit-{$roleId[5]}-edit-all-events",
+ "edit-{$roleId[5]}-access-civievent",
+ );
+ $this->changePermissions($permissions);
+
+ //Create TestUser1
+ $this->open($this->sboxPath . "admin/people/create");
+ $this->waitForElementPresent("edit-submit");
+ $this->type("edit-name", $TestUser1);
+ $this->type("edit-mail", $emailId1);
+ $this->type("edit-pass-pass1", "Test12345");
+ $this->type("edit-pass-pass2", "Test12345");
+ $this->click("xpath=//div[@class='form-item form-type-checkboxes form-item-roles']/div//div/label[contains(text(), '{$role1}')]");
+ $firstName = 'Ma' . substr(sha1(rand()), 0, 4);
+ $lastName = 'An' . substr(sha1(rand()), 0, 7);
+ $this->type("first_name", $firstName);
+ $this->type("last_name", $lastName);
+ $this->type("street_address-1", "902C El Camino Way SW");
+ $this->type("city-1", "Dumfries");
+ $this->type("postal_code-1", "1234");
+ $this->select("state_province-1", "value=1019");
+ $this->click("edit-submit");
+ $this->waitForPageToLoad($this->getTimeoutMsec());
+
+ //Add event
+ $this->openCiviPage("event/add", "reset=1&action=add");
+ $eventName = 'My Event - ' . substr(sha1(rand()), 0, 7);
+ $eventDescription = "Here is a description for this conference.";
+ $this->_testAddEventInfo($eventName, $eventDescription);
+
+ //Logging out
+ $this->webtestLogout();
+
+ //Login with TestUser1
+ $this->webtestLogin($TestUser1, 'Test12345');
+ $this->openCiviPage("event/manage", "reset=1");
+ $this->_testAddReminder($eventName);
+ $this->webtestLogout();
+
+ //Details for TestUser2
+ $role2 = 'role2' . substr(sha1(rand()), 0, 5);
+ $TestUser2 = "TestUser2" . substr(sha1(rand()), 0, 5);
+ $emailId2 = substr(sha1(rand()), 0, 7) . '@web.com';
+
+ //create Role2 with only 'Access CiviCRM' and 'Access CiviEvent' permissions
+ $this->webtestLogin('admin');
+ $this->open($this->sboxPath . "admin/people/permissions/roles");
+ $this->type("edit-name", $role2);
+ $this->waitForElementPresent("edit-add");
+ $this->click("edit-add");
+ $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->open($this->sboxPath . "admin/people/permissions/roles");
+ $this->waitForElementPresent("xpath=//table[@id='user-roles']/tbody//tr/td[1][text()='{$role2}']");
+ $roleId = explode('/', $this->getAttribute("xpath=//table[@id='user-roles']/tbody//tr/td[1][text()='{$role2}']/../td[4]/a[text()='edit permissions']/@href"));
+ $permissions = array(
+ "edit-{$roleId[5]}-access-civicrm",
+ "edit-{$roleId[5]}-access-civievent",
+ );
+ $this->changePermissions($permissions);
+
+ //Create TestUser2
+ $this->open($this->sboxPath . "admin/people/create");
+ $this->waitForElementPresent("edit-submit");
+ $this->type("edit-name", $TestUser2);
+ $this->type("edit-mail", $emailId2);
+ $this->type("edit-pass-pass1", "Test123");
+ $this->type("edit-pass-pass2", "Test123");
+ $this->click("xpath=//div[@class='form-item form-type-checkboxes form-item-roles']/div//div/label[contains(text(), '{$role2}')]");
+ $firstName = 'Smith' . substr(sha1(rand()), 0, 4);
+ $lastName = 'John' . substr(sha1(rand()), 0, 5);
+ $this->type("first_name", $firstName);
+ $this->type("last_name", $lastName);
+ $this->type("street_address-1", "902C El Camino Way SW");
+ $this->type("city-1", "Dumfries");
+ $this->type("postal_code-1", "1234");
+ $this->select("state_province-1", "value=1019");
+ $this->click("edit-submit");
+ $this->waitForPageToLoad($this->getTimeoutMsec());
+
+ //Logout
+ $this->webtestLogout();
+
+ //Login with TestUser2
+ $this->webtestLogin($TestUser2, 'Test123');
+ $this->openCiviPage("event/manage", "reset=1");
+ $this->waitForElementPresent("xpath=//div[@id='event_status_id']/div[@class='dataTables_wrapper no-footer']");
+ $this->verifyText("xpath=//div[@id='event_status_id']/div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td", "None found.");
+ $this->webtestLogout();
+ }
+
}