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 2014-2015 ForgeRock AS.
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne/*global require, define, QUnit, $ */
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne "org/forgerock/commons/ui/common/util/Constants",
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne "org/forgerock/commons/ui/common/main/EventManager",
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne "org/forgerock/openidm/ui/admin/mapping/AddMappingView",
0e2f85c75c270eec9d148bab17911441d8843a2aJake Feasel "org/forgerock/openidm/ui/admin/MapResourceView",
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne QUnit.asyncTest("Add Mapping View", function () {
0e2f85c75c270eec9d148bab17911441d8843a2aJake Feasel * Mocks include:
0e2f85c75c270eec9d148bab17911441d8843a2aJake Feasel * config/sync (mappings: systemLdapAccounts_managedUser and managedUser_systemLdapAccounts)
0e2f85c75c270eec9d148bab17911441d8843a2aJake Feasel * config/managed (objects: role, apple, user, test)
0e2f85c75c270eec9d148bab17911441d8843a2aJake Feasel * system?_action=test (resources: ldap - account, group;)
1e80314f6b8449684f9baac9e8bcae33f0b4e507Jason Browne QUnit.equal(addMappingView.$el.find(".help-link").length, 1, "Help successfully detected");
1e80314f6b8449684f9baac9e8bcae33f0b4e507Jason Browne QUnit.equal(addMappingView.$el.find(".back-bar a").length, 1, "Return link loaded");
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne QUnit.equal(addMappingView.$el.find("#resourceConnectorContainer .resource-body").length, 1, "Resources successfully loaded");
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne QUnit.equal(addMappingView.$el.find("#resourceManagedContainer .resource-body").length, 4, "Managed Objects successfully loaded");
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne addMappingView.$el.find("#resourceConnectorContainer .resource-body:first .add-resource-button").trigger("click");
d1a2899a06be1eab885056aeda85adcd67c010b0Jason Browne addMappingView.$el.find("#resourceManagedContainer .resource-body:first .add-resource-button").trigger("click");
0e2f85c75c270eec9d148bab17911441d8843a2aJake Feasel QUnit.equal(addMappingView.$el.find("#mappingSource .mapping-resource:visible .resource-given-name").text(), 'ldap', "Source system successfully selected");
0e2f85c75c270eec9d148bab17911441d8843a2aJake Feasel QUnit.equal(addMappingView.$el.find("#mappingTarget .mapping-resource:visible .resource-given-name").text(), 'apple', "Target system successfully selected");
0e2f85c75c270eec9d148bab17911441d8843a2aJake Feasel addMappingView.$el.find(".mapping-swap").trigger("click");
0e2f85c75c270eec9d148bab17911441d8843a2aJake Feasel QUnit.equal(addMappingView.$el.find("#mappingTarget .mapping-resource:visible .resource-given-name").text(), 'ldap', "Swap successful");
0e2f85c75c270eec9d148bab17911441d8843a2aJake Feasel QUnit.equal($(".bootstrap-dialog:visible .bootstrap-dialog-title").text(), "Create mapping.", "Create mapping dialog successfully shown");
0e2f85c75c270eec9d148bab17911441d8843a2aJake Feasel QUnit.equal($(".bootstrap-dialog .mappingName").val(), "managedApple_sourceLdapAccount", "Mapping name auto generated successfully");
0e2f85c75c270eec9d148bab17911441d8843a2aJake Feasel $(".bootstrap-dialog").one("hidden.bs.modal", function () {
0e2f85c75c270eec9d148bab17911441d8843a2aJake Feasel QUnit.equal($(".bootstrap-dialog").length, 0, "Create mapping dialog closed");
0e2f85c75c270eec9d148bab17911441d8843a2aJake Feasel MapResourceView.$el.find("#mappingSource .select-resource").trigger("click");
0e2f85c75c270eec9d148bab17911441d8843a2aJake Feasel MapResourceView.$el.find("#mappingTarget .select-resource").trigger("click");
0e2f85c75c270eec9d148bab17911441d8843a2aJake Feasel QUnit.equal(addMappingView.$el.find("#mappingSource .mapping-resource-empty:visible").length, 1, "Removal of source successful");
0e2f85c75c270eec9d148bab17911441d8843a2aJake Feasel QUnit.equal(addMappingView.$el.find("#mappingTarget .mapping-resource-empty:visible").length, 1, "Removal of target successful");
0e2f85c75c270eec9d148bab17911441d8843a2aJake Feasel $(".bootstrap-dialog #mappingSaveCancel").click();
0e2f85c75c270eec9d148bab17911441d8843a2aJake Feasel MapResourceView.$el.find("#createMapping").trigger("click");