editConnectorTest.js revision 67c044a145fa1987d77d3f609876a839b0240ed0
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2015 ForgeRock AS. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* http://forgerock.org/license/CDDLv1.0.html
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at http://forgerock.org/license/CDDLv1.0.html
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*/
/*global require, define, QUnit, $ */
define([
"org/forgerock/commons/ui/common/util/Constants",
"org/forgerock/commons/ui/common/main/Router",
"org/forgerock/commons/ui/common/main/EventManager",
"org/forgerock/openidm/ui/admin/connector/EditConnectorView",
"../mocks/connectorAddEdit",
"org/forgerock/openidm/ui/admin/objectTypes/ObjectTypesDialog"
], function (constants, router, eventManager, editConnector, connectorMock, ObjectTypesDialog) {
return {
executeAll: function (server) {
module('Admin Edit Connector UI Functions');
QUnit.asyncTest("Edit Connector", function () {
connectorMock(server);
editConnector.render(["provisioner.openicf_ldap"], function () {
//Base connector tests
QUnit.equal(editConnector.$el.find(".back-bar a").length, 1, "Return link loaded");
QUnit.ok(editConnector.$el.find(".page-header .media .media-body .page-type").html() === "LDAP Connector - 1.4.0.0", "Connector type set");
QUnit.ok(editConnector.$el.find(".page-header .media .media-body h1").html() === "ldap", "Connector name set");
QUnit.equal(editConnector.$el.find(".nav-tabs li").length, 4, "Tabs detected and tabdrop prepared");
QUnit.ok(editConnector.$el.find("#connectorEnabled").val() === "true", "Connector defaults to enabled");
editConnector.$el.find("input[name='configurationProperties.host']").val("1234");
editConnector.$el.find("input[name='configurationProperties.host']").change();
QUnit.equal(editConnector.$el.find(".message .connector-pending").length, 1, "Connector change message displayed");
//Object type tests
QUnit.equal(editConnector.$el.find("#selectObjectConfig").length, 1, "Prdefined object type dropdown displayed");
QUnit.equal(editConnector.$el.find("#objectTypesTab table tbody tr").length, 2, "Object type table populated");
//Sync tests
QUnit.equal(editConnector.$el.find("#syncTab .sources option").length, 2, "Sync schedule sources loaded");
editConnector.$el.find("#syncTab .addLiveSync").click();
QUnit.equal(editConnector.$el.find("#syncTab .liveSyncScheduleContainer").length, 1, "Sync schedule added");
QUnit.equal(editConnector.$el.find("#syncTab #retryOptions option").length, 3, "LiveSync options loaded");
editConnector.$el.find("#syncTab #retryOptions").val("0");
editConnector.$el.find("#syncTab #retryOptions").change();
QUnit.ok(editConnector.$el.find("#syncTab .postActionBlock").not(":visible"), "Retry options changed");
QUnit.equal(editConnector.$el.find(".message .sync-pending").length, 1, "Sync change message displayed");
//More Object type tests
editConnector.$el.find("#objectTypesTab table tbody tr").first().find(".delete-objectType").click();
QUnit.equal(editConnector.$el.find("#objectTypesTab table tbody tr").length, 1, "Delete successful");
QUnit.equal(editConnector.$el.find(".message .objecttype-pending").length, 1, "Object type change message displayed");
QUnit.start();
});
});
}
};
});