run.js revision b1d9fd8dc3197f92d1b490d07e13f138149234d0
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering/**
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering * The contents of this file are subject to the terms of the Common Development and
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering * Distribution License (the License). You may not use this file except in compliance with the
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering * License.
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering *
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering * specific language governing permission and limitations under the License.
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering *
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering * When distributing Covered Software, include this CDDL Header Notice in each file and include
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering * Header, with the fields enclosed by brackets [] replaced by your own identifying
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering * information: "Portions copyright [year] [name of copyright owner]".
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering *
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering * Copyright 2015 ForgeRock AS.
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering */
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering/*global require, QUnit */
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poetteringdefine([
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering "jquery",
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering "org/forgerock/commons/ui/common/util/Constants",
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering "org/forgerock/commons/ui/common/main/EventManager",
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering "tests/admin/common",
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering "tests/admin/realms/policies",
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering "tests/admin/realms/scripts"
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering], function ($, Constants, EventManager, CommonTests, PoliciesTests, ScriptsTests) {
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering return function (server) {
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering EventManager.registerListener(Constants.EVENT_APP_INITIALIZED, function () {
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering
9eb977db5b89b44f254ab40c1876a76b7d7ea2d0Kay Sievers QUnit.testStart(function (testDetails) {
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering console.log("Starting " + testDetails.module + ": " + testDetails.name + " (" + testDetails.testNumber + ")");
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering // every state needs to be reset at the start of each test
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering var vm = require("org/forgerock/commons/ui/common/main/ViewManager");
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering vm.currentView = null;
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering vm.currentDialog = null;
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering vm.currentViewArgs = null;
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering vm.currentDialogArgs = null;
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering localStorage.clear();
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering sessionStorage.clear();
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering require("org/forgerock/commons/ui/common/main/Configuration").baseTemplate = null;
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering });
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering QUnit.testDone(function () {
9eb977db5b89b44f254ab40c1876a76b7d7ea2d0Kay Sievers // various widgets which get added outside of the fixture and need to be cleaned up
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering $(".modal-backdrop").remove();
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering $(".ui-autocomplete").remove();
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering $(".ui-helper-hidden-accessible").remove();
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering $("body").removeClass("modal-open");
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering });
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering QUnit.done(function () {
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering localStorage.clear();
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering sessionStorage.clear();
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering Backbone.history.stop();
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering window.location.hash = "";
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering });
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering _.delay(function () {
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering QUnit.start();
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering CommonTests.executeAll();
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering PoliciesTests.executeAll();
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering ScriptsTests.executeAll();
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering }, 500);
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering });
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering }
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering});
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering