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