Skip to content

Commit

Permalink
OPENIDM-5762 -- Can not enable a new Audit Event Handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier Quiroz committed May 5, 2016
1 parent f87b199 commit 1e27c60
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 18 deletions.
Expand Up @@ -252,10 +252,13 @@ define("org/forgerock/openidm/ui/admin/settings/audit/AuditEventHandlersView", [
addEventHandler: function (e) {
e.preventDefault();
var newHandler = this.$el.find("#addAuditModuleSelect").val(),
found = false;
found = false,
// If this is the first event handler then it must be enabled
canDisable = this.data.eventHandlers.length >= 1;
if (newHandler !== null) {
AuditEventHandlersDialog.render(
{
"canDisable": canDisable,
"eventHandlerType": newHandler,
"eventHandler": {},
"newEventHandler": true,
Expand Down
Expand Up @@ -52,8 +52,8 @@ module.exports = {
title: {
selector: ".bootstrap-dialog-title"
},
form: {
selector: '#auditEventHandlersForm'
enableField: {
selector: "#auditEventHandlersForm > div.form-group:nth-child(3) p"
},
name: {
selector: "#eventHandlerName"
Expand Down
Expand Up @@ -4,11 +4,11 @@ var auditPage,

module.exports = {
before: function(client, done) {
client.globals.login.helpers.setSession(client, function () {
client.globals.login.helpers.setSession(client, function() {
auditPage = client.page.configureSysPrefAudit();
auditPage
.navigate()
.expect.section('@eventHandlers').to.be.visible.before(2000);
.expect.section("@eventHandlers").to.be.visible.before(2000);
handlersSection = auditPage.section.eventHandlers;
handlersDialogSection = auditPage.section.eventHandlersDialog;
done();
Expand All @@ -21,40 +21,54 @@ module.exports = {
"It should not allow disable when the 'use for query' handler": function(client) {
var useForQueriesRadio = handlersSection.elements.useForQueriesRadio.selector;

client.getAttribute(useForQueriesRadio, 'checked', function(result) {
client.assert.ok(result.value, 'Use for queries active');
client.getAttribute(useForQueriesRadio, "checked", function(result) {
if (!result.value) {
client
.pause(250)
.click(useForQueriesRadio);
}

});

handlersSection
.click('@editHandlerButton');
.click("@editHandlerButton");

handlersDialogSection
.waitForElementPresent('@name', 2000)
.expect.element('@enabledCheck').to.not.be.present;
.waitForElementPresent("@name", 2000)
.expect.element("@enabledCheck").to.not.be.present;

handlersDialogSection
.expect.element('@form').to.contain.text('Unable to disable handler used for queries');
.expect.element("@enableField").to.contain.text("Hander required for queries");

handlersDialogSection
.click('@closeButton');
.click("@closeButton");
},

"It should allow disable when not the 'use for query' hanlder": function(client) {
var editHandlerButton = handlersSection.elements.editHandlerButton.selector;

client
.elements('css selector', editHandlerButton, function(result) {
client.assert.ok(result.value.length > 1, 'More than one handler present');
.elements("css selector", editHandlerButton, function(result) {
client.assert.ok(result.value.length > 1, "More than one handler present");
})
.pause(275);

handlersSection
.click('@repoUseForQueries')
.click('@editHandlerButton');
.click("@repoUseForQueries")
.click("@editHandlerButton");

handlersDialogSection
.waitForElementPresent("@name", 2000)
.expect.element("@enabledCheck").to.be.present;
},

"It should allow disable when adding a hanlder": function(client) {
handlersSection
.click("@addEventHandlerButton");

handlersDialogSection
.waitForElementPresent('@name', 2000)
.expect.element('@enabledCheck').to.be.present;
.waitForElementPresent("@name", 2000)
.expect.element("@enabledCheck").to.be.present;
}

};

0 comments on commit 1e27c60

Please sign in to comment.