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