From 899d5ba2a7a4cdf74b9f49123dc5f82a3204fa41 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 1 Mar 2017 09:21:07 +0100 Subject: [PATCH 01/26] GPII-442: Using dynamic device reporter in most tests --- .../contextManager/src/ContextManager.js | 10 +- .../lifecycleManager/src/LifecycleManager.js | 34 ++-- .../processReporter/src/ProcessReporter.js | 40 +++-- gpii/node_modules/settingsHandlers/index.js | 1 + .../settingsHandlers/src/LaunchHandlers.js | 67 +++++++ .../src/settingsHandlerUtilities.js | 14 +- gpii/node_modules/testing/src/Integration.js | 37 +++- gpii/node_modules/testing/src/Testing.js | 13 +- .../acceptanceTests/linux_builtIn.json | 3 + .../acceptanceTests/os_common.json | 3 +- testData/solutions/linux.json5 | 163 +++++++----------- 11 files changed, 235 insertions(+), 150 deletions(-) create mode 100644 gpii/node_modules/settingsHandlers/src/LaunchHandlers.js diff --git a/gpii/node_modules/contextManager/src/ContextManager.js b/gpii/node_modules/contextManager/src/ContextManager.js index 1b6f4d5c2..d6b19a6f4 100644 --- a/gpii/node_modules/contextManager/src/ContextManager.js +++ b/gpii/node_modules/contextManager/src/ContextManager.js @@ -104,7 +104,7 @@ fluid.defaults("gpii.contextManager", { gpii.contextManager.onEnvironmentChanged = function (that, body) { var newContext = fluid.copy(body); delete newContext.timestamp; - fluid.log("contextManager: Updating context with: " + JSON.stringify(newContext, null, 4)); + fluid.log(fluid.logLevel.TRACE, "contextManager: Updating context with: " + JSON.stringify(newContext, null, 4)); that.applier.change("currentContext", newContext); }; @@ -154,7 +154,7 @@ gpii.contextManager.stopTemporalEnvironmentReporter = function (that) { * @that {Object} The context manager object * @lifecycleManager {Object} the lifecycleManager component from which the current * session will be retrieved - * @context {Object} The model as reporterd by the changeApplier (ie. the content of + * @context {Object} The model as reported by the changeApplier (ie. the content of * that.model.currentContext) **/ gpii.contextManager.evaluateConditions = function (that, lifecycleManager, context) { @@ -166,9 +166,9 @@ gpii.contextManager.evaluateConditions = function (that, lifecycleManager, conte } var activeSession = lifecycleManager.getSession(activeSessions); var newActiveContexts = gpii.contextManager.utils.findActiveContexts(context, activeSession.model.matchMakerOutput); - fluid.log("contextManager: New active contexts: " + newActiveContexts); - if (newActiveContexts[0] === activeSession.activeContextName) { - fluid.log("contextManager: Same context as before (" + activeSession.model.appliedContext + ") so doing nothing"); + fluid.log(fluid.logLevel.TRACE, "contextManager: New active contexts: " + newActiveContexts); + if (newActiveContexts[0] === activeSession.model.activeContextName) { + fluid.log(fluid.logLevel.TRACE, "contextManager: Same context as before (" + activeSession.model.activeContextName + ") so doing nothing"); return; } var activeConfiguration = activeSession.model.matchMakerOutput.inferredConfiguration[newActiveContexts[0]]; diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index d2832cdd2..e73189572 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -96,8 +96,8 @@ var gpii = fluid.registerNamespace("gpii"); }, invokeSettingsHandler: { funcName: "gpii.lifecycleManager.invokeSettingsHandler", - args: ["{that}", "{arguments}.0", "{arguments}.1", "{arguments}.2"] - // solutionId, settingsHandlers, isMultiSH + args: ["{that}", "{arguments}.0", "{arguments}.1"] + // solutionId, settingsHandlers }, restoreSnapshot: { funcName: "gpii.lifecycleManager.restoreSnapshot", @@ -134,21 +134,13 @@ var gpii = fluid.registerNamespace("gpii"); /** Transforms the handlerSpec (handler part of the transformer's response payload) to a form * accepted by a settingsHandler - we use a 1-element array holding the payload for a single solution * per handler - * @param isMultiSH {boolean} is a flag denoting whether it's a multi-settingshandler solution - * If it is, a supported settings block is required for each entry */ - gpii.lifecycleManager.specToSettingsHandler = function (solutionId, handlerSpec, isMultiSH) { + gpii.lifecycleManager.specToSettingsHandler = function (solutionId, handlerSpec) { var returnObj = {}, settings = {}; if (handlerSpec.supportedSettings === undefined) { - if (isMultiSH) { - fluid.fail("Solution " + solutionId + " has multiple settingshandlers but is missing " + - "the 'supportedSettings' directive. Will not set the settings for this settingshandler"); - } else { - // if supportedSettings directive is not present, pass all settings: - settings = handlerSpec.settings; - } + settings = handlerSpec.settings; } else { // we cant simply use fluid.filterKeys because that wont handle the cases where // there are 'undefined' values for the keys in handlerSpec.settings @@ -164,7 +156,7 @@ var gpii = fluid.registerNamespace("gpii"); options: handlerSpec.options }]; - return returnObj; // NB array removed here + return returnObj; }; // Transform the response from the handler SET to a format that we can persist in models before passing to handler SET on restore @@ -181,16 +173,15 @@ var gpii = fluid.registerNamespace("gpii"); /** * @param handlerSpec {Object} A single settings handler specification - * @param isMultiSH {Boolean} [optional] if present and true, the solution has multiple settingshandlers * Payload example: * http://wiki.gpii.net/index.php/Settings_Handler_Payload_Examples * Transformer output: * http://wiki.gpii.net/index.php/Transformer_Payload_Examples */ - gpii.lifecycleManager.invokeSettingsHandler = function (that, solutionId, handlerSpec, isMultiSH) { + gpii.lifecycleManager.invokeSettingsHandler = function (that, solutionId, handlerSpec) { // first prepare the payload for the settingsHandler in question - a more efficient // implementation might bulk together payloads destined for the same handler - var settingsHandlerPayload = gpii.lifecycleManager.specToSettingsHandler(solutionId, handlerSpec, isMultiSH); + var settingsHandlerPayload = gpii.lifecycleManager.specToSettingsHandler(solutionId, handlerSpec); var resolvedName = that.nameResolver.resolveName(handlerSpec.type, "settingsHandler"); var setSettingsPromise = gpii.settingsHandlers.dispatchSettingsHandler(resolvedName, settingsHandlerPayload, that.options.retryOptions); var togo = fluid.promise(); @@ -265,7 +256,6 @@ var gpii = fluid.registerNamespace("gpii"); * that will be resolved once the settings are successfully set. */ gpii.lifecycleManager.executeSettingsAction = function (that, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction) { - var isMultiSH = Object.keys(solutionRecord.settingsHandlers).length > 1; var settingsHandlerBlock = solutionRecord.settingsHandlers[settingsHandlerBlockName]; if (settingsHandlerBlock === undefined) { fluid.fail("Reference to non-existing settingsHandler block named " + settingsHandlerBlockName + @@ -273,7 +263,7 @@ var gpii = fluid.registerNamespace("gpii"); } return function () { var expanded = session.localResolver(settingsHandlerBlock); - var settingsPromise = that.invokeSettingsHandler(solutionId, expanded, isMultiSH); + var settingsPromise = that.invokeSettingsHandler(solutionId, expanded); settingsPromise.then(function (snapshot) { session.applier.change(["appliedSolutions", solutionId], solutionRecord); gpii.lifecycleManager.recordSnapshotInSession(that, snapshot, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction); @@ -335,6 +325,12 @@ var gpii = fluid.registerNamespace("gpii"); // the settings handler block) if (action.indexOf("settings.") === 0) { var settingsHandlerBlockName = action.substring("settings.".length); + // if this is related to launching, overwrite entry with the appropriate settings, + // that is: { running: true } if we're in a start block, else { running: false } + if (actionBlock === "start" || actionBlock === "stop") { + var launchSettings = { running: actionBlock === "start" ? true : false }; + fluid.set(solutionRecord, [ "settingsHandlers", settingsHandlerBlockName, "settings"], launchSettings); + } return gpii.lifecycleManager.executeSettingsAction(that, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction); } else if (actionBlock === "update") { // Keywords: "start", "stop", "configure" are allowed here as well, and @@ -352,7 +348,7 @@ var gpii = fluid.registerNamespace("gpii"); " inside 'update' section for solution " + solutionId); } } - } else { // TODO should be removed when GPII-1235 has been solved (lifecycle actions are settings handlers) + } else { // TODO should be removed when GPII-1235 has been solved (lifecycle actions are settings handlers) // TODO KASPER remove this return function () { var expanded = session.localResolver(action); var result = gpii.lifecycleManager.invokeAction(expanded, that.nameResolver); diff --git a/gpii/node_modules/processReporter/src/ProcessReporter.js b/gpii/node_modules/processReporter/src/ProcessReporter.js index 2e1cf9745..74176dce6 100644 --- a/gpii/node_modules/processReporter/src/ProcessReporter.js +++ b/gpii/node_modules/processReporter/src/ProcessReporter.js @@ -157,30 +157,46 @@ fluid.defaults("gpii.processReporter.live", { }, handleIsRunning: { funcName: "gpii.processReporter.live.handleIsRunning", - args: ["{arguments}.0", "{arguments}.1", "{processReporter}"] - // entry, entry id, processReporter + args: ["{arguments}.0"] + // entry } } }); -gpii.processReporter.live.handleIsRunning = function (entry, entryId, processReporter) { - var runningSolution = null; +/* Marker function for use in isRunning sections of a launch handler + * to identify in a meaningful way that the solutions start block should always + * be run. + */ +fluid.defaults("gpii.processReporter.neverRunning", { + gradeNames: "fluid.function", + argumentMap: {} +}); + +gpii.processReporter.neverRunning = function () { + return false; +}; + +/** + * Runs the 'isRunning' entries of the 'entry' argument. If no 'isRunning' block is present + * undefined is returned + */ +gpii.processReporter.live.handleIsRunning = function (entry) { + var running = undefined; if (!!entry.isRunning) { - runningSolution = { id: entryId, isRunning: true }; + running = true; fluid.each (entry.isRunning, function (aMember) { - var resolvedName = processReporter.nameResolver.resolveName(aMember.type, "processReporter"); - var partial = fluid.invokeGradedFunction(resolvedName, aMember); - runningSolution.isRunning = runningSolution.isRunning && partial; + var partial = fluid.invokeGradedFunction(aMember.type, aMember); + running = running && partial; }); } - return runningSolution; + return running; }; gpii.processReporter.live.get = function (request, processReporter, solutionsRegistryDataSource) { var runningSolutions = []; solutionsRegistryDataSource.get({os: processReporter.platformReporter.reportPlatform().id}, function onSuccess(entries) { - fluid.each(entries, function (entry, entryId) { - var foundEntry = gpii.processReporter.live.handleIsRunning(entry, entryId, processReporter); + fluid.each(entries, function (entry) { + var foundEntry = gpii.processReporter.live.handleIsRunning(entry); if (foundEntry !== null) { runningSolutions.push(foundEntry); } @@ -194,7 +210,7 @@ gpii.processReporter.live.getProcess = function (request, processReporter, solut solutionsRegistryDataSource.get({os: processReporter.platformReporter.reportPlatform().id}, function onSuccess(entries) { var result = fluid.find(entries, function (anEntry, entryID) { if (entryID === solutionID) { - return gpii.processReporter.live.handleIsRunning(anEntry, entryID, processReporter); + return gpii.processReporter.live.handleIsRunning(anEntry); } }, null); if (result === null) { diff --git a/gpii/node_modules/settingsHandlers/index.js b/gpii/node_modules/settingsHandlers/index.js index 9b3e1ebe1..0d0199a92 100644 --- a/gpii/node_modules/settingsHandlers/index.js +++ b/gpii/node_modules/settingsHandlers/index.js @@ -9,3 +9,4 @@ require("./src/XMLSettingsHandler.js"); require("./src/JSONSettingsHandler.js"); require("./src/WebSocketsSettingsHandler.js"); require("./src/NoSettingsHandler.js"); +require("./src/LaunchHandlers.js"); diff --git a/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js b/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js new file mode 100644 index 000000000..c0275b2d0 --- /dev/null +++ b/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js @@ -0,0 +1,67 @@ +/* + * GPII JSON Settings Handler + * + * Copyright 2017 Raising the Floor - International + * + * Licensed under the New BSD license. You may not use this file except in + * compliance with this License. + * + * You may obtain a copy of the License at + * https://github.com/GPII/universal/blob/master/LICENSE.txt + */ + +"use strict"; + +var fluid = require("infusion"), + gpii = fluid.registerNamespace("gpii"); + +fluid.registerNamespace("gpii.launchHandlers"); +fluid.registerNamespace("gpii.launchHandlers.flexibleHandler"); + + +gpii.launchHandlers.flexibleHandler.set = function (payload) { + return fluid.transform(payload, function (allSettingsBlocks, solutionId) { + return fluid.transform(allSettingsBlocks, function (handlerData) { + // find desire state { running: X } + var desiredState = handlerData.settings.running; + if (desiredState !== true && desiredState !== false) { + fluid.fail("Unable to set the launch state of ", solutionId, " to ", desiredState); + } + + // get current state + var currentState = gpii.launchHandlers.flexibleHandler.executeIsRunningBlock(handlerData.options, solutionId); + + // if not in desired state + if (currentState !== desiredState) { + desiredState === true ? + gpii.launchHandlers.flexibleHandler.executeStartBlock(handlerData) : + gpii.launchHandlers.flexibleHandler.executeStopBlock(handlerData); + } + + return gpii.settingsHandlers.setSettings(handlerData, { running: currentState }); + }); + }); +}; + +gpii.launchHandlers.flexibleHandler.get = function (payload) { + return fluid.transform(payload, function (allSettingsBlocks, solutionId) { + return fluid.transform(allSettingsBlocks, function (handlerData) { + var currentState = gpii.launchHandlers.flexibleHandler.executeIsRunningBlock(handlerData.options, solutionId); + return { settings: { running: currentState }}; + }); + }); +}; + +gpii.launchHandlers.flexibleHandler.executeStartBlock = function (mainEntry) { + var startBlock = fluid.get(mainEntry, [ "options", "start" ]); + fluid.invokeGradedFunction(startBlock.type, startBlock); +}; + +gpii.launchHandlers.flexibleHandler.executeStopBlock = function (mainEntry) { + var stopBlock = fluid.get(mainEntry, [ "options", "stop" ]); + fluid.invokeGradedFunction(stopBlock.type, stopBlock); +}; + +gpii.launchHandlers.flexibleHandler.executeIsRunningBlock = function (options) { + return gpii.processReporter.live.handleIsRunning(options); +}; diff --git a/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js b/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js index 02a4ed55d..91ebd0ff6 100644 --- a/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js +++ b/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js @@ -72,9 +72,9 @@ fluid.registerNamespace("gpii.settingsHandlers"); * @return The transformed payload-structured value */ gpii.settingsHandlers.transformPayload = function (payload, handler) { - return fluid.transform(payload, function (oneSolution, solutionPath) { + return fluid.transform(payload, function (oneSolution, solutionId) { return fluid.transform(oneSolution, function (oneSetting, settingPath) { - var path = [solutionPath, settingPath]; + var path = [solutionId, settingPath]; return handler(oneSetting, path, oneSolution); }); }); @@ -138,16 +138,16 @@ gpii.settingsHandlers.numberify = function (payload) { * @return A promise yielding the combined payload expected from a top-level settings handler - this * will resolve synchronously if the supplied handler function is synchronous ("ZALGO" notwithstanding) **/ - gpii.settingsHandlers.invokeSettingsHandler = function (handler, payload) { var worklist = []; var response = gpii.settingsHandlers.transformPayload(payload, function (element, path) { + var solutionId = path[0]; // first entry of path will always be solution ID // Note shallow copy performed within filterKeys var directLoad = fluid.filterKeys(element, ["settings", "options"]); var others = fluid.censorKeys(element, ["settings", "options"]); worklist.push({ path: path, - result: handler(directLoad), + result: handler(directLoad, solutionId), others: others }); return {}; // construct isomorphic skeleton of response @@ -304,8 +304,12 @@ gpii.settingsHandlers.invokeSetHandler = function (resolvedName, payload) { * that matches, or else a rejection if the GET payloads never match after the end of the nominated retry period */ gpii.settingsHandlers.invokeRetryingHandler = function (resolvedName, payload, retryOptions) { + // solution entry options overwrites any component options on retrying + var solutionIds = fluid.keys(payload); + var solutionRetryOptions = fluid.get(payload, [solutionIds[0], 0, "options", "retryOptions"]); + var mergedRetryOptions = fluid.extend(true, {}, retryOptions, solutionRetryOptions); var that = { - retryOptions: retryOptions, + retryOptions: mergedRetryOptions, retries: 1, payload: payload, resolvedName: resolvedName, diff --git a/gpii/node_modules/testing/src/Integration.js b/gpii/node_modules/testing/src/Integration.js index 3098d332b..b8c296a4d 100644 --- a/gpii/node_modules/testing/src/Integration.js +++ b/gpii/node_modules/testing/src/Integration.js @@ -39,6 +39,17 @@ gpii.test.integration.exec.exec = function (that, processSpec /*, expected */) { that.events.onExecExit.fire(true, processSpec); }; +gpii.test.integration.prepopulateSettingsStore = function (testCaseHolder, settings) { + fluid.extend(true, testCaseHolder.settingsStore, { orig: settings }); +}; + +gpii.test.integration.prepopulateSettingsSequence = fluid.freezeRecursive([ + { + func: "gpii.test.integration.prepopulateSettingsStore", + args: [ "{testCaseHolder}", "{testCaseHolder}.options.integrationPrepopulation" ] + } +]); + fluid.defaults("gpii.test.integration.testCaseHolder", { gradeNames: ["gpii.test.common.testCaseHolder"], // TODO: Namespace these distributions so they can be overridden @@ -206,7 +217,8 @@ fluid.defaults("gpii.test.integration.mockSettingsHandler", { }, setImpl: { funcName: "gpii.test.integration.mockSettingsHandler.setImpl", - args: ["{that}", "{arguments}.0"] + args: ["{that}", "{arguments}.0", "{arguments}.1"] + // set payload, solutionId }, get: { funcName: "gpii.test.integration.mockSettingsHandler.get", @@ -214,17 +226,18 @@ fluid.defaults("gpii.test.integration.mockSettingsHandler", { }, getImpl: { funcName: "gpii.test.integration.mockSettingsHandler.getImpl", - args: ["{that}", "{arguments}.0"] + args: ["{that}", "{arguments}.0", "{arguments}.1"] + // get payload, solutionId } } }); -gpii.test.integration.resolveHandlerKey = function (that, payload) { +gpii.test.integration.resolveHandlerKey = function (that, payload, solutionId) { var pathKey = that.options.optionsPathKey; if (typeof(pathKey) === "string") { return fluid.get(payload.options, pathKey); } else if (typeof(pathKey) === "function") { - return pathKey(payload.options); + return pathKey(payload.options, solutionId); } }; @@ -259,9 +272,9 @@ gpii.test.integration.mockSettingsHandler.returnAsyncResponse = function (value, } }; -gpii.test.integration.mockSettingsHandler.setImpl = function (that, payload) { +gpii.test.integration.mockSettingsHandler.setImpl = function (that, payload, solutionId) { var setSettings = function () { - var key = gpii.test.integration.resolveHandlerKey(that, payload); + var key = gpii.test.integration.resolveHandlerKey(that, payload, solutionId); var oldStore = fluid.copy(that.settingsStore[key]) || {}; var store = (that.settingsStore[key] = that.settingsStore[key] || {}); var applySettings = function () { @@ -283,8 +296,8 @@ gpii.test.integration.mockSettingsHandler.set = function (that, payload) { return gpii.settingsHandlers.invokeSettingsHandler(that.setImpl, payload); }; -gpii.test.integration.mockSettingsHandler.getImpl = function (that, payload) { - var key = gpii.test.integration.resolveHandlerKey(that, payload); +gpii.test.integration.mockSettingsHandler.getImpl = function (that, payload, solutionId) { + var key = gpii.test.integration.resolveHandlerKey(that, payload, solutionId); var store = that.settingsStore[key] || {}; var response = fluid.transform(payload.settings, function (value, key) { return store[key]; @@ -297,8 +310,11 @@ gpii.test.integration.mockSettingsHandler.get = function (that, payload) { return gpii.settingsHandlers.invokeSettingsHandler(that.getImpl, payload); }; -// The platform-specific registry of mock settings handlers +gpii.test.integration.flexibleHandlerKey = function (options, solutionId) { + return solutionId + ".flexibleHandler"; +}; +// The platform-specific registry of mock settings handlers gpii.test.integration.registrySettingsHandlerKey = function (options) { return options.hKey + "|" + options.path; }; @@ -360,6 +376,9 @@ fluid.defaults("gpii.test.integration.mockSettingsHandlerRegistry.universal", { "gpii.settingsHandlers.JSONSettingsHandler": { optionsPathKey: "filename" }, + "gpii.launchHandlers.flexibleHandler": { + optionsPathKey: gpii.test.integration.flexibleHandlerKey + }, "gpii.settingsHandlers.webSockets" : {} } }); diff --git a/gpii/node_modules/testing/src/Testing.js b/gpii/node_modules/testing/src/Testing.js index 3fdff025a..5c767c593 100644 --- a/gpii/node_modules/testing/src/Testing.js +++ b/gpii/node_modules/testing/src/Testing.js @@ -165,7 +165,8 @@ gpii.test.operateSettings = function (settingsHandlers, nameResolver, method) { gpii.test.snapshotSettings = function (settingsHandlers, settingsStore, nameResolver, onComplete) { var origPromise = gpii.test.getSettings(settingsHandlers, nameResolver); origPromise.then(function (origSettings) { - settingsStore.orig = origSettings; + // any settings already defined in settingsStore.org overwrites the ones read by snapshotter + settingsStore.orig = fluid.extend(true, origSettings, settingsStore.orig); onComplete(); }); }; @@ -391,8 +392,11 @@ gpii.test.push = function (array, elements) { /** Build a test fixture for integration/acceptance tests operating the stereotypical workflow - * snapshot, login, expectConfigured, logout and expectRestored */ - gpii.test.buildSingleTestFixture = function (testDef, rootGrades) { + var isIntegrationTest = fluid.find(rootGrades, function (val) { + return val.startsWith("gpii.test.integration") ? true : undefined; + }); + var processes = testDef.processes || []; testDef.gradeNames = fluid.makeArray(testDef.gradeNames).concat(fluid.makeArray(rootGrades)); @@ -402,6 +406,11 @@ gpii.test.buildSingleTestFixture = function (testDef, rootGrades) { gpii.test.unshift(testDef.sequence, gpii.test.loginSequence); gpii.test.unshift(testDef.sequence, gpii.test.initialSequence); + // if integration test, prepopulate 'settings' for process reporter + if (isIntegrationTest) { + gpii.test.unshift(testDef.sequence, gpii.test.integration.prepopulateSettingsSequence); + } + // For each process, run the command, then check that we get the expected output testDef.sequence = testDef.sequence.concat(gpii.test.createProcessChecks(processes, "expectConfigured")); diff --git a/testData/deviceReporter/acceptanceTests/linux_builtIn.json b/testData/deviceReporter/acceptanceTests/linux_builtIn.json index e0fbf462b..23b554fb1 100644 --- a/testData/deviceReporter/acceptanceTests/linux_builtIn.json +++ b/testData/deviceReporter/acceptanceTests/linux_builtIn.json @@ -10,5 +10,8 @@ }, { "id": "org.gnome.desktop.a11y.keyboard" + }, + { + "id": "org.gnome.desktop.a11y.applications.onscreen-keyboard" } ] diff --git a/testData/preferences/acceptanceTests/os_common.json b/testData/preferences/acceptanceTests/os_common.json index f2051074c..fc3f21153 100644 --- a/testData/preferences/acceptanceTests/os_common.json +++ b/testData/preferences/acceptanceTests/os_common.json @@ -17,7 +17,8 @@ "http://registry.gpii.net/common/cursorSpeed": 1, "http://registry.gpii.net/common/stickyKeys": true, "http://registry.gpii.net/common/debounceEnable": true, - "http://registry.gpii.net/common/debounceInterval": 1 + "http://registry.gpii.net/common/debounceInterval": 1, + "http://registry.gpii.net/common/onScreenKeyboardEnabled": true } } } diff --git a/testData/solutions/linux.json5 b/testData/solutions/linux.json5 index 7f3a0976e..3da5c3dfc 100644 --- a/testData/solutions/linux.json5 +++ b/testData/solutions/linux.json5 @@ -75,6 +75,31 @@ } ] } + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": { + "type": "gpii.launch.exec", + "command": "gsettings set org.gnome.desktop.a11y.applications screen-magnifier-enabled true" + }, + "stop": { + "type": "gpii.launch.exec", + "command": "gsettings set org.gnome.desktop.a11y.applications screen-magnifier-enabled false" + }, + "isRunning": [ + { + "type": "gpii.processReporter.find", + "command": "gnome-shell" + }, + { + "type": "gpii.processReporter.checkSetting", + "schema": "org.gnome.desktop.a11y.applications", + "setting": "screen-magnifier-enabled", + "value": true + } + ] + } } }, "update": [ @@ -87,34 +112,16 @@ "settings.configuration" ], "start": [ - { - "type": "gpii.launch.exec", - "command": "gsettings set org.gnome.desktop.a11y.applications screen-magnifier-enabled true" - } + "settings.launcher" ], "stop": [ - { - "type": "gpii.launch.exec", - "command": "gsettings set org.gnome.desktop.a11y.applications screen-magnifier-enabled false" - } + "settings.launcher" ], "isInstalled": [ { "type": "gpii.packageKit.find", "name": "gnome-shell" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "gnome-shell" - }, - { - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-magnifier-enabled", - "value": true - } ] }, @@ -231,12 +238,6 @@ "type": "gpii.packageKit.find", "name": "gsettings-desktop-schemas" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "dunno" - } ] }, @@ -273,12 +274,6 @@ "type": "gpii.packageKit.find", "name": "nautilus" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "nautilus" - } ] }, @@ -296,31 +291,36 @@ "capabilities": [ "http://registry\\.gpii\\.net/common/onScreenKeyboardEnabled" ] + }, + "launching": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": { + "type": "gpii.launch.exec", + "command": "gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled true" + }, + "stop": { + "type": "gpii.launch.exec", + "command": "gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled false" + }, + "isRunning": { + "type": "gpii.processReporter.find", + "command": "caribou" + } // TODO KASPER: add gsettings check as well + } } }, "start": [ - { - "type": "gpii.launch.exec", - "command": "gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled true" - } + "settings.launching" ], "stop": [ - { - "type": "gpii.launch.exec", - "command": "gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled false" - } + "settings.launching" ], "isInstalled": [ { "type": "gpii.packageKit.find", "name": "gnome-shell" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "caribou" - } ] }, @@ -393,12 +393,6 @@ "type": "gpii.packageKit.find", "name": "gsettings-desktop-schemas" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "gnome-settings-daemon" - } ] }, @@ -1080,6 +1074,23 @@ } ] } + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": { + "type": "gpii.launch.exec", + "command": "gsettings set org.gnome.desktop.a11y.applications screen-reader-enabled true" + }, + "stop": { + "type": "gpii.launch.exec", + "command": "gsettings set org.gnome.desktop.a11y.applications screen-reader-enabled false" + }, + "isRunning": { + "type": "gpii.processReporter.find", + "command": "orca" + } + } } }, "configure": [ @@ -1089,28 +1100,16 @@ "settings.configuration" ], "start": [ - { - "type": "gpii.launch.exec", - "command": "gsettings set org.gnome.desktop.a11y.applications screen-reader-enabled true" - } + "settings.launcher" ], "stop": [ - { - "type": "gpii.launch.exec", - "command": "gsettings set org.gnome.desktop.a11y.applications screen-reader-enabled false" - } + "settings.launcher" ], "isInstalled": [ { "type": "gpii.packageKit.find", "name": "orca" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "orca" - } ] }, @@ -1157,12 +1156,6 @@ "type": "gpii.packageKit.find", "name": "alsa-lib" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "alsactl" - } ] }, @@ -1209,12 +1202,6 @@ "type": "gpii.packageKit.find", "name": "google-chrome-unstable" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "chrome" - } ] }, @@ -1261,12 +1248,6 @@ "type": "gpii.packageKit.find", "name": "google-chrome-unstable" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "chrome" - } ] }, @@ -1313,12 +1294,6 @@ "type": "gpii.packageKit.find", "name": "google-chrome-unstable" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "chrome" - } ] }, @@ -1339,14 +1314,8 @@ "configure": [ "settings.configuration" ], - "stop": [ + "restore": [ "settings.configuration" - ], - "isInstalled": [ - { - "type": "gpii.packageKit.find", - "name": "libXrandr" - } ] }, From 9df79311059741464f4c1e0c79324f87948c776a Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 1 Mar 2017 09:21:27 +0100 Subject: [PATCH 02/26] GPII-442: Using dynamic device reporter in most tests --- testData/solutions/linux.json5 | 110 +++-- testData/solutions/win32.json5 | 433 +++++++++++------- .../platform/linux/linux-builtIn-testSpec.js | 123 ++++- .../linux-dynamicDeviceReporter-testSpec.js | 75 +++ .../linux-dynamicDeviceReporter-testSpec.txt | 2 +- tests/platform/linux/linux-orca-testSpec.js | 81 +++- .../windows/windows-builtIn-testSpec.js | 147 +++++- .../windows-dynamicDeviceReporter-testSpec.js | 49 +- .../platform/windows/windows-jaws-testSpec.js | 100 +++- .../windows/windows-maavis-testSpec.js | 50 +- .../platform/windows/windows-nvda-testSpec.js | 75 ++- .../windows/windows-readWrite-testSpec.js | 50 +- 12 files changed, 1052 insertions(+), 243 deletions(-) diff --git a/testData/solutions/linux.json5 b/testData/solutions/linux.json5 index 3da5c3dfc..3719d3d5b 100644 --- a/testData/solutions/linux.json5 +++ b/testData/solutions/linux.json5 @@ -303,10 +303,15 @@ "type": "gpii.launch.exec", "command": "gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled false" }, - "isRunning": { - "type": "gpii.processReporter.find", - "command": "caribou" - } // TODO KASPER: add gsettings check as well + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "caribou", + }, { + "type": "gpii.processReporter.checkSetting", + "schema": "org.gnome.desktop.a11y.applications", + "setting": "screen-keyboard-enabled", + "value": true + }] } } }, @@ -1078,6 +1083,11 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { + "verifySettings": true, + "retryOptions": { + "rewriteEvery": 0, + retryInterval: 200 + }, "start": { "type": "gpii.launch.exec", "command": "gsettings set org.gnome.desktop.a11y.applications screen-reader-enabled true" @@ -1086,10 +1096,12 @@ "type": "gpii.launch.exec", "command": "gsettings set org.gnome.desktop.a11y.applications screen-reader-enabled false" }, - "isRunning": { - "type": "gpii.processReporter.find", - "command": "orca" - } + "isRunning": [{ // GPII-2306: Add check for Orca process + "type": "gpii.processReporter.checkSetting", + "schema": "org.gnome.desktop.a11y.applications", + "setting": "screen-reader-enabled", + "value": true + }] } } }, @@ -1175,19 +1187,29 @@ "capabilities": [ "http://registry\\.gpii\\.net/common/simplification" ] + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": { + "type": "gpii.launch.exec", + "command": "google-chrome http://easy123.org/user/${{userToken}}" + }, + "stop": { + "type": "gpii.launch.exec", + "command": "pkill -2 chrome" + }, + "isRunning": [{ + "type": "gpii.processReporter.neverRunning" + }] + } } }, "start": [ - { - "type": "gpii.launch.exec", - "command": "google-chrome http://easy123.org/user/${{userToken}}" - } + "settings.launcher" ], "stop": [ - { - "type": "gpii.launch.exec", - "command": "pkill -2 chrome" - } + "settings.launcher" ], "isInstalled": [ { @@ -1221,19 +1243,29 @@ "capabilities": [ "http://registry\\.gpii\\.net/common/simplification" ] + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": { + "type": "gpii.launch.exec", + "command": "google-chrome http://easy123.org/sudan" + }, + "stop": { + "type": "gpii.launch.exec", + "command": "pkill -2 chrome" + }, + "isRunning": [{ + "type": "gpii.processReporter.neverRunning" + }] + } } }, "start": [ - { - "type": "gpii.launch.exec", - "command": "google-chrome http://easy123.org/sudan" - } + "settings.launcher" ], "stop": [ - { - "type": "gpii.launch.exec", - "command": "pkill -2 chrome" - } + "settings.launcher" ], "isInstalled": [ { @@ -1267,19 +1299,29 @@ "capabilities": [ "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" ] + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": { + "type": "gpii.launch.exec", + "command": "google-chrome http://webanywhere.cs.washington.edu/beta/?starting_url=http%3A%2F%2Fcloud4all.info" + }, + "stop": { + "type": "gpii.launch.exec", + "command": "pkill -2 chrome" + }, + "isRunning": [{ + "type": "gpii.processReporter.neverRunning" + }] + } } }, "start": [ - { - "type": "gpii.launch.exec", - "command": "google-chrome http://webanywhere.cs.washington.edu/beta/?starting_url=http%3A%2F%2Fcloud4all.info" - } + "settings.launcher" ], "stop": [ - { - "type": "gpii.launch.exec", - "command": "pkill -2 chrome" - } + "settings.launcher" ], "isInstalled": [ { @@ -1390,10 +1432,6 @@ "restore": [ "settings.chromeconf" ], - "start": [ - ], - "stop": [ - ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" diff --git a/testData/solutions/win32.json5 b/testData/solutions/win32.json5 index 767e4606f..a6b4365ce 100644 --- a/testData/solutions/win32.json5 +++ b/testData/solutions/win32.json5 @@ -559,6 +559,29 @@ } } } + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "isRunning": [ + { + "type": "gpii.processReporter.find", + "command": "jaws" + } + ], + "start": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\JAWS17.exe\\}\"" + } + ], + "stop": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "jfw.exe" + } + ] + } } }, "configure": [ @@ -570,16 +593,10 @@ "settings.configuration2" ], "start": [ - { - "type": "gpii.launch.exec", - "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\JAWS17.exe\\}\"" - } + "settings.launcher" ], "stop": [ - { - "type": "gpii.windows.closeProcessByName", - "filename": "jfw.exe" - } + "settings.launcher" ], "isInstalled": [ { @@ -589,12 +606,6 @@ "subPath": "", "dataType": "REG_SZ" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "jaws" - } ] }, @@ -622,6 +633,29 @@ "capabilitiesTransformations": { "ApplicationSettings": "ApplicationSettings" } + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_CURRENT_USER\\Software\\Texthelp\\Read&Write11\\InstallPath}\\ReadAndWrite.exe\"" + } + ], + "stop": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "ReadAndWrite.exe" + } + ], + "isRunning": [ + { + "type": "gpii.processReporter.find", + "command": "readandwrite" + } + ] + } } }, "configure": [ @@ -631,16 +665,10 @@ "settings.configuration" ], "start": [ - { - "type": "gpii.launch.exec", - "command": "\"${{registry}.HKEY_CURRENT_USER\\Software\\Texthelp\\Read&Write11\\InstallPath}\\ReadAndWrite.exe\"" - } + "settings.launcher" ], "stop": [ - { - "type": "gpii.windows.closeProcessByName", - "filename": "ReadAndWrite.exe" - } + "settings.launcher" ], "isInstalled": [ { @@ -650,12 +678,6 @@ "subPath": "InstallPath", "dataType": "REG_SZ" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "readandwrite" - } ] }, @@ -766,38 +788,49 @@ } ] } + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": [ + { + "type": "gpii.windows.enableRegisteredAT", + "name": "magnifierpane", + "enable": true + } + ], + "stop": [ + { + "type": "gpii.windows.enableRegisteredAT", + "name": "magnifierpane", + "enable": false + } + ], + "isRunning": [ + { + "type": "gpii.processReporter.find", + "command": "Magnify" + } + ] + } } }, + "start": [ + "settings.launcher" + ], + "stop": [ + "settings.launcher" + ], "configure": [ "settings.configure" ], "restore": [ "settings.configure" ], - "start": [ - { - "type": "gpii.windows.enableRegisteredAT", - "name": "magnifierpane", - "enable": true - } - ], - "stop": [ - { - "type": "gpii.windows.enableRegisteredAT", - "name": "magnifierpane", - "enable": false - } - ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "Magnify" - } ] }, @@ -829,38 +862,49 @@ "literalValue": 0 } } + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": [ + { + "type": "gpii.windows.enableRegisteredAT", + "name": "osk", + "enable": true + } + ], + "stop": [ + { + "type": "gpii.windows.enableRegisteredAT", + "name": "osk", + "enable": false + } + ], + "isRunning": [ + { + "type": "gpii.processReporter.find", + "command": "osk" + } + ] + } } }, + "start": [ + "settings.launcher" + ], + "stop": [ + "settings.launcher" + ], "configure": [ "settings.configure" ], "restore": [ "settings.configure" ], - "start": [ - { - "type": "gpii.windows.enableRegisteredAT", - "name": "osk", - "enable": true - } - ], - "stop": [ - { - "type": "gpii.windows.enableRegisteredAT", - "name": "osk", - "enable": false - } - ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "osk" - } ] }, @@ -1239,29 +1283,46 @@ } ] } + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "isRunning": [ + { + "type": "gpii.processReporter.find", + "command": "nvda" + } + ], + "start": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\nvda.exe\\}\"" + } + ], + "stop": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "nvda_service.exe" + },{ + "type": "gpii.windows.closeProcessByName", + "filename": "nvda.exe" + } + ], + } } }, + "start": [ + "settings.launcher" + ], + "stop": [ + "settings.launcher" + ], "configure": [ "settings.configs" ], "restore": [ "settings.configs" ], - "start": [ - { - "type": "gpii.launch.exec", - "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\nvda.exe\\}\"" - } - ], - "stop": [ - { - "type": "gpii.windows.closeProcessByName", - "filename": "nvda_service.exe" - },{ - "type": "gpii.windows.closeProcessByName", - "filename": "nvda.exe" - } - ], "isInstalled": [ { "type": "gpii.deviceReporter.registryKeyExists", @@ -1270,12 +1331,6 @@ "subPath": "", "dataType": "REG_SZ" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "nvda" - } ] }, @@ -1296,30 +1351,34 @@ "capabilities": [ "http://registry\\.gpii\\.net/common/simplification" ] + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\firefox.exe\\}\" http://easy123.org/user/${{userToken}}" + }, + "stop": { + "type": "gpii.windows.closeProcessByName", + "filename": "firefox.exe" + }, + "isRunning": [{ + "type": "gpii.processReporter.neverRunning" + }] + } } }, "start": [ - { - "type": "gpii.launch.exec", - "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\firefox.exe\\}\" http://easy123.org/user/${{userToken}}" - } + "settings.launcher" ], "stop": [ - { - "type": "gpii.windows.closeProcessByName", - "filename": "firefox.exe" - } + "settings.launcher" ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "firefox" - } ] }, @@ -1339,30 +1398,34 @@ "capabilities": [ "http://registry\\.gpii\\.net/common/pictorialSimplification" ] + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\firefox.exe\\}\" http://easy123.org/sudan" + }, + "stop": { + "type": "gpii.windows.closeProcessByName", + "filename": "firefox.exe" + }, + "isRunning": [{ + "type": "gpii.processReporter.neverRunning" + }] + } } }, "start": [ - { - "type": "gpii.launch.exec", - "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\firefox.exe\\}\" http://easy123.org/sudan" - } + "settings.launcher" ], "stop": [ - { - "type": "gpii.windows.closeProcessByName", - "filename": "firefox.exe" - } + "settings.launcher" ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "firefox" - } ] }, @@ -1382,30 +1445,34 @@ "capabilities": [ "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" ] + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\firefox.exe\\}\" \"http://webanywhere.cs.washington.edu/beta/?starting_url=http%3A%2F%2Fcloud4all.info\"" + }, + "stop": { + "type": "gpii.windows.closeProcessByName", + "filename": "firefox.exe" + }, + "isRunning": [{ + "type": "gpii.processReporter.neverRunning" + }] + } } }, - "start": [ - { - "type": "gpii.launch.exec", - "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\firefox.exe\\}\" \"http://webanywhere.cs.washington.edu/beta/?starting_url=http%3A%2F%2Fcloud4all.info\"" - } + "start": [ + "settings.launcher" ], "stop": [ - { - "type": "gpii.windows.closeProcessByName", - "filename": "firefox.exe" - } + "settings.launcher" ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "firefox" - } ] }, @@ -1474,6 +1541,29 @@ ] }, "inverseCapabilitiesTransformations": {} + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": [ + { + "type": "gpii.launch.exec", + "command": "${{environment}.ComSpec} /c \"cd ${{environment}.MAAVIS_HOME} && MaavisPortable.cmd\"" + } + ], + "stop": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "firefox.exe" + } + ], + "isRunning": [ + { + "type": "gpii.processReporter.find", + "command": "MaavisPortable" + } + ] + } } }, "configure": [ @@ -1483,27 +1573,15 @@ "settings.configuration" ], "start": [ - { - "type": "gpii.launch.exec", - "command": "${{environment}.ComSpec} /c \"cd ${{environment}.MAAVIS_HOME} && MaavisPortable.cmd\"" - } + "settings.launcher" ], "stop": [ - { - "type": "gpii.windows.closeProcessByName", - "filename": "firefox.exe" - } + "settings.launcher" ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "MaavisPortable" - } ] }, @@ -2284,8 +2362,23 @@ } ] } + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": [{ + "type": "gpii.windows.spiSettingsHandler.updateCursors" + }], + "isRunning": [{ + "type": "gpii.processReporter.neverRunning" + }] + } } }, + "start": [ + "settings.launcher" + ], + "stop": [], "configure": [ "settings.configure" ], @@ -2295,13 +2388,6 @@ "type": "gpii.windows.spiSettingsHandler.updateCursors" } ], - "start": [ - { - "type": "gpii.windows.spiSettingsHandler.updateCursors" - } - ], - "stop": [ - ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" @@ -2360,6 +2446,29 @@ } }, "inverseCapabilitiesTransformations": {} + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": [ + { + "type": "gpii.launch.exec", + "command": "C:\\Sociable\\Cloud4All.exe" + } + ], + "stop": [ + { + "type": "gpii.launch.exec", + "command": "C:\\Sociable\\Cloud4All.exe -stop" + } + ], + "isRunning": [ + { + "type": "gpii.processReporter.find", + "command": "Cloud4Allcd " + } + ] + } } }, "configure": [ @@ -2369,22 +2478,10 @@ "settings.configuration" ], "start": [ - { - "type": "gpii.launch.exec", - "command": "C:\\Sociable\\Cloud4All.exe" - } + "settings.launcher" ], "stop": [ - { - "type": "gpii.launch.exec", - "command": "C:\\Sociable\\Cloud4All.exe -stop" - } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "Cloud4Allcd " - } + "settings.launcher" ] }, @@ -2459,8 +2556,6 @@ "restore": [ "settings.chromeconf" ], - "start": [], - "stop": [], "isInstalled": [] // always reported as not installed. Should be changed once GPII-1998 is fixed } } diff --git a/tests/platform/linux/linux-builtIn-testSpec.js b/tests/platform/linux/linux-builtIn-testSpec.js index 680e143a7..ad949d1e8 100644 --- a/tests/platform/linux/linux-builtIn-testSpec.js +++ b/tests/platform/linux/linux-builtIn-testSpec.js @@ -26,9 +26,23 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ { name: "Testing os_common using default matchmaker", userToken: "os_common", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "running": false + } + }], + "org.gnome.desktop.a11y.applications.onscreen-keyboard": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.gsettings": { - "some.app.id": [{ + "org.gnome.desktop.a11y.magnifier": [{ "settings": { "mag-factor": 1.5, "screen-position": "full-screen", @@ -39,7 +53,8 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ "options": { "schema": "org.gnome.desktop.a11y.magnifier" } - }, { + }], + "org.gnome.desktop.interface": [{ "settings": { "gtk-theme": "HighContrast", "icon-theme": "HighContrast", @@ -50,6 +65,44 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ "schema": "org.gnome.desktop.interface" } }] + }, + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.desktop.a11y.applications.onscreen-keyboard": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "caribou" + }, { + "type": "gpii.processReporter.checkSetting", + "schema": "org.gnome.desktop.a11y.applications", + "setting": "screen-keyboard-enabled", + "value": true + }] + } + }], + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "gnome-shell" + }, + { + "type": "gpii.processReporter.checkSetting", + "schema": "org.gnome.desktop.a11y.applications", + "setting": "screen-magnifier-enabled", + "value": true + }] + } + }] + } }, processes: [ @@ -81,9 +134,18 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ { name: "Testing os_gnome using default matchmaker", userToken: "os_gnome", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.gsettings": { - "some.app.id": [{ + "org.gnome.desktop.a11y.magnifier": [{ "settings": { "mag-factor": 1.5, "screen-position": "full-screen" @@ -91,7 +153,8 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ "options": { "schema": "org.gnome.desktop.a11y.magnifier" } - }, { + }], + "org.gnome.desktop.interface": [{ "settings": { "text-scaling-factor": 0.75, "cursor-size": 90 @@ -102,11 +165,31 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ }] }, "gpii.alsa": { - "some.app.id": [{ + "org.alsa-project": [{ "settings": { "masterVolume": 50 } }] + }, + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "gnome-shell" + }, + { + "type": "gpii.processReporter.checkSetting", + "schema": "org.gnome.desktop.a11y.applications", + "setting": "screen-magnifier-enabled", + "value": true + }] + } + }] } }, processes: [ @@ -120,6 +203,15 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ { name: "Testing os_win7 using default matchmaker", userToken: "os_win7", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.gsettings": { "some.app.id": [{ @@ -143,7 +235,28 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ "schema": "org.gnome.desktop.interface" } }] + }, + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "gnome-shell" + }, + { + "type": "gpii.processReporter.checkSetting", + "schema": "org.gnome.desktop.a11y.applications", + "setting": "screen-magnifier-enabled", + "value": true + }] + } + }] } + }, processes: [ { diff --git a/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js b/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js index 3e44192de..34afb4563 100644 --- a/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js +++ b/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js @@ -26,6 +26,15 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ name: "Testing screenreader_common using Flat matchmaker", gradeNames: "gpii.test.integration.deviceReporterAware.linux", userToken: "screenreader_common", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.orca": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.orca": { "data": [ @@ -50,6 +59,22 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.orca": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.checkSetting", + "schema": "org.gnome.desktop.a11y.applications", + "setting": "screen-reader-enabled", + "value": true + }] + } + }] } }, processes: [ @@ -69,6 +94,15 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ name: "Testing screenreader_orca using Flat matchmaker", gradeNames: "gpii.test.integration.deviceReporterAware.linux", userToken: "screenreader_orca", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.orca": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.orca": { "some.app.id": [ @@ -92,6 +126,22 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.orca": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.checkSetting", + "schema": "org.gnome.desktop.a11y.applications", + "setting": "screen-reader-enabled", + "value": true + }] + } + }] } }, processes: [ @@ -111,6 +161,15 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ name: "Testing screenreader_nvda using Flat matchmaker", gradeNames: "gpii.test.integration.deviceReporterAware.linux", userToken: "screenreader_nvda", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.orca": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.orca": { "some.app.id": [ @@ -133,6 +192,22 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.orca": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.checkSetting", + "schema": "org.gnome.desktop.a11y.applications", + "setting": "screen-reader-enabled", + "value": true + }] + } + }] } }, processes: [ diff --git a/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.txt b/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.txt index 979e68516..6ea62ad4e 100644 --- a/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.txt +++ b/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.txt @@ -3,4 +3,4 @@ linux-dynamicDeviceReporter-testSpec.js Descriptions: This will run the acceptance tests with dynamic device reporting. -It uses 1 NP set: screenreader_common (but more will be added) +It uses 3 NP sets: screenreader_common, screenreader_orca and screenreader_nvda diff --git a/tests/platform/linux/linux-orca-testSpec.js b/tests/platform/linux/linux-orca-testSpec.js index 21707a2c1..ad46b289f 100644 --- a/tests/platform/linux/linux-orca-testSpec.js +++ b/tests/platform/linux/linux-orca-testSpec.js @@ -26,9 +26,18 @@ gpii.tests.linux.orca.testDefs = [ { name: "Testing screenreader_common using Flat matchmaker", userToken: "screenreader_common", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.orca": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.orca": { - "some.app.id": [ + "org.gnome.orca": [ { "settings": { "sayAllStyle": 1, @@ -50,6 +59,22 @@ gpii.tests.linux.orca.testDefs = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.orca": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.checkSetting", + "schema": "org.gnome.desktop.a11y.applications", + "setting": "screen-reader-enabled", + "value": true + }] + } + }] } }, processes: [ @@ -63,9 +88,18 @@ gpii.tests.linux.orca.testDefs = [ { name: "Testing screenreader_orca using Flat matchmaker", userToken: "screenreader_orca", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.orca": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.orca": { - "some.app.id": [ + "org.gnome.orca": [ { "settings": { "sayAllStyle": 1, @@ -86,6 +120,22 @@ gpii.tests.linux.orca.testDefs = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.orca": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.checkSetting", + "schema": "org.gnome.desktop.a11y.applications", + "setting": "screen-reader-enabled", + "value": true + }] + } + }] } }, processes: [ @@ -99,9 +149,18 @@ gpii.tests.linux.orca.testDefs = [ { name: "Testing screenreader_nvda using Flat matchmaker", userToken: "screenreader_nvda", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.orca": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.orca": { - "some.app.id": [ + "org.gnome.orca": [ { "settings": { "sayAllStyle": 1, @@ -121,6 +180,22 @@ gpii.tests.linux.orca.testDefs = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.orca": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.checkSetting", + "schema": "org.gnome.desktop.a11y.applications", + "setting": "screen-reader-enabled", + "value": true + }] + } + }] } }, processes: [ diff --git a/tests/platform/windows/windows-builtIn-testSpec.js b/tests/platform/windows/windows-builtIn-testSpec.js index 749ef6677..90466fe9c 100644 --- a/tests/platform/windows/windows-builtIn-testSpec.js +++ b/tests/platform/windows/windows-builtIn-testSpec.js @@ -26,9 +26,18 @@ gpii.tests.windows.builtIn = [ { name: "Testing os_win7 using default matchmaker", userToken: "os_win7", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "com.microsoft.windows.magnifier": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.windows.spiSettingsHandler": { - "some.app.id": [ + "com.microsoft.windows.mouseTrailing": [ { "settings": { "MouseTrails": { @@ -47,7 +56,10 @@ gpii.tests.windows.builtIn = [ "type": "BOOL" } } - }, { + } + ], + "com.microsoft.windows.mouseKeys": [ + { "settings": { "MouseKeysOn": { "path": "pvParam.dwFlags.MKF_MOUSEKEYSON", @@ -71,7 +83,10 @@ gpii.tests.windows.builtIn = [ "name": "MOUSEKEYS" } } - }, { + } + ], + "com.microsoft.windows.stickyKeys": [ + { "settings": { "StickyKeysOn": { "path": "pvParam.dwFlags.SKF_STICKYKEYSON", @@ -87,7 +102,10 @@ gpii.tests.windows.builtIn = [ "name": "STICKYKEYS" } } - }, { + } + ], + "com.microsoft.windows.filterKeys": [ + { "settings": { "FilterKeysEnable": { "path": "pvParam.dwFlags.FKF_FILTERKEYSON", @@ -107,7 +125,10 @@ gpii.tests.windows.builtIn = [ "name": "FILTERKEYS" } } - }, { // high contrast settings + } + ], + "com.microsoft.windows.highContrast": [ + { // high contrast settings "settings": { "HighContrastOn": { "path": "pvParam.dwFlags.HCF_HIGHCONTRASTON", @@ -127,7 +148,7 @@ gpii.tests.windows.builtIn = [ ] }, "gpii.windows.registrySettingsHandler": { - "some.app.id": [{ // magnifier stuff + "com.microsoft.windows.magnifier": [{ // magnifier stuff "settings": { "Invert": 1, "Magnification": 150, @@ -148,7 +169,8 @@ gpii.tests.windows.builtIn = [ "MagnificationMode": "REG_DWORD" } } - }, { // cursor size stuff + }], + "com.microsoft.windows.cursors": [{ // cursor size stuff "settings": { "No": "%SystemRoot%\\cursors\\aero_unavail_xl.cur", "Hand": "%SystemRoot%\\cursors\\aero_link_xl.cur", @@ -186,7 +208,7 @@ gpii.tests.windows.builtIn = [ }] }, "gpii.windows.displaySettingsHandler": { - "some.app.id": [{ + "com.microsoft.windows.screenResolution": [{ "settings": { "screen-resolution": { "width": 800, @@ -194,6 +216,20 @@ gpii.tests.windows.builtIn = [ } } }] + }, + "gpii.launchHandlers.flexibleHandler": { + "com.microsoft.windows.magnifier": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "Magnify" + }] + } + }] } }, processes: [ @@ -206,9 +242,23 @@ gpii.tests.windows.builtIn = [ }, { name: "Testing os_common using default matchmaker", userToken: "os_common", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "com.microsoft.windows.magnifier": [{ + "settings": { + "running": false + } + }], + "com.microsoft.windows.onscreenKeyboard": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.windows.spiSettingsHandler": { - "some.app.id": [ + "com.microsoft.windows.mouseTrailing": [ { "settings": { "MouseTrails": { @@ -227,7 +277,10 @@ gpii.tests.windows.builtIn = [ "type": "BOOL" } } - }, { + } + ], + "com.microsoft.windows.mouseKeys": [ + { "settings": { "MouseKeysOn": { "path": "pvParam.dwFlags.MKF_MOUSEKEYSON", @@ -243,7 +296,10 @@ gpii.tests.windows.builtIn = [ "name": "MOUSEKEYS" } } - }, { + } + ], + "com.microsoft.windows.stickyKeys": [ + { "settings": { "StickyKeysOn": { "path": "pvParam.dwFlags.SKF_STICKYKEYSON", @@ -259,7 +315,10 @@ gpii.tests.windows.builtIn = [ "name": "STICKYKEYS" } } - }, { + } + ], + "com.microsoft.windows.filterKeys": [ + { "settings": { "FilterKeysEnable": { "path": "pvParam.dwFlags.FKF_FILTERKEYSON", @@ -279,7 +338,10 @@ gpii.tests.windows.builtIn = [ "name": "FILTERKEYS" } } - }, { // high contrast settings + } + ], + "com.microsoft.windows.highContrast": [ + { // high contrast settings "settings": { "HighContrastOn": { "path": "pvParam.dwFlags.HCF_HIGHCONTRASTON", @@ -299,7 +361,7 @@ gpii.tests.windows.builtIn = [ ] }, "gpii.windows.registrySettingsHandler": { - "some.app.id": [{ // magnifier stuff + "com.microsoft.windows.magnifier": [{ // magnifier stuff "settings": { "Invert": 1, "Magnification": 150, @@ -320,7 +382,8 @@ gpii.tests.windows.builtIn = [ "MagnificationMode": "REG_DWORD" } } - }, { // cursor size stuff + }], + "com.microsoft.windows.cursors": [{ // cursor size stuff "settings": { "No": "%SystemRoot%\\cursors\\aero_unavail_xl.cur", "Hand": "%SystemRoot%\\cursors\\aero_link_xl.cur", @@ -356,6 +419,32 @@ gpii.tests.windows.builtIn = [ } } }] + }, + "gpii.launchHandlers.flexibleHandler": { + "com.microsoft.windows.magnifier": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "Magnify" + }] + } + }], + "com.microsoft.windows.onscreenKeyboard": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "osk" + }] + } + }] } }, processes: [ @@ -368,9 +457,18 @@ gpii.tests.windows.builtIn = [ }, { name: "Testing os_gnome using default matchmaker", userToken: "os_gnome", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "com.microsoft.windows.magnifier": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.windows.registrySettingsHandler": { - "some.app.id": [{ // magnifier stuff + "com.microsoft.windows.magnifier": [{ // magnifier stuff "settings": { "Magnification": 150, "MagnificationMode": 2 @@ -387,7 +485,8 @@ gpii.tests.windows.builtIn = [ "MagnificationMode": "REG_DWORD" } } - }, { // cursor size stuff + }], + "com.microsoft.windows.cursors": [{ // cursor size stuff "settings": { "No": "%SystemRoot%\\cursors\\aero_unavail_xl.cur", "Hand": "%SystemRoot%\\cursors\\aero_link_xl.cur", @@ -423,6 +522,20 @@ gpii.tests.windows.builtIn = [ } } }] + }, + "gpii.launchHandlers.flexibleHandler": { + "com.microsoft.windows.magnifier": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "Magnify" + }] + } + }] } }, processes: [ diff --git a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js index 87f37784d..3cb425457 100644 --- a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js +++ b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js @@ -24,6 +24,15 @@ gpii.tests.deviceReporterAware.windows = [ { name: "Testing screenreader_nvda using Flat matchmaker", userToken: "screenreader_nvda", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "org.nvda-project": [{ + "settings": { + "running": false + } + }] + } + }, gradeNames: "gpii.test.integration.deviceReporterAware.windows", settingsHandlers: { "gpii.settingsHandlers.INISettingsHandler": { @@ -53,6 +62,20 @@ gpii.tests.deviceReporterAware.windows = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "org.nvda-project": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "nvda" + }] + } + }] } }, processes: [ @@ -76,7 +99,31 @@ gpii.tests.deviceReporterAware.windows = [ name: "Testing readwritegold_application1 using Flat matchmaker", userToken: "readwritegold_application1", gradeNames: "gpii.test.integration.deviceReporterAware.windows", - settingsHandlers: {}, + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "com.texthelp.readWriteGold": [{ + "settings": { + "running": false + } + }] + } + }, + settingsHandlers: { + "gpii.launchHandlers.flexibleHandler": { + "com.texthelp.readWriteGold": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "readandwrite" + }] + } + }] + } + }, processes: [ { "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq ReadAndWrite.exe\" | find /I \"ReadAndWrite.exe\" /C", diff --git a/tests/platform/windows/windows-jaws-testSpec.js b/tests/platform/windows/windows-jaws-testSpec.js index d0ec3b314..73516fc86 100644 --- a/tests/platform/windows/windows-jaws-testSpec.js +++ b/tests/platform/windows/windows-jaws-testSpec.js @@ -26,9 +26,18 @@ gpii.tests.windows.jaws = [ { name: "Testing NP set \"jaws_application\" using Flat matchmaker", userToken: "jaws_application", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "com.freedomscientific.jaws": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.settingsHandlers.INISettingsHandler": { - "some.app.id": [ + "com.freedomscientific.jaws": [ { "settings": { "Voice Profiles.ActiveVoiceProfileName" : "GPII", @@ -82,6 +91,20 @@ gpii.tests.windows.jaws = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "com.freedomscientific.jaws": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "jaws" + }] + } + }] } }, processes: [ @@ -96,9 +119,18 @@ gpii.tests.windows.jaws = [ { name: "Testing NP set \"jaws_common\" using Flat matchmaker", userToken: "jaws_common", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "com.freedomscientific.jaws": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.settingsHandlers.INISettingsHandler": { - "some.app.id": [ + "com.freedomscientific.jaws": [ { "settings": { "Options.PrimarySynthesizer": "eloq", @@ -152,6 +184,20 @@ gpii.tests.windows.jaws = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "com.freedomscientific.jaws": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "jaws" + }] + } + }] } }, processes: [ @@ -166,9 +212,18 @@ gpii.tests.windows.jaws = [ { name: "Testing NP set \"jaws_common2\" using Flat matchmaker", userToken: "jaws_common2", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "com.freedomscientific.jaws": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.settingsHandlers.INISettingsHandler": { - "some.app.id": [ + "com.freedomscientific.jaws": [ { "settings": { "Options.PrimarySynthesizer": "eloq", @@ -221,6 +276,20 @@ gpii.tests.windows.jaws = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "com.freedomscientific.jaws": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "jaws" + }] + } + }] } }, processes: [ @@ -235,9 +304,18 @@ gpii.tests.windows.jaws = [ { name: "Testing NP set \"jaws_common3\" using Flat matchmaker", userToken: "jaws_common3", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "com.freedomscientific.jaws": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.settingsHandlers.INISettingsHandler": { - "some.app.id": [ + "com.freedomscientific.jaws": [ { "settings": { "Options.PrimarySynthesizer": "eloq", @@ -291,6 +369,20 @@ gpii.tests.windows.jaws = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "com.freedomscientific.jaws": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "jaws" + }] + } + }] } }, processes: [ diff --git a/tests/platform/windows/windows-maavis-testSpec.js b/tests/platform/windows/windows-maavis-testSpec.js index 658f95b4d..3598ff290 100644 --- a/tests/platform/windows/windows-maavis-testSpec.js +++ b/tests/platform/windows/windows-maavis-testSpec.js @@ -25,9 +25,18 @@ gpii.tests.windows.maavis = [ { name: "Testing maavis_highcontrast using Flat matchmaker", userToken: "maavis_highcontrast", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "net.opendirective.maavis": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.settingsHandlers.JSONSettingsHandler": { - "data": [ + "net.opendirective.maavis": [ { "settings": { "theme": "hc", @@ -40,6 +49,20 @@ gpii.tests.windows.maavis = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "net.opendirective.maavis": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "MaavisPortable" + }] + } + }] } }, processes: [ @@ -52,9 +75,18 @@ gpii.tests.windows.maavis = [ }, { name: "Testing maavis_selfvoicing using Flat matchmaker", userToken: "maavis_selfvoicing", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "net.opendirective.maavis": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.settingsHandlers.JSONSettingsHandler": { - "data": [ + "net.opendirective.maavis": [ { "settings": { "theme": "colour", @@ -67,6 +99,20 @@ gpii.tests.windows.maavis = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "net.opendirective.maavis": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "MaavisPortable" + }] + } + }] } }, processes: [ diff --git a/tests/platform/windows/windows-nvda-testSpec.js b/tests/platform/windows/windows-nvda-testSpec.js index b6af2d032..0aa6a7305 100644 --- a/tests/platform/windows/windows-nvda-testSpec.js +++ b/tests/platform/windows/windows-nvda-testSpec.js @@ -25,9 +25,18 @@ gpii.tests.windows.nvda = [ { name: "Testing screenreader_nvda using Flat matchmaker", userToken: "screenreader_nvda", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "org.nvda-project": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.settingsHandlers.INISettingsHandler": { - "some.app.id": [ + "org.nvda-project": [ { "settings": { "speech.espeak.rate": 17, @@ -53,6 +62,20 @@ gpii.tests.windows.nvda = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "org.nvda-project": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "nvda" + }] + } + }] } }, processes: [ @@ -65,9 +88,18 @@ gpii.tests.windows.nvda = [ }, { name: "Testing screenreader_common using Flat matchmaker", userToken: "screenreader_common", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "org.nvda-project": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.settingsHandlers.INISettingsHandler": { - "some.app.id": [ + "org.nvda-project": [ { "settings": { "speech.espeak.rate": 17, @@ -91,6 +123,20 @@ gpii.tests.windows.nvda = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "org.nvda-project": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "nvda" + }] + } + }] } }, processes: [ @@ -103,9 +149,18 @@ gpii.tests.windows.nvda = [ }, { name: "Testing screenreader_orca using Flat matchmaker", userToken: "screenreader_orca", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "org.nvda-project": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.settingsHandlers.INISettingsHandler": { - "some.app.id": [ + "org.nvda-project": [ { "settings": { "speech.symbolLevel": 300, @@ -123,6 +178,20 @@ gpii.tests.windows.nvda = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "org.nvda-project": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "nvda" + }] + } + }] } }, processes: [ diff --git a/tests/platform/windows/windows-readWrite-testSpec.js b/tests/platform/windows/windows-readWrite-testSpec.js index bb2d1fb7f..5e15006e2 100644 --- a/tests/platform/windows/windows-readWrite-testSpec.js +++ b/tests/platform/windows/windows-readWrite-testSpec.js @@ -22,9 +22,18 @@ gpii.tests.windows.readWrite = [ { name: "Testing rwg1", userToken: "rwg1", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "com.texthelp.readWriteGold": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.settingsHandlers.XMLHandler": { - "some.app.id": [ + "com.texthelp.readWriteGold": [ { "settings": { "ApplicationSettings.AppBar.optToolbarIconSet.$t": "Fun", @@ -53,6 +62,20 @@ gpii.tests.windows.readWrite = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "com.texthelp.readWriteGold": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "readandwrite" + }] + } + }] } }, processes: [ @@ -65,9 +88,18 @@ gpii.tests.windows.readWrite = [ }, { name: "Testing rwg2", userToken: "rwg2", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "com.texthelp.readWriteGold": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.settingsHandlers.XMLHandler": { - "some.app.id": [ + "com.texthelp.readWriteGold": [ { "settings": { "ApplicationSettings.AppBar.optToolbarIconSet.$t": "Professional", @@ -98,6 +130,20 @@ gpii.tests.windows.readWrite = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "com.texthelp.readWriteGold": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "readandwrite" + }] + } + }] } }, processes: [ From edeb9ace35caed9cf6b0a5e9b10be2341e3356dd Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 1 Mar 2017 13:16:34 +0100 Subject: [PATCH 03/26] GPII-442: Fixed failing Journal integration tests --- tests/JournalIntegrationTests.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/tests/JournalIntegrationTests.js b/tests/JournalIntegrationTests.js index 7852f382f..c389ebf50 100644 --- a/tests/JournalIntegrationTests.js +++ b/tests/JournalIntegrationTests.js @@ -25,6 +25,7 @@ fluid.setLogging(true); fluid.registerNamespace("gpii.tests.journal"); +fluid.logObjectRenderChars = 10000 gpii.tests.journal.testSpec = fluid.require("%universal/tests/platform/windows/windows-builtIn-testSpec.js"); // The os_win7 entry forms the spine of our test. This user has 4 application-specific preferences encoded @@ -35,7 +36,7 @@ gpii.tests.journal.testDef = gpii.tests.windows.builtIn[0]; gpii.tests.journal.initialSettings = { "gpii.windows.spiSettingsHandler": { - "some.app.id": [{ + "com.microsoft.windows.mouseTrailing": [{ "settings": { "MouseTrails": { "value": 20 @@ -49,7 +50,7 @@ gpii.tests.journal.initialSettings = { }] }, "gpii.windows.registrySettingsHandler": { - "some.app.id": [{ // magnifier stuff + "com.microsoft.windows.magnifier": [{ // magnifier stuff "settings": { "Invert": 1, "Magnification": 200, @@ -75,7 +76,7 @@ gpii.tests.journal.initialSettings = { ] }, "gpii.windows.displaySettingsHandler": { - "some.app.id": [{ + "com.microsoft.windows.screenResolution": [{ "settings": { "screen-resolution": { "width": 800, @@ -83,6 +84,15 @@ gpii.tests.journal.initialSettings = { } } }] + }, + "gpii.launchHandlers.flexibleHandler": { + "com.microsoft.windows.magnifier": [ + { + "settings": { + "running": false + } + } + ] } }; @@ -274,8 +284,10 @@ gpii.tests.journal.stashInitial = function (settingsHandlersPayload, settingsSto var settingsHandlers = fluid.copy(testCaseHolder.options.settingsHandlers); // We eliminate the last blocks since our initial settings state does not include them, and the blocks // with values all `undefined` will confuse jqUnit.assertDeepEq in gpii.test.checkConfiguration - settingsHandlers["gpii.windows.spiSettingsHandler"]["some.app.id"].length = 1; - settingsHandlers["gpii.windows.registrySettingsHandler"]["some.app.id"].length = 1; + settingsHandlers["gpii.windows.spiSettingsHandler"] = fluid.filterKeys(settingsHandlers["gpii.windows.spiSettingsHandler"], "com.microsoft.windows.mouseTrailing"); + settingsHandlers["gpii.windows.registrySettingsHandler"] = fluid.filterKeys(settingsHandlers["gpii.windows.registrySettingsHandler"], "com.microsoft.windows.magnifier"); + // settingsHandlers["gpii.windows.spiSettingsHandler"]["com.microsoft.windows.mouseTrailing"].length = 1; + // settingsHandlers["gpii.windows.registrySettingsHandler"]["com.microsoft.windows.magnifier"].length = 1; testCaseHolder.settingsHandlers = settingsHandlers; }; From 957d48891a6a66c9e0c0a492be2588e347bcc5cf Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Thu, 2 Mar 2017 17:54:18 +0100 Subject: [PATCH 04/26] GPII-442: Removed REST related processReporter functionality --- ....config.all.development.pr.production.json | 1 - .../gpii.processReporter.config.base.json | 19 - ...pii.processReporter.config.production.json | 12 - ...gpii.processReporter.config.production.txt | 5 - gpii/node_modules/processReporter/index.js | 1 + .../processReporter/src/ProcessReporter.js | 116 +----- .../test/web/html/ProcessReporterTest.html | 34 ++ .../test/web/js/ProcessReporterTests.js | 109 ++++++ .../settingsHandlers/src/LaunchHandlers.js | 18 +- .../test/web/html/LaunchHandlerTest.html | 36 ++ .../test/web/js/LaunchHandlerTests.js | 347 ++++++++++++++++++ gpii/node_modules/testing/src/Testing.js | 33 +- testData/solutions/android.json5 | 77 ++-- .../platform/linux/linux-builtIn-testSpec.js | 31 +- tests/platform/linux/linux-chrome-testSpec.js | 9 +- .../linux-dynamicDeviceReporter-testSpec.js | 21 -- tests/platform/linux/linux-orca-testSpec.js | 27 +- .../windows/windows-builtIn-testSpec.js | 27 +- .../windows/windows-chrome-testSpec.js | 9 +- .../windows-dynamicDeviceReporter-testSpec.js | 14 - .../platform/windows/windows-jaws-testSpec.js | 40 +- .../windows/windows-maavis-testSpec.js | 18 +- .../platform/windows/windows-nvda-testSpec.js | 27 +- .../windows/windows-readWrite-testSpec.js | 18 +- tests/web/html/all-tests.html | 3 +- 25 files changed, 628 insertions(+), 424 deletions(-) delete mode 100644 gpii/node_modules/processReporter/configs/gpii.processReporter.config.base.json delete mode 100644 gpii/node_modules/processReporter/configs/gpii.processReporter.config.production.json delete mode 100644 gpii/node_modules/processReporter/configs/gpii.processReporter.config.production.txt create mode 100644 gpii/node_modules/processReporter/test/web/html/ProcessReporterTest.html create mode 100644 gpii/node_modules/processReporter/test/web/js/ProcessReporterTests.js create mode 100644 gpii/node_modules/settingsHandlers/test/web/html/LaunchHandlerTest.html create mode 100644 gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js diff --git a/gpii/configs/gpii.config.all.development.pr.production.json b/gpii/configs/gpii.config.all.development.pr.production.json index bccb5ab11..e07369298 100644 --- a/gpii/configs/gpii.config.all.development.pr.production.json +++ b/gpii/configs/gpii.config.all.development.pr.production.json @@ -9,7 +9,6 @@ } }, "mergeConfigs": [ - "%processReporter/configs/gpii.processReporter.config.production.json", "%deviceReporter/configs/gpii.deviceReporter.config.production.json", "%universal/gpii/configs/gpii.config.development.base.local.json" ] diff --git a/gpii/node_modules/processReporter/configs/gpii.processReporter.config.base.json b/gpii/node_modules/processReporter/configs/gpii.processReporter.config.base.json deleted file mode 100644 index 3f1413b93..000000000 --- a/gpii/node_modules/processReporter/configs/gpii.processReporter.config.base.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "type": "gpii.processReporter.config.base", - "options": { - "gradeNames": ["fluid.component"], - "components": { - "server": { - "type": "kettle.server", - "options": { - "components": { - "processReporter": { - "type": "gpii.processReporter" - } - } - } - } - } - }, - "require": "processReporter" -} diff --git a/gpii/node_modules/processReporter/configs/gpii.processReporter.config.production.json b/gpii/node_modules/processReporter/configs/gpii.processReporter.config.production.json deleted file mode 100644 index 59c531d55..000000000 --- a/gpii/node_modules/processReporter/configs/gpii.processReporter.config.production.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "type": "gpii.processReporter.config.production", - "options": { - "distributeOptions": { - "processReporterType": { - "record": "gpii.processReporter.live", - "target": "{that processReporter}.type" - } - } - }, - "mergeConfigs": "gpii.processReporter.config.base.json" -} diff --git a/gpii/node_modules/processReporter/configs/gpii.processReporter.config.production.txt b/gpii/node_modules/processReporter/configs/gpii.processReporter.config.production.txt deleted file mode 100644 index bd849178c..000000000 --- a/gpii/node_modules/processReporter/configs/gpii.processReporter.config.production.txt +++ /dev/null @@ -1,5 +0,0 @@ -==production.json== - -Running the process reporter in production mode - -**WARNING: This config this is untrusted and most likely broken** diff --git a/gpii/node_modules/processReporter/index.js b/gpii/node_modules/processReporter/index.js index 5081d1885..b929e1274 100644 --- a/gpii/node_modules/processReporter/index.js +++ b/gpii/node_modules/processReporter/index.js @@ -5,5 +5,6 @@ var fluid = require("infusion"); fluid.module.register("processReporter", __dirname, require); require("./src/ProcessReporter.js"); +require("./src/ProcessesBridge.js") diff --git a/gpii/node_modules/processReporter/src/ProcessReporter.js b/gpii/node_modules/processReporter/src/ProcessReporter.js index 7129a2c69..a76f32756 100644 --- a/gpii/node_modules/processReporter/src/ProcessReporter.js +++ b/gpii/node_modules/processReporter/src/ProcessReporter.js @@ -12,30 +12,11 @@ "use strict"; -var fluid = require("infusion"), +var fluid = fluid || require("infusion"), gpii = fluid.registerNamespace("gpii"); -fluid.require("kettle", require); -fluid.require("./processesBridge.js", require); - fluid.defaults("gpii.processReporter", { - gradeNames: "fluid.component" -}); - -fluid.defaults("gpii.processReporter.base", { - gradeNames: ["kettle.app", "gpii.processReporter"], - requestHandlers: { - processGet: { - route: "/processes", - type: "gpii.processReporter.allSolutions.get", - method: "get" - }, - processGetSingle: { - route: "/processes/:solutionID", - type: "gpii.processReporter.solution.get", - method: "get" - } - }, + gradeNames: ["fluid.component"], components: { platformReporter: { type: "gpii.platformReporter.native" @@ -45,32 +26,10 @@ fluid.defaults("gpii.processReporter.base", { } }, invokers: { - fireResponse: { - funcName: "gpii.processReporter.fireResponse", - args: ["{arguments}.0", "{arguments}.1", "{platformReporter}"] - // request, runningSolutions - } - } -}); - -fluid.defaults("gpii.processReporter.allSolutions.get", { - gradeNames: ["kettle.request.http"], - invokers: { - handleRequest: { - func: "{processReporter}.get", - args: [ - "{request}" - ] - } - } -}); - -fluid.defaults("gpii.processReporter.solution.get", { - gradeNames: ["kettle.request.http"], - invokers: { - handleRequest: { - func: "{processReporter}.getProcess", - args: ["{request}", "{processReporter}", "{solutionsRegistryDataSource}"] + handleIsRunning: { + funcName: "gpii.processReporter.handleIsRunning", + args: ["{arguments}.0"] + // entry } } }); @@ -84,32 +43,6 @@ fluid.defaults("gpii.processReporter.nameResolver", { } }); -gpii.processReporter.fireResponse = function (request, runningSolutions, platformReporter) { - request.events.onSuccess.fire({ - solutions: runningSolutions, - OS: platformReporter.reportPlatform() - }); -}; - -fluid.defaults("gpii.processReporter.live", { - gradeNames: ["gpii.processReporter.base"], - invokers: { - get: { - funcName: "gpii.processReporter.live.get", - args: ["{arguments}.0", "{processReporter}", "{flowManager}.solutionsRegistryDataSource"] - }, - getProcess: { - funcName: "gpii.processReporter.live.getProcess", - args: ["{arguments}.0", "{processReporter}", "{flowManager}.solutionsRegistryDataSource"] - }, - handleIsRunning: { - funcName: "gpii.processReporter.live.handleIsRunning", - args: ["{arguments}.0"] - // entry - } - } -}); - /* Marker function for use in isRunning sections of a launch handler * to identify in a meaningful way that the solutions start block should always * be run. @@ -127,46 +60,15 @@ gpii.processReporter.neverRunning = function () { * Runs the 'isRunning' entries of the 'entry' argument. If no 'isRunning' block is present * undefined is returned */ -gpii.processReporter.live.handleIsRunning = function (entry) { +gpii.processReporter.handleIsRunning = function (entry) { var running = undefined; if (!!entry.isRunning) { running = true; - fluid.each (entry.isRunning, function (aMember) { + + fluid.each (fluid.makeArray(entry.isRunning), function (aMember) { var partial = fluid.invokeGradedFunction(aMember.type, aMember); running = running && partial; }); } return running; }; - -gpii.processReporter.live.get = function (request, processReporter, solutionsRegistryDataSource) { - var runningSolutions = []; - solutionsRegistryDataSource.get({os: processReporter.platformReporter.reportPlatform().id}, function onSuccess(entries) { - fluid.each(entries, function (entry) { - var foundEntry = gpii.processReporter.live.handleIsRunning(entry); - if (foundEntry !== null) { - runningSolutions.push(foundEntry); - } - }); - processReporter.fireResponse(request, runningSolutions); - }); -}; - -gpii.processReporter.live.getProcess = function (request, processReporter, solutionsRegistryDataSource) { - var solutionID = request.req.params.solutionID; - solutionsRegistryDataSource.get({os: processReporter.platformReporter.reportPlatform().id}, function onSuccess(entries) { - var result = fluid.find(entries, function (anEntry, entryID) { - if (entryID === solutionID) { - return gpii.processReporter.live.handleIsRunning(anEntry); - } - }, null); - if (result === null) { - result = { id: solutionID, running: false }; - } - processReporter.fireResponse(request, result); - }); -}; - -fluid.defaults("gpii.processReporter.dev", { - gradeNames: ["kettle.urlExpander.distributeDevVariables"] -}); diff --git a/gpii/node_modules/processReporter/test/web/html/ProcessReporterTest.html b/gpii/node_modules/processReporter/test/web/html/ProcessReporterTest.html new file mode 100644 index 000000000..5d3df1cf1 --- /dev/null +++ b/gpii/node_modules/processReporter/test/web/html/ProcessReporterTest.html @@ -0,0 +1,34 @@ + + + + + GPII Process Reporter Tests + + + + + + + + + + + + + + + + + + + +

GPII Process Reporter Tests

+

+
+

+
    + + + + diff --git a/gpii/node_modules/processReporter/test/web/js/ProcessReporterTests.js b/gpii/node_modules/processReporter/test/web/js/ProcessReporterTests.js new file mode 100644 index 000000000..4ff5200f1 --- /dev/null +++ b/gpii/node_modules/processReporter/test/web/js/ProcessReporterTests.js @@ -0,0 +1,109 @@ +/* + * Process Reporter Tests + * + * Copyright 2017 Raising the Floor - International + * + * Licensed under the New BSD license. You may not use this file except in + * compliance with this License. + * + * You may obtain a copy of the License at + * https://github.com/GPII/universal/blob/master/LICENSE.txt + */ + +/* global fluid, jqUnit, gpii */ + +"use strict"; + +(function () { + // TODO: Rewrite all these tests into browser-style jqUnit tests, leaving just + // a stub tester here to test filesystem integration + + fluid.registerNamespace("gpii.tests"); + fluid.registerNamespace("gpii.tests.processReporter"); + + fluid.defaults("gpii.tests.processReporter.alwaysTrue", { + gradeNames: "fluid.function", + argumentMap: {} + }); + + gpii.tests.processReporter.alwaysTrue = function () { + return true; + } + + fluid.defaults("gpii.tests.processReporter.alwaysFalse", { + gradeNames: "fluid.function", + argumentMap: {} + }); + + gpii.tests.processReporter.alwaysFalse = function () { + return false; + } + + gpii.tests.processReporter.handleIsRunningSpecs = { + "No isRunning block": { + input: {}, + expected: undefined + }, + "Single true entry as object": { + input: { + isRunning: { + "type": "gpii.tests.processReporter.alwaysTrue" + } + }, + expected: true + }, + "Single true entry as array": { + input: { + isRunning: [{ + "type": "gpii.tests.processReporter.alwaysTrue" + }] + }, + expected: true + }, + "Single false entry": { + input: { + isRunning: [{ + "type": "gpii.tests.processReporter.alwaysFalse" + }] + }, + expected: false + }, + "true + false => false": { + input: { + isRunning: [{ + "type": "gpii.tests.processReporter.alwaysTrue" + }, { + "type": "gpii.tests.processReporter.alwaysFalse" + }] + }, + expected: false + }, + "false + true => false": { + input: { + isRunning: [{ + "type": "gpii.tests.processReporter.alwaysFalse" + }, { + "type": "gpii.tests.processReporter.alwaysTrue" + }] + }, + expected: false + }, + "true + true => true": { + input: { + isRunning: [{ + "type": "gpii.tests.processReporter.alwaysTrue" + }, { + "type": "gpii.tests.processReporter.alwaysTrue" + }] + }, + expected: true + } + }; + + jqUnit.test("gpii.processReporter.handleIsRunning tests", function () { + fluid.each(gpii.tests.processReporter.handleIsRunningSpecs, function (spec, title) { + var actual = gpii.processReporter.handleIsRunning(spec.input); + jqUnit.assertEquals(title, spec.expected, actual); + }); + }); +})(); diff --git a/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js b/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js index c0275b2d0..537da67e4 100644 --- a/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js +++ b/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js @@ -1,5 +1,5 @@ /* - * GPII JSON Settings Handler + * GPII Launch Handlers * * Copyright 2017 Raising the Floor - International * @@ -12,7 +12,7 @@ "use strict"; -var fluid = require("infusion"), +var fluid = fluid || require("infusion"), gpii = fluid.registerNamespace("gpii"); fluid.registerNamespace("gpii.launchHandlers"); @@ -53,15 +53,19 @@ gpii.launchHandlers.flexibleHandler.get = function (payload) { }; gpii.launchHandlers.flexibleHandler.executeStartBlock = function (mainEntry) { - var startBlock = fluid.get(mainEntry, [ "options", "start" ]); - fluid.invokeGradedFunction(startBlock.type, startBlock); + var startBlocks = fluid.get(mainEntry, [ "options", "start" ]); + fluid.each(fluid.makeArray(startBlocks), function (startBlock) { + fluid.invokeGradedFunction(startBlock.type, startBlock); + }); }; gpii.launchHandlers.flexibleHandler.executeStopBlock = function (mainEntry) { - var stopBlock = fluid.get(mainEntry, [ "options", "stop" ]); - fluid.invokeGradedFunction(stopBlock.type, stopBlock); + var stopBlocks = fluid.get(mainEntry, [ "options", "stop" ]); + fluid.each(fluid.makeArray(stopBlocks), function (stopBlock) { + fluid.invokeGradedFunction(stopBlock.type, stopBlock); + }); }; gpii.launchHandlers.flexibleHandler.executeIsRunningBlock = function (options) { - return gpii.processReporter.live.handleIsRunning(options); + return gpii.processReporter.handleIsRunning(options); }; diff --git a/gpii/node_modules/settingsHandlers/test/web/html/LaunchHandlerTest.html b/gpii/node_modules/settingsHandlers/test/web/html/LaunchHandlerTest.html new file mode 100644 index 000000000..4e66b8577 --- /dev/null +++ b/gpii/node_modules/settingsHandlers/test/web/html/LaunchHandlerTest.html @@ -0,0 +1,36 @@ + + + + + GPII Launch Handler Tests + + + + + + + + + + + + + + + + + + + + + +

    GPII Launch Handlers Tests

    +

    +
    +

    +
      + + + + diff --git a/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js b/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js new file mode 100644 index 000000000..06cb63a44 --- /dev/null +++ b/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js @@ -0,0 +1,347 @@ +/* + * Launch Handler Tests + * + * Copyright 2017 Raising the Floor - International + * + * Licensed under the New BSD license. You may not use this file except in + * compliance with this License. + * + * You may obtain a copy of the License at + * https://github.com/GPII/universal/blob/master/LICENSE.txt + */ + +/* global fluid, jqUnit, gpii */ + +"use strict"; + +(function () { + // TODO: Rewrite all these tests into browser-style jqUnit tests, leaving just + // a stub tester here to test filesystem integration + + fluid.registerNamespace("gpii.tests"); + fluid.registerNamespace("gpii.tests.flexibleHandler"); + + + fluid.defaults("gpii.tests.flexibleHandler.assertDirective", { + gradeNames: "fluid.function", + argumentMap: {} + }); + + gpii.tests.flexibleHandler.assertDirective = function () { + jqUnit.assertTrue("Assertion block", true); + }; + + fluid.defaults("gpii.tests.flexibleHandler.failBlock", { + gradeNames: "fluid.function", + argumentMap: {} + }); + + gpii.tests.flexibleHandler.failBlock = function () { + jqUnit.assertTrue("Asserted that this block should not be called", false); + }; + + fluid.defaults("gpii.tests.flexibleHandler.returnTrue", { + gradeNames: "fluid.function", + argumentMap: {} + }); + + gpii.tests.flexibleHandler.returnTrue = function () { + return true + }; + + fluid.defaults("gpii.tests.flexibleHandler.returnFalse", { + gradeNames: "fluid.function", + argumentMap: {} + }); + + gpii.tests.flexibleHandler.returnFalse = function () { + return false + }; + + gpii.tests.flexibleHandler.assertBlock = { + "type": "gpii.tests.flexibleHandler.assertDirective" + }; + + gpii.tests.flexibleHandler.reportRunning = { + "type": "gpii.tests.flexibleHandler.returnTrue" + }; + + gpii.tests.flexibleHandler.reportNotRunning = { + "type": "gpii.tests.flexibleHandler.returnFalse" + }; + + gpii.tests.flexibleHandler.basicTestDefs = [ + { + description: "Passing true to handler if already running should not execute start block", + expect: 1, + input: { + settings: { + "running": true + }, + options: { + "start": gpii.tests.flexibleHandler.failBlock, + "stop": gpii.tests.flexibleHandler.failBlock, + "isRunning": gpii.tests.flexibleHandler.reportRunning + } + }, + expectedSettings: { + "running": { + "newValue": true, + "oldValue": true + } + } + }, { + description: "Passing false to handler if already not running should not execute stop block", + expect: 1, + input: { + settings: { + "running": false + }, + options: { + "start": gpii.tests.flexibleHandler.failBlock, + "stop": gpii.tests.flexibleHandler.failBlock, + "isRunning": gpii.tests.flexibleHandler.reportNotRunning + } + }, + expectedSettings: { + "running": { + "newValue": false, + "oldValue": false + } + } + }, { + description: "Passing true to handler if solution is not running should execute start block", + expect: 2, + input: { + settings: { + "running": true + }, + options: { + "start": gpii.tests.flexibleHandler.assertBlock, + "stop": gpii.tests.flexibleHandler.failBlock, + "isRunning": gpii.tests.flexibleHandler.reportNotRunning + } + }, + expectedSettings: { + "running": { + "newValue": true, + "oldValue": false + } + } + }, { + description: "Passing false to handler if solution is running should execute stop block", + expect: 2, + input: { + settings: { + "running": false + }, + options: { + "start": gpii.tests.flexibleHandler.failBlock, + "stop": gpii.tests.flexibleHandler.assertBlock, + "isRunning": gpii.tests.flexibleHandler.reportRunning + } + }, + expectedSettings: { + "running": { + "newValue": false, + "oldValue": true + } + } + }, { + description: "Testing for multiple start blocks", + expect: 3, + input: { + settings: { + "running": true + }, + options: { + "start": [ + gpii.tests.flexibleHandler.assertBlock, + gpii.tests.flexibleHandler.assertBlock + ], + "stop": gpii.tests.flexibleHandler.failBlock, + "isRunning": gpii.tests.flexibleHandler.reportNotRunning + } + }, + expectedSettings: { + "running": { + "newValue": true, + "oldValue": false + } + } + }, { + description: "Testing for multiple stop blocks", + expect: 3, + input: { + settings: { + "running": false + }, + options: { + "start": gpii.tests.flexibleHandler.failBlock, + "stop": [ + gpii.tests.flexibleHandler.assertBlock, + gpii.tests.flexibleHandler.assertBlock + ], + "isRunning": gpii.tests.flexibleHandler.reportRunning + } + }, + expectedSettings: { + "running": { + "newValue": false, + "oldValue": true + } + } + } + ]; + + fluid.each(gpii.tests.flexibleHandler.basicTestDefs, function (spec) { + jqUnit.test(spec.description, function () { + jqUnit.expect(spec.expect); + var actual = gpii.launchHandlers.flexibleHandler.set({ + "my.solution1": [ + spec.input + ] + }); + // build expected return payload: + jqUnit.assertDeepEq("Return payload is correct", spec.expectedSettings, actual["my.solution1"][0].settings); + }); + }); + + gpii.tests.flexibleHandler.extraTestDefs = [ + { + description: "Multiple solution entries sent - both should attempt to start", + expect: 3, + input: { + "my.solution1": [ + { + settings: { + "running": true + }, + options: { + "start": gpii.tests.flexibleHandler.assertBlock, + "stop": gpii.tests.flexibleHandler.failBlock, + "isRunning": gpii.tests.flexibleHandler.reportNotRunning + } + } + ], + "my.solution2": [ + { + settings: { + "running": true + }, + options: { + "start": gpii.tests.flexibleHandler.assertBlock, + "stop": gpii.tests.flexibleHandler.failBlock, + "isRunning": gpii.tests.flexibleHandler.reportNotRunning + } + } + ] + }, + expected: { + "my.solution1": [ + { + settings: { + running: { + "newValue": true, + "oldValue": false + } + }, + options: { + "start": gpii.tests.flexibleHandler.assertBlock, + "stop": gpii.tests.flexibleHandler.failBlock, + "isRunning": gpii.tests.flexibleHandler.reportNotRunning + } + } + ], + "my.solution2": [ + { + settings: { + running: { + "newValue": true, + "oldValue": false + } + }, + options: { + "start": gpii.tests.flexibleHandler.assertBlock, + "stop": gpii.tests.flexibleHandler.failBlock, + "isRunning": gpii.tests.flexibleHandler.reportNotRunning + } + } + ] + } + }, + { + description: "Multiple solution entries sent - different actions", + expect: 2, + input: { + "my.solution1": [ + { + settings: { + "running": false + }, + options: { + "start": gpii.tests.flexibleHandler.failBlock, + "stop": gpii.tests.flexibleHandler.assertBlock, + "isRunning": gpii.tests.flexibleHandler.reportRunning + } + } + ], + "my.solution2": [ + { + settings: { + "running": false + }, + options: { + "start": gpii.tests.flexibleHandler.failBlock, + "stop": gpii.tests.flexibleHandler.failBlock, + "isRunning": gpii.tests.flexibleHandler.reportNotRunning + } + } + ] + }, + expected: { + "my.solution1": [ + { + settings: { + running: { + "newValue": false, + "oldValue": true + } + }, + options: { + "start": gpii.tests.flexibleHandler.failBlock, + "stop": gpii.tests.flexibleHandler.assertBlock, + "isRunning": gpii.tests.flexibleHandler.reportRunning + } + } + ], + "my.solution2": [ + { + settings: { + running: { + "newValue": false, + "oldValue": false + } + }, + options: { + "start": gpii.tests.flexibleHandler.failBlock, + "stop": gpii.tests.flexibleHandler.failBlock, + "isRunning": gpii.tests.flexibleHandler.reportNotRunning + } + } + ] + } + } + ]; + + fluid.each(gpii.tests.flexibleHandler.extraTestDefs, function (spec) { + jqUnit.test(spec.description, function () { + jqUnit.expect(spec.expect); + var actual = gpii.launchHandlers.flexibleHandler.set(spec.input); + // build expected return payload: + jqUnit.assertDeepEq("Return payload is correct", spec.expected, actual); + }); + }); + + +})(); diff --git a/gpii/node_modules/testing/src/Testing.js b/gpii/node_modules/testing/src/Testing.js index 5c767c593..8d8f7f722 100644 --- a/gpii/node_modules/testing/src/Testing.js +++ b/gpii/node_modules/testing/src/Testing.js @@ -189,10 +189,6 @@ gpii.test.checkConfiguration = function (settingsHandlers, nameResolver, onCompl }); }; -gpii.test.onExecExit = function (result, processSpec) { - jqUnit.assertTrue("Checking the process with command: " + processSpec, result); -}; - gpii.test.logoutRequestListen = function (data) { jqUnit.assertNotEquals("Successful logout message returned " + data, -1, data.indexOf("was successfully logged out.")); @@ -298,26 +294,6 @@ gpii.test.common.receiveLifecycleManager = function (testCaseHolder, lifecycleMa }; -// Will return the part of a test sequence that tests for the process state based on the -// 'expectedKey' parameter -gpii.test.createProcessChecks = function (processList, expectedKey) { - var sequence = []; - // For each process, run the command, then check that we get the expected output - fluid.each(processList, function (process, pindex) { - sequence.push({ - func: "{exec}.exec", - args: [ - fluid.model.composeSegments("{tests}.options.processes", pindex), - fluid.model.composeSegments("{tests}.options.processes", pindex, expectedKey) - ] - }, { - event: "{exec}.events.onExecExit", - listener: "gpii.test.onExecExit" - }); - }); - return sequence; -}; - /** Expand material in a `gpii.test.common.testCaseHolder` fixture's options using the variableResolver fished out of the real implementation, * and place it at a public member for the assertions to use * @param testCaseHolder {gpii.test.common.testCaseHolder} a testCaseHolder with some expandable material in its options @@ -397,10 +373,9 @@ gpii.test.buildSingleTestFixture = function (testDef, rootGrades) { return val.startsWith("gpii.test.integration") ? true : undefined; }); - var processes = testDef.processes || []; testDef.gradeNames = fluid.makeArray(testDef.gradeNames).concat(fluid.makeArray(rootGrades)); - testDef.expect = 4 + processes.length * 2; + testDef.expect = 4; testDef.sequence = fluid.makeArray(testDef.sequence); gpii.test.unshift(testDef.sequence, gpii.test.loginSequence); @@ -411,14 +386,8 @@ gpii.test.buildSingleTestFixture = function (testDef, rootGrades) { gpii.test.unshift(testDef.sequence, gpii.test.integration.prepopulateSettingsSequence); } - // For each process, run the command, then check that we get the expected output - testDef.sequence = testDef.sequence.concat(gpii.test.createProcessChecks(processes, "expectConfigured")); - gpii.test.push(testDef.sequence, gpii.test.logoutSequence); - // Check that the processes are in the expected state after logout - testDef.sequence = testDef.sequence.concat(gpii.test.createProcessChecks(processes, "expectRestored")); - gpii.test.push(testDef.sequence, gpii.test.checkSequence); return testDef; diff --git a/testData/solutions/android.json5 b/testData/solutions/android.json5 index a8c4cef32..708f41db2 100644 --- a/testData/solutions/android.json5 +++ b/testData/solutions/android.json5 @@ -13,12 +13,21 @@ "capabilities": [ "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" ] + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": { + "type": "gpii.androidActivityManager.startFreespeech" + }, + "isRunning": [{ + "type": "gpii.processReporter.neverRunning" + }] + } } }, "start": [ - { - "type": "gpii.androidActivityManager.startFreespeech" - } + "settings.launcher" ] }, @@ -36,17 +45,24 @@ "capabilities": [ "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" ] + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": { + "type": "gpii.androidActivityManager.startTalkback" + }, + "stop": { + "type": "gpii.androidActivityManager.stopTalkback" + }, + "isRunning": [{ + "type": "gpii.processReporter.neverRunning" + }] + } } }, "start": [ - { - "type": "gpii.androidActivityManager.startTalkback" - } - ], - "stop": [ - { - "type": "gpii.androidActivityManager.stopTalkback" - } + "settings.launcher" ] }, @@ -392,28 +408,37 @@ } }, "inverseCapabilitiesTransformations": {} + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": { + "type": "gpii.androidActivityManager.startActivityByPackageName", + "packageName": "se.omnitor.ecmobile" + }, + "stop": [ + { + "type": "gpii.androidActivityManager.stopActivityByPackageName", + "packageName": "se.omnitor.ecmobile" + }, + { + "type": "gpii.androidActivityManager.goToHomeScreen" + } + ], + "isRunning": [{ + "type": "gpii.processReporter.neverRunning" + }] + } } }, + "start": [ + "settings.launcher" + ], "configure": [ "settings.configuration" ], "restore": [ "settings.configuration" - ], - "start": [ - { - "type": "gpii.androidActivityManager.startActivityByPackageName", - "packageName": "se.omnitor.ecmobile" - } - ], - "stop": [ - { - "type": "gpii.androidActivityManager.stopActivityByPackageName", - "packageName": "se.omnitor.ecmobile" - }, - { - "type": "gpii.androidActivityManager.goToHomeScreen" - } ] }, diff --git a/tests/platform/linux/linux-builtIn-testSpec.js b/tests/platform/linux/linux-builtIn-testSpec.js index 40ab6d14e..fdfa87226 100644 --- a/tests/platform/linux/linux-builtIn-testSpec.js +++ b/tests/platform/linux/linux-builtIn-testSpec.js @@ -104,16 +104,8 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ }] } }] - - } - }, - processes: [ - { - "command": "gsettings get org.gnome.desktop.a11y.applications screen-magnifier-enabled", - "expectConfigured": "true", - "expectRestored": "false" } - ] + } }, { name: "Testing os_common2 using default matchmaker", @@ -130,8 +122,7 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ } }] } - }, - processes: [] + } }, { name: "Testing os_gnome using default matchmaker", @@ -193,14 +184,7 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ } }] } - }, - processes: [ - { - "command": "gsettings get org.gnome.desktop.a11y.applications screen-magnifier-enabled", - "expectConfigured": "true", - "expectRestored": "false" - } - ] + } }, { name: "Testing os_win7 using default matchmaker", @@ -259,14 +243,7 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ }] } - }, - processes: [ - { - "command": "gsettings get org.gnome.desktop.a11y.applications screen-magnifier-enabled", - "expectConfigured": "true", - "expectRestored": "false" - } - ] + } } ]); diff --git a/tests/platform/linux/linux-chrome-testSpec.js b/tests/platform/linux/linux-chrome-testSpec.js index 46dd95da5..94055ef96 100644 --- a/tests/platform/linux/linux-chrome-testSpec.js +++ b/tests/platform/linux/linux-chrome-testSpec.js @@ -47,8 +47,7 @@ gpii.tests.linux.chrome.testDefs = [ } ] } - }, - processes: [] + } }, { name: "Acceptance test for font size transformation in Chrome", @@ -71,8 +70,7 @@ gpii.tests.linux.chrome.testDefs = [ } ] } - }, - processes: [] + } }, { name: "Acceptance test for magnification transformation in Chrome", @@ -95,8 +93,7 @@ gpii.tests.linux.chrome.testDefs = [ } ] } - }, - processes: [] + } } ]; diff --git a/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js b/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js index ced7bcf59..aae5de0c6 100644 --- a/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js +++ b/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js @@ -80,13 +80,6 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ }] } }, - processes: [ - { - "command": "gsettings get org.gnome.desktop.a11y.applications screen-reader-enabled", - "expectConfigured": "true", - "expectRestored": "false" - } - ], deviceReporters: { "gpii.packageKit.find": { "expectInstalled": ["orca"] @@ -147,13 +140,6 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ }] } }, - processes: [ - { - "command": "gsettings get org.gnome.desktop.a11y.applications screen-reader-enabled", - "expectConfigured": "true", - "expectRestored": "false" - } - ], deviceReporters: { "gpii.packageKit.find": { "expectInstalled": ["orca"] @@ -213,13 +199,6 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ }] } }, - processes: [ - { - "command": "gsettings get org.gnome.desktop.a11y.applications screen-reader-enabled", - "expectConfigured": "true", - "expectRestored": "false" - } - ], deviceReporters: { "gpii.packageKit.find": { "expectInstalled": ["orca"] diff --git a/tests/platform/linux/linux-orca-testSpec.js b/tests/platform/linux/linux-orca-testSpec.js index c5f839dad..e87e81c34 100644 --- a/tests/platform/linux/linux-orca-testSpec.js +++ b/tests/platform/linux/linux-orca-testSpec.js @@ -78,14 +78,7 @@ gpii.tests.linux.orca.testDefs = [ } }] } - }, - processes: [ - { - "command": "gsettings get org.gnome.desktop.a11y.applications screen-reader-enabled", - "expectConfigured": "true", - "expectRestored": "false" - } - ] + } }, { name: "Testing screenreader_orca using Flat matchmaker", @@ -139,14 +132,7 @@ gpii.tests.linux.orca.testDefs = [ } }] } - }, - processes: [ - { - "command": "gsettings get org.gnome.desktop.a11y.applications screen-reader-enabled", - "expectConfigured": "true", - "expectRestored": "false" - } - ] + } }, { name: "Testing screenreader_nvda using Flat matchmaker", @@ -199,14 +185,7 @@ gpii.tests.linux.orca.testDefs = [ } }] } - }, - processes: [ - { - "command": "gsettings get org.gnome.desktop.a11y.applications screen-reader-enabled", - "expectConfigured": "true", - "expectRestored": "false" - } - ] + } } ]; diff --git a/tests/platform/windows/windows-builtIn-testSpec.js b/tests/platform/windows/windows-builtIn-testSpec.js index a0326002c..f1bbfa69b 100644 --- a/tests/platform/windows/windows-builtIn-testSpec.js +++ b/tests/platform/windows/windows-builtIn-testSpec.js @@ -233,14 +233,7 @@ gpii.tests.windows.builtIn = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq Magnify.exe\" | find /I \"Magnify.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0" - } - ] + } }, { name: "Testing os_common using default matchmaker", userToken: "os_common", @@ -448,14 +441,7 @@ gpii.tests.windows.builtIn = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq Magnify.exe\" | find /I \"Magnify.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0" - } - ] + } }, { name: "Testing os_gnome using default matchmaker", userToken: "os_gnome", @@ -539,14 +525,7 @@ gpii.tests.windows.builtIn = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq Magnify.exe\" | find /I \"Magnify.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0" - } - ] + } } ]; diff --git a/tests/platform/windows/windows-chrome-testSpec.js b/tests/platform/windows/windows-chrome-testSpec.js index bc66b41ae..930cb0cd8 100644 --- a/tests/platform/windows/windows-chrome-testSpec.js +++ b/tests/platform/windows/windows-chrome-testSpec.js @@ -49,8 +49,7 @@ gpii.tests.windows.chrome = [ } ] } - }, - processes: [] + } }, { name: "Acceptance test for font size transformation in Chrome", @@ -73,8 +72,7 @@ gpii.tests.windows.chrome = [ } ] } - }, - processes: [] + } }, { name: "Acceptance test for magnification transformation in Chrome", @@ -97,8 +95,7 @@ gpii.tests.windows.chrome = [ } ] } - }, - processes: [] + } } ]; diff --git a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js index 1e2b80bc1..7da440571 100644 --- a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js +++ b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js @@ -82,13 +82,6 @@ gpii.tests.deviceReporterAware.windows = [ }] } }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq nvda.exe\" | find /I \"nvda.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0" - } - ], deviceReporters: { "gpii.deviceReporter.registryKeyExists": { "expectInstalled": [{ @@ -128,13 +121,6 @@ gpii.tests.deviceReporterAware.windows = [ }] } }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq ReadAndWrite.exe\" | find /I \"ReadAndWrite.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0" - } - ], deviceReporters: { "gpii.deviceReporter.registryKeyExists": { "expectInstalled": [{ diff --git a/tests/platform/windows/windows-jaws-testSpec.js b/tests/platform/windows/windows-jaws-testSpec.js index 26a529a10..569d661fd 100644 --- a/tests/platform/windows/windows-jaws-testSpec.js +++ b/tests/platform/windows/windows-jaws-testSpec.js @@ -108,15 +108,7 @@ gpii.tests.windows.jaws = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq jfw.exe\" | find /I \"jfw.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0", - "maxTimeouts": "40" - } - ] + } }, { name: "Testing NP set \"jaws_common\" using Flat matchmaker", @@ -201,15 +193,7 @@ gpii.tests.windows.jaws = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq jfw.exe\" | find /I \"jfw.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0", - "maxTimeouts": "40" - } - ] + } }, { name: "Testing NP set \"jaws_common2\" using Flat matchmaker", @@ -293,15 +277,7 @@ gpii.tests.windows.jaws = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq jfw.exe\" | find /I \"jfw.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0", - "maxTimeouts": "40" - } - ] + } }, { name: "Testing NP set \"jaws_common3\" using Flat matchmaker", @@ -386,15 +362,7 @@ gpii.tests.windows.jaws = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq jfw.exe\" | find /I \"jfw.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0", - "maxTimeouts": "40" - } - ] + } } ]; diff --git a/tests/platform/windows/windows-maavis-testSpec.js b/tests/platform/windows/windows-maavis-testSpec.js index b4c48c2ee..7d21f99e5 100644 --- a/tests/platform/windows/windows-maavis-testSpec.js +++ b/tests/platform/windows/windows-maavis-testSpec.js @@ -67,14 +67,7 @@ gpii.tests.windows.maavis = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq MaavisPortable.exe\" | find /I \"MaavisPortable.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0" - } - ] + } }, { name: "Testing maavis_selfvoicing using Flat matchmaker", userToken: "maavis_selfvoicing", @@ -117,14 +110,7 @@ gpii.tests.windows.maavis = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq MaavisPortable.exe\" | find /I \"MaavisPortable.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0" - } - ] + } } ]; diff --git a/tests/platform/windows/windows-nvda-testSpec.js b/tests/platform/windows/windows-nvda-testSpec.js index 1b466cfab..312bc4592 100644 --- a/tests/platform/windows/windows-nvda-testSpec.js +++ b/tests/platform/windows/windows-nvda-testSpec.js @@ -80,14 +80,7 @@ gpii.tests.windows.nvda = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq nvda.exe\" | find /I \"nvda.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0" - } - ] + } }, { name: "Testing screenreader_common using Flat matchmaker", userToken: "screenreader_common", @@ -141,14 +134,7 @@ gpii.tests.windows.nvda = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq nvda.exe\" | find /I \"nvda.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0" - } - ] + } }, { name: "Testing screenreader_orca using Flat matchmaker", userToken: "screenreader_orca", @@ -196,14 +182,7 @@ gpii.tests.windows.nvda = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq nvda.exe\" | find /I \"nvda.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0" - } - ] + } } ]; diff --git a/tests/platform/windows/windows-readWrite-testSpec.js b/tests/platform/windows/windows-readWrite-testSpec.js index 29dbb50cd..efe676e25 100644 --- a/tests/platform/windows/windows-readWrite-testSpec.js +++ b/tests/platform/windows/windows-readWrite-testSpec.js @@ -80,14 +80,7 @@ gpii.tests.windows.readWrite = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq ReadAndWrite.exe\" | find /I \"ReadAndWrite.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0" - } - ] + } }, { name: "Testing rwg2", userToken: "rwg2", @@ -148,14 +141,7 @@ gpii.tests.windows.readWrite = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq ReadAndWrite.exe\" | find /I \"ReadAndWrite.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0" - } - ] + } } ]; diff --git a/tests/web/html/all-tests.html b/tests/web/html/all-tests.html index 9aa6e76fe..4528d57a7 100644 --- a/tests/web/html/all-tests.html +++ b/tests/web/html/all-tests.html @@ -26,7 +26,8 @@ "../../../gpii/node_modules/gpii-oauth2/gpii-oauth2-authz-server/test/html/AuthorizationServiceTests.html", "../../../gpii/node_modules/gpii-oauth2/gpii-oauth2-authz-server/test/html/UserServiceTests.html", "../../../gpii/node_modules/gpii-oauth2/gpii-oauth2-datastore/test/html/DataSource-PouchDBTests.html", - "../../../gpii/node_modules/gpii-oauth2/gpii-oauth2-utilities/test/html/OAuth2UtilitiesTests.html" + "../../../gpii/node_modules/gpii-oauth2/gpii-oauth2-utilities/test/html/OAuth2UtilitiesTests.html", + "../../../gpii/node_modules/processReporter/test/web/html/ProcessReporterTest.html" ]); QUnit.testSuites("GPII OAuth2 Component Tests", [ "../../../gpii/node_modules/gpii-oauth2/gpii-oauth2-authz-server/webTests/all-tests.html" From a5a59097c48a581f653f0b164b2ac606dc37dcf2 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Tue, 7 Mar 2017 13:17:18 +0100 Subject: [PATCH 05/26] GPII-442: Improvements to linux gsettings launch handler --- .../settingsHandlers/src/LaunchHandlers.js | 27 ++--- gpii/node_modules/testing/src/Integration.js | 7 ++ testData/solutions/android.json5 | 16 +-- testData/solutions/linux.json5 | 107 +++++++----------- testData/solutions/win32.json5 | 64 +++++------ tests/ContextIntegrationTests.js | 11 +- .../platform/linux/linux-builtIn-testSpec.js | 71 ++++-------- .../linux-dynamicDeviceReporter-testSpec.js | 39 ++----- tests/platform/linux/linux-orca-testSpec.js | 41 +++---- 9 files changed, 144 insertions(+), 239 deletions(-) diff --git a/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js b/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js index 537da67e4..daba8f5ec 100644 --- a/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js +++ b/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js @@ -29,13 +29,13 @@ gpii.launchHandlers.flexibleHandler.set = function (payload) { } // get current state - var currentState = gpii.launchHandlers.flexibleHandler.executeIsRunningBlock(handlerData.options, solutionId); + var currentState = gpii.launchHandlers.flexibleHandler.executeGetBlock(handlerData.options, solutionId); // if not in desired state if (currentState !== desiredState) { desiredState === true ? - gpii.launchHandlers.flexibleHandler.executeStartBlock(handlerData) : - gpii.launchHandlers.flexibleHandler.executeStopBlock(handlerData); + gpii.launchHandlers.flexibleHandler.executeSetBlock(handlerData, "setTrue") : + gpii.launchHandlers.flexibleHandler.executeStopBlock(handlerData, "setFalse"); } return gpii.settingsHandlers.setSettings(handlerData, { running: currentState }); @@ -46,26 +46,19 @@ gpii.launchHandlers.flexibleHandler.set = function (payload) { gpii.launchHandlers.flexibleHandler.get = function (payload) { return fluid.transform(payload, function (allSettingsBlocks, solutionId) { return fluid.transform(allSettingsBlocks, function (handlerData) { - var currentState = gpii.launchHandlers.flexibleHandler.executeIsRunningBlock(handlerData.options, solutionId); + var currentState = gpii.launchHandlers.flexibleHandler.executeGetBlock(handlerData.options, solutionId); return { settings: { running: currentState }}; }); }); }; -gpii.launchHandlers.flexibleHandler.executeStartBlock = function (mainEntry) { - var startBlocks = fluid.get(mainEntry, [ "options", "start" ]); - fluid.each(fluid.makeArray(startBlocks), function (startBlock) { - fluid.invokeGradedFunction(startBlock.type, startBlock); +gpii.launchHandlers.flexibleHandler.executeSetBlock = function (mainEntry, blockName) { + var setBlocks = fluid.get(mainEntry, [ "options", blockName ]); + fluid.each(fluid.makeArray(setBlocks), function (setBlock) { + fluid.invokeGradedFunction(setBlock.type, setBlock); }); }; -gpii.launchHandlers.flexibleHandler.executeStopBlock = function (mainEntry) { - var stopBlocks = fluid.get(mainEntry, [ "options", "stop" ]); - fluid.each(fluid.makeArray(stopBlocks), function (stopBlock) { - fluid.invokeGradedFunction(stopBlock.type, stopBlock); - }); -}; - -gpii.launchHandlers.flexibleHandler.executeIsRunningBlock = function (options) { - return gpii.processReporter.handleIsRunning(options); +gpii.launchHandlers.flexibleHandler.executeGetBlock = function (options) { + return gpii.processReporter.handleIsRunning({ isRunning: options.getState }); }; diff --git a/gpii/node_modules/testing/src/Integration.js b/gpii/node_modules/testing/src/Integration.js index b8c296a4d..8666a14a7 100644 --- a/gpii/node_modules/testing/src/Integration.js +++ b/gpii/node_modules/testing/src/Integration.js @@ -319,6 +319,10 @@ gpii.test.integration.registrySettingsHandlerKey = function (options) { return options.hKey + "|" + options.path; }; +gpii.test.integration.gsettingsLaunchKey = function (options) { + return options.schema + "|" + options.key; +} + fluid.defaults("gpii.test.integration.mockSettingsHandlerRegistry", { gradeNames: ["fluid.component"], rootPath: "gpii.test.integration.mockSettingsHandlers", // the global names for mocks will be deposited in here @@ -410,6 +414,9 @@ fluid.defaults("gpii.test.integration.mockSettingsHandlerRegistry.linux", { }, "gpii.alsa": { optionsPathKey: "NONE" + }, + "gpii.gsettings.launch": { + optionsPathkey: gpii.test.integration.gsettingsLaunchKey } } }); diff --git a/testData/solutions/android.json5 b/testData/solutions/android.json5 index 708f41db2..c36af5dee 100644 --- a/testData/solutions/android.json5 +++ b/testData/solutions/android.json5 @@ -17,10 +17,10 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": { + "setTrue": { "type": "gpii.androidActivityManager.startFreespeech" }, - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.neverRunning" }] } @@ -49,13 +49,13 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": { + "setTrue": { "type": "gpii.androidActivityManager.startTalkback" }, - "stop": { + "setFalse": { "type": "gpii.androidActivityManager.stopTalkback" }, - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.neverRunning" }] } @@ -412,11 +412,11 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": { + "setTrue": { "type": "gpii.androidActivityManager.startActivityByPackageName", "packageName": "se.omnitor.ecmobile" }, - "stop": [ + "setFalse": [ { "type": "gpii.androidActivityManager.stopActivityByPackageName", "packageName": "se.omnitor.ecmobile" @@ -425,7 +425,7 @@ "type": "gpii.androidActivityManager.goToHomeScreen" } ], - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.neverRunning" }] } diff --git a/testData/solutions/linux.json5 b/testData/solutions/linux.json5 index 3719d3d5b..b8b984d43 100644 --- a/testData/solutions/linux.json5 +++ b/testData/solutions/linux.json5 @@ -77,28 +77,10 @@ } }, "launcher": { - "type": "gpii.launchHandlers.flexibleHandler", + "type": "gpii.gsettings.launch", "options": { - "start": { - "type": "gpii.launch.exec", - "command": "gsettings set org.gnome.desktop.a11y.applications screen-magnifier-enabled true" - }, - "stop": { - "type": "gpii.launch.exec", - "command": "gsettings set org.gnome.desktop.a11y.applications screen-magnifier-enabled false" - }, - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "gnome-shell" - }, - { - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-magnifier-enabled", - "value": true - } - ] + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-magnifier-enabled" } } }, @@ -117,6 +99,12 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], + "isRunning": [ + "settings.launcher" + ], "isInstalled": [ { "type": "gpii.packageKit.find", @@ -293,25 +281,10 @@ ] }, "launching": { - "type": "gpii.launchHandlers.flexibleHandler", + "type": "gpii.gsettings.launch", "options": { - "start": { - "type": "gpii.launch.exec", - "command": "gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled true" - }, - "stop": { - "type": "gpii.launch.exec", - "command": "gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled false" - }, - "isRunning": [{ - "type": "gpii.processReporter.find", - "command": "caribou", - }, { - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-keyboard-enabled", - "value": true - }] + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-keyboard-enabled" } } }, @@ -321,6 +294,9 @@ "stop": [ "settings.launching" ], + "isRunning": [ + "settings.launching" + ], "isInstalled": [ { "type": "gpii.packageKit.find", @@ -1081,27 +1057,10 @@ } }, "launcher": { - "type": "gpii.launchHandlers.flexibleHandler", + "type": "gpii.gsettings.launch", "options": { - "verifySettings": true, - "retryOptions": { - "rewriteEvery": 0, - retryInterval: 200 - }, - "start": { - "type": "gpii.launch.exec", - "command": "gsettings set org.gnome.desktop.a11y.applications screen-reader-enabled true" - }, - "stop": { - "type": "gpii.launch.exec", - "command": "gsettings set org.gnome.desktop.a11y.applications screen-reader-enabled false" - }, - "isRunning": [{ // GPII-2306: Add check for Orca process - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-reader-enabled", - "value": true - }] + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" } } }, @@ -1117,6 +1076,9 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], "isInstalled": [ { "type": "gpii.packageKit.find", @@ -1191,15 +1153,15 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": { + "setTrue": { "type": "gpii.launch.exec", "command": "google-chrome http://easy123.org/user/${{userToken}}" }, - "stop": { + "setFalse": { "type": "gpii.launch.exec", "command": "pkill -2 chrome" }, - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.neverRunning" }] } @@ -1211,6 +1173,9 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], "isInstalled": [ { "type": "gpii.packageKit.find", @@ -1247,15 +1212,15 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": { + "setTrue": { "type": "gpii.launch.exec", "command": "google-chrome http://easy123.org/sudan" }, - "stop": { + "setFalse": { "type": "gpii.launch.exec", "command": "pkill -2 chrome" }, - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.neverRunning" }] } @@ -1267,6 +1232,9 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], "isInstalled": [ { "type": "gpii.packageKit.find", @@ -1303,15 +1271,15 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": { + "setTrue": { "type": "gpii.launch.exec", "command": "google-chrome http://webanywhere.cs.washington.edu/beta/?starting_url=http%3A%2F%2Fcloud4all.info" }, - "stop": { + "setFalse": { "type": "gpii.launch.exec", "command": "pkill -2 chrome" }, - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.neverRunning" }] } @@ -1323,6 +1291,9 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], "isInstalled": [ { "type": "gpii.packageKit.find", diff --git a/testData/solutions/win32.json5 b/testData/solutions/win32.json5 index afb0b8d37..ae0768ff0 100644 --- a/testData/solutions/win32.json5 +++ b/testData/solutions/win32.json5 @@ -563,19 +563,19 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "isRunning": [ + "getState": [ { "type": "gpii.processReporter.find", "command": "jaws" } ], - "start": [ + "setTrue": [ { "type": "gpii.launch.exec", "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\JAWS17.exe\\}\"" } ], - "stop": [ + "setFalse": [ { "type": "gpii.windows.closeProcessByName", "filename": "jfw.exe" @@ -637,19 +637,19 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": [ + "setTrue": [ { "type": "gpii.launch.exec", "command": "\"${{registry}.HKEY_CURRENT_USER\\Software\\Texthelp\\Read&Write11\\InstallPath}\\ReadAndWrite.exe\"" } ], - "stop": [ + "setFalse": [ { "type": "gpii.windows.closeProcessByName", "filename": "ReadAndWrite.exe" } ], - "isRunning": [ + "getState": [ { "type": "gpii.processReporter.find", "command": "readandwrite" @@ -792,21 +792,21 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": [ + "setTrue": [ { "type": "gpii.windows.enableRegisteredAT", "name": "magnifierpane", "enable": true } ], - "stop": [ + "setFalse": [ { "type": "gpii.windows.enableRegisteredAT", "name": "magnifierpane", "enable": false } ], - "isRunning": [ + "getState": [ { "type": "gpii.processReporter.find", "command": "Magnify" @@ -866,21 +866,21 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": [ + "setTrue": [ { "type": "gpii.windows.enableRegisteredAT", "name": "osk", "enable": true } ], - "stop": [ + "setFalse": [ { "type": "gpii.windows.enableRegisteredAT", "name": "osk", "enable": false } ], - "isRunning": [ + "getState": [ { "type": "gpii.processReporter.find", "command": "osk" @@ -1287,19 +1287,19 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "isRunning": [ + "getState": [ { "type": "gpii.processReporter.find", "command": "nvda" } ], - "start": [ + "setTrue": [ { "type": "gpii.launch.exec", "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\nvda.exe\\}\"" } ], - "stop": [ + "setFalse": [ { "type": "gpii.windows.closeProcessByName", "filename": "nvda_service.exe" @@ -1355,15 +1355,15 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": { + "setTrue": { "type": "gpii.launch.exec", "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\firefox.exe\\}\" http://easy123.org/user/${{userToken}}" }, - "stop": { + "setFalse": { "type": "gpii.windows.closeProcessByName", "filename": "firefox.exe" }, - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.neverRunning" }] } @@ -1402,15 +1402,15 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": { + "setTrue": { "type": "gpii.launch.exec", "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\firefox.exe\\}\" http://easy123.org/sudan" }, - "stop": { + "setFalse": { "type": "gpii.windows.closeProcessByName", "filename": "firefox.exe" }, - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.neverRunning" }] } @@ -1449,15 +1449,15 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": { + "setTrue": { "type": "gpii.launch.exec", "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\firefox.exe\\}\" \"http://webanywhere.cs.washington.edu/beta/?starting_url=http%3A%2F%2Fcloud4all.info\"" }, - "stop": { + "setFalse": { "type": "gpii.windows.closeProcessByName", "filename": "firefox.exe" }, - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.neverRunning" }] } @@ -1545,19 +1545,19 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": [ + "setTrue": [ { "type": "gpii.launch.exec", "command": "${{environment}.ComSpec} /c \"cd ${{environment}.MAAVIS_HOME} && MaavisPortable.cmd\"" } ], - "stop": [ + "setFalse": [ { "type": "gpii.windows.closeProcessByName", "filename": "firefox.exe" } ], - "isRunning": [ + "getState": [ { "type": "gpii.processReporter.find", "command": "MaavisPortable" @@ -2402,10 +2402,10 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": [{ + "setTrue": [{ "type": "gpii.windows.spiSettingsHandler.updateCursors" }], - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.neverRunning" }] } @@ -2486,19 +2486,19 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": [ + "setTrue": [ { "type": "gpii.launch.exec", "command": "C:\\Sociable\\Cloud4All.exe" } ], - "stop": [ + "setFalse": [ { "type": "gpii.launch.exec", "command": "C:\\Sociable\\Cloud4All.exe -stop" } ], - "isRunning": [ + "getState": [ { "type": "gpii.processReporter.find", "command": "Cloud4Allcd " diff --git a/tests/ContextIntegrationTests.js b/tests/ContextIntegrationTests.js index bafdbab73..8d63c70f7 100644 --- a/tests/ContextIntegrationTests.js +++ b/tests/ContextIntegrationTests.js @@ -218,7 +218,7 @@ gpii.tests.contextIntegration.data = { gpii.tests.contextIntegration.fixtures = [ { name: "Simple context change after login", - expect: 9, + expect: 7, sequenceSegments: [ [ { @@ -246,7 +246,6 @@ gpii.tests.contextIntegration.fixtures = [ args: ["{lifecycleManager}", "context1", "gpii-default"] } ], - gpii.test.createProcessChecks(gpii.tests.contextIntegration.data.processes, "expectConfigured"), gpii.tests.contextIntegration.changeEnvironmentAndCheck("bright"), [ { @@ -256,7 +255,6 @@ gpii.tests.contextIntegration.fixtures = [ listener: "gpii.test.logoutRequestListen" } ], - gpii.test.createProcessChecks(gpii.tests.contextIntegration.data.processes, "expectRestored"), [ { func: "gpii.test.checkRestoredConfiguration", @@ -270,7 +268,7 @@ gpii.tests.contextIntegration.fixtures = [ }, { name: "Context changed before login", - expect: 6, + expect: 5, sequenceSegments: [ [ { @@ -310,7 +308,6 @@ gpii.tests.contextIntegration.fixtures = [ listener: "gpii.test.logoutRequestListen" } ], - gpii.test.createProcessChecks(gpii.tests.contextIntegration.data.processes, "expectRestored"), [ { func: "gpii.test.checkRestoredConfiguration", @@ -323,7 +320,7 @@ gpii.tests.contextIntegration.fixtures = [ ] }, { name: "Multiple context changes", - expect: 15, + expect: 13, sequenceSegments: [ [ { @@ -351,7 +348,6 @@ gpii.tests.contextIntegration.fixtures = [ args: ["{lifecycleManager}", "context1", "gpii-default"] } ], - gpii.test.createProcessChecks(gpii.tests.contextIntegration.data.processes, "expectConfigured"), gpii.tests.contextIntegration.changeEnvironmentAndCheck("bright"), gpii.tests.contextIntegration.changeEnvironmentAndCheck("gpii-default"), gpii.tests.contextIntegration.changeEnvironmentAndCheck("noise"), @@ -364,7 +360,6 @@ gpii.tests.contextIntegration.fixtures = [ listener: "gpii.test.logoutRequestListen" } ], - gpii.test.createProcessChecks(gpii.tests.contextIntegration.data.processes, "expectRestored"), [ { func: "gpii.test.checkRestoredConfiguration", diff --git a/tests/platform/linux/linux-builtIn-testSpec.js b/tests/platform/linux/linux-builtIn-testSpec.js index fdfa87226..e7a84170c 100644 --- a/tests/platform/linux/linux-builtIn-testSpec.js +++ b/tests/platform/linux/linux-builtIn-testSpec.js @@ -15,9 +15,12 @@ Seventh Framework Programme (FP7/2007-2013) under grant agreement no. 289016. "use strict"; + var fluid = require("infusion"), gpii = fluid.registerNamespace("gpii"); +fluid.logObjectRenderChars = 2048 + fluid.require("%universal"); gpii.loadTestingSupport(); @@ -29,7 +32,7 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ name: "Testing os_common using default matchmaker", userToken: "os_common", integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.desktop.a11y.magnifier": [{ "settings": { "running": false @@ -68,40 +71,23 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ } }] }, - "gpii.launchHandlers.flexibleHandler": { - "org.gnome.desktop.a11y.applications.onscreen-keyboard": [{ + "gpii.gsettings.launch": { + "org.gnome.desktop.a11y.magnifier": [{ "settings": { "running": true }, "options": { - // start and stop blocks omitted for size/clarity - "isRunning": [{ - "type": "gpii.processReporter.find", - "command": "caribou" - }, { - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-keyboard-enabled", - "value": true - }] + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-magnifier-enabled" } }], - "org.gnome.desktop.a11y.magnifier": [{ + "org.gnome.desktop.a11y.applications.onscreen-keyboard": [{ "settings": { "running": true }, "options": { - // start and stop blocks omitted for size/clarity - "isRunning": [{ - "type": "gpii.processReporter.find", - "command": "gnome-shell" - }, - { - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-magnifier-enabled", - "value": true - }] + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-keyboard-enabled" } }] } @@ -128,7 +114,7 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ name: "Testing os_gnome using default matchmaker", userToken: "os_gnome", integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.desktop.a11y.magnifier": [{ "settings": { "running": false @@ -164,23 +150,14 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ } }] }, - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.desktop.a11y.magnifier": [{ "settings": { "running": true }, "options": { - // start and stop blocks omitted for size/clarity - "isRunning": [{ - "type": "gpii.processReporter.find", - "command": "gnome-shell" - }, - { - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-magnifier-enabled", - "value": true - }] + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-magnifier-enabled" } }] } @@ -190,7 +167,7 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ name: "Testing os_win7 using default matchmaker", userToken: "os_win7", integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.desktop.a11y.magnifier": [{ "settings": { "running": false @@ -222,27 +199,17 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ } }] }, - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.desktop.a11y.magnifier": [{ "settings": { "running": true }, "options": { - // start and stop blocks omitted for size/clarity - "isRunning": [{ - "type": "gpii.processReporter.find", - "command": "gnome-shell" - }, - { - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-magnifier-enabled", - "value": true - }] + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-magnifier-enabled" } }] } - } } ]); diff --git a/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js b/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js index aae5de0c6..94c1689c7 100644 --- a/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js +++ b/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js @@ -30,7 +30,7 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ gradeNames: "gpii.test.integration.deviceReporterAware.linux", userToken: "screenreader_common", integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { "running": false @@ -63,19 +63,14 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { "running": true }, "options": { - // start and stop blocks omitted for size/clarity - "isRunning": [{ - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-reader-enabled", - "value": true - }] + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" } }] } @@ -91,7 +86,7 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ gradeNames: "gpii.test.integration.deviceReporterAware.linux", userToken: "screenreader_orca", integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { "running": false @@ -123,19 +118,14 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { "running": true }, "options": { - // start and stop blocks omitted for size/clarity - "isRunning": [{ - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-reader-enabled", - "value": true - }] + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" } }] } @@ -151,7 +141,7 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ gradeNames: "gpii.test.integration.deviceReporterAware.linux", userToken: "screenreader_nvda", integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { "running": false @@ -182,19 +172,14 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { "running": true }, "options": { - // start and stop blocks omitted for size/clarity - "isRunning": [{ - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-reader-enabled", - "value": true - }] + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" } }] } diff --git a/tests/platform/linux/linux-orca-testSpec.js b/tests/platform/linux/linux-orca-testSpec.js index e87e81c34..644642d8b 100644 --- a/tests/platform/linux/linux-orca-testSpec.js +++ b/tests/platform/linux/linux-orca-testSpec.js @@ -22,6 +22,8 @@ fluid.require("%universal"); gpii.loadTestingSupport(); +fluid.logObjectRenderChars = 8000 + fluid.registerNamespace("gpii.tests.linux.orca"); gpii.tests.linux.orca.testDefs = [ @@ -29,7 +31,7 @@ gpii.tests.linux.orca.testDefs = [ name: "Testing screenreader_common using Flat matchmaker", userToken: "screenreader_common", integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { "running": false @@ -62,19 +64,14 @@ gpii.tests.linux.orca.testDefs = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { "running": true }, "options": { - // start and stop blocks omitted for size/clarity - "isRunning": [{ - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-reader-enabled", - "value": true - }] + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" } }] } @@ -84,7 +81,7 @@ gpii.tests.linux.orca.testDefs = [ name: "Testing screenreader_orca using Flat matchmaker", userToken: "screenreader_orca", integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { "running": false @@ -116,19 +113,14 @@ gpii.tests.linux.orca.testDefs = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { "running": true }, "options": { - // start and stop blocks omitted for size/clarity - "isRunning": [{ - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-reader-enabled", - "value": true - }] + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" } }] } @@ -138,7 +130,7 @@ gpii.tests.linux.orca.testDefs = [ name: "Testing screenreader_nvda using Flat matchmaker", userToken: "screenreader_nvda", integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { "running": false @@ -169,19 +161,14 @@ gpii.tests.linux.orca.testDefs = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { "running": true }, "options": { - // start and stop blocks omitted for size/clarity - "isRunning": [{ - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-reader-enabled", - "value": true - }] + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" } }] } From ac4f90ea0f1dd1f79c374ea035848b09c1e16419 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 8 Mar 2017 22:57:34 +0100 Subject: [PATCH 06/26] GPII-1230: Working with already running solutions plus other minor improvements --- documentation/SolutionsRegistryFormat.md | 8 +- .../lifecycleManager/src/LifecycleManager.js | 118 ++++++++++++++---- .../test/js/LifecycleManagerTests.js | 49 ++++++++ .../src/settingsHandlerUtilities.js | 41 +++++- gpii/node_modules/testing/src/Integration.js | 23 ++-- gpii/node_modules/testing/src/Testing.js | 13 +- testData/solutions/linux.json5 | 5 + .../platform/linux/linux-builtIn-testSpec.js | 16 +++ .../linux-dynamicDeviceReporter-testSpec.js | 12 ++ tests/platform/linux/linux-orca-testSpec.js | 12 ++ .../windows/windows-builtIn-testSpec.js | 35 +++++- .../windows-dynamicDeviceReporter-testSpec.js | 18 ++- .../platform/windows/windows-jaws-testSpec.js | 36 +++++- .../windows/windows-maavis-testSpec.js | 18 ++- .../platform/windows/windows-nvda-testSpec.js | 27 +++- .../windows/windows-readWrite-testSpec.js | 18 ++- 16 files changed, 379 insertions(+), 70 deletions(-) diff --git a/documentation/SolutionsRegistryFormat.md b/documentation/SolutionsRegistryFormat.md index 969e78b0a..c7a6a7379 100644 --- a/documentation/SolutionsRegistryFormat.md +++ b/documentation/SolutionsRegistryFormat.md @@ -14,7 +14,7 @@ Each entry in the solution registry should have a unique ID (`Solution.id` in th "start": [ .. ], "stop": [ .. ], "isInstalled": [ .. ], - + // Not yet supported. Post-Cloud4All features. "install": [ ... ], "uninstall": [ ... ], @@ -116,7 +116,7 @@ These four lifecycle blocks have different meanings to the system but has the sa * `start`: Launch/start the solution * `stop`: Stop/kill the solution -Each of these lifecycle blocks allow the same content - which is an array with entries that are either references to settingsHandlers blocks or customized lifecycle blocks. To reference a settingsHandler block, the keywork `settings.` is used, where `` should be replaced with the name of a settingsHandler block. In the case of `configure` and `start`, a consequence of referencing a settingsHandler is that the settings given in the settingsHandler and users preferences set will be applied to that solution (and their original values will be saved to the system - if user just logged in). In the case of `restore` and `stop`, the settings that has previously been written using the settingshandler(s) in question will be restored. Alternative to referencings setting and restoring settings, arbitrary lifecycle actions are allowed - the syntax for this is an object that contains at least a `type` key for the function to call. None of these blocks are mandatory. +Each of these lifecycle blocks allow the same content - which is an array with entries that are either references to settingsHandlers blocks or customized lifecycle blocks. To reference a settingsHandler block, the keywork `settings.` is used, where `` should be replaced with the name of a settingsHandler block. In the case of `configure` and `start`, a consequence of referencing a settingsHandler is that the settings given in the settingsHandler and users preferences set will be applied to that solution (and their original values will be saved to the system - if user just logged in). In the case of `restore` and `stop`, the settings that has previously been written using the settingshandler(s) in question will be restored. Alternative to referencings setting and restoring settings, arbitrary lifecycle actions are allowed - the syntax for this is an object that contains at least a `type` key for the function to call. None of these blocks are mandatory. **Example blocks**: ``` @@ -144,7 +144,7 @@ Each of these lifecycle blocks allow the same content - which is an array with e The `update` block works very similarly to the configure, restore, start and stop blocks. It describes what should happen when the configuration needs to be updated (e.g. due to context changes, PCP adjustments, etc). -The format of the `update` block allows for the same entries as the configure, restore, start and stop blocks - that is: arbitrary lifecycle action blocks and `settings.`. Unlike for the other lifecycle blocks, the `update` block furthermore allows references to the `start`, `stop` and `configure` blocks. This is one by putting a string with the name of that block. When the system encounters one of these references, the entries of that block will be run. +The format of the `update` block allows for the same entries as the configure, restore, start and stop blocks - that is: arbitrary lifecycle action blocks and `settings.`. Unlike for the other lifecycle blocks, the `update` block furthermore allows references to the `start`, `stop` and `configure` blocks. This is done by putting a string with the name of that block. When the system encounters one of these references, the entries of that block will be run. **Example block**: ``` @@ -204,7 +204,7 @@ This is run before configuration to ensure that the application is actually read **Example Entry**: ``` -"isConfigurable": [{ +"isConfigurable": [{ "type": "gpii.reporter.fileExists", "path": "${{environment}.XDG_DATA_HOME}/orca/user-settings.conf"" }] diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index 36c32727d..e58e8f8f7 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -94,8 +94,13 @@ var gpii = fluid.registerNamespace("gpii"); args: ["{that}", "{arguments}.0", "{arguments}.1", "{arguments}.2", "{arguments}.3", "{arguments}.4"] // solutionId, settingsHandlers, actions, session, rootAction }, - invokeSettingsHandler: { - funcName: "gpii.lifecycleManager.invokeSettingsHandler", + invokeSettingsHandlerGet: { + funcName: "gpii.lifecycleManager.invokeSettingsHandlerGet", + args: ["{that}", "{arguments}.0", "{arguments}.1"] + // solutionId, settingsHandlers + }, + invokeSettingsHandlerSet: { + funcName: "gpii.lifecycleManager.invokeSettingsHandlerSet", args: ["{that}", "{arguments}.0", "{arguments}.1"] // solutionId, settingsHandlers }, @@ -103,6 +108,11 @@ var gpii = fluid.registerNamespace("gpii"); funcName: "gpii.lifecycleManager.restoreSnapshot", args: ["{that}", "{arguments}.0"] // originalSettings + }, + getSolutionRunningState: { + funcName: "gpii.lifecycleManager.getSolutionRunningState", + args: ["{that}", "{arguments}.0", "{arguments}.1", "{arguments}.2"] + // solutionId, solution, session } } }); @@ -171,19 +181,27 @@ var gpii = fluid.registerNamespace("gpii"); return fluid.get(armoured, [solutionId, 0]); }; - /** + gpii.lifecycleManager.invokeSettingsHandlerGet = function (that, solutionId, handlerSpec) { + // first prepare the payload for the settingsHandler in question - a more efficient + // implementation might bulk together payloads destined for the same handler + var settingsHandlerPayload = gpii.lifecycleManager.specToSettingsHandler(solutionId, handlerSpec); + var resolvedName = that.nameResolver.resolveName(handlerSpec.type, "settingsHandler"); + return gpii.settingsHandlers.dispatchSettingsHandlerGet(resolvedName, settingsHandlerPayload); + }; + + /** * @param handlerSpec {Object} A single settings handler specification * Payload example: * http://wiki.gpii.net/index.php/Settings_Handler_Payload_Examples * Transformer output: * http://wiki.gpii.net/index.php/Transformer_Payload_Examples */ - gpii.lifecycleManager.invokeSettingsHandler = function (that, solutionId, handlerSpec) { + gpii.lifecycleManager.invokeSettingsHandlerSet = function (that, solutionId, handlerSpec) { // first prepare the payload for the settingsHandler in question - a more efficient // implementation might bulk together payloads destined for the same handler var settingsHandlerPayload = gpii.lifecycleManager.specToSettingsHandler(solutionId, handlerSpec); var resolvedName = that.nameResolver.resolveName(handlerSpec.type, "settingsHandler"); - var setSettingsPromise = gpii.settingsHandlers.dispatchSettingsHandler(resolvedName, settingsHandlerPayload, that.options.retryOptions); + var setSettingsPromise = gpii.settingsHandlers.dispatchSettingsHandlerSet(resolvedName, settingsHandlerPayload, that.options.retryOptions); var togo = fluid.promise(); setSettingsPromise.then(function (handlerResponse) { @@ -226,13 +244,18 @@ var gpii = fluid.registerNamespace("gpii"); var toSnapshot = fluid.copy(solutionRecord); toSnapshot.settingsHandlers = {}; toSnapshot.settingsHandlers[settingsHandlerBlockName] = snapshot; - if (rootAction === "start") { - session.applier.change(["originalSettings", solutionId], toSnapshot); - } else if (rootAction === "update") { - // if we're doing an update, keep the settings that are already stored from the + if (rootAction === "start" || rootAction === "update") { + // keep the settings that are already stored from the // original snapshot, but augment it with any settings from the new snapshot // that were not present in the original snapshot. - // This workflow is tested in LifecycleManagerTests.js "Updating with normal reference to settingsHandler block, and 'undefined' value stored in snapshot" + // + // This is relevant when doing an update for obvious reasons + // (and tested) in LifecycleManagerTests.js "Updating with normal reference to settingsHandler block, and 'undefined' value stored in snapshot" + // + // It is also relevant for logins ("start" root action), in case a solution is already running. + // This would trigger a call to its "update" block. If that in turn eg. looks like the following + // [ "stop", "configure", "start" ] we would want the original state recorded during the "stop" + // action to persist - even when the "start" block is later run var mergedSettings = fluid.extend(true, {}, toSnapshot, session.model.originalSettings[solutionId]); var cleanedSettings = gpii.lifecycleManager.transformSolutionSettings(mergedSettings, gpii.lifecycleManager.cleanDeletes); session.applier.change(["originalSettings", solutionId], cleanedSettings); @@ -260,7 +283,7 @@ var gpii = fluid.registerNamespace("gpii"); * @param settingsHandlerBlockName {String} should be a reference to a settings block from the * settingsHandlers section. * @param rootAction {String} The root action on the LifecycleManager which is being serviced: "start", "stop", - * "update" or "restore" + * "update", "restore" or "isRunning" * @return {Function} a nullary function (a task), that once executed will set the settings returning a promise * that will be resolved once the settings are successfully set. */ @@ -272,13 +295,17 @@ var gpii = fluid.registerNamespace("gpii"); } return function () { var expanded = session.localResolver(settingsHandlerBlock); - var settingsPromise = that.invokeSettingsHandler(solutionId, expanded); - settingsPromise.then(function (snapshot) { - session.applier.change(["appliedSolutions", solutionId], solutionRecord); - gpii.lifecycleManager.recordSnapshotInSession(that, snapshot, solutionId, solutionRecord, session, - settingsHandlerBlockName, rootAction); - }); - return gpii.lifecycleManager.wrapRestorePromise(settingsPromise, rootAction); + if (rootAction === "isRunning") { // only run get and return directly if where checking for running applications + return that.invokeSettingsHandlerGet(solutionId, expanded); + } else { + var settingsPromise = that.invokeSettingsHandlerSet(solutionId, expanded); + settingsPromise.then(function (snapshot) { + session.applier.change(["appliedSolutions", solutionId], solutionRecord); + gpii.lifecycleManager.recordSnapshotInSession(that, snapshot, solutionId, solutionRecord, session, + settingsHandlerBlockName, rootAction); + }); + return gpii.lifecycleManager.wrapRestorePromise(settingsPromise, rootAction); + } }; }; @@ -385,7 +412,7 @@ var gpii = fluid.registerNamespace("gpii"); var settingsHandlerBlockName = action.substring("settings.".length); // if this is related to launching, overwrite entry with the appropriate settings, // that is: { running: true } if we're in a start block, else { running: false } - if (actionBlock === "start" || actionBlock === "stop") { + if (actionBlock === "start" || (actionBlock === "stop" && rootAction !== "stop") || actionBlock === "isRunning") { var launchSettings = { running: actionBlock === "start" ? true : false }; fluid.set(solutionRecord, [ "settingsHandlers", settingsHandlerBlockName, "settings"], launchSettings); } @@ -398,10 +425,13 @@ var gpii = fluid.registerNamespace("gpii"); if (action === "start" || action === "configure") { return that.executeActions(solutionId, solutionRecord, session, action, rootAction); } else if (action === "stop") { + // TODO KASPER -- OVERVEJ AT GENINDFØRE DET NEDENSTÅENDE // This branch is used when an "update" action requires a stop and start of the solution - var unarmoured = gpii.lifecycleManager.transformSolutionSettings( - session.model.originalSettings[solutionId], gpii.settingsHandlers.changesToSettings); - return that.executeActions(solutionId, unarmoured, session, "stop", rootAction); + // var unarmoured = gpii.lifecycleManager.transformSolutionSettings( + // session.model.originalSettings[solutionId], gpii.settingsHandlers.changesToSettings); + // return that.executeActions(solutionId, unarmoured, session, "stop", rootAction); + // TODO KASPER: Har erstattet ovenstående med: + return that.executeActions(solutionId, solutionRecord, session, "stop", rootAction); } else { fluid.fail("Unrecognised string action in LifecycleManager: " + action + " inside 'update' section for solution " + solutionId); @@ -455,7 +485,9 @@ var gpii = fluid.registerNamespace("gpii"); gpii.lifecycleManager.restoreSystem = function (that, session, rootAction) { var promises = fluid.transform(session.model.originalSettings, function (changesSolutionRecord, solutionId) { var solutionRecord = gpii.lifecycleManager.transformSolutionSettings(changesSolutionRecord, gpii.settingsHandlers.changesToSettings); - return that.applySolution(solutionId, solutionRecord, session, [ "stop", "restore" ], rootAction); + // if a solution was running on login, run the update block to ensure that restored settings are applied + var actions = session.model.runningOnLogin[solutionId] ? [ "update" ] : [ "stop", "restore" ]; + return that.applySolution(solutionId, solutionRecord, session, actions, rootAction); }); // TODO: In theory we could stop all solutions in parallel @@ -483,6 +515,19 @@ var gpii = fluid.registerNamespace("gpii"); }); }; + gpii.lifecycleManager.getSolutionRunningState = function (that, solutionId, solutionRecord, session) { + if (!fluid.isDestroyed(that)) { + var promise = that.executeActions(solutionId, solutionRecord, session, "isRunning", "isRunning"); + var togo = fluid.promise(); + promise.then(function (val) { + var isRunning = fluid.get(val, [0, solutionId, 0, "settings", "running"]); + session.applier.change(["runningOnLogin", solutionId], isRunning); + togo.resolve(isRunning); + }); + return togo; + } + }; + /** * Structure of lifecycleManager options: * userid: userid, @@ -561,9 +606,32 @@ var gpii = fluid.registerNamespace("gpii"); fluid.each(lifecycleInstructions, function (solution, solutionId) { tasks.push(function () { if (!fluid.isDestroyed(that)) { // See above comment for GPII-580 + // check the current state of the solution to decide whether we should run the + // "update", "start" or "stop" directive + return that.getSolutionRunningState(solutionId, solution, session); + } + }); + tasks.push(function () { + if (!fluid.isDestroyed(that)) { // See above comment for GPII-580 + // if solution is already running, call "update" directive - else use "start" directive + var isRunning = session.model.runningOnLogin[solutionId]; + var actions; + if (isRunning === true) { // if it's already running + if (solution.active === false) { // and it shouldn't + actions = [ "stop", "configure" ]; + } else { // else call "update" to make changes apply to a running solutions + actions = [ "update" ]; + } + } else { // if it is not running + if (solution.active === true) { // and we want it to run + actions = [ "configure", "start" ]; + } else { // else just configure it + actions = [ "configure" ] + } + } + // build structure for returned values (for later reset) - return that.applySolution(solutionId, solution, session, - (solution.active ? [ "configure", "start" ] : [ "configure" ]), "start"); + return that.applySolution(solutionId, solution, session, actions, "start"); } }); }); diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index 406df736d..92c65e257 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -673,6 +673,54 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt }); }; + gpii.tests.lifecycleManager.isRunningTests = function () { + jqUnit.asyncTest("Tests for correct behavior when application is not already running", function () { + // call start block for solution + gpii.tests.lifecycleManager.setup(); + // 2 tests for the settingsHandler (see mockSettingsHandler function above) + // 2 tests for the launchHandler (see mockLaunchHandler function above) + // and the two asserts below + jqUnit.expect(5); + var lifecycleManager = gpii.lifecycleManager(gpii.tests.lifecycleManager.testOptions); + gpii.tests.lifecycleManager.initBackingMock(); + + lifecycleManager.start(gpii.tests.lifecycleManager.startPayload, function () { + gpii.tests.lifecycleManager.assertExpectedExec(); + // gpii.tests.lifecycleManager.assertExpectedSettingsHandler(" - on start", gpii.tests.lifecycleManager.settingsHandlerExpectedInputNewSettings); + // lifecycleManager.stop(gpii.tests.lifecycleManager.userOptions, function () { + // gpii.tests.lifecycleManager.assertExpectedSettingsHandler(" - on stop", gpii.tests.lifecycleManager.settingsHandlerExpectedInputRestoreSettings); + // jqUnit.assertEquals("Expected pid has been sent to kill handler", + // 8839, gpii.tests.lifecycleManager.staticRepository.killHandler.pid); + // gpii.tests.lifecycleManager.assertNoActiveSessions(lifecycleManager, "stop: Stop message to lifecycle manager"); + // jqUnit.start(); + // }); + jqUnit.start(); + }); + + // expect the isRunning block to be called (will return false) + // do NOT expect the 'update' block to be called + // DO expect the 'start' block to be called + // the correct state should be stored + // the correct state should be applied + // on logout DO expect the 'stop' block to be called + // the correct state should be restored + + // TEST: Running on startup - no reference to start/stop block in update + // call start block for solution + // get for isRunning block should be called (will return true) + // Expect the update block to be called + // do NOT expect the start block to be called + // The correct state should be stored + // The correct state should be applied + // on logout, update should be called + // do NOT expect the stop block to be called + // + + + // TEST: Running on startup + }); + }; + gpii.tests.lifecycleManager.settingsToChanges = function (expected) { return gpii.settingsHandlers.transformOneSolutionSettings(expected, gpii.settingsHandlers.settingsToChanges); }; @@ -685,6 +733,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt jqUnit.module("Lifecycle Manager", function () { gpii.tests.staticRepository = {}; }); + gpii.tests.lifecycleManager.isRunningTests(); jqUnit.test("gpii.lifecycleManager.specToSettingsHandler()", function () { fluid.each(gpii.tests.lifecycleManager.specToSettingsHandlerTests, function (spec, name) { diff --git a/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js b/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js index 0bccbf2a9..0aeee8d44 100644 --- a/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js +++ b/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js @@ -258,7 +258,38 @@ gpii.settingsHandlers.checkRereadSettings = function (that) { }; /** - * Called to invoke settings handlers. Based on the first verifySettings option found in the payload, + * Called to invoke settings handlers' get functionality. + + * Structure of 'payload' argument is: + * { + * "some.app.id": [{ + * "settings": { ... }, + * "options": { + * ..., + * "verifySettings": true + * } + * }] + * } + * @param resolvedName {String} The resolved "trunk name" of the settings handler to be invoked - e.g. gpii.windows.registrySettingsHandler + * @param payload {Object} The full payload that would be sent to the SET method of the settings handler + * @return a promise that will yield the original payload of the invoked GET method + */ +gpii.settingsHandlers.dispatchSettingsHandlerGet = function (resolvedName, payload, retryOptions) { + // TODO "gpii.lifecycleManager.specToSettingsHandler" is the one responsible for this awkward + // layout of the settings handler payload - all of this infrastructure will have to be updated + // and cleaned up at some point + try { + var solutionIds = fluid.keys(payload); + return gpii.settingsHandlers.invokeGetHandler(resolvedName, payload); + } catch (e) { + fluid.log(fluid.logLevel.WARN, "Error received when dispatching settingsHandler.get " + resolvedName + " with payload ", + payload, ": " + e); + return fluid.promise().reject(e); + } +}; + +/** + * Called to invoke settings handlers' set function. Based on the first verifySettings option found in the payload, * the settingshandler will be invoked with retrying enabled (if true) or without it (false). * Structure of 'payload' argument is: * { @@ -278,7 +309,7 @@ gpii.settingsHandlers.checkRereadSettings = function (that) { * @return a promise that will yield the original payload of the invoked SET method. In the case * that retrying is enabled, a rejection occurs if the GET payloads never match after the end of the nominated retry period */ -gpii.settingsHandlers.dispatchSettingsHandler = function (resolvedName, payload, retryOptions) { +gpii.settingsHandlers.dispatchSettingsHandlerSet = function (resolvedName, payload, retryOptions) { // TODO "gpii.lifecycleManager.specToSettingsHandler" is the one responsible for this awkward // layout of the settings handler payload - all of this infrastructure will have to be updated // and cleaned up at some point @@ -290,12 +321,16 @@ gpii.settingsHandlers.dispatchSettingsHandler = function (resolvedName, payload, gpii.settingsHandlers.invokeRetryingHandler(resolvedName, payload, retryOptions) : gpii.settingsHandlers.invokeSetHandler(resolvedName, payload); } catch (e) { - fluid.log(fluid.logLevel.WARN, "Error received when dispatching settingsHandler " + resolvedName + " with payload ", + fluid.log(fluid.logLevel.WARN, "Error received when dispatching settingsHandler.set " + resolvedName + " with payload ", payload, ": " + e); return fluid.promise().reject(e); } }; +gpii.settingsHandlers.invokeGetHandler = function (resolvedName, payload) { + return gpii.toPromise(fluid.invokeGlobalFunction(resolvedName + ".get", [payload])); +}; + gpii.settingsHandlers.invokeSetHandler = function (resolvedName, payload) { return gpii.toPromise(fluid.invokeGlobalFunction(resolvedName + ".set", [payload])); }; diff --git a/gpii/node_modules/testing/src/Integration.js b/gpii/node_modules/testing/src/Integration.js index 8666a14a7..d55dae021 100644 --- a/gpii/node_modules/testing/src/Integration.js +++ b/gpii/node_modules/testing/src/Integration.js @@ -39,17 +39,11 @@ gpii.test.integration.exec.exec = function (that, processSpec /*, expected */) { that.events.onExecExit.fire(true, processSpec); }; -gpii.test.integration.prepopulateSettingsStore = function (testCaseHolder, settings) { - fluid.extend(true, testCaseHolder.settingsStore, { orig: settings }); +gpii.test.integration.prepopulateSettingsStore = function (testCaseHolder, nameResolver) { + var settingsHandlers = testCaseHolder.options.integrationPrepopulation; + gpii.test.setSettings(settingsHandlers, nameResolver); }; -gpii.test.integration.prepopulateSettingsSequence = fluid.freezeRecursive([ - { - func: "gpii.test.integration.prepopulateSettingsStore", - args: [ "{testCaseHolder}", "{testCaseHolder}.options.integrationPrepopulation" ] - } -]); - fluid.defaults("gpii.test.integration.testCaseHolder", { gradeNames: ["gpii.test.common.testCaseHolder"], // TODO: Namespace these distributions so they can be overridden @@ -75,6 +69,12 @@ fluid.defaults("gpii.test.integration.testCaseHolder", { target: "{that lifecycleManager > variableResolver}.options.components.resolverConfig.type", record: "gpii.test.integration.standardResolverConfig" }], + invokers: { + prepopulateSettingsStore: { + funcName: "gpii.test.integration.prepopulateSettingsStore", + args: [ "{that}", "{nameResolver}" ] + } + }, components: { exec: { type: "gpii.test.integration.exec" @@ -96,6 +96,9 @@ fluid.defaults("gpii.test.integration.testCaseHolder", { } } } + }, + listeners: { + "onCreate.prepopulateSettingsStore": "{that}.prepopulateSettingsStore" } }); @@ -416,7 +419,7 @@ fluid.defaults("gpii.test.integration.mockSettingsHandlerRegistry.linux", { optionsPathKey: "NONE" }, "gpii.gsettings.launch": { - optionsPathkey: gpii.test.integration.gsettingsLaunchKey + optionsPathKey: gpii.test.integration.gsettingsLaunchKey } } }); diff --git a/gpii/node_modules/testing/src/Testing.js b/gpii/node_modules/testing/src/Testing.js index 8d8f7f722..b8c85fa8b 100644 --- a/gpii/node_modules/testing/src/Testing.js +++ b/gpii/node_modules/testing/src/Testing.js @@ -369,10 +369,6 @@ gpii.test.push = function (array, elements) { * snapshot, login, expectConfigured, logout and expectRestored */ gpii.test.buildSingleTestFixture = function (testDef, rootGrades) { - var isIntegrationTest = fluid.find(rootGrades, function (val) { - return val.startsWith("gpii.test.integration") ? true : undefined; - }); - testDef.gradeNames = fluid.makeArray(testDef.gradeNames).concat(fluid.makeArray(rootGrades)); testDef.expect = 4; @@ -381,11 +377,6 @@ gpii.test.buildSingleTestFixture = function (testDef, rootGrades) { gpii.test.unshift(testDef.sequence, gpii.test.loginSequence); gpii.test.unshift(testDef.sequence, gpii.test.initialSequence); - // if integration test, prepopulate 'settings' for process reporter - if (isIntegrationTest) { - gpii.test.unshift(testDef.sequence, gpii.test.integration.prepopulateSettingsSequence); - } - gpii.test.push(testDef.sequence, gpii.test.logoutSequence); gpii.test.push(testDef.sequence, gpii.test.checkSequence); @@ -419,8 +410,8 @@ gpii.test.recordToTestDefs = function (record) { var testDefs = fluid.copy(fluid.getGlobalValue(record.testDefs)); fluid.each(testDefs, function (testDef) { testDef.config = { - configName: record.configName, - configPath: record.configPath + configName: testDef.configName || record.configName, + configPath: testDef.configPath || record.configPath }; }); return testDefs; diff --git a/testData/solutions/linux.json5 b/testData/solutions/linux.json5 index b8b984d43..06b98d1d4 100644 --- a/testData/solutions/linux.json5 +++ b/testData/solutions/linux.json5 @@ -1064,6 +1064,11 @@ } } }, + "update": [ + "stop", + "configure", + "start" + ], "configure": [ "settings.configuration" ], diff --git a/tests/platform/linux/linux-builtIn-testSpec.js b/tests/platform/linux/linux-builtIn-testSpec.js index e7a84170c..bd0d3970e 100644 --- a/tests/platform/linux/linux-builtIn-testSpec.js +++ b/tests/platform/linux/linux-builtIn-testSpec.js @@ -36,11 +36,19 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ "org.gnome.desktop.a11y.magnifier": [{ "settings": { "running": false + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-magnifier-enabled" } }], "org.gnome.desktop.a11y.applications.onscreen-keyboard": [{ "settings": { "running": false + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-keyboard-enabled" } }] } @@ -118,6 +126,10 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ "org.gnome.desktop.a11y.magnifier": [{ "settings": { "running": false + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-magnifier-enabled" } }] } @@ -171,6 +183,10 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ "org.gnome.desktop.a11y.magnifier": [{ "settings": { "running": false + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-magnifier-enabled" } }] } diff --git a/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js b/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js index 94c1689c7..6a0ff47a4 100644 --- a/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js +++ b/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js @@ -34,6 +34,10 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ "org.gnome.orca": [{ "settings": { "running": false + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" } }] } @@ -90,6 +94,10 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ "org.gnome.orca": [{ "settings": { "running": false + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" } }] } @@ -145,6 +153,10 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ "org.gnome.orca": [{ "settings": { "running": false + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" } }] } diff --git a/tests/platform/linux/linux-orca-testSpec.js b/tests/platform/linux/linux-orca-testSpec.js index 644642d8b..0cb8df889 100644 --- a/tests/platform/linux/linux-orca-testSpec.js +++ b/tests/platform/linux/linux-orca-testSpec.js @@ -35,6 +35,10 @@ gpii.tests.linux.orca.testDefs = [ "org.gnome.orca": [{ "settings": { "running": false + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" } }] } @@ -85,6 +89,10 @@ gpii.tests.linux.orca.testDefs = [ "org.gnome.orca": [{ "settings": { "running": false + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" } }] } @@ -134,6 +142,10 @@ gpii.tests.linux.orca.testDefs = [ "org.gnome.orca": [{ "settings": { "running": false + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" } }] } diff --git a/tests/platform/windows/windows-builtIn-testSpec.js b/tests/platform/windows/windows-builtIn-testSpec.js index f1bbfa69b..946cfd5a0 100644 --- a/tests/platform/windows/windows-builtIn-testSpec.js +++ b/tests/platform/windows/windows-builtIn-testSpec.js @@ -33,6 +33,12 @@ gpii.tests.windows.builtIn = [ "com.microsoft.windows.magnifier": [{ "settings": { "running": false + }, + "options": { + "getState": [{ + "type": "gpii.processReporter.find", + "command": "Magnify" + }] } }] } @@ -226,7 +232,7 @@ gpii.tests.windows.builtIn = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "Magnify" }] @@ -242,11 +248,25 @@ gpii.tests.windows.builtIn = [ "com.microsoft.windows.magnifier": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "Magnify" + }] } }], "com.microsoft.windows.onscreenKeyboard": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "osk" + }] } }] } @@ -422,7 +442,7 @@ gpii.tests.windows.builtIn = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "Magnify" }] @@ -434,7 +454,7 @@ gpii.tests.windows.builtIn = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "osk" }] @@ -450,6 +470,13 @@ gpii.tests.windows.builtIn = [ "com.microsoft.windows.magnifier": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "Magnify" + }] } }] } @@ -518,7 +545,7 @@ gpii.tests.windows.builtIn = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "Magnify" }] diff --git a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js index 7da440571..a36246ead 100644 --- a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js +++ b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js @@ -33,6 +33,13 @@ gpii.tests.deviceReporterAware.windows = [ "org.nvda-project": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "nvda" + }] } }] } @@ -74,7 +81,7 @@ gpii.tests.deviceReporterAware.windows = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "nvda" }] @@ -101,6 +108,13 @@ gpii.tests.deviceReporterAware.windows = [ "com.texthelp.readWriteGold": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "readandwrite" + }] } }] } @@ -113,7 +127,7 @@ gpii.tests.deviceReporterAware.windows = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "readandwrite" }] diff --git a/tests/platform/windows/windows-jaws-testSpec.js b/tests/platform/windows/windows-jaws-testSpec.js index 569d661fd..75fedf9c9 100644 --- a/tests/platform/windows/windows-jaws-testSpec.js +++ b/tests/platform/windows/windows-jaws-testSpec.js @@ -33,6 +33,13 @@ gpii.tests.windows.jaws = [ "com.freedomscientific.jaws": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "jaws" + }] } }] } @@ -101,7 +108,7 @@ gpii.tests.windows.jaws = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "jaws" }] @@ -118,6 +125,13 @@ gpii.tests.windows.jaws = [ "com.freedomscientific.jaws": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "jaws" + }] } }] } @@ -186,7 +200,7 @@ gpii.tests.windows.jaws = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "jaws" }] @@ -203,6 +217,13 @@ gpii.tests.windows.jaws = [ "com.freedomscientific.jaws": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "jaws" + }] } }] } @@ -270,7 +291,7 @@ gpii.tests.windows.jaws = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "jaws" }] @@ -287,6 +308,13 @@ gpii.tests.windows.jaws = [ "com.freedomscientific.jaws": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "jaws" + }] } }] } @@ -355,7 +383,7 @@ gpii.tests.windows.jaws = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "jaws" }] diff --git a/tests/platform/windows/windows-maavis-testSpec.js b/tests/platform/windows/windows-maavis-testSpec.js index 7d21f99e5..c0e967435 100644 --- a/tests/platform/windows/windows-maavis-testSpec.js +++ b/tests/platform/windows/windows-maavis-testSpec.js @@ -33,6 +33,13 @@ gpii.tests.windows.maavis = [ "net.opendirective.maavis": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "MaavisPortable" + }] } }] } @@ -60,7 +67,7 @@ gpii.tests.windows.maavis = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "MaavisPortable" }] @@ -76,6 +83,13 @@ gpii.tests.windows.maavis = [ "net.opendirective.maavis": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "MaavisPortable" + }] } }] } @@ -103,7 +117,7 @@ gpii.tests.windows.maavis = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "MaavisPortable" }] diff --git a/tests/platform/windows/windows-nvda-testSpec.js b/tests/platform/windows/windows-nvda-testSpec.js index 312bc4592..f0582d56c 100644 --- a/tests/platform/windows/windows-nvda-testSpec.js +++ b/tests/platform/windows/windows-nvda-testSpec.js @@ -33,6 +33,13 @@ gpii.tests.windows.nvda = [ "org.nvda-project": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "nvda" + }] } }] } @@ -73,7 +80,7 @@ gpii.tests.windows.nvda = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "nvda" }] @@ -89,6 +96,13 @@ gpii.tests.windows.nvda = [ "org.nvda-project": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "nvda" + }] } }] } @@ -127,7 +141,7 @@ gpii.tests.windows.nvda = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "nvda" }] @@ -143,6 +157,13 @@ gpii.tests.windows.nvda = [ "org.nvda-project": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "nvda" + }] } }] } @@ -175,7 +196,7 @@ gpii.tests.windows.nvda = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "nvda" }] diff --git a/tests/platform/windows/windows-readWrite-testSpec.js b/tests/platform/windows/windows-readWrite-testSpec.js index efe676e25..e0120f9eb 100644 --- a/tests/platform/windows/windows-readWrite-testSpec.js +++ b/tests/platform/windows/windows-readWrite-testSpec.js @@ -30,6 +30,13 @@ gpii.tests.windows.readWrite = [ "com.texthelp.readWriteGold": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "readandwrite" + }] } }] } @@ -73,7 +80,7 @@ gpii.tests.windows.readWrite = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "readandwrite" }] @@ -89,6 +96,13 @@ gpii.tests.windows.readWrite = [ "com.texthelp.readWriteGold": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "readandwrite" + }] } }] } @@ -134,7 +148,7 @@ gpii.tests.windows.readWrite = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "readandwrite" }] From 30e77a1d023bbaf98cc7232ca27afc390d1ec198 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Thu, 9 Mar 2017 22:45:44 +0100 Subject: [PATCH 07/26] GPII-1230: Fixed most of the windows acceptance tests --- .../settingsHandlers/src/LaunchHandlers.js | 2 +- testData/solutions/win32.json5 | 107 +++++++++++------- .../windows/windows-builtIn-testSpec.js | 14 +-- .../windows-dynamicDeviceReporter-testSpec.js | 8 +- .../platform/windows/windows-jaws-testSpec.js | 30 ++--- .../windows/windows-maavis-testSpec.js | 8 +- .../windows/windows-readWrite-testSpec.js | 8 +- 7 files changed, 99 insertions(+), 78 deletions(-) diff --git a/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js b/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js index daba8f5ec..cc9fb6b57 100644 --- a/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js +++ b/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js @@ -35,7 +35,7 @@ gpii.launchHandlers.flexibleHandler.set = function (payload) { if (currentState !== desiredState) { desiredState === true ? gpii.launchHandlers.flexibleHandler.executeSetBlock(handlerData, "setTrue") : - gpii.launchHandlers.flexibleHandler.executeStopBlock(handlerData, "setFalse"); + gpii.launchHandlers.flexibleHandler.executeSetBlock(handlerData, "setFalse"); } return gpii.settingsHandlers.setSettings(handlerData, { running: currentState }); diff --git a/testData/solutions/win32.json5 b/testData/solutions/win32.json5 index ae0768ff0..2bfe94fc8 100644 --- a/testData/solutions/win32.json5 +++ b/testData/solutions/win32.json5 @@ -563,10 +563,15 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20 + }, "getState": [ { "type": "gpii.processReporter.find", - "command": "jaws" + "command": "jfw" } ], "setTrue": [ @@ -579,6 +584,14 @@ { "type": "gpii.windows.closeProcessByName", "filename": "jfw.exe" + }, + { + "type": "gpii.windows.closeProcessByName", + "filename": "fsSynth32.exe" + }, + { + "type": "gpii.windows.closeProcessByName", + "filename": "jhookldr.exe" } ] } @@ -598,6 +611,9 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], "isInstalled": [ { "type": "gpii.deviceReporter.registryKeyExists", @@ -670,6 +686,9 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], "isInstalled": [ { "type": "gpii.deviceReporter.registryKeyExists", @@ -790,28 +809,10 @@ } }, "launcher": { - "type": "gpii.launchHandlers.flexibleHandler", + "type": "gpii.windows.enableRegisteredAT", "options": { - "setTrue": [ - { - "type": "gpii.windows.enableRegisteredAT", - "name": "magnifierpane", - "enable": true - } - ], - "setFalse": [ - { - "type": "gpii.windows.enableRegisteredAT", - "name": "magnifierpane", - "enable": false - } - ], - "getState": [ - { - "type": "gpii.processReporter.find", - "command": "Magnify" - } - ] + "registryName": "magnifierpane", + "queryProcess": "Magnify" } } }, @@ -821,6 +822,9 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], "configure": [ "settings.configure" ], @@ -864,28 +868,10 @@ } }, "launcher": { - "type": "gpii.launchHandlers.flexibleHandler", + "type": "gpii.windows.enableRegisteredAT", "options": { - "setTrue": [ - { - "type": "gpii.windows.enableRegisteredAT", - "name": "osk", - "enable": true - } - ], - "setFalse": [ - { - "type": "gpii.windows.enableRegisteredAT", - "name": "osk", - "enable": false - } - ], - "getState": [ - { - "type": "gpii.processReporter.find", - "command": "osk" - } - ] + "registryName": "osk", + "queryProcess": "osk" } } }, @@ -895,6 +881,9 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], "configure": [ "settings.configure" ], @@ -1287,6 +1276,11 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20 + }, "getState": [ { "type": "gpii.processReporter.find", @@ -1317,12 +1311,16 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], "configure": [ "settings.configs" ], "restore": [ "settings.configs" ], + "isInstalled": [ { "type": "gpii.deviceReporter.registryKeyExists", @@ -1375,6 +1373,9 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" @@ -1422,6 +1423,9 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" @@ -1469,6 +1473,9 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" @@ -1545,6 +1552,11 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { + "verifySettings": true, + "retryOptions": { + "rewriteEvery": 0, + "numRetries": 20 + }, "setTrue": [ { "type": "gpii.launch.exec", @@ -1578,6 +1590,9 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" @@ -2415,6 +2430,9 @@ "settings.launcher" ], "stop": [], + "isRunning": [ + "settings.launcher" + ], "configure": [ "settings.configure" ], @@ -2513,6 +2531,9 @@ "restore": [ "settings.configuration" ], + "isRunning": [ + "settings.launcher" + ], "start": [ "settings.launcher" ], diff --git a/tests/platform/windows/windows-builtIn-testSpec.js b/tests/platform/windows/windows-builtIn-testSpec.js index 946cfd5a0..bd227ba3d 100644 --- a/tests/platform/windows/windows-builtIn-testSpec.js +++ b/tests/platform/windows/windows-builtIn-testSpec.js @@ -231,7 +231,7 @@ gpii.tests.windows.builtIn = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "Magnify" @@ -250,7 +250,7 @@ gpii.tests.windows.builtIn = [ "running": false }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "Magnify" @@ -262,7 +262,7 @@ gpii.tests.windows.builtIn = [ "running": false }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "osk" @@ -441,7 +441,7 @@ gpii.tests.windows.builtIn = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "Magnify" @@ -453,7 +453,7 @@ gpii.tests.windows.builtIn = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "osk" @@ -472,7 +472,7 @@ gpii.tests.windows.builtIn = [ "running": false }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "Magnify" @@ -544,7 +544,7 @@ gpii.tests.windows.builtIn = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "Magnify" diff --git a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js index a36246ead..9f0b80187 100644 --- a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js +++ b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js @@ -35,7 +35,7 @@ gpii.tests.deviceReporterAware.windows = [ "running": false }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "nvda" @@ -80,7 +80,7 @@ gpii.tests.deviceReporterAware.windows = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "nvda" @@ -110,7 +110,7 @@ gpii.tests.deviceReporterAware.windows = [ "running": false }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "readandwrite" @@ -126,7 +126,7 @@ gpii.tests.deviceReporterAware.windows = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "readandwrite" diff --git a/tests/platform/windows/windows-jaws-testSpec.js b/tests/platform/windows/windows-jaws-testSpec.js index 75fedf9c9..01e6ed44c 100644 --- a/tests/platform/windows/windows-jaws-testSpec.js +++ b/tests/platform/windows/windows-jaws-testSpec.js @@ -35,10 +35,10 @@ gpii.tests.windows.jaws = [ "running": false }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", - "command": "jaws" + "command": "jfw" }] } }] @@ -107,10 +107,10 @@ gpii.tests.windows.jaws = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", - "command": "jaws" + "command": "jfw" }] } }] @@ -127,10 +127,10 @@ gpii.tests.windows.jaws = [ "running": false }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", - "command": "jaws" + "command": "jfw" }] } }] @@ -199,10 +199,10 @@ gpii.tests.windows.jaws = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", - "command": "jaws" + "command": "jfw" }] } }] @@ -219,10 +219,10 @@ gpii.tests.windows.jaws = [ "running": false }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", - "command": "jaws" + "command": "jfw" }] } }] @@ -290,10 +290,10 @@ gpii.tests.windows.jaws = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", - "command": "jaws" + "command": "jfw" }] } }] @@ -310,7 +310,7 @@ gpii.tests.windows.jaws = [ "running": false }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "jaws" @@ -382,10 +382,10 @@ gpii.tests.windows.jaws = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", - "command": "jaws" + "command": "jfw" }] } }] diff --git a/tests/platform/windows/windows-maavis-testSpec.js b/tests/platform/windows/windows-maavis-testSpec.js index c0e967435..76ff0e861 100644 --- a/tests/platform/windows/windows-maavis-testSpec.js +++ b/tests/platform/windows/windows-maavis-testSpec.js @@ -35,7 +35,7 @@ gpii.tests.windows.maavis = [ "running": false }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "MaavisPortable" @@ -66,7 +66,7 @@ gpii.tests.windows.maavis = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "MaavisPortable" @@ -85,7 +85,7 @@ gpii.tests.windows.maavis = [ "running": false }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "MaavisPortable" @@ -116,7 +116,7 @@ gpii.tests.windows.maavis = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "MaavisPortable" diff --git a/tests/platform/windows/windows-readWrite-testSpec.js b/tests/platform/windows/windows-readWrite-testSpec.js index e0120f9eb..dce3099b6 100644 --- a/tests/platform/windows/windows-readWrite-testSpec.js +++ b/tests/platform/windows/windows-readWrite-testSpec.js @@ -32,7 +32,7 @@ gpii.tests.windows.readWrite = [ "running": false }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "readandwrite" @@ -79,7 +79,7 @@ gpii.tests.windows.readWrite = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "readandwrite" @@ -98,7 +98,7 @@ gpii.tests.windows.readWrite = [ "running": false }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "readandwrite" @@ -147,7 +147,7 @@ gpii.tests.windows.readWrite = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "readandwrite" From a645511e6e4898f6bfc0592014b27d9070410084 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Fri, 10 Mar 2017 14:43:32 +0100 Subject: [PATCH 08/26] GPII-1230: Committing to do Acceptance tests in linux --- .../src/settingsHandlerUtilities.js | 11 +- gpii/node_modules/testing/src/Integration.js | 21 +- gpii/node_modules/testing/src/Testing.js | 49 +- testData/solutions/android.json5 | 15 + testData/solutions/linux.json5 | 3 - testData/solutions/win32.json5 | 53 +- .../platform/linux/linux-builtIn-testSpec.js | 150 +++++- .../linux-dynamicDeviceReporter-testSpec.js | 6 +- tests/platform/linux/linux-orca-testSpec.js | 65 ++- .../windows/windows-builtIn-testSpec.js | 493 ++++++++++++++++-- .../windows-dynamicDeviceReporter-testSpec.js | 4 +- .../platform/windows/windows-jaws-testSpec.js | 248 ++++----- .../windows/windows-maavis-testSpec.js | 135 ++--- .../platform/windows/windows-nvda-testSpec.js | 301 +++++------ .../windows/windows-readWrite-testSpec.js | 123 ++++- 15 files changed, 1235 insertions(+), 442 deletions(-) diff --git a/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js b/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js index 0aeee8d44..ed9a99a8e 100644 --- a/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js +++ b/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js @@ -257,6 +257,12 @@ gpii.settingsHandlers.checkRereadSettings = function (that) { } }; +gpii.settingsHandlers.dispatchSettingsHandler = function (resolvedName, payload, operation, retryOptions) { + return (operation === "get") ? + gpii.settingsHandlers.dispatchSettingsHandlerGet(resolvedName, payload) : + gpii.settingsHandlers.dispatchSettingsHandlerSet(resolvedName, payload, retryOptions); +}; + /** * Called to invoke settings handlers' get functionality. @@ -265,8 +271,7 @@ gpii.settingsHandlers.checkRereadSettings = function (that) { * "some.app.id": [{ * "settings": { ... }, * "options": { - * ..., - * "verifySettings": true + * ... * } * }] * } @@ -274,7 +279,7 @@ gpii.settingsHandlers.checkRereadSettings = function (that) { * @param payload {Object} The full payload that would be sent to the SET method of the settings handler * @return a promise that will yield the original payload of the invoked GET method */ -gpii.settingsHandlers.dispatchSettingsHandlerGet = function (resolvedName, payload, retryOptions) { +gpii.settingsHandlers.dispatchSettingsHandlerGet = function (resolvedName, payload) { // TODO "gpii.lifecycleManager.specToSettingsHandler" is the one responsible for this awkward // layout of the settings handler payload - all of this infrastructure will have to be updated // and cleaned up at some point diff --git a/gpii/node_modules/testing/src/Integration.js b/gpii/node_modules/testing/src/Integration.js index d55dae021..55767a06a 100644 --- a/gpii/node_modules/testing/src/Integration.js +++ b/gpii/node_modules/testing/src/Integration.js @@ -39,11 +39,6 @@ gpii.test.integration.exec.exec = function (that, processSpec /*, expected */) { that.events.onExecExit.fire(true, processSpec); }; -gpii.test.integration.prepopulateSettingsStore = function (testCaseHolder, nameResolver) { - var settingsHandlers = testCaseHolder.options.integrationPrepopulation; - gpii.test.setSettings(settingsHandlers, nameResolver); -}; - fluid.defaults("gpii.test.integration.testCaseHolder", { gradeNames: ["gpii.test.common.testCaseHolder"], // TODO: Namespace these distributions so they can be overridden @@ -69,12 +64,6 @@ fluid.defaults("gpii.test.integration.testCaseHolder", { target: "{that lifecycleManager > variableResolver}.options.components.resolverConfig.type", record: "gpii.test.integration.standardResolverConfig" }], - invokers: { - prepopulateSettingsStore: { - funcName: "gpii.test.integration.prepopulateSettingsStore", - args: [ "{that}", "{nameResolver}" ] - } - }, components: { exec: { type: "gpii.test.integration.exec" @@ -96,9 +85,6 @@ fluid.defaults("gpii.test.integration.testCaseHolder", { } } } - }, - listeners: { - "onCreate.prepopulateSettingsStore": "{that}.prepopulateSettingsStore" } }); @@ -400,7 +386,10 @@ fluid.defaults("gpii.test.integration.mockSettingsHandlerRegistry.windows", { delaying: true, optionsPathKey: "setAction" }, - "gpii.windows.displaySettingsHandler": {} + "gpii.windows.displaySettingsHandler": {}, + "gpii.windows.enableRegisteredAT": { + optionsPathKey: "registryName" + } } }); @@ -420,7 +409,7 @@ fluid.defaults("gpii.test.integration.mockSettingsHandlerRegistry.linux", { }, "gpii.gsettings.launch": { optionsPathKey: gpii.test.integration.gsettingsLaunchKey - } + }, } }); diff --git a/gpii/node_modules/testing/src/Testing.js b/gpii/node_modules/testing/src/Testing.js index b8c85fa8b..c5794db07 100644 --- a/gpii/node_modules/testing/src/Testing.js +++ b/gpii/node_modules/testing/src/Testing.js @@ -143,7 +143,9 @@ gpii.test.operateSettings = function (settingsHandlers, nameResolver, method) { var ret = {}; fluid.each(settingsHandlers, function (handlerBlock, handlerID) { var resolvedName = nameResolver ? nameResolver.resolveName(handlerID, "settingsHandler") : handlerID; - var response = fluid.invokeGlobalFunction(resolvedName + "." + method, [handlerBlock]); + var response = gpii.settingsHandlers.dispatchSettingsHandler(resolvedName, handlerBlock, method); + + // var response = fluid.invokeGlobalFunction(resolvedName + "." + method, [handlerBlock]); ret[handlerID] = response; }); var togo = gpii.test.settleStructure(ret); @@ -153,6 +155,12 @@ gpii.test.operateSettings = function (settingsHandlers, nameResolver, method) { return togo; }; +gpii.test.setInitialState = function (settingsHandlers, nameResolver, onComplete) { + console.log("KASPER: SETTING INITIAL STATE " + JSON.stringify(settingsHandlers, null, 2)); + var promise = gpii.test.setSettings(settingsHandlers, nameResolver); + promise.then(onComplete) +} + /** Snapshot the state of all settingsHandlers by stashing them in a member named `orig` on the supplied settingsStore * @param settingsHandlers {Object} A map of settings handler names to `settingsHandler` blocks as seen in the `settingsHandlers` * option of a `gpii.test.common.testCaseHolder` @@ -180,11 +188,15 @@ gpii.test.extractSettingsBlocks = function (settingsHandlers) { return fluid.transform(settingsHandlers, gpii.settingsHandlers.extractSettingsBlocks); }; -gpii.test.checkConfiguration = function (settingsHandlers, nameResolver, onComplete) { +gpii.test.checkConfiguration = function (settingsHandlers, nameResolver, onComplete, customMsg) { + console.log("KASPER: CHECKING CONFIGURATION " + JSON.stringify(settingsHandlers, null, 2)); var configPromise = gpii.test.getSettings(settingsHandlers, nameResolver); configPromise.then(function (config) { var noOptions = gpii.test.extractSettingsBlocks(settingsHandlers); - jqUnit.assertDeepEq("Checking that settings are set", noOptions, config); + jqUnit.assertDeepEq(customMsg || "Checking that settings are set", noOptions, config); + // console.log(JSON.stringify(noOptions, null, 2)) + // console.log("VS") + // console.log(JSON.stringify(config, null, 2)) onComplete(); }); }; @@ -240,10 +252,13 @@ fluid.defaults("gpii.test.common.testCaseHolder", { settingsStore: {} }, mergePolicy: { - "settingsHandlers": "noexpand" + "settingsHandlers": "noexpand", + "initialState": "noexpand" // KASPER? }, events: { onSnapshotComplete: null, + onInitialStateSet: null, + onInitialStateConfirmed: null, onCheckConfigurationComplete: null, onCheckRestoredConfigurationComplete: null }, @@ -309,7 +324,25 @@ gpii.test.expandSettings = function (testCaseHolder, members) { }; // TODO: remove these clumsy constants once https://issues.fluidproject.org/browse/FLUID-5903 is implemented -gpii.test.initialSequence = fluid.freezeRecursive([ +gpii.test.initalStateSequence = fluid.freezeRecursive([ + { + func: "gpii.test.expandSettings", + args: [ "{tests}", "initialState" ] + }, { + func: "gpii.test.setInitialState", + args: [ "{tests}.initialState", "{nameResolver}", "{testCaseHolder}.events.onInitialStateSet.fire"] + }, { + event: "{testCaseHolder}.events.onInitialStateSet", + listener: "fluid.identity" + }, { + func: "gpii.test.checkConfiguration", + args: ["{tests}.initialState", "{nameResolver}", "{testCaseHolder}.events.onInitialStateConfirmed.fire", "Confirming initial state"] + }, { + event: "{testCaseHolder}.events.onInitialStateConfirmed", + listener: "fluid.identity" + } +]) +gpii.test.snapshotSequence = fluid.freezeRecursive([ { func: "gpii.test.expandSettings", args: [ "{tests}", "settingsHandlers" ] @@ -375,7 +408,11 @@ gpii.test.buildSingleTestFixture = function (testDef, rootGrades) { testDef.sequence = fluid.makeArray(testDef.sequence); gpii.test.unshift(testDef.sequence, gpii.test.loginSequence); - gpii.test.unshift(testDef.sequence, gpii.test.initialSequence); + gpii.test.unshift(testDef.sequence, gpii.test.snapshotSequence); + if (testDef.initialState) { + gpii.test.unshift(testDef.sequence, gpii.test.initalStateSequence); + testDef.expect++; + } gpii.test.push(testDef.sequence, gpii.test.logoutSequence); diff --git a/testData/solutions/android.json5 b/testData/solutions/android.json5 index c36af5dee..52c87d30f 100644 --- a/testData/solutions/android.json5 +++ b/testData/solutions/android.json5 @@ -28,6 +28,9 @@ }, "start": [ "settings.launcher" + ], + "isRunning": [ + "settings.launcher" ] }, @@ -63,6 +66,12 @@ }, "start": [ "settings.launcher" + ], + "stop": [ + "settings.launcher" + ], + "isRunning": [ + "settings.launcher" ] }, @@ -434,6 +443,12 @@ "start": [ "settings.launcher" ], + "stop": [ + "settings.launcher" + ], + "isRunning": [ + "settings.launcher" + ], "configure": [ "settings.configuration" ], diff --git a/testData/solutions/linux.json5 b/testData/solutions/linux.json5 index 06b98d1d4..968034727 100644 --- a/testData/solutions/linux.json5 +++ b/testData/solutions/linux.json5 @@ -102,9 +102,6 @@ "isRunning": [ "settings.launcher" ], - "isRunning": [ - "settings.launcher" - ], "isInstalled": [ { "type": "gpii.packageKit.find", diff --git a/testData/solutions/win32.json5 b/testData/solutions/win32.json5 index 2bfe94fc8..60647ff8c 100644 --- a/testData/solutions/win32.json5 +++ b/testData/solutions/win32.json5 @@ -501,11 +501,6 @@ "inverseCapabilitiesTransformations": { "http://registry\\.gpii\\.net/common/speechSynthesizer": "Options\\.PrimarySynthesizer", "http://registry\\.gpii\\.net/common/speechRate": "ENU-Global\\.Rate", - "http://registry\\.gpii\\.net/common/speechRate": "ENU-JAWSCursor\\.Rate", - "http://registry\\.gpii\\.net/common/speechRate": "ENU-Keyboard\\.Rate", - "http://registry\\.gpii\\.net/common/speechRate": "ENU-MenuAndDialog\\.Rate", - "http://registry\\.gpii\\.net/common/speechRate": "ENU-Message\\.Rate", - "http://registry\\.gpii\\.net/common/speechRate": "ENU-PCCursor\\.Rate", "http://registry\\.gpii\\.net/common/pitch": { "transform": { "type": "fluid.transforms.linearScale", @@ -611,6 +606,11 @@ "stop": [ "settings.launcher" ], + "update": [ + "stop", + "configure", + "start" + ], "isRunning": [ "settings.launcher" ], @@ -686,6 +686,11 @@ "stop": [ "settings.launcher" ], + "update": [ + "stop", + "configure", + "start" + ], "isRunning": [ "settings.launcher" ], @@ -822,6 +827,11 @@ "stop": [ "settings.launcher" ], + "update": [ + "stop", + "configure", + "start" + ], "isRunning": [ "settings.launcher" ], @@ -881,6 +891,11 @@ "stop": [ "settings.launcher" ], + "update": [ + "stop", + "configure", + "start" + ], "isRunning": [ "settings.launcher" ], @@ -1057,7 +1072,6 @@ "grc": "test\\grc", "eo": "eo", "es": "es", - "es-ES": "es", "es-419": "es-la", "et": "et", "fi": "fi", @@ -1098,8 +1112,7 @@ "vi": "vi", "zh-cmn": "zh", "cmn": "zh", - "zh-yue": "zh-yue", - "zh-yue": "yue" + "zh-yue": "zh-yue" } } } @@ -1226,7 +1239,6 @@ "test\\grc": "grc", "eo": "eo", "es": "es", - "es": "es-ES", "es-la": "es-419", "et": "et", "fi": "fi", @@ -1267,7 +1279,6 @@ "vi": "vi", "zh": "zh-cmn", "zh-yue": "zh-yue", - "yue": "zh-yue" } } ] @@ -1301,7 +1312,7 @@ "type": "gpii.windows.closeProcessByName", "filename": "nvda.exe" } - ], + ] } } }, @@ -1311,6 +1322,11 @@ "stop": [ "settings.launcher" ], + "update": [ + "stop", + "configure", + "start" + ], "isRunning": [ "settings.launcher" ], @@ -1320,7 +1336,6 @@ "restore": [ "settings.configs" ], - "isInstalled": [ { "type": "gpii.deviceReporter.registryKeyExists", @@ -1590,6 +1605,11 @@ "stop": [ "settings.launcher" ], + "update": [ + "stop", + "configure", + "start" + ], "isRunning": [ "settings.launcher" ], @@ -2430,6 +2450,10 @@ "settings.launcher" ], "stop": [], + "update": [ + "configure", + "start" + ], "isRunning": [ "settings.launcher" ], @@ -2539,6 +2563,11 @@ ], "stop": [ "settings.launcher" + ], + "update": [ + "stop", + "configure", + "start" ] }, diff --git a/tests/platform/linux/linux-builtIn-testSpec.js b/tests/platform/linux/linux-builtIn-testSpec.js index bd0d3970e..479cce567 100644 --- a/tests/platform/linux/linux-builtIn-testSpec.js +++ b/tests/platform/linux/linux-builtIn-testSpec.js @@ -31,7 +31,7 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ { name: "Testing os_common using default matchmaker", userToken: "os_common", - integrationPrepopulation: { + initialState: { "gpii.gsettings.launch": { "org.gnome.desktop.a11y.magnifier": [{ "settings": { @@ -100,6 +100,150 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ }] } } + }, { + name: "Testing os_common - magnifier running on startup", + userToken: "os_common", + initialState: { + "gpii.gsettings.launch": { + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "running": true + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-magnifier-enabled" + } + }], + "org.gnome.desktop.a11y.applications.onscreen-keyboard": [{ + "settings": { + "running": false + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-keyboard-enabled" + } + }] + } + }, + settingsHandlers: { + "gpii.gsettings": { + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "mag-factor": 1.5, + "screen-position": "full-screen", + "mouse-tracking": "proportional", + "caret-tracking": "proportional", + "focus-tracking": "none" + }, + "options": { + "schema": "org.gnome.desktop.a11y.magnifier" + } + }], + "org.gnome.desktop.interface": [{ + "settings": { + "gtk-theme": "HighContrast", + "icon-theme": "HighContrast", + "text-scaling-factor": 0.75, + "cursor-size": 41 + }, + "options": { + "schema": "org.gnome.desktop.interface" + } + }] + }, + "gpii.gsettings.launch": { + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "running": true + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-magnifier-enabled" + } + }], + "org.gnome.desktop.a11y.applications.onscreen-keyboard": [{ + "settings": { + "running": true + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-keyboard-enabled" + } + }] + } + } + }, { + name: "Testing os_common - magnifier and keyboard running on startup", + userToken: "os_common", + initialState: { + "gpii.gsettings.launch": { + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "running": true + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-magnifier-enabled" + } + }], + "org.gnome.desktop.a11y.applications.onscreen-keyboard": [{ + "settings": { + "running": true + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-keyboard-enabled" + } + }] + } + }, + settingsHandlers: { + "gpii.gsettings": { + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "mag-factor": 1.5, + "screen-position": "full-screen", + "mouse-tracking": "proportional", + "caret-tracking": "proportional", + "focus-tracking": "none" + }, + "options": { + "schema": "org.gnome.desktop.a11y.magnifier" + } + }], + "org.gnome.desktop.interface": [{ + "settings": { + "gtk-theme": "HighContrast", + "icon-theme": "HighContrast", + "text-scaling-factor": 0.75, + "cursor-size": 41 + }, + "options": { + "schema": "org.gnome.desktop.interface" + } + }] + }, + "gpii.gsettings.launch": { + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "running": true + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-magnifier-enabled" + } + }], + "org.gnome.desktop.a11y.applications.onscreen-keyboard": [{ + "settings": { + "running": true + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-keyboard-enabled" + } + }] + } + } }, { name: "Testing os_common2 using default matchmaker", @@ -121,7 +265,7 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ { name: "Testing os_gnome using default matchmaker", userToken: "os_gnome", - integrationPrepopulation: { + initialState: { "gpii.gsettings.launch": { "org.gnome.desktop.a11y.magnifier": [{ "settings": { @@ -178,7 +322,7 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ { name: "Testing os_win7 using default matchmaker", userToken: "os_win7", - integrationPrepopulation: { + initialState: { "gpii.gsettings.launch": { "org.gnome.desktop.a11y.magnifier": [{ "settings": { diff --git a/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js b/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js index 6a0ff47a4..e69e92668 100644 --- a/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js +++ b/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js @@ -29,7 +29,7 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ name: "Testing screenreader_common using Flat matchmaker", gradeNames: "gpii.test.integration.deviceReporterAware.linux", userToken: "screenreader_common", - integrationPrepopulation: { + initialState: { "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { @@ -89,7 +89,7 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ name: "Testing screenreader_orca using Flat matchmaker", gradeNames: "gpii.test.integration.deviceReporterAware.linux", userToken: "screenreader_orca", - integrationPrepopulation: { + initialState: { "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { @@ -148,7 +148,7 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ name: "Testing screenreader_nvda using Flat matchmaker", gradeNames: "gpii.test.integration.deviceReporterAware.linux", userToken: "screenreader_nvda", - integrationPrepopulation: { + initialState: { "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { diff --git a/tests/platform/linux/linux-orca-testSpec.js b/tests/platform/linux/linux-orca-testSpec.js index 0cb8df889..21cbf7ecf 100644 --- a/tests/platform/linux/linux-orca-testSpec.js +++ b/tests/platform/linux/linux-orca-testSpec.js @@ -28,9 +28,9 @@ fluid.registerNamespace("gpii.tests.linux.orca"); gpii.tests.linux.orca.testDefs = [ { - name: "Testing screenreader_common using Flat matchmaker", + name: "Testing screenreader_common", userToken: "screenreader_common", - integrationPrepopulation: { + initialState: { "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { @@ -80,11 +80,64 @@ gpii.tests.linux.orca.testDefs = [ }] } } + }, { + name: "Testing screenreader_common with orca running on login", + userToken: "screenreader_common", + initialState: { + "gpii.gsettings.launch": { + "org.gnome.orca": [{ + "settings": { + "running": true + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" + } + }] + } + }, + settingsHandlers: { + "gpii.orca": { + "org.gnome.orca": [ + { + "settings": { + "sayAllStyle": 1, + "enableSpeech": true, + "enableEchoByWord": true, + "enableEchoByCharacter": false, + "voices.default.rate": 102.27272727272727, + "voices.default.gain": 7.5, + "enableTutorialMessages": false, + "voices.default.family": { + "locale": "en", + "name": "en-westindies" + }, + "verbalizePunctuationStyle": 0, + "voices.default.average-pitch": 1.5 + }, + "options": { + "user": "screenreader_common" + } + } + ] + }, + "gpii.gsettings.launch": { + "org.gnome.orca": [{ + "settings": { + "running": true + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" + } + }] + } + } }, { - name: "Testing screenreader_orca using Flat matchmaker", + name: "Testing screenreader_orca", userToken: "screenreader_orca", - integrationPrepopulation: { + initialState: { "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { @@ -135,9 +188,9 @@ gpii.tests.linux.orca.testDefs = [ } }, { - name: "Testing screenreader_nvda using Flat matchmaker", + name: "Testing screenreader_nvda", userToken: "screenreader_nvda", - integrationPrepopulation: { + initialState: { "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { diff --git a/tests/platform/windows/windows-builtIn-testSpec.js b/tests/platform/windows/windows-builtIn-testSpec.js index bd227ba3d..ace416f75 100644 --- a/tests/platform/windows/windows-builtIn-testSpec.js +++ b/tests/platform/windows/windows-builtIn-testSpec.js @@ -28,17 +28,15 @@ gpii.tests.windows.builtIn = [ { name: "Testing os_win7 using default matchmaker", userToken: "os_win7", - integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { + initialState: { + "gpii.windows.enableRegisteredAT": { "com.microsoft.windows.magnifier": [{ "settings": { "running": false }, "options": { - "getState": [{ - "type": "gpii.processReporter.find", - "command": "Magnify" - }] + "registryName": "magnifierpane", + "queryProcess": "Magnify" } }] } @@ -225,17 +223,14 @@ gpii.tests.windows.builtIn = [ } }] }, - "gpii.launchHandlers.flexibleHandler": { + "gpii.windows.enableRegisteredAT": { "com.microsoft.windows.magnifier": [{ "settings": { "running": true }, "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "Magnify" - }] + "registryName": "magnifierpane", + "queryProcess": "Magnify" } }] } @@ -243,18 +238,15 @@ gpii.tests.windows.builtIn = [ }, { name: "Testing os_common using default matchmaker", userToken: "os_common", - integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { + initialState: { + "gpii.windows.enableRegisteredAT": { "com.microsoft.windows.magnifier": [{ "settings": { "running": false }, "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "Magnify" - }] + "registryName": "magnifierpane", + "queryProcess": "Magnify" } }], "com.microsoft.windows.onscreenKeyboard": [{ @@ -262,11 +254,8 @@ gpii.tests.windows.builtIn = [ "running": false }, "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "osk" - }] + "registryName": "osk", + "queryProcess": "osk" } }] } @@ -435,17 +424,14 @@ gpii.tests.windows.builtIn = [ } }] }, - "gpii.launchHandlers.flexibleHandler": { + "gpii.windows.enableRegisteredAT": { "com.microsoft.windows.magnifier": [{ "settings": { "running": true }, "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "Magnify" - }] + "registryName": "magnifierpane", + "queryProcess": "Magnify" } }], "com.microsoft.windows.onscreenKeyboard": [{ @@ -453,11 +439,428 @@ gpii.tests.windows.builtIn = [ "running": true }, "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "osk" - }] + "registryName": "osk", + "queryProcess": "osk" + } + }] + } + } + }, { + name: "Testing os_common - magnifier running on startup", + userToken: "os_common", + initialState: { + "gpii.windows.enableRegisteredAT": { + "com.microsoft.windows.magnifier": [{ + "settings": { + "running": true + }, + "options": { + "registryName": "magnifierpane", + "queryProcess": "Magnify" + } + }], + "com.microsoft.windows.onscreenKeyboard": [{ + "settings": { + "running": false + }, + "options": { + "registryName": "osk", + "queryProcess": "osk" + } + }] + } + }, + settingsHandlers: { + "gpii.windows.spiSettingsHandler": { + "com.microsoft.windows.mouseTrailing": [ + { + "settings": { + "MouseTrails": { + "path": { + "get": "pvParam", + "set": "uiParam" + }, + "value": 10 + } + }, + "options": { + "getAction": "SPI_GETMOUSETRAILS", + "setAction": "SPI_SETMOUSETRAILS", + "uiParam": 0, + "pvParam": { + "type": "BOOL" + } + } + } + ], + "com.microsoft.windows.mouseKeys": [ + { + "settings": { + "MouseKeysOn": { + "path": "pvParam.dwFlags.MKF_MOUSEKEYSON", + "value": true + } + }, + "options": { + "getAction": "SPI_GETMOUSEKEYS", + "setAction": "SPI_SETMOUSEKEYS", + "uiParam": "struct_size", + "pvParam": { + "type": "struct", + "name": "MOUSEKEYS" + } + } + } + ], + "com.microsoft.windows.stickyKeys": [ + { + "settings": { + "StickyKeysOn": { + "path": "pvParam.dwFlags.SKF_STICKYKEYSON", + "value": true + } + }, + "options": { + "getAction": "SPI_GETSTICKYKEYS", + "setAction": "SPI_SETSTICKYKEYS", + "uiParam": "struct_size", + "pvParam": { + "type": "struct", + "name": "STICKYKEYS" + } + } + } + ], + "com.microsoft.windows.filterKeys": [ + { + "settings": { + "FilterKeysEnable": { + "path": "pvParam.dwFlags.FKF_FILTERKEYSON", + "value": true + }, + "BounceKeysInterval": { + "path": "pvParam.iBounceMSec", + "value": 1000 + } + }, + "options": { + "getAction": "SPI_GETFILTERKEYS", + "setAction": "SPI_SETFILTERKEYS", + "uiParam": "struct_size", + "pvParam": { + "type": "struct", + "name": "FILTERKEYS" + } + } + } + ], + "com.microsoft.windows.highContrast": [ + { // high contrast settings + "settings": { + "HighContrastOn": { + "path": "pvParam.dwFlags.HCF_HIGHCONTRASTON", + "value": true + } + }, + "options": { + "getAction": "SPI_GETHIGHCONTRAST", + "setAction": "SPI_SETHIGHCONTRAST", + "uiParam": "struct_size", + "pvParam": { + "type": "struct", + "name": "HIGHCONTRAST" + } + } + } + ] + }, + "gpii.windows.registrySettingsHandler": { + "com.microsoft.windows.magnifier": [{ // magnifier stuff + "settings": { + "Invert": 1, + "Magnification": 150, + "MagnificationMode": 3, + "FollowFocus": 0, + "FollowCaret": 1, + "FollowMouse": 1 + }, + "options": { + "hKey": "HKEY_CURRENT_USER", + "path": "Software\\Microsoft\\ScreenMagnifier", + "dataTypes": { + "Magnification": "REG_DWORD", + "Invert": "REG_DWORD", + "FollowFocus": "REG_DWORD", + "FollowCaret": "REG_DWORD", + "FollowMouse": "REG_DWORD", + "MagnificationMode": "REG_DWORD" + } + } + }], + "com.microsoft.windows.cursors": [{ // cursor size stuff + "settings": { + "No": "%SystemRoot%\\cursors\\aero_unavail_xl.cur", + "Hand": "%SystemRoot%\\cursors\\aero_link_xl.cur", + "Help": "%SystemRoot%\\cursors\\aero_helpsel_xl.cur", + "Wait": "%SystemRoot%\\cursors\\aero_busy_xl.ani", + "Arrow": "%SystemRoot%\\cursors\\aero_arrow_xl.cur", + "NWPen": "%SystemRoot%\\cursors\\aero_pen_xl.cur", + "SizeNS": "%SystemRoot%\\cursors\\aero_ns_xl.cur", + "SizeWE": "%SystemRoot%\\cursors\\aero_ew_xl.cur", + "SizeAll": "%SystemRoot%\\cursors\\aero_move_xl.cur", + "UpArrow": "%SystemRoot%\\cursors\\aero_up_xl.cur", + "SizeNESW": "%SystemRoot%\\cursors\\aero_nesw_xl.cur", + "SizeNWSE": "%SystemRoot%\\cursors\\aero_nwse_xl.cur", + "AppStarting": "%SystemRoot%\\cursors\\aero_working_xl.ani" + }, + "options": { + "hKey": "HKEY_CURRENT_USER", + "path": "Control Panel\\Cursors", + "dataTypes": { + "Arrow": "REG_SZ", + "Hand": "REG_SZ", + "Help": "REG_SZ", + "AppStarting": "REG_SZ", + "No": "REG_SZ", + "NWPen": "REG_SZ", + "SizeAll": "REG_SZ", + "SizeNESW": "REG_SZ", + "SizeNS": "REG_SZ", + "SizeNWSE": "REG_SZ", + "SizeWE": "REG_SZ", + "UpArrow": "REG_SZ", + "Wait": "REG_SZ" + } + } + }] + }, + "gpii.windows.enableRegisteredAT": { + "com.microsoft.windows.magnifier": [{ + "settings": { + "running": true + }, + "options": { + "registryName": "magnifierpane", + "queryProcess": "Magnify" + } + }], + "com.microsoft.windows.onscreenKeyboard": [{ + "settings": { + "running": true + }, + "options": { + "registryName": "osk", + "queryProcess": "osk" + } + }] + } + } + }, { + name: "Testing os_common - magnifier running on startup and keyboard both running on startup", + userToken: "os_common", + initialState: { + "gpii.windows.enableRegisteredAT": { + "com.microsoft.windows.magnifier": [{ + "settings": { + "running": true + }, + "options": { + "registryName": "magnifierpane", + "queryProcess": "Magnify" + } + }], + "com.microsoft.windows.onscreenKeyboard": [{ + "settings": { + "running": true + }, + "options": { + "registryName": "osk", + "queryProcess": "osk" + } + }] + } + }, + settingsHandlers: { + "gpii.windows.spiSettingsHandler": { + "com.microsoft.windows.mouseTrailing": [ + { + "settings": { + "MouseTrails": { + "path": { + "get": "pvParam", + "set": "uiParam" + }, + "value": 10 + } + }, + "options": { + "getAction": "SPI_GETMOUSETRAILS", + "setAction": "SPI_SETMOUSETRAILS", + "uiParam": 0, + "pvParam": { + "type": "BOOL" + } + } + } + ], + "com.microsoft.windows.mouseKeys": [ + { + "settings": { + "MouseKeysOn": { + "path": "pvParam.dwFlags.MKF_MOUSEKEYSON", + "value": true + } + }, + "options": { + "getAction": "SPI_GETMOUSEKEYS", + "setAction": "SPI_SETMOUSEKEYS", + "uiParam": "struct_size", + "pvParam": { + "type": "struct", + "name": "MOUSEKEYS" + } + } + } + ], + "com.microsoft.windows.stickyKeys": [ + { + "settings": { + "StickyKeysOn": { + "path": "pvParam.dwFlags.SKF_STICKYKEYSON", + "value": true + } + }, + "options": { + "getAction": "SPI_GETSTICKYKEYS", + "setAction": "SPI_SETSTICKYKEYS", + "uiParam": "struct_size", + "pvParam": { + "type": "struct", + "name": "STICKYKEYS" + } + } + } + ], + "com.microsoft.windows.filterKeys": [ + { + "settings": { + "FilterKeysEnable": { + "path": "pvParam.dwFlags.FKF_FILTERKEYSON", + "value": true + }, + "BounceKeysInterval": { + "path": "pvParam.iBounceMSec", + "value": 1000 + } + }, + "options": { + "getAction": "SPI_GETFILTERKEYS", + "setAction": "SPI_SETFILTERKEYS", + "uiParam": "struct_size", + "pvParam": { + "type": "struct", + "name": "FILTERKEYS" + } + } + } + ], + "com.microsoft.windows.highContrast": [ + { // high contrast settings + "settings": { + "HighContrastOn": { + "path": "pvParam.dwFlags.HCF_HIGHCONTRASTON", + "value": true + } + }, + "options": { + "getAction": "SPI_GETHIGHCONTRAST", + "setAction": "SPI_SETHIGHCONTRAST", + "uiParam": "struct_size", + "pvParam": { + "type": "struct", + "name": "HIGHCONTRAST" + } + } + } + ] + }, + "gpii.windows.registrySettingsHandler": { + "com.microsoft.windows.magnifier": [{ // magnifier stuff + "settings": { + "Invert": 1, + "Magnification": 150, + "MagnificationMode": 3, + "FollowFocus": 0, + "FollowCaret": 1, + "FollowMouse": 1 + }, + "options": { + "hKey": "HKEY_CURRENT_USER", + "path": "Software\\Microsoft\\ScreenMagnifier", + "dataTypes": { + "Magnification": "REG_DWORD", + "Invert": "REG_DWORD", + "FollowFocus": "REG_DWORD", + "FollowCaret": "REG_DWORD", + "FollowMouse": "REG_DWORD", + "MagnificationMode": "REG_DWORD" + } + } + }], + "com.microsoft.windows.cursors": [{ // cursor size stuff + "settings": { + "No": "%SystemRoot%\\cursors\\aero_unavail_xl.cur", + "Hand": "%SystemRoot%\\cursors\\aero_link_xl.cur", + "Help": "%SystemRoot%\\cursors\\aero_helpsel_xl.cur", + "Wait": "%SystemRoot%\\cursors\\aero_busy_xl.ani", + "Arrow": "%SystemRoot%\\cursors\\aero_arrow_xl.cur", + "NWPen": "%SystemRoot%\\cursors\\aero_pen_xl.cur", + "SizeNS": "%SystemRoot%\\cursors\\aero_ns_xl.cur", + "SizeWE": "%SystemRoot%\\cursors\\aero_ew_xl.cur", + "SizeAll": "%SystemRoot%\\cursors\\aero_move_xl.cur", + "UpArrow": "%SystemRoot%\\cursors\\aero_up_xl.cur", + "SizeNESW": "%SystemRoot%\\cursors\\aero_nesw_xl.cur", + "SizeNWSE": "%SystemRoot%\\cursors\\aero_nwse_xl.cur", + "AppStarting": "%SystemRoot%\\cursors\\aero_working_xl.ani" + }, + "options": { + "hKey": "HKEY_CURRENT_USER", + "path": "Control Panel\\Cursors", + "dataTypes": { + "Arrow": "REG_SZ", + "Hand": "REG_SZ", + "Help": "REG_SZ", + "AppStarting": "REG_SZ", + "No": "REG_SZ", + "NWPen": "REG_SZ", + "SizeAll": "REG_SZ", + "SizeNESW": "REG_SZ", + "SizeNS": "REG_SZ", + "SizeNWSE": "REG_SZ", + "SizeWE": "REG_SZ", + "UpArrow": "REG_SZ", + "Wait": "REG_SZ" + } + } + }] + }, + "gpii.windows.enableRegisteredAT": { + "com.microsoft.windows.magnifier": [{ + "settings": { + "running": true + }, + "options": { + "registryName": "magnifierpane", + "queryProcess": "Magnify" + } + }], + "com.microsoft.windows.onscreenKeyboard": [{ + "settings": { + "running": true + }, + "options": { + "registryName": "osk", + "queryProcess": "osk" } }] } @@ -465,18 +868,15 @@ gpii.tests.windows.builtIn = [ }, { name: "Testing os_gnome using default matchmaker", userToken: "os_gnome", - integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { + initialState: { + "gpii.windows.enableRegisteredAT": { "com.microsoft.windows.magnifier": [{ "settings": { "running": false }, "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "Magnify" - }] + "registryName": "magnifierpane", + "queryProcess": "Magnify" } }] } @@ -538,17 +938,14 @@ gpii.tests.windows.builtIn = [ } }] }, - "gpii.launchHandlers.flexibleHandler": { + "gpii.windows.enableRegisteredAT": { "com.microsoft.windows.magnifier": [{ "settings": { "running": true }, "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "Magnify" - }] + "registryName": "magnifierpane", + "queryProcess": "Magnify" } }] } diff --git a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js index 9f0b80187..ceffbebb3 100644 --- a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js +++ b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js @@ -28,7 +28,7 @@ gpii.tests.deviceReporterAware.windows = [ { name: "Testing screenreader_nvda using Flat matchmaker", userToken: "screenreader_nvda", - integrationPrepopulation: { + initialState: { "gpii.launchHandlers.flexibleHandler": { "org.nvda-project": [{ "settings": { @@ -103,7 +103,7 @@ gpii.tests.deviceReporterAware.windows = [ name: "Testing readwritegold_application1 using Flat matchmaker", userToken: "readwritegold_application1", gradeNames: "gpii.test.integration.deviceReporterAware.windows", - integrationPrepopulation: { + initialState: { "gpii.launchHandlers.flexibleHandler": { "com.texthelp.readWriteGold": [{ "settings": { diff --git a/tests/platform/windows/windows-jaws-testSpec.js b/tests/platform/windows/windows-jaws-testSpec.js index 01e6ed44c..eca2f17da 100644 --- a/tests/platform/windows/windows-jaws-testSpec.js +++ b/tests/platform/windows/windows-jaws-testSpec.js @@ -22,27 +22,60 @@ fluid.require("%universal"); gpii.loadTestingSupport(); -fluid.registerNamespace("gpii.tests.windows"); +fluid.registerNamespace("gpii.tests.windows.jaws"); -gpii.tests.windows.jaws = [ - { - name: "Testing NP set \"jaws_application\" using Flat matchmaker", - userToken: "jaws_application", - integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { - "com.freedomscientific.jaws": [{ - "settings": { - "running": false +// To avoid duplicating this entire piece in each test. Given a true or false value +// as input, this will return a settingshandler entry, containing all the options from +// the solutions registry entry for NVDAs launchHandler, with a settings block with +// running: X - where X is replaced with the input parameter +gpii.tests.windows.jaws.flexibleHandlerEntry = function (running) { + return { + "com.freedomscientific.jaws": [{ + "settings": { + "running": running + }, + "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20 + }, + "getState": [ + { + "type": "gpii.processReporter.find", + "command": "jfw" + } + ], + "setTrue": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\JAWS17.exe\\}\"" + } + ], + "setFalse": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "jfw.exe" + }, + { + "type": "gpii.windows.closeProcessByName", + "filename": "fsSynth32.exe" }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "jfw" - }] + { + "type": "gpii.windows.closeProcessByName", + "filename": "jhookldr.exe" } - }] + ] } + }] + } +}; +gpii.tests.windows.jaws.testDefs = [ + { + name: "Testing NP set \"jaws_application\"", + userToken: "jaws_application", + initialState: { + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.jaws.flexibleHandlerEntry(false) }, settingsHandlers: { "gpii.settingsHandlers.INISettingsHandler": { @@ -101,40 +134,80 @@ gpii.tests.windows.jaws = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { - "com.freedomscientific.jaws": [{ - "settings": { - "running": true + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.jaws.flexibleHandlerEntry(true) + } + }, + { + name: "Testing NP set \"jaws_application\" - where jaws is running on startup", + userToken: "jaws_application", + initialState: { + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.jaws.flexibleHandlerEntry(true) + }, + settingsHandlers: { + "gpii.settingsHandlers.INISettingsHandler": { + "com.freedomscientific.jaws": [ + { + "settings": { + "Voice Profiles.ActiveVoiceProfileName" : "GPII", + "options.SayAllIndicateCaps" : false, + "options.TypingEcho": 3, + "options.SayAllMode": 0, + "Braille.BrailleMode": 0, + "options.SayAllIgnoreShiftKeys": true + }, + "options": { + "filename": "${{environment}.APPDATA}\\Freedom Scientific\\JAWS\\17.0\\Settings\\enu\\DEFAULT.JCF" + } }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "jfw" - }] + + { + "settings": { + "Options.PrimarySynthesizer" : "eloq", + "ENU-Global.Rate": 100, + "ENU-JAWSCursor.Rate": 100, + "ENU-Keyboard.Rate": 100, + "ENU-MenuAndDialog.Rate": 100, + "ENU-Message.Rate": 100, + "ENU-PCCursor.Rate": 100, + "ENU-Global.Pitch": 75, + "ENU-JAWSCursor.Pitch": 75, + "ENU-Keyboard.Pitch": 75, + "ENU-MenuAndDialog.Pitch": 75, + "ENU-Message.Pitch": 75, + "ENU-PCCursor.Pitch": 75, + "ENU-Global.Volume": 100, + "ENU-JAWSCursor.Volume": 100, + "ENU-Keyboard.Volume": 100, + "ENU-MenuAndDialog.Volume": 100, + "ENU-Message.Volume": 100, + "ENU-PCCursor.Volume": 100, + "ENU-Global.Punctuation": 2, + "ENU-JAWSCursor.Punctuation": 2, + "ENU-Keyboard.Punctuation": 2, + "ENU-MenuAndDialog.Punctuation": 2, + "ENU-Message.Punctuation": 2, + "ENU-PCCursor.Punctuation": 2, + "ENU-Global.SynthLangString": "Italian", + "ENU-JAWSCursor.SynthLangString": "Italian", + "ENU-Keyboard.SynthLangString": "Italian", + "ENU-MenuAndDialog.SynthLangString": "Italian", + "ENU-Message.SynthLangString": "Italian", + "ENU-PCCursor.SynthLangString": "Italian" + }, + "options": { + "filename": "${{environment}.APPDATA}\\Freedom Scientific\\JAWS\\17.0\\Settings\\VoiceProfiles\\GPII.VPF" + } } - }] - } + ] + }, + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.jaws.flexibleHandlerEntry(true) } }, { - name: "Testing NP set \"jaws_common\" using Flat matchmaker", + name: "Testing NP set \"jaws_common\"", userToken: "jaws_common", - integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { - "com.freedomscientific.jaws": [{ - "settings": { - "running": false - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "jfw" - }] - } - }] - } + initialState: { + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.jaws.flexibleHandlerEntry(false) }, settingsHandlers: { "gpii.settingsHandlers.INISettingsHandler": { @@ -193,40 +266,14 @@ gpii.tests.windows.jaws = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { - "com.freedomscientific.jaws": [{ - "settings": { - "running": true - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "jfw" - }] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.jaws.flexibleHandlerEntry(true) } }, { - name: "Testing NP set \"jaws_common2\" using Flat matchmaker", + name: "Testing NP set \"jaws_common2\"", userToken: "jaws_common2", - integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { - "com.freedomscientific.jaws": [{ - "settings": { - "running": false - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "jfw" - }] - } - }] - } + initialState: { + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.jaws.flexibleHandlerEntry(false) }, settingsHandlers: { "gpii.settingsHandlers.INISettingsHandler": { @@ -284,40 +331,14 @@ gpii.tests.windows.jaws = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { - "com.freedomscientific.jaws": [{ - "settings": { - "running": true - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "jfw" - }] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.jaws.flexibleHandlerEntry(true) } }, { - name: "Testing NP set \"jaws_common3\" using Flat matchmaker", + name: "Testing NP set \"jaws_common3\"", userToken: "jaws_common3", - integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { - "com.freedomscientific.jaws": [{ - "settings": { - "running": false - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "jaws" - }] - } - }] - } + initialState: { + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.jaws.flexibleHandlerEntry(false) }, settingsHandlers: { "gpii.settingsHandlers.INISettingsHandler": { @@ -376,26 +397,13 @@ gpii.tests.windows.jaws = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { - "com.freedomscientific.jaws": [{ - "settings": { - "running": true - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "jfw" - }] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.jaws.flexibleHandlerEntry(true) } } ]; module.exports = gpii.test.bootstrap({ - testDefs: "gpii.tests.windows.jaws", + testDefs: "gpii.tests.windows.jaws.testDefs", configName: "gpii.tests.acceptance.windows.jaws.config", configPath: "%universal/tests/platform/windows/configs" }, ["gpii.test.integration.testCaseHolder.windows"], diff --git a/tests/platform/windows/windows-maavis-testSpec.js b/tests/platform/windows/windows-maavis-testSpec.js index 76ff0e861..a357c13ec 100644 --- a/tests/platform/windows/windows-maavis-testSpec.js +++ b/tests/platform/windows/windows-maavis-testSpec.js @@ -22,27 +22,53 @@ fluid.require("%universal"); gpii.loadTestingSupport(); -fluid.registerNamespace("gpii.tests.windows"); +fluid.registerNamespace("gpii.tests.windows.maavis"); -gpii.tests.windows.maavis = [ - { - name: "Testing maavis_highcontrast using Flat matchmaker", - userToken: "maavis_highcontrast", - integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { - "net.opendirective.maavis": [{ - "settings": { - "running": false - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "MaavisPortable" - }] +// To avoid duplicating this entire piece in each test. Given a true or false value +// as input, this will return a settingshandler entry, containing all the options from +// the solutions registry entry for NVDAs launchHandler, with a settings block with +// running: X - where X is replaced with the input parameter +gpii.tests.windows.maavis.flexibleHandlerEntry = function (running) { + return { + "net.opendirective.maavis": [{ + "settings": { + "running": running + }, + "options": { + "verifySettings": true, + "retryOptions": { + "rewriteEvery": 0, + "numRetries": 20 + }, + "setTrue": [ + { + "type": "gpii.launch.exec", + "command": "${{environment}.ComSpec} /c \"cd ${{environment}.MAAVIS_HOME} && MaavisPortable.cmd\"" + } + ], + "setFalse": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "firefox.exe" + } + ], + "getState": [ + { + "type": "gpii.processReporter.find", + "command": "MaavisPortable" } - }] + ] } + }] + } +}; + +gpii.tests.windows.maavis.testDefs = [ + { + name: "Testing maavis_highcontrast - when maavis is running on login", + userToken: "maavis_highcontrast", + initialState: { + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.maavis.flexibleHandlerEntry(true) }, settingsHandlers: { "gpii.settingsHandlers.JSONSettingsHandler": { @@ -60,39 +86,37 @@ gpii.tests.windows.maavis = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { - "net.opendirective.maavis": [{ - "settings": { - "running": true - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "MaavisPortable" - }] + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.maavis.flexibleHandlerEntry(true) + } + }, { + name: "Testing maavis_highcontrast", + userToken: "maavis_highcontrast", + initialState: { + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.maavis.flexibleHandlerEntry(false) + }, + settingsHandlers: { + "gpii.settingsHandlers.JSONSettingsHandler": { + "net.opendirective.maavis": [ + { + "settings": { + "theme": "hc", + "speakTitles": "no", + "speakLabels": "no", + "speakOnActivate": "no" + }, + "options": { + "filename": "${{environment}.MAAVIS_HOME}\\MaavisMedia\\Users\\Default\\userconfig.json" + } } - }] - } + ] + }, + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.maavis.flexibleHandlerEntry(true) } }, { - name: "Testing maavis_selfvoicing using Flat matchmaker", + name: "Testing maavis_selfvoicing", userToken: "maavis_selfvoicing", - integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { - "net.opendirective.maavis": [{ - "settings": { - "running": false - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "MaavisPortable" - }] - } - }] - } + initialState: { + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.maavis.flexibleHandlerEntry(false) }, settingsHandlers: { "gpii.settingsHandlers.JSONSettingsHandler": { @@ -110,26 +134,13 @@ gpii.tests.windows.maavis = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { - "net.opendirective.maavis": [{ - "settings": { - "running": true - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "MaavisPortable" - }] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.maavis.flexibleHandlerEntry(true) } } ]; module.exports = gpii.test.bootstrap({ - testDefs: "gpii.tests.windows.maavis", + testDefs: "gpii.tests.windows.maavis.testDefs", configName: "gpii.tests.acceptance.windows.maavis.config", configPath: "%universal/tests/platform/windows/configs" }, ["gpii.test.integration.testCaseHolder.windows"], diff --git a/tests/platform/windows/windows-nvda-testSpec.js b/tests/platform/windows/windows-nvda-testSpec.js index f0582d56c..49e542709 100644 --- a/tests/platform/windows/windows-nvda-testSpec.js +++ b/tests/platform/windows/windows-nvda-testSpec.js @@ -20,29 +20,60 @@ var fluid = require("infusion"), fluid.require("%universal"); +fluid.logObjectRenderChars = 80000 + gpii.loadTestingSupport(); -fluid.registerNamespace("gpii.tests.windows"); +fluid.registerNamespace("gpii.tests.windows.nvda"); -gpii.tests.windows.nvda = [ - { - name: "Testing screenreader_nvda using Flat matchmaker", - userToken: "screenreader_nvda", - integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { - "org.nvda-project": [{ - "settings": { - "running": false - }, - "options": { - // start and stop blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "nvda" - }] +// To avoid duplicating this entire piece in each test. Given a true or false value +// as input, this will return a settingshandler entry, containing all the options from +// the solutions registry entry for NVDAs launchHandler, with a settings block with +// running: X - where X is replaced with the input parameter +gpii.tests.windows.nvda.flexibleHandlerEntry = function (running) { + return { + "org.nvda-project": [{ + "settings": { + "running": running + }, + "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20 + }, + "getState": [ + { + "type": "gpii.processReporter.find", + "command": "nvda" } - }] + ], + "setTrue": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\nvda.exe\\}\"" + } + ], + "setFalse": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "nvda_service.exe" + },{ + "type": "gpii.windows.closeProcessByName", + "filename": "nvda.exe" + } + ] } + }] + } +}; + +gpii.tests.windows.nvda.testDef = [ + { + name: "Testing screenreader_nvda - When running on start", + userToken: "screenreader_nvda", + initialState: { + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(true) }, settingsHandlers: { "gpii.settingsHandlers.INISettingsHandler": { @@ -73,142 +104,114 @@ gpii.tests.windows.nvda = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { - "org.nvda-project": [{ - "settings": { - "running": true - }, - "options": { - // start and stop blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "nvda" - }] - } - }] - } - } - }, { - name: "Testing screenreader_common using Flat matchmaker", - userToken: "screenreader_common", - integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { - "org.nvda-project": [{ - "settings": { - "running": false - }, - "options": { - // start and stop blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "nvda" - }] - } - }] - } - }, - settingsHandlers: { - "gpii.settingsHandlers.INISettingsHandler": { - "org.nvda-project": [ - { - "settings": { - "speech.espeak.rate": 17, - "speech.espeak.volume": 75, - "speech.espeak.pitch": 15, - "speech.espeak.rateBoost": true, - "speech.symbolLevel": 300, - "speech.espeak.voice": "en\\en-wi", - "reviewCursor.followFocus": false, - "reviewCursor.followCaret": true, - "reviewCursor.followMouse": true, - "keyboard.speakTypedWords": true, - "keyboard.speakTypedCharacters": false, - "presentation.reportHelpBalloons": false, - "speech.espeak.sayCapForCapitals": true - }, - "options": { - "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", - "allowNumberSignComments": true, - "allowSubSections": true - } - } - ] - }, - "gpii.launchHandlers.flexibleHandler": { - "org.nvda-project": [{ - "settings": { - "running": true - }, - "options": { - // start and stop blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "nvda" - }] - } - }] - } - } - }, { - name: "Testing screenreader_orca using Flat matchmaker", - userToken: "screenreader_orca", - integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { - "org.nvda-project": [{ - "settings": { - "running": false - }, - "options": { - // start and stop blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "nvda" - }] - } - }] - } - }, - settingsHandlers: { - "gpii.settingsHandlers.INISettingsHandler": { - "org.nvda-project": [ - { - "settings": { - "speech.symbolLevel": 300, - "speech.espeak.rate": 17, - "speech.espeak.voice": "en\\en-wi", - "keyboard.speakTypedWords": true, - "speech.espeak.rateBoost": true, - "keyboard.speakTypedCharacters": false, - "presentation.reportHelpBalloons": false - }, - "options": { - "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", - "allowNumberSignComments": true, - "allowSubSections": true - } - } - ] - }, - "gpii.launchHandlers.flexibleHandler": { - "org.nvda-project": [{ - "settings": { - "running": true - }, - "options": { - // start and stop blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "nvda" - }] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(true) } + // }, { + // name: "Testing screenreader_nvda", + // userToken: "screenreader_nvda", + // initialState: { + // "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(false) + // }, + // settingsHandlers: { + // "gpii.settingsHandlers.INISettingsHandler": { + // "org.nvda-project": [ + // { + // "settings": { + // "speech.espeak.rate": 17, + // "speech.espeak.volume": 80, + // "speech.espeak.pitch": 60, + // "speech.espeak.rateBoost": true, + // "speech.synth": "espeak", + // "speech.outputDevice": "Microsoft Sound Mapper", + // "speech.symbolLevel": 300, + // "speech.espeak.voice": "en\\en-wi", + // "reviewCursor.followFocus": false, + // "reviewCursor.followCaret": true, + // "reviewCursor.followMouse": true, + // "keyboard.speakTypedWords": true, + // "keyboard.speakTypedCharacters": false, + // "presentation.reportHelpBalloons": false, + // "speech.espeak.sayCapForCapitals": true + // }, + // "options": { + // "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", + // "allowNumberSignComments": true, + // "allowSubSections": true + // } + // } + // ] + // }, + // "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(true) + // } + // }, { + // name: "Testing screenreader_common", + // userToken: "screenreader_common", + // initialState: { + // "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(false) + // }, + // settingsHandlers: { + // "gpii.settingsHandlers.INISettingsHandler": { + // "org.nvda-project": [ + // { + // "settings": { + // "speech.espeak.rate": 17, + // "speech.espeak.volume": 75, + // "speech.espeak.pitch": 15, + // "speech.espeak.rateBoost": true, + // "speech.symbolLevel": 300, + // "speech.espeak.voice": "en\\en-wi", + // "reviewCursor.followFocus": false, + // "reviewCursor.followCaret": true, + // "reviewCursor.followMouse": true, + // "keyboard.speakTypedWords": true, + // "keyboard.speakTypedCharacters": false, + // "presentation.reportHelpBalloons": false, + // "speech.espeak.sayCapForCapitals": true + // }, + // "options": { + // "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", + // "allowNumberSignComments": true, + // "allowSubSections": true + // } + // } + // ] + // }, + // "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(true) + // } + // }, { + // name: "Testing screenreader_orca", + // userToken: "screenreader_orca", + // initialState: { + // "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(false) + // }, + // settingsHandlers: { + // "gpii.settingsHandlers.INISettingsHandler": { + // "org.nvda-project": [ + // { + // "settings": { + // "speech.symbolLevel": 300, + // "speech.espeak.rate": 17, + // "speech.espeak.voice": "en\\en-wi", + // "keyboard.speakTypedWords": true, + // "speech.espeak.rateBoost": true, + // "keyboard.speakTypedCharacters": false, + // "presentation.reportHelpBalloons": false + // }, + // "options": { + // "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", + // "allowNumberSignComments": true, + // "allowSubSections": true + // } + // } + // ] + // }, + // "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(true) + // } } ]; module.exports = gpii.test.bootstrap({ - testDefs: "gpii.tests.windows.nvda", + testDefs: "gpii.tests.windows.nvda.testDef", configName: "gpii.tests.acceptance.windows.nvda.config", configPath: "%universal/tests/platform/windows/configs" }, ["gpii.test.integration.testCaseHolder.windows"], diff --git a/tests/platform/windows/windows-readWrite-testSpec.js b/tests/platform/windows/windows-readWrite-testSpec.js index dce3099b6..77a00f367 100644 --- a/tests/platform/windows/windows-readWrite-testSpec.js +++ b/tests/platform/windows/windows-readWrite-testSpec.js @@ -23,13 +23,73 @@ fluid.registerNamespace("gpii.tests.windows"); gpii.tests.windows.readWrite = [ { - name: "Testing rwg1", + name: "Testing rwg1 - running on login", userToken: "rwg1", - integrationPrepopulation: { + initialState: { "gpii.launchHandlers.flexibleHandler": { "com.texthelp.readWriteGold": [{ "settings": { - "running": false + "running": true + }, + "options": { + "setTrue": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_CURRENT_USER\\Software\\Texthelp\\Read&Write11\\InstallPath}\\ReadAndWrite.exe\"" + } + ], + "setFalse": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "ReadAndWrite.exe" + } + ], + "getState": [ + { + "type": "gpii.processReporter.find", + "command": "readandwrite" + } + ] + } + }] + } + }, + settingsHandlers: { + "gpii.settingsHandlers.XMLHandler": { + "com.texthelp.readWriteGold": [ + { + "settings": { + "ApplicationSettings.AppBar.optToolbarIconSet.$t": "Fun", + "ApplicationSettings.AppBar.optToolbarButtonGroupNameCurrent.$t": "Writing Features", + "ApplicationSettings.AppBar.DocType.$t": "1", + "ApplicationSettings.AppBar.ShowText.$t": "true", + "ApplicationSettings.AppBar.optToolbarShowText.$t": "true", + "ApplicationSettings.AppBar.LargeIcons.$t": "true", + "ApplicationSettings.AppBar.optToolbarLargeIcons.$t": "true", + "ApplicationSettings.Speech.optSAPI5Pitch.$t": "36", + "ApplicationSettings.Speech.optSAPI5Speed.$t": "38", + "ApplicationSettings.Speech.optSAPI5Volume.$t": "72", + "ApplicationSettings.Speech.optSAPI5PauseBetweenWords.$t": "0", + "ApplicationSettings.Speech.optSAPI5Voice.$t": "ScanSoft UK English Daniel", + "ApplicationSettings.Speech.WebHighlighting.$t": "false", + "ApplicationSettings.Translation.ToLanguage.$t": "fr", + "ApplicationSettings.Speech.optSAPI5SpeechHighlightContext.$t": "2", + "ApplicationSettings.Scanning.ScanDestination.$t": "PDF", + "ApplicationSettings.Scanning.ScanToFile.$t": "false", + "ApplicationSettings.Spelling.SpellAsIType.$t": "true" + }, + "options": { + "filename": "${{environment}.APPDATA}\\Texthelp\\ReadAndWrite\\11\\RWSettings11.xml", + "encoding": "utf-8", + "xml-tag": "" + } + } + ] + }, + "gpii.launchHandlers.flexibleHandler": { + "com.texthelp.readWriteGold": [{ + "settings": { + "running": true }, "options": { // setTrue and setFalse blocks omitted for size/clarity @@ -40,6 +100,38 @@ gpii.tests.windows.readWrite = [ } }] } + } + }, { + name: "Testing rwg1", + userToken: "rwg1", + initialState: { + "gpii.launchHandlers.flexibleHandler": { + "com.texthelp.readWriteGold": [{ + "settings": { + "running": false + }, + "options": { + "setTrue": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_CURRENT_USER\\Software\\Texthelp\\Read&Write11\\InstallPath}\\ReadAndWrite.exe\"" + } + ], + "setFalse": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "ReadAndWrite.exe" + } + ], + "getState": [ + { + "type": "gpii.processReporter.find", + "command": "readandwrite" + } + ] + } + }] + } }, settingsHandlers: { "gpii.settingsHandlers.XMLHandler": { @@ -91,18 +183,31 @@ gpii.tests.windows.readWrite = [ }, { name: "Testing rwg2", userToken: "rwg2", - integrationPrepopulation: { + initialState: { "gpii.launchHandlers.flexibleHandler": { "com.texthelp.readWriteGold": [{ "settings": { "running": false }, "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "readandwrite" - }] + "setTrue": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_CURRENT_USER\\Software\\Texthelp\\Read&Write11\\InstallPath}\\ReadAndWrite.exe\"" + } + ], + "setFalse": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "ReadAndWrite.exe" + } + ], + "getState": [ + { + "type": "gpii.processReporter.find", + "command": "readandwrite" + } + ] } }] } From 6b74c91bc4ea37aaedda0867284f3069994a4953 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Tue, 14 Mar 2017 21:47:14 +0100 Subject: [PATCH 09/26] GPII-1230: Linted, fixed minor issues --- .../lifecycleManager/src/LifecycleManager.js | 11 ++++++++++- gpii/node_modules/processReporter/index.js | 2 +- .../test/web/js/ProcessReporterTests.js | 4 ++-- .../settingsHandlers/src/settingsHandlerUtilities.js | 1 - .../test/web/js/LaunchHandlerTests.js | 6 ++++-- gpii/node_modules/testing/src/Integration.js | 4 ++-- gpii/node_modules/testing/src/Testing.js | 9 +++++---- testData/solutions/linux.json5 | 2 ++ tests/JournalIntegrationTests.js | 1 - tests/platform/linux/linux-builtIn-testSpec.js | 2 -- tests/platform/linux/linux-orca-testSpec.js | 2 -- tests/platform/windows/windows-jaws-testSpec.js | 3 ++- tests/platform/windows/windows-maavis-testSpec.js | 2 +- tests/platform/windows/windows-nvda-testSpec.js | 2 +- 14 files changed, 30 insertions(+), 21 deletions(-) diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index e58e8f8f7..bbf709e5f 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -288,6 +288,10 @@ var gpii = fluid.registerNamespace("gpii"); * that will be resolved once the settings are successfully set. */ gpii.lifecycleManager.executeSettingsAction = function (that, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction) { + + // console.log("KASPER Record: " + JSON.stringify(solutionRecord, null, 2)); + var tmp = JSON.stringify(fluid.get(solutionRecord, [ "settingsHandlers", settingsHandlerBlockName, "settings"]), null, 2) + console.log("KASPER: executeSettingsAction: (" + solutionId + ": " + settingsHandlerBlockName + ") with settings: " + tmp); var settingsHandlerBlock = solutionRecord.settingsHandlers[settingsHandlerBlockName]; if (settingsHandlerBlock === undefined) { fluid.fail("Reference to non-existing settingsHandler block named " + settingsHandlerBlockName + @@ -300,6 +304,8 @@ var gpii = fluid.registerNamespace("gpii"); } else { var settingsPromise = that.invokeSettingsHandlerSet(solutionId, expanded); settingsPromise.then(function (snapshot) { + console.log("KASPER: executeSettingsAction: (" + solutionId + ": " + settingsHandlerBlockName + ") with settings: " + tmp + + " .... PROMISE RESOLVED"); session.applier.change(["appliedSolutions", solutionId], solutionRecord); gpii.lifecycleManager.recordSnapshotInSession(that, snapshot, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction); @@ -399,6 +405,7 @@ var gpii = fluid.registerNamespace("gpii"); */ gpii.lifecycleManager.executeActions = function (that, solutionId, solutionRecord, session, actionBlock, rootAction) { + console.log("KASPER: Execute actions: " + JSON.stringify(actionBlock) + "... rootAction: " + rootAction) var steps = solutionRecord[actionBlock]; if (steps === undefined) { fluid.log("No " + actionBlock + " actions defined for solution " + solutionId); @@ -583,6 +590,7 @@ var gpii = fluid.registerNamespace("gpii"); }; gpii.lifecycleManager.start = function (that, request, finalPayload, callback) { + console.log("KASPER: gpii.lifecycleManager.start") var userToken = finalPayload.userToken, lifecycleInstructions = finalPayload.lifecycleInstructions; if (that.sessionIndex[userToken]) { @@ -620,13 +628,14 @@ var gpii = fluid.registerNamespace("gpii"); if (solution.active === false) { // and it shouldn't actions = [ "stop", "configure" ]; } else { // else call "update" to make changes apply to a running solutions + console.log("KASPER: running and active = yes, so using 'update directive'") actions = [ "update" ]; } } else { // if it is not running if (solution.active === true) { // and we want it to run actions = [ "configure", "start" ]; } else { // else just configure it - actions = [ "configure" ] + actions = [ "configure" ]; } } diff --git a/gpii/node_modules/processReporter/index.js b/gpii/node_modules/processReporter/index.js index b929e1274..a56e90d76 100644 --- a/gpii/node_modules/processReporter/index.js +++ b/gpii/node_modules/processReporter/index.js @@ -5,6 +5,6 @@ var fluid = require("infusion"); fluid.module.register("processReporter", __dirname, require); require("./src/ProcessReporter.js"); -require("./src/ProcessesBridge.js") +require("./src/ProcessesBridge.js"); diff --git a/gpii/node_modules/processReporter/test/web/js/ProcessReporterTests.js b/gpii/node_modules/processReporter/test/web/js/ProcessReporterTests.js index 4ff5200f1..d1e5fb514 100644 --- a/gpii/node_modules/processReporter/test/web/js/ProcessReporterTests.js +++ b/gpii/node_modules/processReporter/test/web/js/ProcessReporterTests.js @@ -28,7 +28,7 @@ gpii.tests.processReporter.alwaysTrue = function () { return true; - } + }; fluid.defaults("gpii.tests.processReporter.alwaysFalse", { gradeNames: "fluid.function", @@ -37,7 +37,7 @@ gpii.tests.processReporter.alwaysFalse = function () { return false; - } + }; gpii.tests.processReporter.handleIsRunningSpecs = { "No isRunning block": { diff --git a/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js b/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js index ed9a99a8e..c9c4cf0d1 100644 --- a/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js +++ b/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js @@ -284,7 +284,6 @@ gpii.settingsHandlers.dispatchSettingsHandlerGet = function (resolvedName, paylo // layout of the settings handler payload - all of this infrastructure will have to be updated // and cleaned up at some point try { - var solutionIds = fluid.keys(payload); return gpii.settingsHandlers.invokeGetHandler(resolvedName, payload); } catch (e) { fluid.log(fluid.logLevel.WARN, "Error received when dispatching settingsHandler.get " + resolvedName + " with payload ", diff --git a/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js b/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js index 06cb63a44..b2f99b068 100644 --- a/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js +++ b/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js @@ -45,8 +45,10 @@ argumentMap: {} }); + // TODO KASPER: + // fix returnTrue og returnFalse til noget lidt lækrere gpii.tests.flexibleHandler.returnTrue = function () { - return true + return true; }; fluid.defaults("gpii.tests.flexibleHandler.returnFalse", { @@ -55,7 +57,7 @@ }); gpii.tests.flexibleHandler.returnFalse = function () { - return false + return false; }; gpii.tests.flexibleHandler.assertBlock = { diff --git a/gpii/node_modules/testing/src/Integration.js b/gpii/node_modules/testing/src/Integration.js index 55767a06a..1613763e2 100644 --- a/gpii/node_modules/testing/src/Integration.js +++ b/gpii/node_modules/testing/src/Integration.js @@ -310,7 +310,7 @@ gpii.test.integration.registrySettingsHandlerKey = function (options) { gpii.test.integration.gsettingsLaunchKey = function (options) { return options.schema + "|" + options.key; -} +}; fluid.defaults("gpii.test.integration.mockSettingsHandlerRegistry", { gradeNames: ["fluid.component"], @@ -409,7 +409,7 @@ fluid.defaults("gpii.test.integration.mockSettingsHandlerRegistry.linux", { }, "gpii.gsettings.launch": { optionsPathKey: gpii.test.integration.gsettingsLaunchKey - }, + } } }); diff --git a/gpii/node_modules/testing/src/Testing.js b/gpii/node_modules/testing/src/Testing.js index c5794db07..0be7f06a5 100644 --- a/gpii/node_modules/testing/src/Testing.js +++ b/gpii/node_modules/testing/src/Testing.js @@ -156,10 +156,10 @@ gpii.test.operateSettings = function (settingsHandlers, nameResolver, method) { }; gpii.test.setInitialState = function (settingsHandlers, nameResolver, onComplete) { - console.log("KASPER: SETTING INITIAL STATE " + JSON.stringify(settingsHandlers, null, 2)); + console.log("KASPER: SETTING INITIAL STATE " + JSON.stringify(settingsHandlers, null, 2)); // TODO KASPER var promise = gpii.test.setSettings(settingsHandlers, nameResolver); - promise.then(onComplete) -} + promise.then(onComplete); +}; /** Snapshot the state of all settingsHandlers by stashing them in a member named `orig` on the supplied settingsStore * @param settingsHandlers {Object} A map of settings handler names to `settingsHandler` blocks as seen in the `settingsHandlers` @@ -341,7 +341,8 @@ gpii.test.initalStateSequence = fluid.freezeRecursive([ event: "{testCaseHolder}.events.onInitialStateConfirmed", listener: "fluid.identity" } -]) +]); + gpii.test.snapshotSequence = fluid.freezeRecursive([ { func: "gpii.test.expandSettings", diff --git a/testData/solutions/linux.json5 b/testData/solutions/linux.json5 index 968034727..4835de7da 100644 --- a/testData/solutions/linux.json5 +++ b/testData/solutions/linux.json5 @@ -285,6 +285,8 @@ } } }, + "update": [ + ], "start": [ "settings.launching" ], diff --git a/tests/JournalIntegrationTests.js b/tests/JournalIntegrationTests.js index 71924c8f5..bf43fe989 100644 --- a/tests/JournalIntegrationTests.js +++ b/tests/JournalIntegrationTests.js @@ -26,7 +26,6 @@ fluid.logObjectRenderChars = 10240; fluid.registerNamespace("gpii.tests.journal"); -fluid.logObjectRenderChars = 10000 gpii.tests.journal.testSpec = fluid.require("%universal/tests/platform/windows/windows-builtIn-testSpec.js"); // The os_win7 entry forms the spine of our test. This user has 4 application-specific preferences encoded diff --git a/tests/platform/linux/linux-builtIn-testSpec.js b/tests/platform/linux/linux-builtIn-testSpec.js index 479cce567..6d00d6ad4 100644 --- a/tests/platform/linux/linux-builtIn-testSpec.js +++ b/tests/platform/linux/linux-builtIn-testSpec.js @@ -19,8 +19,6 @@ Seventh Framework Programme (FP7/2007-2013) under grant agreement no. 289016. var fluid = require("infusion"), gpii = fluid.registerNamespace("gpii"); -fluid.logObjectRenderChars = 2048 - fluid.require("%universal"); gpii.loadTestingSupport(); diff --git a/tests/platform/linux/linux-orca-testSpec.js b/tests/platform/linux/linux-orca-testSpec.js index 21cbf7ecf..fecb1fc93 100644 --- a/tests/platform/linux/linux-orca-testSpec.js +++ b/tests/platform/linux/linux-orca-testSpec.js @@ -22,8 +22,6 @@ fluid.require("%universal"); gpii.loadTestingSupport(); -fluid.logObjectRenderChars = 8000 - fluid.registerNamespace("gpii.tests.linux.orca"); gpii.tests.linux.orca.testDefs = [ diff --git a/tests/platform/windows/windows-jaws-testSpec.js b/tests/platform/windows/windows-jaws-testSpec.js index eca2f17da..89da550e0 100644 --- a/tests/platform/windows/windows-jaws-testSpec.js +++ b/tests/platform/windows/windows-jaws-testSpec.js @@ -68,8 +68,9 @@ gpii.tests.windows.jaws.flexibleHandlerEntry = function (running) { ] } }] - } + }; }; + gpii.tests.windows.jaws.testDefs = [ { name: "Testing NP set \"jaws_application\"", diff --git a/tests/platform/windows/windows-maavis-testSpec.js b/tests/platform/windows/windows-maavis-testSpec.js index a357c13ec..93ade6a8a 100644 --- a/tests/platform/windows/windows-maavis-testSpec.js +++ b/tests/platform/windows/windows-maavis-testSpec.js @@ -60,7 +60,7 @@ gpii.tests.windows.maavis.flexibleHandlerEntry = function (running) { ] } }] - } + }; }; gpii.tests.windows.maavis.testDefs = [ diff --git a/tests/platform/windows/windows-nvda-testSpec.js b/tests/platform/windows/windows-nvda-testSpec.js index 49e542709..2df5954a6 100644 --- a/tests/platform/windows/windows-nvda-testSpec.js +++ b/tests/platform/windows/windows-nvda-testSpec.js @@ -65,7 +65,7 @@ gpii.tests.windows.nvda.flexibleHandlerEntry = function (running) { ] } }] - } + }; }; gpii.tests.windows.nvda.testDef = [ From 3beba5597d9d6c7b60609ae03e592f2a61580f58 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Tue, 14 Mar 2017 23:25:26 +0100 Subject: [PATCH 10/26] GPII-1230: Fixed unit tests for launch handler --- .../test/web/js/LaunchHandlerTests.js | 84 +++++++++---------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js b/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js index b2f99b068..899741eb7 100644 --- a/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js +++ b/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js @@ -81,9 +81,9 @@ "running": true }, options: { - "start": gpii.tests.flexibleHandler.failBlock, - "stop": gpii.tests.flexibleHandler.failBlock, - "isRunning": gpii.tests.flexibleHandler.reportRunning + "setTrue": gpii.tests.flexibleHandler.failBlock, + "setFalse": gpii.tests.flexibleHandler.failBlock, + "getState": gpii.tests.flexibleHandler.reportRunning } }, expectedSettings: { @@ -100,9 +100,9 @@ "running": false }, options: { - "start": gpii.tests.flexibleHandler.failBlock, - "stop": gpii.tests.flexibleHandler.failBlock, - "isRunning": gpii.tests.flexibleHandler.reportNotRunning + "setTrue": gpii.tests.flexibleHandler.failBlock, + "setFalse": gpii.tests.flexibleHandler.failBlock, + "getState": gpii.tests.flexibleHandler.reportNotRunning } }, expectedSettings: { @@ -119,9 +119,9 @@ "running": true }, options: { - "start": gpii.tests.flexibleHandler.assertBlock, - "stop": gpii.tests.flexibleHandler.failBlock, - "isRunning": gpii.tests.flexibleHandler.reportNotRunning + "setTrue": gpii.tests.flexibleHandler.assertBlock, + "setFalse": gpii.tests.flexibleHandler.failBlock, + "getState": gpii.tests.flexibleHandler.reportNotRunning } }, expectedSettings: { @@ -138,9 +138,9 @@ "running": false }, options: { - "start": gpii.tests.flexibleHandler.failBlock, - "stop": gpii.tests.flexibleHandler.assertBlock, - "isRunning": gpii.tests.flexibleHandler.reportRunning + "setTrue": gpii.tests.flexibleHandler.failBlock, + "setFalse": gpii.tests.flexibleHandler.assertBlock, + "getState": gpii.tests.flexibleHandler.reportRunning } }, expectedSettings: { @@ -157,12 +157,12 @@ "running": true }, options: { - "start": [ + "setTrue": [ gpii.tests.flexibleHandler.assertBlock, gpii.tests.flexibleHandler.assertBlock ], - "stop": gpii.tests.flexibleHandler.failBlock, - "isRunning": gpii.tests.flexibleHandler.reportNotRunning + "setFalse": gpii.tests.flexibleHandler.failBlock, + "getState": gpii.tests.flexibleHandler.reportNotRunning } }, expectedSettings: { @@ -179,12 +179,12 @@ "running": false }, options: { - "start": gpii.tests.flexibleHandler.failBlock, - "stop": [ + "setTrue": gpii.tests.flexibleHandler.failBlock, + "setFalse": [ gpii.tests.flexibleHandler.assertBlock, gpii.tests.flexibleHandler.assertBlock ], - "isRunning": gpii.tests.flexibleHandler.reportRunning + "getState": gpii.tests.flexibleHandler.reportRunning } }, expectedSettings: { @@ -220,9 +220,9 @@ "running": true }, options: { - "start": gpii.tests.flexibleHandler.assertBlock, - "stop": gpii.tests.flexibleHandler.failBlock, - "isRunning": gpii.tests.flexibleHandler.reportNotRunning + "setTrue": gpii.tests.flexibleHandler.assertBlock, + "setFalse": gpii.tests.flexibleHandler.failBlock, + "getState": gpii.tests.flexibleHandler.reportNotRunning } } ], @@ -232,9 +232,9 @@ "running": true }, options: { - "start": gpii.tests.flexibleHandler.assertBlock, - "stop": gpii.tests.flexibleHandler.failBlock, - "isRunning": gpii.tests.flexibleHandler.reportNotRunning + "setTrue": gpii.tests.flexibleHandler.assertBlock, + "setFalse": gpii.tests.flexibleHandler.failBlock, + "getState": gpii.tests.flexibleHandler.reportNotRunning } } ] @@ -249,9 +249,9 @@ } }, options: { - "start": gpii.tests.flexibleHandler.assertBlock, - "stop": gpii.tests.flexibleHandler.failBlock, - "isRunning": gpii.tests.flexibleHandler.reportNotRunning + "setTrue": gpii.tests.flexibleHandler.assertBlock, + "setFalse": gpii.tests.flexibleHandler.failBlock, + "getState": gpii.tests.flexibleHandler.reportNotRunning } } ], @@ -264,9 +264,9 @@ } }, options: { - "start": gpii.tests.flexibleHandler.assertBlock, - "stop": gpii.tests.flexibleHandler.failBlock, - "isRunning": gpii.tests.flexibleHandler.reportNotRunning + "setTrue": gpii.tests.flexibleHandler.assertBlock, + "setFalse": gpii.tests.flexibleHandler.failBlock, + "getState": gpii.tests.flexibleHandler.reportNotRunning } } ] @@ -282,9 +282,9 @@ "running": false }, options: { - "start": gpii.tests.flexibleHandler.failBlock, - "stop": gpii.tests.flexibleHandler.assertBlock, - "isRunning": gpii.tests.flexibleHandler.reportRunning + "setTrue": gpii.tests.flexibleHandler.failBlock, + "setFalse": gpii.tests.flexibleHandler.assertBlock, + "getState": gpii.tests.flexibleHandler.reportRunning } } ], @@ -294,9 +294,9 @@ "running": false }, options: { - "start": gpii.tests.flexibleHandler.failBlock, - "stop": gpii.tests.flexibleHandler.failBlock, - "isRunning": gpii.tests.flexibleHandler.reportNotRunning + "setTrue": gpii.tests.flexibleHandler.failBlock, + "setFalse": gpii.tests.flexibleHandler.failBlock, + "getState": gpii.tests.flexibleHandler.reportNotRunning } } ] @@ -311,9 +311,9 @@ } }, options: { - "start": gpii.tests.flexibleHandler.failBlock, - "stop": gpii.tests.flexibleHandler.assertBlock, - "isRunning": gpii.tests.flexibleHandler.reportRunning + "setTrue": gpii.tests.flexibleHandler.failBlock, + "setFalse": gpii.tests.flexibleHandler.assertBlock, + "getState": gpii.tests.flexibleHandler.reportRunning } } ], @@ -326,9 +326,9 @@ } }, options: { - "start": gpii.tests.flexibleHandler.failBlock, - "stop": gpii.tests.flexibleHandler.failBlock, - "isRunning": gpii.tests.flexibleHandler.reportNotRunning + "setTrue": gpii.tests.flexibleHandler.failBlock, + "setFalse": gpii.tests.flexibleHandler.failBlock, + "getState": gpii.tests.flexibleHandler.reportNotRunning } } ] From f39112bc399c32461010f20d203607927d9e4384 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Mon, 20 Mar 2017 17:17:10 +0100 Subject: [PATCH 11/26] GPII-1230: Fixed up tests and linting... still needs more work --- .../lifecycleManager/src/LifecycleManager.js | 58 ++++++++++--------- .../test/js/LifecycleManagerTests.js | 20 +------ .../test/web/js/LaunchHandlerTests.js | 2 - gpii/node_modules/testing/src/Testing.js | 4 +- tests/JournalIntegrationTests.js | 16 ++--- .../platform/windows/windows-nvda-testSpec.js | 2 - 6 files changed, 44 insertions(+), 58 deletions(-) diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index bbf709e5f..d4cb06841 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -242,7 +242,10 @@ var gpii = fluid.registerNamespace("gpii"); gpii.lifecycleManager.recordSnapshotInSession = function (that, snapshot, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction) { var toSnapshot = fluid.copy(solutionRecord); - toSnapshot.settingsHandlers = {}; + // Disabled the removing of all settingshandlers blocks to ensure that we have them available when restoring the system. + // This is particularly relevant for launch handlers, where we will need to run the "get" directives on logout to decide + // whether we an application is running or not, and consequently, whether to run the "update" or "stop" block + // toSnapshot.settingsHandlers = {}; toSnapshot.settingsHandlers[settingsHandlerBlockName] = snapshot; if (rootAction === "start" || rootAction === "update") { // keep the settings that are already stored from the @@ -288,10 +291,6 @@ var gpii = fluid.registerNamespace("gpii"); * that will be resolved once the settings are successfully set. */ gpii.lifecycleManager.executeSettingsAction = function (that, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction) { - - // console.log("KASPER Record: " + JSON.stringify(solutionRecord, null, 2)); - var tmp = JSON.stringify(fluid.get(solutionRecord, [ "settingsHandlers", settingsHandlerBlockName, "settings"]), null, 2) - console.log("KASPER: executeSettingsAction: (" + solutionId + ": " + settingsHandlerBlockName + ") with settings: " + tmp); var settingsHandlerBlock = solutionRecord.settingsHandlers[settingsHandlerBlockName]; if (settingsHandlerBlock === undefined) { fluid.fail("Reference to non-existing settingsHandler block named " + settingsHandlerBlockName + @@ -304,8 +303,6 @@ var gpii = fluid.registerNamespace("gpii"); } else { var settingsPromise = that.invokeSettingsHandlerSet(solutionId, expanded); settingsPromise.then(function (snapshot) { - console.log("KASPER: executeSettingsAction: (" + solutionId + ": " + settingsHandlerBlockName + ") with settings: " + tmp + - " .... PROMISE RESOLVED"); session.applier.change(["appliedSolutions", solutionId], solutionRecord); gpii.lifecycleManager.recordSnapshotInSession(that, snapshot, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction); @@ -405,7 +402,6 @@ var gpii = fluid.registerNamespace("gpii"); */ gpii.lifecycleManager.executeActions = function (that, solutionId, solutionRecord, session, actionBlock, rootAction) { - console.log("KASPER: Execute actions: " + JSON.stringify(actionBlock) + "... rootAction: " + rootAction) var steps = solutionRecord[actionBlock]; if (steps === undefined) { fluid.log("No " + actionBlock + " actions defined for solution " + solutionId); @@ -417,34 +413,33 @@ var gpii = fluid.registerNamespace("gpii"); // the settings handler block) if (action.indexOf("settings.") === 0) { var settingsHandlerBlockName = action.substring("settings.".length); - // if this is related to launching, overwrite entry with the appropriate settings, - // that is: { running: true } if we're in a start block, else { running: false } - if (actionBlock === "start" || (actionBlock === "stop" && rootAction !== "stop") || actionBlock === "isRunning") { - var launchSettings = { running: actionBlock === "start" ? true : false }; - fluid.set(solutionRecord, [ "settingsHandlers", settingsHandlerBlockName, "settings"], launchSettings); + if (actionBlock === "isRunning") { + // if we're just checking for the run state, dont actually modify the solutionRecord with settings: + var tmpSolutionRecord = fluid.copy(solutionRecord); + fluid.set(tmpSolutionRecord, [ "settingsHandlers", settingsHandlerBlockName, "settings"], { running: null }); + return gpii.lifecycleManager.executeSettingsAction(that, solutionId, tmpSolutionRecord, session, settingsHandlerBlockName, rootAction); + } else { + // if this is related to launching, overwrite entry with the appropriate settings, + // that is: { running: true } if we're in a start block, else { running: false } + if (actionBlock === "start" || (actionBlock === "stop" && rootAction !== "stop") || actionBlock === "isRunning") { + var launchSettings = { running: actionBlock === "start" ? true : false }; + fluid.set(solutionRecord, [ "settingsHandlers", settingsHandlerBlockName, "settings"], launchSettings); + } + return gpii.lifecycleManager.executeSettingsAction(that, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction); } - return gpii.lifecycleManager.executeSettingsAction(that, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction); } else if (actionBlock === "update") { // Keywords: "start", "stop", "configure" are allowed here as well, and // and will result in evaluating the respective block // TODO (GPII-1230) Fix this up so we don't always run the full start and stops (including) // system restoration, etc. - if (action === "start" || action === "configure") { + if (action === "start" || action === "configure" || action === "stop") { return that.executeActions(solutionId, solutionRecord, session, action, rootAction); - } else if (action === "stop") { - // TODO KASPER -- OVERVEJ AT GENINDFØRE DET NEDENSTÅENDE - // This branch is used when an "update" action requires a stop and start of the solution - // var unarmoured = gpii.lifecycleManager.transformSolutionSettings( - // session.model.originalSettings[solutionId], gpii.settingsHandlers.changesToSettings); - // return that.executeActions(solutionId, unarmoured, session, "stop", rootAction); - // TODO KASPER: Har erstattet ovenstående med: - return that.executeActions(solutionId, solutionRecord, session, "stop", rootAction); } else { fluid.fail("Unrecognised string action in LifecycleManager: " + action + " inside 'update' section for solution " + solutionId); } } - } else { // TODO should be removed when GPII-1235 has been solved (lifecycle actions are settings handlers) // TODO KASPER remove this + } else { // TODO should be removed when GPII-1235 has been solved (lifecycle actions are settings handlers) return function () { var expanded = session.localResolver(action); var result = gpii.lifecycleManager.invokeAction(expanded, that.nameResolver); @@ -493,7 +488,8 @@ var gpii = fluid.registerNamespace("gpii"); var promises = fluid.transform(session.model.originalSettings, function (changesSolutionRecord, solutionId) { var solutionRecord = gpii.lifecycleManager.transformSolutionSettings(changesSolutionRecord, gpii.settingsHandlers.changesToSettings); // if a solution was running on login, run the update block to ensure that restored settings are applied - var actions = session.model.runningOnLogin[solutionId] ? [ "update" ] : [ "stop", "restore" ]; + var recordedState = gpii.lifecycleManager.getSolutionRunningStateFromSnapshot(solutionRecord); + var actions = recordedState ? [ "update" ] : [ "stop", "restore" ]; return that.applySolution(solutionId, solutionRecord, session, actions, rootAction); }); @@ -522,6 +518,16 @@ var gpii = fluid.registerNamespace("gpii"); }); }; + gpii.lifecycleManager.getSolutionRunningStateFromSnapshot = function (solutionSnapshot) { + // get isRunning entry from snapshot and block to run: + var isRunningBlock = fluid.makeArray(solutionSnapshot.isRunning)[0]; + if (isRunningBlock && isRunningBlock.indexOf("settings.") === 0) { + var settingsHandlerBlockName = isRunningBlock.substring("settings.".length); + var recordedState = fluid.get(solutionSnapshot, ["settingsHandlers", settingsHandlerBlockName, "settings", "running"]); + return recordedState; + } + }; + gpii.lifecycleManager.getSolutionRunningState = function (that, solutionId, solutionRecord, session) { if (!fluid.isDestroyed(that)) { var promise = that.executeActions(solutionId, solutionRecord, session, "isRunning", "isRunning"); @@ -590,7 +596,6 @@ var gpii = fluid.registerNamespace("gpii"); }; gpii.lifecycleManager.start = function (that, request, finalPayload, callback) { - console.log("KASPER: gpii.lifecycleManager.start") var userToken = finalPayload.userToken, lifecycleInstructions = finalPayload.lifecycleInstructions; if (that.sessionIndex[userToken]) { @@ -628,7 +633,6 @@ var gpii = fluid.registerNamespace("gpii"); if (solution.active === false) { // and it shouldn't actions = [ "stop", "configure" ]; } else { // else call "update" to make changes apply to a running solutions - console.log("KASPER: running and active = yes, so using 'update directive'") actions = [ "update" ]; } } else { // if it is not running diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index 92c65e257..11875031c 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -680,7 +680,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt // 2 tests for the settingsHandler (see mockSettingsHandler function above) // 2 tests for the launchHandler (see mockLaunchHandler function above) // and the two asserts below - jqUnit.expect(5); + jqUnit.expect(1); var lifecycleManager = gpii.lifecycleManager(gpii.tests.lifecycleManager.testOptions); gpii.tests.lifecycleManager.initBackingMock(); @@ -741,20 +741,6 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt var response = gpii.lifecycleManager.specToSettingsHandler("fake.solution", spec.request, spec.isMultiSH); jqUnit.assertDeepEq(name, { "fake.solution": spec.response }, response); }); - - // Test for fail if a multi settingshandler solution doesn't have a supportedSettings directive - var failingFunc = function () { - gpii.lifecycleManager.specToSettingsHandler("fake.solution", { - "type": "gpii.gsettings.set", - "options": {}, - "settings": { - "weirdSetting": "foo", - "otherSetting": "bar" - } - }, true); - }; - jqUnit.expectFrameworkDiagnostic("Expect failure if no supportedSettings for multiple SH solution", - failingFunc, "missing the 'supportedSettings' directive"); }); jqUnit.test("gpii.lifecycleManager.responseToSnapshot() no settings", function () { @@ -772,11 +758,11 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt jqUnit.assertDeepEq("responseToSnapshot returning the correct payload", expected, response); }); - jqUnit.asyncTest("gpii.lifecycleManager.invokeSettingsHandler()", function () { + jqUnit.asyncTest("gpii.lifecycleManager.invokeSettingsHandlerSet()", function () { jqUnit.expect(2); var lifecycleManager = gpii.lifecycleManager(); gpii.tests.lifecycleManager.initBackingMock(); - var snapshotPromise = lifecycleManager.invokeSettingsHandler("org.gnome.desktop.a11y.magnifier", gpii.tests.lifecycleManager.invokeSettingsHandlersRequest); + var snapshotPromise = lifecycleManager.invokeSettingsHandlerSet("org.gnome.desktop.a11y.magnifier", gpii.tests.lifecycleManager.invokeSettingsHandlersRequest); var expected = gpii.tests.lifecycleManager.settingsToChanges(gpii.tests.lifecycleManager.invokeSettingsHandlersExpectedSnapshot); snapshotPromise.then(function (snapshot) { jqUnit.assertDeepEq("invokeSettingsHandlers produced snapshot", expected, snapshot); diff --git a/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js b/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js index 899741eb7..9e9c9f6a1 100644 --- a/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js +++ b/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js @@ -45,8 +45,6 @@ argumentMap: {} }); - // TODO KASPER: - // fix returnTrue og returnFalse til noget lidt lækrere gpii.tests.flexibleHandler.returnTrue = function () { return true; }; diff --git a/gpii/node_modules/testing/src/Testing.js b/gpii/node_modules/testing/src/Testing.js index 0be7f06a5..36b7a8651 100644 --- a/gpii/node_modules/testing/src/Testing.js +++ b/gpii/node_modules/testing/src/Testing.js @@ -156,7 +156,6 @@ gpii.test.operateSettings = function (settingsHandlers, nameResolver, method) { }; gpii.test.setInitialState = function (settingsHandlers, nameResolver, onComplete) { - console.log("KASPER: SETTING INITIAL STATE " + JSON.stringify(settingsHandlers, null, 2)); // TODO KASPER var promise = gpii.test.setSettings(settingsHandlers, nameResolver); promise.then(onComplete); }; @@ -189,7 +188,6 @@ gpii.test.extractSettingsBlocks = function (settingsHandlers) { }; gpii.test.checkConfiguration = function (settingsHandlers, nameResolver, onComplete, customMsg) { - console.log("KASPER: CHECKING CONFIGURATION " + JSON.stringify(settingsHandlers, null, 2)); var configPromise = gpii.test.getSettings(settingsHandlers, nameResolver); configPromise.then(function (config) { var noOptions = gpii.test.extractSettingsBlocks(settingsHandlers); @@ -253,7 +251,7 @@ fluid.defaults("gpii.test.common.testCaseHolder", { }, mergePolicy: { "settingsHandlers": "noexpand", - "initialState": "noexpand" // KASPER? + "initialState": "noexpand" }, events: { onSnapshotComplete: null, diff --git a/tests/JournalIntegrationTests.js b/tests/JournalIntegrationTests.js index bf43fe989..219a9a23b 100644 --- a/tests/JournalIntegrationTests.js +++ b/tests/JournalIntegrationTests.js @@ -85,14 +85,16 @@ gpii.tests.journal.initialSettings = { } }] }, - "gpii.launchHandlers.flexibleHandler": { - "com.microsoft.windows.magnifier": [ - { - "settings": { - "running": false - } + "gpii.windows.enableRegisteredAT": { + "com.microsoft.windows.magnifier": [{ + "settings": { + "running": false + }, + "options": { + "registryName": "magnifierpane", + "queryProcess": "Magnify" } - ] + }] } }; diff --git a/tests/platform/windows/windows-nvda-testSpec.js b/tests/platform/windows/windows-nvda-testSpec.js index 2df5954a6..19a46c278 100644 --- a/tests/platform/windows/windows-nvda-testSpec.js +++ b/tests/platform/windows/windows-nvda-testSpec.js @@ -20,8 +20,6 @@ var fluid = require("infusion"), fluid.require("%universal"); -fluid.logObjectRenderChars = 80000 - gpii.loadTestingSupport(); fluid.registerNamespace("gpii.tests.windows.nvda"); From b9af1c8bb1ea9d391457cfeddfb0558d80f315dd Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 29 Mar 2017 15:49:09 +0200 Subject: [PATCH 12/26] GPII-1230: Added and fixed a bunch of LFM unit tests --- .../lifecycleManager/src/LifecycleManager.js | 73 +- .../test/js/LifecycleManagerTests.js | 968 +++++++++++------- .../src/settingsHandlerUtilities.js | 7 +- 3 files changed, 691 insertions(+), 357 deletions(-) diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index d4cb06841..17c1f60f4 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -235,13 +235,22 @@ var gpii = fluid.registerNamespace("gpii"); return value; }; + /** Remove all the settings blocks from a solutions registry entry + */ + gpii.settingsHandlers.removeSettingsBlocks = function (solutionEntry) { + solutionEntry.settingsHandlers = fluid.transform(solutionEntry.settingsHandlers, function (handler) { + return fluid.filterKeys(handler, "settings", true); + }); + return solutionEntry; + }; + /** Applies snapshotted settings from a single settingsHandler block attached to a single solution into the "originalSettings" * model snapshot area in the LifecycleManager's session. Tightly bound to executeSettingsAction, executes one-to-one with it * with almost identical argument list. */ - gpii.lifecycleManager.recordSnapshotInSession = function (that, snapshot, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction) { - var toSnapshot = fluid.copy(solutionRecord); + var toSnapshot = gpii.settingsHandlers.removeSettingsBlocks(fluid.copy(solutionRecord)); + // Disabled the removing of all settingshandlers blocks to ensure that we have them available when restoring the system. // This is particularly relevant for launch handlers, where we will need to run the "get" directives on logout to decide // whether we an application is running or not, and consequently, whether to run the "update" or "stop" block @@ -485,16 +494,60 @@ var gpii = fluid.registerNamespace("gpii"); * @return {Promise} A promise for the action of restoring the system */ gpii.lifecycleManager.restoreSystem = function (that, session, rootAction) { - var promises = fluid.transform(session.model.originalSettings, function (changesSolutionRecord, solutionId) { - var solutionRecord = gpii.lifecycleManager.transformSolutionSettings(changesSolutionRecord, gpii.settingsHandlers.changesToSettings); - // if a solution was running on login, run the update block to ensure that restored settings are applied - var recordedState = gpii.lifecycleManager.getSolutionRunningStateFromSnapshot(solutionRecord); - var actions = recordedState ? [ "update" ] : [ "stop", "restore" ]; - return that.applySolution(solutionId, solutionRecord, session, actions, rootAction); + var tasks = []; + fluid.each(session.model.originalSettings, function (changesSolutionRecord, solutionId) { + tasks.push(function () { + // check the current state of the solution to decide whether we should run the + // "restore", "update, or "stop" + return that.getSolutionRunningState(solutionId, changesSolutionRecord, session); + }); + tasks.push(function () { + if (!fluid.isDestroyed(that)) { // See above comment for GPII-580 + // if solution is already running, call "update" directive - else use "start" directive + var solutionRecord = gpii.lifecycleManager.transformSolutionSettings(changesSolutionRecord, gpii.settingsHandlers.changesToSettings); + var recordedRunState = gpii.lifecycleManager.getSolutionRunningStateFromSnapshot(solutionRecord); + var currentRunState = session.model.runningOnLogin[solutionId]; + + var actions; + if (currentRunState === true) { // if it's already running + if (recordedRunState === false) { // and it was not running on start + actions = [ "stop", "restore" ] + } else { // else update it + actions = [ "update" ] + } + } else { // if it is not running + if (recordedRunState === true) { // and it was running when we started + actions = [ "restore", "start" ]; + } else { // just restore settings + actions = [ "restore" ]; + } + } + + // build structure for returned values (for later reset) + return that.applySolution(solutionId, solutionRecord, session, actions, rootAction); + } + }); }); + var sequence = fluid.promise.sequence(tasks); + - // TODO: In theory we could stop all solutions in parallel - var sequence = fluid.promise.sequence(fluid.values(promises)); + // var promises = fluid.transform(session.model.originalSettings, function (changesSolutionRecord, solutionId) { + // var solutionRecord = gpii.lifecycleManager.transformSolutionSettings(changesSolutionRecord, gpii.settingsHandlers.changesToSettings); + // // if a solution was running on login, run the update block to ensure that restored settings are applied + // var recordedState = gpii.lifecycleManager.getSolutionRunningStateFromSnapshot(solutionRecord); + // var currentState = that.getSolutionRunningState(solutionId, changesSolutionRecord, session); + // var actions; + // if (recordedState === undefined) { // if we didn't do anything to solution state before, dont do it now + // actions = [ "restore" ] + // } else if (recordedState === true) { // if originally running and we stopped it, updait was started when we logged in, ensure that it is still started + // = recordedState ? [ "update" ] : [ "stop", "restore" ]; + // } + // } + // return that.applySolution(solutionId, solutionRecord, session, actions, rootAction); + // }); + + // // TODO: In theory we could stop all solutions in parallel + // var sequence = fluid.promise.sequence(fluid.values(promises)); return sequence; }; diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index 11875031c..c21603de5 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -2,7 +2,7 @@ GPII Lifecycle Manager Tests Copyright 2012 OCAD University -Copyright 2012 Raising The Floor - International +Copyright 2012, 2017 Raising The Floor - International Licensed under the New BSD license. You may not use this file except in compliance with this License. @@ -64,16 +64,37 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt return togo; }; - gpii.tests.lifecycleManager.buildSettingsHandlersEntry = function (settings) { - return { + gpii.tests.lifecycleManager.extendLifecycleInstructions = function (currentInstructions) { + var togo = fluid.copy(currentInstructions); + var solId = Object.keys(currentInstructions)[0]; + + for (var i = 1; i < arguments.length; ++i) { + togo[solId] = fluid.extend(true, {}, togo[solId], arguments[i]); + } + + return togo; + } + + gpii.tests.lifecycleManager.buildSettingsHandlersEntry = function (settings, setRunning) { + var togo = { "settingsHandlers": { "myconf": { "type": "gpii.tests.lifecycleManager.mockSettingsHandler", - "settings": settings, + "options": {} + }, + "launcher": { + "type": "gpii.tests.lifecycleManager.mockLaunchHandler", "options": {} } } }; + if (settings !== undefined) { + fluid.set(togo, [ "settingsHandlers", "myconf", "settings" ], settings) + } + if (setRunning !== undefined) { + fluid.set(togo, [ "settingsHandlers", "launcher", "settings" ], { running: setRunning }) + } + return togo; }; gpii.tests.lifecycleManager.noUpdateLifecycle = { @@ -100,7 +121,27 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt ] }; - gpii.tests.lifecycleManager.configurationSpec = gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle = { + "active": true, + "configure": [ + "settings.myconf" + ], + "restore": [ + "settings.myconf" + ], + "start": [ + "settings.launcher" + ], + "stop": [ + "settings.launcher" + ], + "isRunning": [ + "settings.launcher" + ] + }; + + gpii.tests.lifecycleManager.configurationSpec = gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "red" }), gpii.tests.lifecycleManager.noUpdateLifecycle, { "update": [ "settings.myconf" ] }); @@ -261,9 +302,14 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt userToken: 123 }; - gpii.tests.lifecycleManager.startPayload = fluid.extend(true, {}, gpii.tests.lifecycleManager.userOptions, { - lifecycleInstructions: gpii.tests.lifecycleManager.configurationSpec - }); + gpii.tests.lifecycleManager.buildStartPayload = function (lifecycleInstructions) { + return fluid.extend(true, {}, gpii.tests.lifecycleManager.userOptions, { + lifecycleInstructions: lifecycleInstructions + }); + }; + + gpii.tests.lifecycleManager.startPayload = gpii.tests.lifecycleManager.buildStartPayload(gpii.tests.lifecycleManager.configurationSpec); + gpii.tests.lifecycleManager.sampleActiveSession = { 123: { @@ -309,10 +355,31 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt gpii.tests.lifecycleManager.backingMockSettingsHandler = null; // initialised in every test that requires it - gpii.tests.lifecycleManager.initBackingMock = function () { - gpii.tests.lifecycleManager.backingMockSettingsHandler = gpii.test.integration.mockSettingsHandler(); + gpii.tests.lifecycleManager.initBackingMock = function (origSettings, setRunning) { + gpii.tests.lifecycleManager.backingMockSettingsHandler = gpii.test.integration.mockSettingsHandler({ + optionsPathKey: function (options, solutionId) { + return "settings|" + solutionId; + } + }); + gpii.tests.lifecycleManager.backingMockLaunchHandler = gpii.test.integration.mockSettingsHandler({ + optionsPathKey: function (options, solutionId) { + return "launch|" + solutionId; + } + }); + + var settings = origSettings === undefined ? // use default if no parameter is given + gpii.tests.lifecycleManager.settingsHandlerOriginalSystemSettings : + origSettings; + + var setRunning = (setRunning === undefined) ? false : setRunning; // default to false + var launchSettings = gpii.tests.lifecycleManager.launchHandlerOriginalSystemSettingsRunning(setRunning); // initialise the mock with the initial settings expected at the end of the test - gpii.tests.lifecycleManager.backingMockSettingsHandler.set(gpii.tests.lifecycleManager.settingsHandlerOriginalSystemSettings); + gpii.tests.lifecycleManager.backingMockSettingsHandler.set(settings); + gpii.tests.lifecycleManager.backingMockLaunchHandler.set(launchSettings); + // and ensure our 'local' storage is reset + gpii.tests.lifecycleManager.staticRepository.settingsHandler = undefined; + gpii.tests.lifecycleManager.staticRepository.launchHandler = undefined; + gpii.tests.lifecycleManager.staticRepository.launchHandlerCalls = 0; }; gpii.tests.lifecycleManager.mockSettingsHandler = { @@ -330,6 +397,40 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt } }; + // TODO KASPER: this is duplicate + gpii.tests.lifecycleManager.mockLaunchHandler = { + set: function (data) { + var togo = fluid.promise(); + gpii.invokeLater(function () { + gpii.tests.lifecycleManager.staticRepository.launchHandlerCalls++; + gpii.tests.lifecycleManager.staticRepository.launchHandler = data; + var response = gpii.resolveSync(gpii.tests.lifecycleManager.backingMockLaunchHandler.set(data)); + togo.resolve(response); + }, 100); + return togo; + }, + get: function (data) { + return gpii.resolveSync(gpii.tests.lifecycleManager.backingMockLaunchHandler.get(data)); + } + }; + + + gpii.tests.lifecycleManager.createSettingsHandlerPayload = function (solutionId, settings) { + if (settings === undefined) { + return undefined; + } else { + var togo = {}; + togo[solutionId] = [ + { + options: {}, + settings: settings + } + ]; + return togo; + } + } + + // TODO KASPER: Remove this and all references (probably) gpii.tests.lifecycleManager.assertExpectedExec = function () { jqUnit.assertDeepEq("Exec handler fired with expected arguments", { "command": gpii.tests.lifecycleManager.fakeEnvironment.JAWS_DIR + "jaws.exe", @@ -354,16 +455,30 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt "iamasetting": 200, "undefSetting": undefined }, - "options": {} + "options": { + // "storePath": "settingsBlock1" + } }], "other.application": [{ "settings": { "mysetting": "Hello World" }, - "type": "gpii.tests.lifecycleManager.mockSettingsHandler" + "options": { + // "storePath": "settingsBlock1" + } }] }; + gpii.tests.lifecycleManager.launchHandlerOriginalSystemSettingsRunning = function (setRunning) { + return { + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "running": setRunning + } + }] + } + }; + gpii.tests.lifecycleManager.settingsHandlerExpectedInputNewSettings = { "org.gnome.desktop.a11y.magnifier": [{ "settings": { @@ -384,340 +499,524 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt }] }; - gpii.tests.lifecycleManager.updateTestDefs = fluid.freezeRecursive([{ - name: "Updating with the same prefs and values as already applied", - activeSessions: gpii.tests.lifecycleManager.sampleActiveSession, - startPayload: gpii.tests.lifecycleManager.startPayload, - updateSpec: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false, "cross-hairs-color": "green" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - expectedAppliedSolutions: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false, "cross-hairs-color": "green" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - expectedOriginalSettings: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false, "cross-hairs-color": "red" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }) - }, { - name: "single pref changed without 'update' directive in solution registry entry", - activeSessions: gpii.tests.lifecycleManager.sampleActiveSession, - startPayload: fluid.extend(true, {}, gpii.tests.lifecycleManager.userOptions, { - lifecycleInstructions: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "red" }), - gpii.tests.lifecycleManager.noUpdateLifecycle) - }), - updateSpec: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-color": "green" }), - gpii.tests.lifecycleManager.noUpdateLifecycle), - // dont expect changes on update due to missing 'update' directive - expectedAppliedSolutions: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "red" }), - gpii.tests.lifecycleManager.noUpdateLifecycle), - expectedOriginalSettings: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false, "cross-hairs-color": "red" }), - gpii.tests.lifecycleManager.noUpdateLifecycle) - }, { - name: "Updating with normal reference to settingsHandler block, single settings", - activeSessions: gpii.tests.lifecycleManager.sampleActiveSession, - startPayload: gpii.tests.lifecycleManager.startPayload, - updateSpec: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-color": "green" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - expectedAppliedSolutions: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "green" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - expectedOriginalSettings: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false, "cross-hairs-color": "red" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }) - }, { - name: "Updating with normal reference to settingsHandler block, multiple settings", - activeSessions: gpii.tests.lifecycleManager.sampleActiveSession, - startPayload: gpii.tests.lifecycleManager.startPayload, - updateSpec: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-color": "green", "cross-hairs-clip": false }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - expectedAppliedSolutions: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false, "cross-hairs-color": "green" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - expectedOriginalSettings: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false, "cross-hairs-color": "red" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }) + gpii.tests.lifecycleManager.startTestDefs = [{ + name: "Solution with only start and stop blocks", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + { + "active": true, + "start": [ + "settings.launcher" + ], + "stop": [ + "settings.launcher" + ], + "isRunning": [ + "settings.launcher" + ] + } + ), + originalSettings: undefined, + runningOnLogin: false, + appliedSettings: {}, + runningAfterLogin: true, + expectedLaunchHandlerCalls: 2 }, { - name: "Updating with reference to 'configure' directive, single settings", - activeSessions: gpii.tests.lifecycleManager.sampleActiveSession, - startPayload: fluid.extend(true, {}, gpii.tests.lifecycleManager.userOptions, { - lifecycleInstructions: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "red" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "configure" ] }) - }), - updateSpec: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-color": "green" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "configure" ] }), - expectedAppliedSolutions: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "green" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "configure" ] }), - expectedOriginalSettings: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false, "cross-hairs-color": "red" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "configure" ] }) + name: "solution with only configure and restore blocks", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + { + "active": true, + "restore": [ + "settings.myconf" + ], + "configure": [ + "settings.myconf" + ], + "isRunning": [ + "settings.launcher" + ] + } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: undefined, + appliedSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, + runningAfterLogin: undefined, + expectedLaunchHandlerCalls: 0 }, { - name: "Updating with normal reference to settingsHandler block, and a setting not in the original settings applied to the system", - activeSessions: gpii.tests.lifecycleManager.sampleActiveSession, - startPayload: gpii.tests.lifecycleManager.startPayload, - updateSpec: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-color": "green", "iamasetting": 100 }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - expectedAppliedSolutions: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "green", "iamasetting": 100 }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - expectedOriginalSettings: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false, "cross-hairs-color": "red", "iamasetting": 200 }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }) + name: "Solution with all lifecycle blocks", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: false, + appliedSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, + runningAfterLogin: true, + expectedLaunchHandlerCalls: 2 }, { - name: "Updating with normal reference to settingsHandler block, and a an application not in the original settings applied to the system", - activeSessions: gpii.tests.lifecycleManager.sampleActiveSession, - startPayload: gpii.tests.lifecycleManager.startPayload, - updateSpec: gpii.tests.lifecycleManager.buildLifecycleInstructions("other.application", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "mysetting": "Hallow World" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - expectedAppliedSolutions: fluid.extend(true, {}, - gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "red" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - gpii.tests.lifecycleManager.buildLifecycleInstructions("other.application", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "mysetting": "Hallow World" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] })), - expectedOriginalSettings: fluid.extend(true, {}, - gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false, "cross-hairs-color": "red" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - gpii.tests.lifecycleManager.buildLifecycleInstructions("other.application", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "mysetting": "Hello World" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] })) + name: "solution with active: false", // no launch handler calls + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { "active": false } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: false, + appliedSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, + runningAfterLogin: undefined, + expectedLaunchHandlerCalls: 0 }, { - // TODO: What is the difference between this test and the next one? Also, eliminate the massive duplication - name: "Updating with normal reference to settingsHandler block, and 'undefined' value stored in snapshot", - activeSessions: gpii.tests.lifecycleManager.sampleActiveSession, - startPayload: fluid.extend(true, {}, gpii.tests.lifecycleManager.userOptions, { - lifecycleInstructions: fluid.extend(true, {}, - gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "undefSetting": "some value" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] })) - }), - expectedFirstAppliedSettings: { - "org.gnome.desktop.a11y.magnifier": [{ - "options": {}, - "settings": { - "cross-hairs-clip": true, - "undefSetting": "some value" - } - }] - }, - updateSpec: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "undefSetting": "some other value" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - expectedAppliedSolutions: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "undefSetting": "some other value" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - expectedOriginalSettings: { - "org.gnome.desktop.a11y.magnifier": { - "active": true, + name: "solution with active: undefined", // expect no launch handler calls + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + { + "active": undefined, "configure": [ "settings.myconf" ], "restore": [ "settings.myconf" ], - "settingsHandlers": { - "myconf": { - "options": {}, - "settings": { - "cross-hairs-clip": false, - "undefSetting": gpii.undefinedEncoding - }, - "type": "gpii.tests.lifecycleManager.mockSettingsHandler" - } - }, "start": [ - { - "args": [ - "-settingsDirectory", - "${{environment}.WINDIR}" - ], - "command": "${{environment}.JAWS_DIR}jaws.exe", - "name": "exec", - "type": "gpii.tests.lifecycleManager.mockExecHandler" - } + "settings.launcher" ], "stop": [ - { - "pid": "${{exec}.pid}", - "type": "gpii.tests.lifecycleManager.mockKillHandler" - } + "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ] + } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: false, + appliedSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, + runningAfterLogin: undefined, + expectedLaunchHandlerCalls: 0 + }, { + name: "running on login - 'update' with reference to settings handler block", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "settings.myconf" ] } - } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: true, + appliedSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, + runningAfterLogin: undefined, + expectedLaunchHandlerCalls: 0 }, { - name: "Updating with normal reference to settingsHandler block, and 'undefined' value stored in snapshot on update", - activeSessions: gpii.tests.lifecycleManager.sampleActiveSession, - startPayload: gpii.tests.lifecycleManager.startPayload, - updateSpec: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "undefSetting": "some value" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - expectedAppliedSolutions: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "red", "undefSetting": "some value" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - expectedOriginalSettings: { - "org.gnome.desktop.a11y.magnifier": { - "active": true, + name: "running on login - 'update' with reference to 'configure' block", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { + "update": [ + "configure" + ] + } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: true, + appliedSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, + runningAfterLogin: undefined, + expectedLaunchHandlerCalls: 0 + }, { + name: "running on login - 'update' with reference to 'stop', 'configure' and 'start' blocks", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { + "update": [ + "stop", + "configure", + "start" + ] + } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: true, + appliedSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, + runningAfterLogin: true, + expectedLaunchHandlerCalls: 4 // we run start/stop cycle both on login and logout + }, { + name: "running on login - with active: false", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { + "active": false + } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: true, + appliedSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, + runningAfterLogin: false, + expectedLaunchHandlerCalls: 2 + }, { + name: "running on login - with active: undefined", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + { + "active": undefined, "configure": [ "settings.myconf" ], "restore": [ "settings.myconf" ], - "settingsHandlers": { - "myconf": { - "options": {}, - "settings": { - "cross-hairs-clip": false, - "cross-hairs-color": "red", - "undefSetting": undefined - }, - "type": "gpii.tests.lifecycleManager.mockSettingsHandler" - } - }, "start": [ - { - "args": [ - "-settingsDirectory", - "${{environment}.WINDIR}" - ], - "command": "${{environment}.JAWS_DIR}jaws.exe", - "name": "exec", - "type": "gpii.tests.lifecycleManager.mockExecHandler" - } + "settings.launcher" ], "stop": [ - { - "pid": "${{exec}.pid}", - "type": "gpii.tests.lifecycleManager.mockKillHandler" - } + "settings.launcher" + ], + "isRunning": [ + "settings.launcher" ], "update": [ - "settings.myconf" + "stop", + "configure", + "start" ] } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: true, + appliedSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, + runningAfterLogin: true, + expectedLaunchHandlerCalls: 4 // we run start/stop cycle both on login and logout + }]; + + + gpii.tests.lifecycleManager.updateTestDefs = [{ + name: "Updating with the same prefs and values as already applied", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "settings.myconf" ] } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: false, + loginSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, + runningAfterLogin: true, + updateSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, + runningAfterUpdate: true, + expectedSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, + expectedLaunchHandlerCalls: 2 + }, { + name: "single pref changed without 'update' directive in solution registry entry", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: false, + loginSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, + runningAfterLogin: true, + updateSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, // dont expect these to apply + runningAfterUpdate: true, + expectedSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, + expectedLaunchHandlerCalls: 2 + }, { + name: "Updating with normal reference to settingsHandler block, single settings", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "settings.myconf" ] } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: false, + loginSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, + runningAfterLogin: true, + updateSettings: { "cross-hairs-color": "green" }, + runningAfterUpdate: true, + expectedSettings: { "cross-hairs-clip": true, "cross-hairs-color": "green" }, + expectedLaunchHandlerCalls: 2 + }, { + name: "Updating with normal reference to settingsHandler block, multiple settings", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "settings.myconf" ] } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: false, + loginSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, + runningAfterLogin: true, + updateSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, + runningAfterUpdate: true, + expectedSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, + expectedLaunchHandlerCalls: 2 + }, { + name: "Updating with reference to 'configure' directive, single settings", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: false, + loginSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, + runningAfterLogin: true, + updateSettings: { "cross-hairs-color": "green" }, + runningAfterUpdate: true, + expectedSettings: { "cross-hairs-clip": true, "cross-hairs-color": "green" }, + expectedLaunchHandlerCalls: 2 + }, { + name: "Updating with normal reference to settingsHandler block, and a setting not in the original settings applied to the system", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "settings.myconf" ] } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: false, + loginSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, + runningAfterLogin: true, + updateSettings: { "cross-hairs-color": "green", "iamasetting": 100 }, + runningAfterUpdate: true, + expectedSettings: { "cross-hairs-clip": true, "cross-hairs-color": "green", "iamasetting": 100 }, + originalSettingsAfterUpdate: { "cross-hairs-clip": false, "cross-hairs-color": "red", "iamasetting": undefined }, + expectedLaunchHandlerCalls: 2 + }]; + + + + gpii.tests.lifecycleManager.completeLifecycleTests = [{ + name: "Updating with normal reference to settingsHandler block, and a an application not in the original settings applied to the system", + expect: 9, + expectedLaunchHandlerCalls: 2, + runningOnLogin: false, + originalSettings: { + "org.gnome.desktop.a11y.magnifier": [{ options: {}, settings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }}] + }, + loginPayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] }, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "red" })), + expectedOriginal: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] }, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false, "cross-hairs-color": "red" }, false)), + expectedAfterLogin: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] }, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "red" }, true)), + runningAfterLogin: true, + updatePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions("other.application", + gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "mysetting": "Hallow World" }), + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] }), + expectedAfterUpdate: fluid.extend(true, {}, + gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "red" }, true), + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] }), + gpii.tests.lifecycleManager.buildLifecycleInstructions("other.application", + gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "mysetting": "Hallow World" }), + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] })), + expectedOriginalSettingsAfterUpdate: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false, "cross-hairs-color": "red" }, false), + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] }), + originalSettingsAfterUpdate: { + "other.application": [{ + "options": {}, + "settings": { + "mysetting": undefined + } + } + ] + }, + runningAfterUpdate: true + }, { + name: "Updating with normal reference to settingsHandler block, and 'undefined' value stored in snapshot", + expect: 9, + expectedLaunchHandlerCalls: 2, + runningOnLogin: false, + originalSettings: { + "org.gnome.desktop.a11y.magnifier": [{ options: {}, settings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }}] + }, + loginPayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] }, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true })), + expectedOriginal: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] }, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false }, false)), + expectedAfterLogin: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] }, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true }, true)), + runningAfterLogin: true, + updatePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "undefSetting": "some other value" }), + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] }), + expectedAfterUpdate: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "undefSetting": "some other value" }, true), + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] }), + expectedOriginalSettingsAfterUpdate: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false, "undefSetting": undefined }, false), + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] }), + originalSettingsAfterUpdate: gpii.tests.lifecycleManager.createSettingsHandlerPayload("org.gnome.desktop.a11y.magnifier", { "cross-hairs-clip": false, "undefSetting": undefined }), + runningAfterUpdate: true + }]; + + gpii.tests.lifecycleManager.checkFinalSettingsPayload = function (msg, expSettings, store) { + var expectedLastSettings; + if (expSettings === undefined) { + expectedLastSettings = expSettings; + } else { + // change to the format that is stoed by the mock settingshandler: + expectedLastSettings = { + "org.gnome.desktop.a11y.magnifier": [ + { + "options": {}, + "settings": expSettings + } + ] + }; } - }]); + jqUnit.assertDeepEq(msg, expectedLastSettings, store); + }; - gpii.tests.lifecycleManager.buildUpdateTests = function () { - fluid.each(gpii.tests.lifecycleManager.updateTestDefs, function (test) { - jqUnit.asyncTest("gpii.lifecycleManager.update() with active user session: " + test.name, function () { - gpii.tests.lifecycleManager.setup(); - jqUnit.expect(6); + /** + * expects an input with the following: + * name: name of the test + * expect: number of tests to expect + * expectedLaunchHandlerCalls: number of luanch handler calls to expect (incl. logout) + * originalSettings: the original settings to apply to the system (ie. before login) + * runningOnLogin: boolean - if the magnifier should be running before login + * loginPayload: payload to send to the start() function + * expectedOriginal: the expected "originalSettings" of the session after login + * expectedAfterLogin: the expected "appliedSolutions" of the session after login + * runningAfterLogin: boolean - if the magnifier should be running after login + * --- The below keys are optional and will trigger an update cycle if present. --- + * updatePayload: payload to send to the update() function + * expectedAfterUpdate: the expected "appliedSOlutions" of the session after update call + * expectedOriginalSettingsAfterUpdate: the original after a call to update() has been done, + * originalSettingsAfterUpdate: the settings that the system should reset to (ie. last call to settingsHandler) + * runningAfterUpdate: boolean - if the magnifier should be running after update + */ + gpii.tests.lifecycleManager.runLifecycleTest = function (testDef) { + var originalRunSetting = testDef.expectedLaunchHandlerCalls === 0 ? undefined : testDef.runningOnLogin; + jqUnit.asyncTest(testDef.name, function () { + gpii.tests.lifecycleManager.setup(); + jqUnit.expect(testDef.expect); - var lifecycleManager = gpii.lifecycleManager(gpii.tests.lifecycleManager.testOptions); - gpii.tests.lifecycleManager.initBackingMock(); + var lifecycleManager = gpii.lifecycleManager(gpii.tests.lifecycleManager.testOptions); + gpii.tests.lifecycleManager.initBackingMock(testDef.originalSettings, testDef.runningOnLogin); - lifecycleManager.start(test.startPayload, function (success) { - jqUnit.assertTrue("gpii.lifecycleManager.start() succeeds", success); - var updatePayload = fluid.extend(true, {}, test.startPayload, { - lifecycleInstructions: test.updateSpec - }); - gpii.tests.lifecycleManager.assertExpectedExec(); - var expectedFirstAppliedSettings = (test.expectedFirstAppliedSettings !== undefined) ? test.expectedFirstAppliedSettings : gpii.tests.lifecycleManager.settingsHandlerExpectedInputNewSettings; - gpii.tests.lifecycleManager.assertExpectedSettingsHandler(" - on start", expectedFirstAppliedSettings); - - lifecycleManager.update(updatePayload, function () { - var session = lifecycleManager.getSession(test.startPayload.userToken); - var appliedSolutions = session.model.appliedSolutions; - var originalSettings = session.model.originalSettings; - jqUnit.assertDeepEq("Checking appliedSolutions after update", test.expectedAppliedSolutions, appliedSolutions); - var expected = gpii.lifecycleManager.transformAllSolutionSettings(test.expectedOriginalSettings, gpii.settingsHandlers.settingsToChanges); + lifecycleManager.start(gpii.tests.lifecycleManager.buildStartPayload(testDef.loginPayload), function (success) { + jqUnit.assertTrue("gpii.lifecycleManager.start() succeeds", success); + var session = lifecycleManager.getSession(123); // always just use the default user token + jqUnit.assertDeepEq("Checking appliedSolutions after start", testDef.expectedAfterLogin, session.model.appliedSolutions); + + var originalSettings = session.model.originalSettings; + jqUnit.assertDeepEq("Checking originalSettings after start", gpii.lifecycleManager.transformAllSolutionSettings(testDef.expectedOriginal, gpii.settingsHandlers.settingsToChanges), originalSettings); + + var stopCycle = function () { + jqUnit.assertDeepEq("Session not running after stop", lifecycleManager.getSession(123)); + jqUnit.assertEquals("Number of calls to launch handler", testDef.expectedLaunchHandlerCalls, gpii.tests.lifecycleManager.staticRepository.launchHandlerCalls) + // Check that last calls to launch and settings handlers were actually the ones resetting to expected state + jqUnit.assertDeepEq("checking last payload sent to settingshandler:", testDef.originalSettingsAfterUpdate || testDef.originalSettings, gpii.tests.lifecycleManager.staticRepository.settingsHandler); + + // Check that last calls to launch and settings handlers were actually the ones resetting to expected state + gpii.tests.lifecycleManager.checkFinalSettingsPayload("checking last set launch settings", (originalRunSetting === undefined) ? undefined : { running: originalRunSetting }, gpii.tests.lifecycleManager.staticRepository.launchHandler); + jqUnit.start(); + } + + if (testDef.updatePayload) { + lifecycleManager.update(gpii.tests.lifecycleManager.buildStartPayload(testDef.updatePayload), function () { + jqUnit.assertDeepEq("Checking appliedSolutions after update", testDef.expectedAfterUpdate, session.model.appliedSolutions); + var expected = gpii.lifecycleManager.transformAllSolutionSettings(testDef.expectedOriginalSettingsAfterUpdate, gpii.settingsHandlers.settingsToChanges); jqUnit.assertDeepEq("Checking originalSettings after update", expected, originalSettings); - lifecycleManager.stop(gpii.tests.lifecycleManager.userOptions, function () { - jqUnit.assertDeepEq("Session not running after stop", lifecycleManager.getSession(test.startPayload.userToken)); - jqUnit.start(); - }); + lifecycleManager.stop(gpii.tests.lifecycleManager.userOptions, stopCycle); }); - }); + } else { + lifecycleManager.stop(gpii.tests.lifecycleManager.userOptions, stopCycle); + } }); }); }; - gpii.tests.lifecycleManager.isRunningTests = function () { - jqUnit.asyncTest("Tests for correct behavior when application is not already running", function () { - // call start block for solution - gpii.tests.lifecycleManager.setup(); - // 2 tests for the settingsHandler (see mockSettingsHandler function above) - // 2 tests for the launchHandler (see mockLaunchHandler function above) - // and the two asserts below - jqUnit.expect(1); - var lifecycleManager = gpii.lifecycleManager(gpii.tests.lifecycleManager.testOptions); - gpii.tests.lifecycleManager.initBackingMock(); + gpii.tests.lifecycleManager.buildUpdateTests = function () { + fluid.each(gpii.tests.lifecycleManager.updateTestDefs, function (test) { + var expectedOriginal = gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.originalSettings, test.runningOnLogin)); + var loginPayload = gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.loginSettings)); + var expectedAfterLogin = gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.loginSettings, test.runningAfterLogin)); + var updatePayload = gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.updateSettings)); + var expectedAfterUpdate = gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.expectedSettings, test.runningAfterUpdate)); + var originalRunSetting = test.expectedLaunchHandlerCalls === 0 ? undefined : test.runningOnLogin; + + var originalSettingsAfterUpdate = test.originalSettingsAfterUpdate || test.originalSettings; + var expectedOriginalSettingsAfterUpdate = gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry(originalSettingsAfterUpdate, test.runningOnLogin)); + + var testDef = { + name: "gpii.lifecycleManager.update() with active user session: " + test.name, + expect: 9, + expectedLaunchHandlerCalls: test.expectedLaunchHandlerCalls, + originalSettings: gpii.tests.lifecycleManager.createSettingsHandlerPayload("org.gnome.desktop.a11y.magnifier", test.originalSettings), + runningOnLogin: test.runningOnLogin, + loginPayload: loginPayload, + expectedOriginal: expectedOriginal, + expectedAfterLogin: expectedAfterLogin, + runningAfterLogin: test.runningAfterLogin, + updatePayload: updatePayload, + expectedAfterUpdate: expectedAfterUpdate, + expectedOriginalSettingsAfterUpdate: expectedOriginalSettingsAfterUpdate, + runningAfterUpdate: test.runningAfterUpdate, + originalSettingsAfterUpdate: gpii.tests.lifecycleManager.createSettingsHandlerPayload("org.gnome.desktop.a11y.magnifier", originalSettingsAfterUpdate) + } - lifecycleManager.start(gpii.tests.lifecycleManager.startPayload, function () { - gpii.tests.lifecycleManager.assertExpectedExec(); - // gpii.tests.lifecycleManager.assertExpectedSettingsHandler(" - on start", gpii.tests.lifecycleManager.settingsHandlerExpectedInputNewSettings); - // lifecycleManager.stop(gpii.tests.lifecycleManager.userOptions, function () { - // gpii.tests.lifecycleManager.assertExpectedSettingsHandler(" - on stop", gpii.tests.lifecycleManager.settingsHandlerExpectedInputRestoreSettings); - // jqUnit.assertEquals("Expected pid has been sent to kill handler", - // 8839, gpii.tests.lifecycleManager.staticRepository.killHandler.pid); - // gpii.tests.lifecycleManager.assertNoActiveSessions(lifecycleManager, "stop: Stop message to lifecycle manager"); - // jqUnit.start(); - // }); - jqUnit.start(); - }); + gpii.tests.lifecycleManager.runLifecycleTest(testDef); + }); + }; - // expect the isRunning block to be called (will return false) - // do NOT expect the 'update' block to be called - // DO expect the 'start' block to be called - // the correct state should be stored - // the correct state should be applied - // on logout DO expect the 'stop' block to be called - // the correct state should be restored - - // TEST: Running on startup - no reference to start/stop block in update - // call start block for solution - // get for isRunning block should be called (will return true) - // Expect the update block to be called - // do NOT expect the start block to be called - // The correct state should be stored - // The correct state should be applied - // on logout, update should be called - // do NOT expect the stop block to be called - // - - - // TEST: Running on startup + gpii.tests.lifecycleManager.buildStartTests = function () { + fluid.each(gpii.tests.lifecycleManager.startTestDefs, function (test) { + var testDef = { + name: "gpii.lifecycleManager.start()/stop(): " + test.name, + expect: 7, + expectedLaunchHandlerCalls: test.expectedLaunchHandlerCalls, + runningOnLogin: test.runningOnLogin, + originalSettings: gpii.tests.lifecycleManager.createSettingsHandlerPayload("org.gnome.desktop.a11y.magnifier", test.originalSettings), + loginPayload: gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.appliedSettings)), + expectedAfterLogin: gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.appliedSettings, test.runningAfterLogin)), + runningAfterLogin: test.runningAfterLogin, + // only expect launch handler settings to be in the original snapshot if we've run a launchHandler call during login + expectedOriginal: gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.originalSettings, test.expectedLaunchHandlerCalls === 0 ? undefined : test.runningOnLogin)) + }; + + gpii.tests.lifecycleManager.runLifecycleTest(testDef); }); }; @@ -733,7 +1032,6 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt jqUnit.module("Lifecycle Manager", function () { gpii.tests.staticRepository = {}; }); - gpii.tests.lifecycleManager.isRunningTests(); jqUnit.test("gpii.lifecycleManager.specToSettingsHandler()", function () { fluid.each(gpii.tests.lifecycleManager.specToSettingsHandlerTests, function (spec, name) { @@ -771,48 +1069,24 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt }); }); - jqUnit.asyncTest("gpii.lifecycleManager.start() and stop()", function () { - gpii.tests.lifecycleManager.setup(); - // 2 tests for the settingsHandler (see mockSettingsHandler function above) - // 2 tests for the launchHandler (see mockLaunchHandler function above) - // and the two asserts below - jqUnit.expect(5); - var lifecycleManager = gpii.lifecycleManager(gpii.tests.lifecycleManager.testOptions); + jqUnit.asyncTest("gpii.lifecycleManager.invokeSettingsHandlerGet()", function () { + jqUnit.expect(1); + var lifecycleManager = gpii.lifecycleManager(); gpii.tests.lifecycleManager.initBackingMock(); - - lifecycleManager.start(gpii.tests.lifecycleManager.startPayload, function () { - gpii.tests.lifecycleManager.assertExpectedExec(); - gpii.tests.lifecycleManager.assertExpectedSettingsHandler(" - on start", gpii.tests.lifecycleManager.settingsHandlerExpectedInputNewSettings); - lifecycleManager.stop(gpii.tests.lifecycleManager.userOptions, function () { - gpii.tests.lifecycleManager.assertExpectedSettingsHandler(" - on stop", gpii.tests.lifecycleManager.settingsHandlerExpectedInputRestoreSettings); - jqUnit.assertEquals("Expected pid has been sent to kill handler", - 8839, gpii.tests.lifecycleManager.staticRepository.killHandler.pid); - gpii.tests.lifecycleManager.assertNoActiveSessions(lifecycleManager, "stop: Stop message to lifecycle manager"); - jqUnit.start(); - }); - }); - }); - - // tests for active: false and active: undefined. - // active: true is tested in all the other tests - var activeValues = [ false, undefined ]; - fluid.each(activeValues, function (active) { - jqUnit.asyncTest("gpii.lifecycleManager.start() with active: " + (active === undefined ? "undefined" : active), function () { - //reset the exec values - gpii.tests.lifecycleManager.setup(); - - jqUnit.expect(2); - var lifecycleManager = gpii.lifecycleManager(gpii.tests.lifecycleManager.testOptions); - gpii.tests.lifecycleManager.initBackingMock(); - - // set up payload with active false - var activeFalsePayload = fluid.copy(gpii.tests.lifecycleManager.startPayload); - fluid.set(activeFalsePayload, [ "lifecycleInstructions", "org.gnome.desktop.a11y.magnifier", "active" ], active); - lifecycleManager.start(activeFalsePayload, function () { - gpii.tests.lifecycleManager.assertExpectedSettingsHandler(" - on start", gpii.tests.lifecycleManager.settingsHandlerExpectedInputNewSettings); - gpii.tests.lifecycleManager.assertNoExec(); - jqUnit.start(); - }); + var snapshotPromise = lifecycleManager.invokeSettingsHandlerGet("org.gnome.desktop.a11y.magnifier", gpii.tests.lifecycleManager.invokeSettingsHandlersRequest); + var expected = { + "org.gnome.desktop.a11y.magnifier": [ + { + "settings": { + "cross-hairs-clip": false, + "cross-hairs-color": "red" + } + } + ] + }; + snapshotPromise.then(function (snapshot) { + jqUnit.assertDeepEq("invokeSettingsHandlerGet produced snapshot", expected, snapshot); + jqUnit.start(); }); }); @@ -824,6 +1098,10 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt }); gpii.tests.lifecycleManager.buildUpdateTests(); + gpii.tests.lifecycleManager.buildStartTests(); + fluid.each(gpii.tests.lifecycleManager.completeLifecycleTests, function (testDef) { + gpii.tests.lifecycleManager.runLifecycleTest(testDef); + }) jqUnit.asyncTest("gpii.lifecycleManager.update() tests for 'stop' reference", function () { // initial payload: diff --git a/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js b/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js index c9c4cf0d1..8b0cf7800 100644 --- a/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js +++ b/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js @@ -89,10 +89,14 @@ gpii.settingsHandlers.transformPayload = function (payload, handler) { gpii.settingsHandlers.transformOneSolutionSettings = function (oneSolution, handler, path) { path = path || []; var togo = fluid.censorKeys(oneSolution, "settings"); - togo.settings = fluid.transform(oneSolution.settings, function (oneSetting, settingKey) { + var newSettings = fluid.transform(oneSolution.settings, function (oneSetting, settingKey) { var innerPath = path.concat(["settings", settingKey]); return handler(oneSetting, innerPath, oneSolution); }); + if (newSettings !== undefined) { // ignore undefined settings blocks + togo.settings = newSettings; + } + return togo; }; @@ -109,7 +113,6 @@ gpii.settingsHandlers.transformPayloadSettings = function (payload, handler) { /** Extract just the settings (eliminating "options") from the nested settingsHandler blocks for a full payload (top-level keys are solution ids) * - this is used from gpii.settingsHandlers.comparePayloads and gpii.test.checkConfiguration */ - gpii.settingsHandlers.extractSettingsBlocks = function (payload) { return gpii.settingsHandlers.transformPayload(payload, function (oneSolution) { return fluid.filterKeys(oneSolution, "settings"); From 17992aeaf1e55392424fe56a6f63fc8c1a1b127f Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Thu, 6 Apr 2017 12:49:14 +0200 Subject: [PATCH 13/26] GPII-1230: Added integration tests for closing conflicting solutions --- .../src/CanopyMatchMakerUtilities.js | 2 +- .../test/CanopyMatchMakerTests.js | 67 ++++- .../lifecycleManager/src/LifecycleManager.js | 37 +-- .../test/js/LifecycleManagerTests.js | 51 ++-- .../src/MatchMakerUtilities.js | 14 +- .../test/js/CanopyMatchMakerTests.js | 191 ------------- ...hMakerUtilitiesDisposeFromPriorityTests.js | 10 +- .../test/js/MatchMakerUtilitiesTests.js | 6 +- gpii/node_modules/testing/src/Testing.js | 24 +- tests/CloseConflictingAppsTests.js | 266 ++++++++++++++++++ tests/JournalIntegrationTests.js | 28 +- .../gpii.tests.multiScreenreader.config.json | 18 ++ .../gpii.tests.multiScreenreader.config.txt | 4 + .../data/multiScreenreaderDeviceReporter.json | 9 + ...sts.acceptance.windows.builtIn.config.json | 2 +- 15 files changed, 458 insertions(+), 271 deletions(-) delete mode 100644 gpii/node_modules/matchMakerFramework/test/js/CanopyMatchMakerTests.js create mode 100644 tests/CloseConflictingAppsTests.js create mode 100644 tests/configs/gpii.tests.multiScreenreader.config.json create mode 100644 tests/configs/gpii.tests.multiScreenreader.config.txt create mode 100644 tests/data/multiScreenreaderDeviceReporter.json diff --git a/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js b/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js index e773b3468..349b1c69b 100644 --- a/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js +++ b/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js @@ -103,7 +103,7 @@ gpii.canopyMatchMaker.utils.disposeFromCanopy = function (leaves, ranked, solrec for (var i = 0; i < ranked.length; ++i) { var sol = solrecs[ranked[i]]; - if (sol.disposition === "reject") { + if (sol.disposition === "reject" || sol.disposition === "deactivate") { continue; } diff --git a/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js b/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js index 36fb41680..a80c86c07 100644 --- a/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js +++ b/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js @@ -94,7 +94,7 @@ var matchFixtures = [ } } }, { - description: "Two magnifier preferences->best fit is launched", + description: "Two magnifier preferences->best fit is launched, the other one should not run", input: require("./data/full_mm_payload2.json"), preferences: { "gpii-default": { @@ -115,6 +115,13 @@ var matchFixtures = [ "http://registry.gpii.net/common/magnification": 150, "http://registry.gpii.net/common/invertColours": true } + }, + "fakemag1": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150, + "http://registry.gpii.net/common/invertColours": true + } } } } @@ -140,6 +147,12 @@ var matchFixtures = [ "settings": { "http://registry.gpii.net/common/magnification": 150 } + }, + "fakemag2": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150 + } } } } @@ -174,6 +187,13 @@ var matchFixtures = [ "http://registry.gpii.net/common/magnification": 150, "http://registry.gpii.net/common/pitch": 0.8 } + }, + "fakemag2": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150, + "http://registry.gpii.net/common/pitch": 0.8 + } } } } @@ -207,6 +227,12 @@ var matchFixtures = [ "settings": { "http://registry.gpii.net/common/magnification": 150 } + }, + "fakemag1": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150 + } } } } @@ -245,6 +271,12 @@ var matchFixtures = [ "settings": { "http://registry.gpii.net/common/magnification": 150 } + }, + "fakemag1": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150 + } } } } @@ -284,6 +316,12 @@ var matchFixtures = [ "settings": { "http://registry.gpii.net/common/magnification": 150 } + }, + "fakemag2": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150 + } } } } @@ -325,6 +363,13 @@ var matchFixtures = [ "http://registry.gpii.net/common/magnification": 150, "http://registry.gpii.net/common/invertColours": true } + }, + "fakemag1": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150, + "http://registry.gpii.net/common/invertColours": true + } } } } @@ -350,6 +395,12 @@ var matchFixtures = [ "settings": { "http://registry.gpii.net/applications/fakemag2": {} } + }, + "fakemag1": { + "active": false, + "settings": { + "http://registry.gpii.net/applications/fakemag2": {} + } } } } @@ -377,6 +428,13 @@ var matchFixtures = [ "http://registry.gpii.net/applications/fakemag2": {}, "http://registry.gpii.net/applications/fakemag1": {} } + }, + "fakemag2": { + "active": false, + "settings": { + "http://registry.gpii.net/applications/fakemag2": {}, + "http://registry.gpii.net/applications/fakemag1": {} + } } } } @@ -436,6 +494,13 @@ var matchFixtures = [ "http://registry.gpii.net/applications/fakemag2": {}, "http://registry.gpii.net/common/magnification": 150 } + }, + "fakemag2": { + "active": false, + "settings": { + "http://registry.gpii.net/applications/fakemag2": {}, + "http://registry.gpii.net/common/magnification": 150 + } } } } diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index 17c1f60f4..6b2d080ab 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -237,7 +237,7 @@ var gpii = fluid.registerNamespace("gpii"); /** Remove all the settings blocks from a solutions registry entry */ - gpii.settingsHandlers.removeSettingsBlocks = function (solutionEntry) { + gpii.lifecycleManager.removeSettingsBlocks = function (solutionEntry) { solutionEntry.settingsHandlers = fluid.transform(solutionEntry.settingsHandlers, function (handler) { return fluid.filterKeys(handler, "settings", true); }); @@ -249,14 +249,14 @@ var gpii = fluid.registerNamespace("gpii"); * with almost identical argument list. */ gpii.lifecycleManager.recordSnapshotInSession = function (that, snapshot, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction) { - var toSnapshot = gpii.settingsHandlers.removeSettingsBlocks(fluid.copy(solutionRecord)); - - // Disabled the removing of all settingshandlers blocks to ensure that we have them available when restoring the system. - // This is particularly relevant for launch handlers, where we will need to run the "get" directives on logout to decide - // whether we an application is running or not, and consequently, whether to run the "update" or "stop" block - // toSnapshot.settingsHandlers = {}; - toSnapshot.settingsHandlers[settingsHandlerBlockName] = snapshot; if (rootAction === "start" || rootAction === "update") { + var toSnapshot = gpii.lifecycleManager.removeSettingsBlocks(fluid.copy(solutionRecord)); + + // Disabled the removing of all settingshandlers blocks to ensure that we have them available when restoring the system. + // This is particularly relevant for launch handlers, where we will need to run the "get" directives on logout to decide + // whether we an application is running or not, and consequently, whether to run the "update" or "stop" block + // toSnapshot.settingsHandlers = {}; + toSnapshot.settingsHandlers[settingsHandlerBlockName] = snapshot; // keep the settings that are already stored from the // original snapshot, but augment it with any settings from the new snapshot // that were not present in the original snapshot. @@ -511,9 +511,9 @@ var gpii = fluid.registerNamespace("gpii"); var actions; if (currentRunState === true) { // if it's already running if (recordedRunState === false) { // and it was not running on start - actions = [ "stop", "restore" ] + actions = [ "stop", "restore" ]; } else { // else update it - actions = [ "update" ] + actions = [ "update" ]; } } else { // if it is not running if (recordedRunState === true) { // and it was running when we started @@ -530,24 +530,7 @@ var gpii = fluid.registerNamespace("gpii"); }); var sequence = fluid.promise.sequence(tasks); - - // var promises = fluid.transform(session.model.originalSettings, function (changesSolutionRecord, solutionId) { - // var solutionRecord = gpii.lifecycleManager.transformSolutionSettings(changesSolutionRecord, gpii.settingsHandlers.changesToSettings); - // // if a solution was running on login, run the update block to ensure that restored settings are applied - // var recordedState = gpii.lifecycleManager.getSolutionRunningStateFromSnapshot(solutionRecord); - // var currentState = that.getSolutionRunningState(solutionId, changesSolutionRecord, session); - // var actions; - // if (recordedState === undefined) { // if we didn't do anything to solution state before, dont do it now - // actions = [ "restore" ] - // } else if (recordedState === true) { // if originally running and we stopped it, updait was started when we logged in, ensure that it is still started - // = recordedState ? [ "update" ] : [ "stop", "restore" ]; - // } - // } - // return that.applySolution(solutionId, solutionRecord, session, actions, rootAction); - // }); - // // TODO: In theory we could stop all solutions in parallel - // var sequence = fluid.promise.sequence(fluid.values(promises)); return sequence; }; diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index c21603de5..1779ee41f 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -73,7 +73,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt } return togo; - } + }; gpii.tests.lifecycleManager.buildSettingsHandlersEntry = function (settings, setRunning) { var togo = { @@ -89,10 +89,10 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt } }; if (settings !== undefined) { - fluid.set(togo, [ "settingsHandlers", "myconf", "settings" ], settings) + fluid.set(togo, [ "settingsHandlers", "myconf", "settings" ], settings); } if (setRunning !== undefined) { - fluid.set(togo, [ "settingsHandlers", "launcher", "settings" ], { running: setRunning }) + fluid.set(togo, [ "settingsHandlers", "launcher", "settings" ], { running: setRunning }); } return togo; }; @@ -371,7 +371,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt gpii.tests.lifecycleManager.settingsHandlerOriginalSystemSettings : origSettings; - var setRunning = (setRunning === undefined) ? false : setRunning; // default to false + setRunning = (setRunning === undefined) ? false : setRunning; // default to false var launchSettings = gpii.tests.lifecycleManager.launchHandlerOriginalSystemSettingsRunning(setRunning); // initialise the mock with the initial settings expected at the end of the test gpii.tests.lifecycleManager.backingMockSettingsHandler.set(settings); @@ -414,7 +414,6 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt } }; - gpii.tests.lifecycleManager.createSettingsHandlerPayload = function (solutionId, settings) { if (settings === undefined) { return undefined; @@ -428,7 +427,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt ]; return togo; } - } + }; // TODO KASPER: Remove this and all references (probably) gpii.tests.lifecycleManager.assertExpectedExec = function () { @@ -476,7 +475,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt "running": setRunning } }] - } + }; }; gpii.tests.lifecycleManager.settingsHandlerExpectedInputNewSettings = { @@ -830,13 +829,12 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt gpii.tests.lifecycleManager.standardLifecycle, { "update": [ "configure" ] }), originalSettingsAfterUpdate: { - "other.application": [{ - "options": {}, - "settings": { - "mysetting": undefined - } - } - ] + "other.application": [{ + "options": {}, + "settings": { + "mysetting": undefined + } + }] }, runningAfterUpdate: true }, { @@ -888,7 +886,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt } else { // change to the format that is stoed by the mock settingshandler: expectedLastSettings = { - "org.gnome.desktop.a11y.magnifier": [ + "org.gnome.desktop.a11y.magnifier": [ { "options": {}, "settings": expSettings @@ -936,14 +934,14 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt var stopCycle = function () { jqUnit.assertDeepEq("Session not running after stop", lifecycleManager.getSession(123)); - jqUnit.assertEquals("Number of calls to launch handler", testDef.expectedLaunchHandlerCalls, gpii.tests.lifecycleManager.staticRepository.launchHandlerCalls) + jqUnit.assertEquals("Number of calls to launch handler", testDef.expectedLaunchHandlerCalls, gpii.tests.lifecycleManager.staticRepository.launchHandlerCalls); // Check that last calls to launch and settings handlers were actually the ones resetting to expected state jqUnit.assertDeepEq("checking last payload sent to settingshandler:", testDef.originalSettingsAfterUpdate || testDef.originalSettings, gpii.tests.lifecycleManager.staticRepository.settingsHandler); // Check that last calls to launch and settings handlers were actually the ones resetting to expected state gpii.tests.lifecycleManager.checkFinalSettingsPayload("checking last set launch settings", (originalRunSetting === undefined) ? undefined : { running: originalRunSetting }, gpii.tests.lifecycleManager.staticRepository.launchHandler); jqUnit.start(); - } + }; if (testDef.updatePayload) { lifecycleManager.update(gpii.tests.lifecycleManager.buildStartPayload(testDef.updatePayload), function () { @@ -971,7 +969,6 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.updateSettings)); var expectedAfterUpdate = gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.expectedSettings, test.runningAfterUpdate)); - var originalRunSetting = test.expectedLaunchHandlerCalls === 0 ? undefined : test.runningOnLogin; var originalSettingsAfterUpdate = test.originalSettingsAfterUpdate || test.originalSettings; var expectedOriginalSettingsAfterUpdate = gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, @@ -992,7 +989,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt expectedOriginalSettingsAfterUpdate: expectedOriginalSettingsAfterUpdate, runningAfterUpdate: test.runningAfterUpdate, originalSettingsAfterUpdate: gpii.tests.lifecycleManager.createSettingsHandlerPayload("org.gnome.desktop.a11y.magnifier", originalSettingsAfterUpdate) - } + }; gpii.tests.lifecycleManager.runLifecycleTest(testDef); }); @@ -1075,14 +1072,12 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt gpii.tests.lifecycleManager.initBackingMock(); var snapshotPromise = lifecycleManager.invokeSettingsHandlerGet("org.gnome.desktop.a11y.magnifier", gpii.tests.lifecycleManager.invokeSettingsHandlersRequest); var expected = { - "org.gnome.desktop.a11y.magnifier": [ - { - "settings": { - "cross-hairs-clip": false, - "cross-hairs-color": "red" - } - } - ] + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "cross-hairs-clip": false, + "cross-hairs-color": "red" + } + }] }; snapshotPromise.then(function (snapshot) { jqUnit.assertDeepEq("invokeSettingsHandlerGet produced snapshot", expected, snapshot); @@ -1101,7 +1096,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt gpii.tests.lifecycleManager.buildStartTests(); fluid.each(gpii.tests.lifecycleManager.completeLifecycleTests, function (testDef) { gpii.tests.lifecycleManager.runLifecycleTest(testDef); - }) + }); jqUnit.asyncTest("gpii.lifecycleManager.update() tests for 'stop' reference", function () { // initial payload: diff --git a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js index 38f8ac4ad..6976e8ebc 100644 --- a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js +++ b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js @@ -189,10 +189,10 @@ var fluid = fluid || require("infusion"), var leaves = gpii.matchMakerFramework.utils.computeLeaves(context.preferences); var disposed = strategy(leaves, tmpSolrecs, data, ontologyMetadata); - togo[contextId] = []; + togo[contextId] = {}; fluid.each(disposed, function (solrec, solid) { - if (solrec.disposition === "accept") { - togo[contextId].push(solid); + if (solrec.disposition === "accept" || solrec.disposition === "deactivate") { + togo[contextId][solid] = (solrec.disposition === "accept"); // true if it should be running } }); }); @@ -327,8 +327,8 @@ var fluid = fluid || require("infusion"), for (var solutionId in solutionTypeMapping[type]) { var sol = solrecs[solutionId]; if (!sol.disposition) { - sol.disposition = "reject"; - sol.dispositionReason = disposeReason || "Solution rejected due to its type of " + type; + sol.disposition = "deactivate"; + sol.dispositionReason = disposeReason || "Solution rejected (deactivated) due to its type of " + type; } } }); @@ -394,9 +394,9 @@ var fluid = fluid || require("infusion"), applications: {} }; var appBlock = togo.inferredConfiguration[contextId].applications; - fluid.each(solArray, function (solutionId) { + fluid.each(solArray, function (active, solutionId) { var content = { - active: true, + active: active, settings: fullModel.preferences.contexts[contextId].preferences }; appBlock[solutionId] = content; diff --git a/gpii/node_modules/matchMakerFramework/test/js/CanopyMatchMakerTests.js b/gpii/node_modules/matchMakerFramework/test/js/CanopyMatchMakerTests.js deleted file mode 100644 index 179323e50..000000000 --- a/gpii/node_modules/matchMakerFramework/test/js/CanopyMatchMakerTests.js +++ /dev/null @@ -1,191 +0,0 @@ -/* - * GPII Canopy MatchMaker Tests - * - * Copyright 2012 OCAD University - * Copyright 2012 Raising The Floor - International - * - * Licensed under the New BSD license. You may not use this file except in - * compliance with this License. - * - * The research leading to these results has received funding from the European Union's - * Seventh Framework Programme (FP7/2007-2013) - * under grant agreement no. 289016. - * - * You may obtain a copy of the License at - * https://github.com/GPII/universal/blob/master/LICENSE.txt - */ - -/* global jqUnit, fluid */ - -var gpii = fluid.registerNamespace("gpii"); - -(function () { - "use strict"; - - fluid.registerNamespace("gpii.tests.canopyMatchMaker"); - - var magnifier = { - "settingsHandlers": { - "myconf": { - "type": "gpii.integrationTesting.mockSettingsHandler", - "capabilities": ["display.screenEnhancement"], - "capabilitiesTransformations": { - "mag-factor": "display.screenEnhancement.magnification", - "show-cross-hairs": "display.screenEnhancement.-provisional-showCrosshairs", - "mouse-tracking": { - "transform": { - "type": "fluid.transforms.valueMapper", - "defaultInputPath": "display.screenEnhancement.tracking", - "match": { - "mouse": "centered" - } - } - } - } - } - } - }; - - var lesserMagnifier = { - "settingsHandlers": { - "myconf": { - "type": "gpii.integrationTesting.mockSettingsHandler", - "capabilitiesTransformations": { - "mag-factor": "display.screenEnhancement.magnification" - } - }, - "yourconf": { - "type": "gpii.integrationTesting.mockSettingsHandler", - "capabilities": "display.screenEnhancement.magnification" - } - } - }; - - var magnifierLeaves = [ - "display.screenEnhancement.magnification", - "display.screenEnhancement.-provisional-showCrosshairs", - "display.screenEnhancement.tracking", - "display.screenEnhancement" - ]; - - var magnifierSkeleton = { - display: { - screenEnhancement: { - magnification: {}, - "-provisional-showCrosshairs": {}, - tracking: {} - } - } - }; - - var escapedLeaves = [ - "display.screenReader.applications.nvda\\.screenReader" - ]; - - var escapedSkeleton = { - display: { - screenReader: { - applications: { - "nvda.screenReader": {} - } - } - } - }; - - var sammyProfile = { - "display": { - "screenEnhancement": { - "fontSize": 24, - "foregroundColor": "white", - "backgroundColor": "black", - "fontFace": { - "fontName": ["Comic Sans"], - "genericFontFace": "sans serif" - }, - "magnification": 2.0, - "tracking": ["mouse"], - "invertImages": true, - "-provisional-showCrosshairs": true - } - } - }; - - var sammyLeaves = [ - "display.screenEnhancement.-provisional-showCrosshairs", - "display.screenEnhancement.backgroundColor", - "display.screenEnhancement.fontFace.fontName.0", - "display.screenEnhancement.fontFace.genericFontFace", - "display.screenEnhancement.fontSize", - "display.screenEnhancement.foregroundColor", - "display.screenEnhancement.invertImages", - "display.screenEnhancement.magnification", - "display.screenEnhancement.tracking.0" - ]; - - var expandFitness = function (fitnesses) { - return fluid.transform(fitnesses, function (fit, index) { - return { - fitness: fit, - index: index - }; - }); - }; - - var extractIndices = function (solns) { - return fluid.transform(solns, function (soln) { - return soln.index; - }); - }; - - gpii.tests.canopyMatchMaker.runTests = function () { - jqUnit.module("Utilities"); - - jqUnit.test("Path Utilities", function () { - jqUnit.assertEquals("Exact depth", 0, gpii.matchMakerFramework.utils.prefixLength("display.screenEnhancement.fontSize", sammyProfile)); - jqUnit.assertEquals("Near depth", 0, gpii.matchMakerFramework.utils.prefixLength("display.screenEnhancement.fontSize", sammyProfile)); - jqUnit.assertEquals("Mid depth", -1, gpii.matchMakerFramework.utils.prefixLength("display.unrecognizable", sammyProfile)); - jqUnit.assertEquals("Far depth", -2, gpii.matchMakerFramework.utils.prefixLength("display.unrecognizable.thing", sammyProfile)); - var skeleton = gpii.matchMakerFramework.utils.pathsToSkeleton(magnifierLeaves); - jqUnit.assertDeepEq("Computed model skeleton", magnifierSkeleton, skeleton); - - var skeleton2 = gpii.matchMakerFramework.utils.pathsToSkeleton(escapedLeaves); - jqUnit.assertDeepEq("Computed model escaped skeleton", escapedSkeleton, skeleton2); - }); - - jqUnit.test("Fitness computation", function () { - var fitness = gpii.matchMaker.canopy.computeFitness(sammyLeaves, magnifierSkeleton); - var expected = [0, 0, -1, -1, -1, -1, -1, -2, -3]; - jqUnit.assertDeepEq("Computed fitness vector", expected, fitness); - - var fitnesses = [ - [-1, -3, 0], - [0, 0, 0], - [0, 0], - [0, 0, 0, 0], - [-1, -3, -1] - ]; - var solns = gpii.matchMaker.canopy.sortSolutions(expandFitness(fitnesses)); - var indices = extractIndices(solns); - var expected2 = [3, 1, 2, 0, 4]; - jqUnit.assertDeepEq("Ranked fitnesses", expected2, indices); - }); - - jqUnit.module("MatchMaker"); - jqUnit.test("Rank and dispose solutions", function () { - var solutions = [lesserMagnifier, - magnifier - ]; - var expanded = gpii.matchMakerFramework.utils.expandSolutions(solutions, { "*": "*" }); - var ranked = gpii.matchMaker.canopy.rankSolutions(sammyLeaves, expanded); - var indices = extractIndices(ranked); - var expected = [1, 0]; - jqUnit.assertDeepEq("Ranked solutions", expected, indices); - - var disposed = gpii.matchMaker.canopy.disposeSolutionsImpl(sammyLeaves, ranked); - var itions = gpii.matchMakerFramework.utils.extractDispositions(disposed); - expected = ["reject", "accept"]; - jqUnit.assertDeepEq("Disposed solutions", expected, itions); - }); - }; - -})(); diff --git a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js index f088d22eb..4b704b3ad 100644 --- a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js +++ b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js @@ -98,11 +98,11 @@ var fluid = fluid || require("infusion"), var testData = [{ description: "Tie between highest priority, rest rejected", priorities: [2, 2, 1, 1, 1], - expectedDispositions: [undefined, undefined, "reject", "reject", "reject"] + expectedDispositions: [undefined, undefined, "deactivate", "deactivate", "deactivate"] }, { description: "Single highest priority wins, rest rejected", priorities: [2, 1, 1, 1, 1], - expectedDispositions: ["accept", "reject", "reject", "reject", "reject"] + expectedDispositions: ["accept", "deactivate", "deactivate", "deactivate", "deactivate"] }, { // description: "Only solution covering all required solution types selected", // priorities: [2, 1, 2, 1, 1], @@ -110,15 +110,15 @@ var fluid = fluid || require("infusion"), // }, { description: "Highest priority selected, solution type equivalents remove", priorities: [2, 1, 3, 1, 2], - expectedDispositions: ["reject", "reject", "accept", "reject", "accept"] + expectedDispositions: ["deactivate", "deactivate", "accept", "deactivate", "accept"] }, { description: "Tie between multiple solutions of different types", priorities: [2, 1, 2, 2, 2], - expectedDispositions: [undefined, "reject", undefined, undefined, undefined] + expectedDispositions: [undefined, "deactivate", undefined, undefined, undefined] }, { description: "Tie between multiple solutions of different types #2", priorities: [2, 1, 2, 1, 2], - expectedDispositions: [undefined, "reject", undefined, "reject", undefined] + expectedDispositions: [undefined, "deactivate", undefined, "deactivate", undefined] // }, { // description: "", // priorities: [1, null, 2, null, null], diff --git a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js index ed53b5ca7..c4c68cfdf 100644 --- a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js +++ b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js @@ -287,9 +287,9 @@ var fluid = fluid || require("infusion"), { description: "Basic payloads", disposed: { - "gpii-default": [ - "mac.dummy" - ] + "gpii-default": { + "mac.dummy": true + } }, fullModel: { "userToken": "mac", diff --git a/gpii/node_modules/testing/src/Testing.js b/gpii/node_modules/testing/src/Testing.js index 36b7a8651..7beb91481 100644 --- a/gpii/node_modules/testing/src/Testing.js +++ b/gpii/node_modules/testing/src/Testing.js @@ -212,6 +212,19 @@ gpii.test.checkRestoredConfiguration = function (settingsHandlers, settingsStore }); }; +gpii.test.checkRestoredInitialState = function (initialSettings, nameResolver, onComplete) { + if (initialSettings === undefined) { + jqUnit.assertTrue("No initial settings defined, so not checking", true); + onComplete(); + return; + } + var currentSettingsPromise = gpii.test.getSettings(initialSettings, nameResolver); + currentSettingsPromise.then(function (currentSettings) { + jqUnit.assertDeepEq("Checking that initital settings are also properly reset", gpii.test.extractSettingsBlocks(initialSettings), currentSettings); + onComplete(); + }); +}; + gpii.test.common.receiveVariableResolver = function (testCaseHolder, variableResolver) { testCaseHolder.variableResolver = variableResolver; }; @@ -258,7 +271,8 @@ fluid.defaults("gpii.test.common.testCaseHolder", { onInitialStateSet: null, onInitialStateConfirmed: null, onCheckConfigurationComplete: null, - onCheckRestoredConfigurationComplete: null + onCheckRestoredConfigurationComplete: null, + onCheckRestoredInitialStateComplete: null }, distributeOptions: { "common.testCaseHolder.variableResolver": { @@ -385,6 +399,12 @@ gpii.test.checkSequence = fluid.freezeRecursive([ }, { event: "{testCaseHolder}.events.onCheckRestoredConfigurationComplete", listener: "fluid.identity" + }, { // anything in the intial state should also be restored upon logout + func: "gpii.test.checkRestoredInitialState", + args: [ "{tests}.initialState", "{nameResolver}", "{testCaseHolder}.events.onCheckRestoredInitialStateComplete.fire"] + }, { + event: "{testCaseHolder}.events.onCheckRestoredInitialStateComplete", + listener: "fluid.identity" } ]); @@ -403,7 +423,7 @@ gpii.test.push = function (array, elements) { gpii.test.buildSingleTestFixture = function (testDef, rootGrades) { testDef.gradeNames = fluid.makeArray(testDef.gradeNames).concat(fluid.makeArray(rootGrades)); - testDef.expect = 4; + testDef.expect = 5; testDef.sequence = fluid.makeArray(testDef.sequence); gpii.test.unshift(testDef.sequence, gpii.test.loginSequence); diff --git a/tests/CloseConflictingAppsTests.js b/tests/CloseConflictingAppsTests.js new file mode 100644 index 000000000..52ba5d84a --- /dev/null +++ b/tests/CloseConflictingAppsTests.js @@ -0,0 +1,266 @@ +/* + * GPII Tests for ensuring that two conflicting apps will not be launched + * + * These are integration tests for ensuring that eg. two screenreaders will not be active at the same time on + * the system. Besides the obvious case of checking that the MM doesn't launch two screenreaders on login, + * it is also tested that an already running screenreader will be closed if the matchmaker finds that another + * (conflicting) matchmaker should be launched. + * + * Copyright 2016 Raising The Floor - International + * + * Licensed under the New BSD license. You may not use this file except in + * compliance with this License. + * + * You may obtain a copy of the License at + * https://github.com/GPII/universal/blob/master/LICENSE.txt + */ +"use strict"; + +var fluid = require("infusion"), + gpii = fluid.registerNamespace("gpii"); + +fluid.require("%universal"); + +gpii.loadTestingSupport(); + +fluid.registerNamespace("gpii.tests.conflictingApps"); + +gpii.tests.conflictingApps.jawsHandlerEntry = function (running) { + return { + "com.freedomscientific.jaws": [{ + "settings": { + "running": running + }, + "options": { + "verifySettings": true, + "getState": [ + { + "type": "gpii.processReporter.find", + "command": "jfw" + } + ], + "setTrue": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\JAWS17.exe\\}\"" + } + ], + "setFalse": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "jfw.exe" + }, + { + "type": "gpii.windows.closeProcessByName", + "filename": "fsSynth32.exe" + }, + { + "type": "gpii.windows.closeProcessByName", + "filename": "jhookldr.exe" + } + ] + } + }] + }; +}; + +gpii.tests.conflictingApps.NVDAHandlerEntry = function (running) { + return { + "org.nvda-project": [{ + "settings": { + "running": running + }, + "options": { + "verifySettings": true, + "getState": [ + { + "type": "gpii.processReporter.find", + "command": "nvda" + } + ], + "setTrue": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\nvda.exe\\}\"" + } + ], + "setFalse": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "nvda_service.exe" + },{ + "type": "gpii.windows.closeProcessByName", + "filename": "nvda.exe" + } + ] + } + }] + }; +}; + +gpii.tests.conflictingApps.testDefs = [ + { + name: "Only one screenreader is launched", + userToken: "screenreader_common", + initialState: { + "gpii.launchHandlers.flexibleHandler": fluid.extend({}, + gpii.tests.conflictingApps.jawsHandlerEntry(false), + gpii.tests.conflictingApps.NVDAHandlerEntry(false)) + }, + settingsHandlers: { + + "gpii.settingsHandlers.INISettingsHandler": { + "org.nvda-project": [ + { + "settings": { + "speech.espeak.rate": 17, + "speech.espeak.volume": 75, + "speech.espeak.pitch": 15, + "speech.espeak.rateBoost": true, + "speech.symbolLevel": 300, + "speech.espeak.voice": "en\\en-wi", + "reviewCursor.followFocus": false, + "reviewCursor.followCaret": true, + "reviewCursor.followMouse": true, + "keyboard.speakTypedWords": true, + "keyboard.speakTypedCharacters": false, + "presentation.reportHelpBalloons": false, + "speech.espeak.sayCapForCapitals": true + }, + "options": { + "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", + "allowNumberSignComments": true, + "allowSubSections": true + } + } + ], + "com.freedomscientific.jaws": [ + { + "settings": { + "Voice Profiles.ActiveVoiceProfileName": "GPII", + "options.SayAllIndicateCaps": true, + "options.TypingEcho": 2 + }, + "options": { + "filename": "${{environment}.APPDATA}\\Freedom Scientific\\JAWS\\17.0\\Settings\\enu\\DEFAULT.JCF" + } + }, + + { + "settings": { + "ENU-Global.Rate": 400, + "ENU-Global.Punctuation": 3, + "ENU-Global.Pitch": 16, + "ENU-Message.Rate": 400, + "ENU-Message.Punctuation": 3, + "ENU-Message.Pitch": 16, + "ENU-Keyboard.Rate": 400, + "ENU-Keyboard.Punctuation": 3, + "ENU-Keyboard.Pitch": 16, + "ENU-PCCursor.Rate": 400, + "ENU-PCCursor.Punctuation": 3, + "ENU-PCCursor.Pitch": 16, + "ENU-JAWSCursor.Rate": 400, + "ENU-JAWSCursor.Punctuation": 3, + "ENU-JAWSCursor.Pitch": 16, + "ENU-MenuAndDialog.Rate": 400, + "ENU-MenuAndDialog.Punctuation": 3, + "ENU-MenuAndDialog.Pitch": 16 + }, + "options": { + "filename": "${{environment}.APPDATA}\\Freedom Scientific\\JAWS\\17.0\\Settings\\VoiceProfiles\\GPII.VPF" + } + } + ] + }, + "gpii.launchHandlers.flexibleHandler": fluid.extend({}, + gpii.tests.conflictingApps.jawsHandlerEntry(false), + gpii.tests.conflictingApps.NVDAHandlerEntry(true)) + } + }, { + name: "Conflicting screenreader (jaws) is closed is Only one screenreader is launched", + userToken: "screenreader_common", + initialState: { + "gpii.launchHandlers.flexibleHandler": fluid.extend({}, + gpii.tests.conflictingApps.jawsHandlerEntry(true), + gpii.tests.conflictingApps.NVDAHandlerEntry(false)) + }, + settingsHandlers: { + + "gpii.settingsHandlers.INISettingsHandler": { + "org.nvda-project": [ + { + "settings": { + "speech.espeak.rate": 17, + "speech.espeak.volume": 75, + "speech.espeak.pitch": 15, + "speech.espeak.rateBoost": true, + "speech.symbolLevel": 300, + "speech.espeak.voice": "en\\en-wi", + "reviewCursor.followFocus": false, + "reviewCursor.followCaret": true, + "reviewCursor.followMouse": true, + "keyboard.speakTypedWords": true, + "keyboard.speakTypedCharacters": false, + "presentation.reportHelpBalloons": false, + "speech.espeak.sayCapForCapitals": true + }, + "options": { + "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", + "allowNumberSignComments": true, + "allowSubSections": true + } + } + ], + "com.freedomscientific.jaws": [ + { + "settings": { + "Voice Profiles.ActiveVoiceProfileName": "GPII", + "options.SayAllIndicateCaps": true, + "options.TypingEcho": 2 + }, + "options": { + "filename": "${{environment}.APPDATA}\\Freedom Scientific\\JAWS\\17.0\\Settings\\enu\\DEFAULT.JCF" + } + }, + + { + "settings": { + "ENU-Global.Rate": 400, + "ENU-Global.Punctuation": 3, + "ENU-Global.Pitch": 16, + "ENU-Message.Rate": 400, + "ENU-Message.Punctuation": 3, + "ENU-Message.Pitch": 16, + "ENU-Keyboard.Rate": 400, + "ENU-Keyboard.Punctuation": 3, + "ENU-Keyboard.Pitch": 16, + "ENU-PCCursor.Rate": 400, + "ENU-PCCursor.Punctuation": 3, + "ENU-PCCursor.Pitch": 16, + "ENU-JAWSCursor.Rate": 400, + "ENU-JAWSCursor.Punctuation": 3, + "ENU-JAWSCursor.Pitch": 16, + "ENU-MenuAndDialog.Rate": 400, + "ENU-MenuAndDialog.Punctuation": 3, + "ENU-MenuAndDialog.Pitch": 16 + }, + "options": { + "filename": "${{environment}.APPDATA}\\Freedom Scientific\\JAWS\\17.0\\Settings\\VoiceProfiles\\GPII.VPF" + } + } + ] + }, + "gpii.launchHandlers.flexibleHandler": fluid.extend({}, + gpii.tests.conflictingApps.jawsHandlerEntry(false), + gpii.tests.conflictingApps.NVDAHandlerEntry(true)) + } + } +]; + +module.exports = gpii.test.bootstrap({ + testDefs: "gpii.tests.conflictingApps.testDefs", + configName: "gpii.tests.multiScreenreader.config", + configPath: "%universal/tests/configs" +}, ["gpii.test.integration.testCaseHolder.windows"], + module, require, __dirname); diff --git a/tests/JournalIntegrationTests.js b/tests/JournalIntegrationTests.js index 219a9a23b..0a7719d7e 100644 --- a/tests/JournalIntegrationTests.js +++ b/tests/JournalIntegrationTests.js @@ -98,6 +98,20 @@ gpii.tests.journal.initialSettings = { } }; +gpii.tests.journal.settingsAfterCrash = { + "gpii.windows.enableRegisteredAT": { + "com.microsoft.windows.magnifier": [{ + "settings": { + "running": false + }, + "options": { + "registryName": "magnifierpane", + "queryProcess": "Magnify" + } + }] + } +}; + fluid.defaults("gpii.tests.journal.solutionsRegistryAdvisor", { gradeNames: "fluid.modelComponent", model: { @@ -332,8 +346,6 @@ gpii.tests.journal.stashInitial = function (settingsHandlersPayload, settingsSto // with values all `undefined` will confuse jqUnit.assertDeepEq in gpii.test.checkConfiguration settingsHandlers["gpii.windows.spiSettingsHandler"] = fluid.filterKeys(settingsHandlers["gpii.windows.spiSettingsHandler"], "com.microsoft.windows.mouseTrailing"); settingsHandlers["gpii.windows.registrySettingsHandler"] = fluid.filterKeys(settingsHandlers["gpii.windows.registrySettingsHandler"], "com.microsoft.windows.magnifier"); - // settingsHandlers["gpii.windows.spiSettingsHandler"]["com.microsoft.windows.mouseTrailing"].length = 1; - // settingsHandlers["gpii.windows.registrySettingsHandler"]["com.microsoft.windows.magnifier"].length = 1; testCaseHolder.settingsHandlers = settingsHandlers; }; @@ -362,7 +374,7 @@ gpii.tests.journal.normalLoginFixtures = [ gpii.tests.journal.fixtures = [ { name: "Journal state and restoration", - expect: 10, + expect: 11, sequenceSegments: [ { func: "gpii.tests.journal.stashJournalId", args: "{testCaseHolder}" @@ -399,6 +411,12 @@ gpii.tests.journal.fixtures = [ }, kettle.test.startServerSequence, { + func: "gpii.test.setSettings", + args: [gpii.tests.journal.settingsAfterCrash, "{nameResolver}", "{testCaseHolder}.events.onInitialSettingsComplete.fire"] + }, { + event: "{tests}.events.onInitialSettingsComplete", + listener: "fluid.identity" + }, { func: "{listJournalsRequest}.send" }, { event: "{listJournalsRequest}.events.onComplete", @@ -487,5 +505,5 @@ gpii.tests.journal.badJournalBaseTestDef = fluid.extend({ kettle.test.bootstrapServer(gpii.test.buildSegmentedFixtures( gpii.tests.journal.fixtures, gpii.tests.journal.baseTestDef)); -kettle.test.bootstrapServer(gpii.test.buildSegmentedFixtures( - gpii.tests.journal.badJournalFixtures, gpii.tests.journal.badJournalBaseTestDef)); +// kettle.test.bootstrapServer(gpii.test.buildSegmentedFixtures( +// gpii.tests.journal.badJournalFixtures, gpii.tests.journal.badJournalBaseTestDef)); diff --git a/tests/configs/gpii.tests.multiScreenreader.config.json b/tests/configs/gpii.tests.multiScreenreader.config.json new file mode 100644 index 000000000..0ce917b80 --- /dev/null +++ b/tests/configs/gpii.tests.multiScreenreader.config.json @@ -0,0 +1,18 @@ +{ + "type": "gpii.tests.multiScreenreader.config", + "options": { + "distributeOptions": { + "multiSH.rawPreferencesDataSource": { + "record": "%universal/testData/preferences/acceptanceTests/%userToken.json", + "target": "{that rawPreferencesServer rawPreferencesDataSource}.options.path", + "priority": "after:development.rawPreferencesDataSource" + }, + "multiSH.deviceReporter": { + "record": "%universal/tests/data/multiScreenreaderDeviceReporter.json", + "target": "{that deviceReporter installedSolutionsDataSource}.options.path", + "priority": "after:development.installedSolutionsPath" + } + } + }, + "mergeConfigs": "%universal/gpii/configs/gpii.config.development.all.local.json" +} diff --git a/tests/configs/gpii.tests.multiScreenreader.config.txt b/tests/configs/gpii.tests.multiScreenreader.config.txt new file mode 100644 index 000000000..4e792098a --- /dev/null +++ b/tests/configs/gpii.tests.multiScreenreader.config.txt @@ -0,0 +1,4 @@ +gpii.tests.multiScreenreader.config.json + +Is used for the integration test CloseConflictingAppsTest. It uses the NP sets of the testData's acceptanceTests folder and a device reporter that reports only two screenreaders (Jaws and NVDA) installed. + diff --git a/tests/data/multiScreenreaderDeviceReporter.json b/tests/data/multiScreenreaderDeviceReporter.json new file mode 100644 index 000000000..5e9147038 --- /dev/null +++ b/tests/data/multiScreenreaderDeviceReporter.json @@ -0,0 +1,9 @@ +[ + { + "id": "com.freedomscientific.jaws" + }, + + { + "id": "org.nvda-project" + } +] diff --git a/tests/platform/windows/configs/gpii.tests.acceptance.windows.builtIn.config.json b/tests/platform/windows/configs/gpii.tests.acceptance.windows.builtIn.config.json index 064856ecb..c7e30261c 100644 --- a/tests/platform/windows/configs/gpii.tests.acceptance.windows.builtIn.config.json +++ b/tests/platform/windows/configs/gpii.tests.acceptance.windows.builtIn.config.json @@ -8,6 +8,6 @@ "priority": "after:development.installedSolutionsPath" } } - }, + }, "mergeConfigs": "%universal/tests/configs/gpii.tests.acceptance.localInstall.config.json" } From 625a684395beeebb347af148f40bfcdbf4592c29 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Thu, 6 Apr 2017 12:49:14 +0200 Subject: [PATCH 14/26] GPII-1230: Added integration tests for closing conflicting solutions --- .../src/CanopyMatchMakerUtilities.js | 2 +- .../test/CanopyMatchMakerTests.js | 67 ++++- .../lifecycleManager/src/LifecycleManager.js | 44 +-- .../test/js/LifecycleManagerTests.js | 52 ++-- .../src/MatchMakerUtilities.js | 14 +- .../test/js/CanopyMatchMakerTests.js | 191 ------------- ...hMakerUtilitiesDisposeFromPriorityTests.js | 10 +- .../test/js/MatchMakerUtilitiesTests.js | 6 +- gpii/node_modules/testing/src/Testing.js | 24 +- testData/solutions/win32.json5 | 13 +- tests/CloseConflictingAppsTests.js | 266 ++++++++++++++++++ tests/JournalIntegrationTests.js | 28 +- .../gpii.tests.multiScreenreader.config.json | 18 ++ .../gpii.tests.multiScreenreader.config.txt | 4 + .../data/multiScreenreaderDeviceReporter.json | 9 + ...sts.acceptance.windows.builtIn.config.json | 2 +- .../windows/windows-builtIn-testSpec.js | 71 ++++- .../windows-dynamicDeviceReporter-testSpec.js | 141 ++++++---- .../platform/windows/windows-jaws-testSpec.js | 3 +- .../platform/windows/windows-nvda-testSpec.js | 205 +++++++------- .../windows/windows-readWrite-testSpec.js | 176 ++++-------- 21 files changed, 783 insertions(+), 563 deletions(-) delete mode 100644 gpii/node_modules/matchMakerFramework/test/js/CanopyMatchMakerTests.js create mode 100644 tests/CloseConflictingAppsTests.js create mode 100644 tests/configs/gpii.tests.multiScreenreader.config.json create mode 100644 tests/configs/gpii.tests.multiScreenreader.config.txt create mode 100644 tests/data/multiScreenreaderDeviceReporter.json diff --git a/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js b/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js index e773b3468..349b1c69b 100644 --- a/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js +++ b/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js @@ -103,7 +103,7 @@ gpii.canopyMatchMaker.utils.disposeFromCanopy = function (leaves, ranked, solrec for (var i = 0; i < ranked.length; ++i) { var sol = solrecs[ranked[i]]; - if (sol.disposition === "reject") { + if (sol.disposition === "reject" || sol.disposition === "deactivate") { continue; } diff --git a/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js b/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js index 36fb41680..a80c86c07 100644 --- a/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js +++ b/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js @@ -94,7 +94,7 @@ var matchFixtures = [ } } }, { - description: "Two magnifier preferences->best fit is launched", + description: "Two magnifier preferences->best fit is launched, the other one should not run", input: require("./data/full_mm_payload2.json"), preferences: { "gpii-default": { @@ -115,6 +115,13 @@ var matchFixtures = [ "http://registry.gpii.net/common/magnification": 150, "http://registry.gpii.net/common/invertColours": true } + }, + "fakemag1": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150, + "http://registry.gpii.net/common/invertColours": true + } } } } @@ -140,6 +147,12 @@ var matchFixtures = [ "settings": { "http://registry.gpii.net/common/magnification": 150 } + }, + "fakemag2": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150 + } } } } @@ -174,6 +187,13 @@ var matchFixtures = [ "http://registry.gpii.net/common/magnification": 150, "http://registry.gpii.net/common/pitch": 0.8 } + }, + "fakemag2": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150, + "http://registry.gpii.net/common/pitch": 0.8 + } } } } @@ -207,6 +227,12 @@ var matchFixtures = [ "settings": { "http://registry.gpii.net/common/magnification": 150 } + }, + "fakemag1": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150 + } } } } @@ -245,6 +271,12 @@ var matchFixtures = [ "settings": { "http://registry.gpii.net/common/magnification": 150 } + }, + "fakemag1": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150 + } } } } @@ -284,6 +316,12 @@ var matchFixtures = [ "settings": { "http://registry.gpii.net/common/magnification": 150 } + }, + "fakemag2": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150 + } } } } @@ -325,6 +363,13 @@ var matchFixtures = [ "http://registry.gpii.net/common/magnification": 150, "http://registry.gpii.net/common/invertColours": true } + }, + "fakemag1": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150, + "http://registry.gpii.net/common/invertColours": true + } } } } @@ -350,6 +395,12 @@ var matchFixtures = [ "settings": { "http://registry.gpii.net/applications/fakemag2": {} } + }, + "fakemag1": { + "active": false, + "settings": { + "http://registry.gpii.net/applications/fakemag2": {} + } } } } @@ -377,6 +428,13 @@ var matchFixtures = [ "http://registry.gpii.net/applications/fakemag2": {}, "http://registry.gpii.net/applications/fakemag1": {} } + }, + "fakemag2": { + "active": false, + "settings": { + "http://registry.gpii.net/applications/fakemag2": {}, + "http://registry.gpii.net/applications/fakemag1": {} + } } } } @@ -436,6 +494,13 @@ var matchFixtures = [ "http://registry.gpii.net/applications/fakemag2": {}, "http://registry.gpii.net/common/magnification": 150 } + }, + "fakemag2": { + "active": false, + "settings": { + "http://registry.gpii.net/applications/fakemag2": {}, + "http://registry.gpii.net/common/magnification": 150 + } } } } diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index 17c1f60f4..978be8314 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -237,7 +237,7 @@ var gpii = fluid.registerNamespace("gpii"); /** Remove all the settings blocks from a solutions registry entry */ - gpii.settingsHandlers.removeSettingsBlocks = function (solutionEntry) { + gpii.lifecycleManager.removeSettingsBlocks = function (solutionEntry) { solutionEntry.settingsHandlers = fluid.transform(solutionEntry.settingsHandlers, function (handler) { return fluid.filterKeys(handler, "settings", true); }); @@ -249,14 +249,14 @@ var gpii = fluid.registerNamespace("gpii"); * with almost identical argument list. */ gpii.lifecycleManager.recordSnapshotInSession = function (that, snapshot, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction) { - var toSnapshot = gpii.settingsHandlers.removeSettingsBlocks(fluid.copy(solutionRecord)); - - // Disabled the removing of all settingshandlers blocks to ensure that we have them available when restoring the system. - // This is particularly relevant for launch handlers, where we will need to run the "get" directives on logout to decide - // whether we an application is running or not, and consequently, whether to run the "update" or "stop" block - // toSnapshot.settingsHandlers = {}; - toSnapshot.settingsHandlers[settingsHandlerBlockName] = snapshot; if (rootAction === "start" || rootAction === "update") { + var toSnapshot = gpii.lifecycleManager.removeSettingsBlocks(fluid.copy(solutionRecord)); + + // Disabled the removing of all settingshandlers blocks to ensure that we have them available when restoring the system. + // This is particularly relevant for launch handlers, where we will need to run the "get" directives on logout to decide + // whether we an application is running or not, and consequently, whether to run the "update" or "stop" block + // toSnapshot.settingsHandlers = {}; + toSnapshot.settingsHandlers[settingsHandlerBlockName] = snapshot; // keep the settings that are already stored from the // original snapshot, but augment it with any settings from the new snapshot // that were not present in the original snapshot. @@ -311,6 +311,7 @@ var gpii = fluid.registerNamespace("gpii"); return that.invokeSettingsHandlerGet(solutionId, expanded); } else { var settingsPromise = that.invokeSettingsHandlerSet(solutionId, expanded); + settingsPromise.then(function (snapshot) { session.applier.change(["appliedSolutions", solutionId], solutionRecord); gpii.lifecycleManager.recordSnapshotInSession(that, snapshot, solutionId, solutionRecord, session, @@ -430,7 +431,7 @@ var gpii = fluid.registerNamespace("gpii"); } else { // if this is related to launching, overwrite entry with the appropriate settings, // that is: { running: true } if we're in a start block, else { running: false } - if (actionBlock === "start" || (actionBlock === "stop" && rootAction !== "stop") || actionBlock === "isRunning") { + if (actionBlock === "start" || actionBlock === "stop") { var launchSettings = { running: actionBlock === "start" ? true : false }; fluid.set(solutionRecord, [ "settingsHandlers", settingsHandlerBlockName, "settings"], launchSettings); } @@ -442,7 +443,9 @@ var gpii = fluid.registerNamespace("gpii"); // TODO (GPII-1230) Fix this up so we don't always run the full start and stops (including) // system restoration, etc. if (action === "start" || action === "configure" || action === "stop") { - return that.executeActions(solutionId, solutionRecord, session, action, rootAction); + return function () { + return that.executeActions(solutionId, solutionRecord, session, action, rootAction); + }; } else { fluid.fail("Unrecognised string action in LifecycleManager: " + action + " inside 'update' section for solution " + solutionId); @@ -511,9 +514,9 @@ var gpii = fluid.registerNamespace("gpii"); var actions; if (currentRunState === true) { // if it's already running if (recordedRunState === false) { // and it was not running on start - actions = [ "stop", "restore" ] + actions = [ "stop", "restore" ]; } else { // else update it - actions = [ "update" ] + actions = [ "update" ]; } } else { // if it is not running if (recordedRunState === true) { // and it was running when we started @@ -530,24 +533,7 @@ var gpii = fluid.registerNamespace("gpii"); }); var sequence = fluid.promise.sequence(tasks); - - // var promises = fluid.transform(session.model.originalSettings, function (changesSolutionRecord, solutionId) { - // var solutionRecord = gpii.lifecycleManager.transformSolutionSettings(changesSolutionRecord, gpii.settingsHandlers.changesToSettings); - // // if a solution was running on login, run the update block to ensure that restored settings are applied - // var recordedState = gpii.lifecycleManager.getSolutionRunningStateFromSnapshot(solutionRecord); - // var currentState = that.getSolutionRunningState(solutionId, changesSolutionRecord, session); - // var actions; - // if (recordedState === undefined) { // if we didn't do anything to solution state before, dont do it now - // actions = [ "restore" ] - // } else if (recordedState === true) { // if originally running and we stopped it, updait was started when we logged in, ensure that it is still started - // = recordedState ? [ "update" ] : [ "stop", "restore" ]; - // } - // } - // return that.applySolution(solutionId, solutionRecord, session, actions, rootAction); - // }); - // // TODO: In theory we could stop all solutions in parallel - // var sequence = fluid.promise.sequence(fluid.values(promises)); return sequence; }; diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index c21603de5..4e0ae3c52 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -73,7 +73,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt } return togo; - } + }; gpii.tests.lifecycleManager.buildSettingsHandlersEntry = function (settings, setRunning) { var togo = { @@ -89,10 +89,10 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt } }; if (settings !== undefined) { - fluid.set(togo, [ "settingsHandlers", "myconf", "settings" ], settings) + fluid.set(togo, [ "settingsHandlers", "myconf", "settings" ], settings); } if (setRunning !== undefined) { - fluid.set(togo, [ "settingsHandlers", "launcher", "settings" ], { running: setRunning }) + fluid.set(togo, [ "settingsHandlers", "launcher", "settings" ], { running: setRunning }); } return togo; }; @@ -371,7 +371,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt gpii.tests.lifecycleManager.settingsHandlerOriginalSystemSettings : origSettings; - var setRunning = (setRunning === undefined) ? false : setRunning; // default to false + setRunning = (setRunning === undefined) ? false : setRunning; // default to false var launchSettings = gpii.tests.lifecycleManager.launchHandlerOriginalSystemSettingsRunning(setRunning); // initialise the mock with the initial settings expected at the end of the test gpii.tests.lifecycleManager.backingMockSettingsHandler.set(settings); @@ -397,7 +397,6 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt } }; - // TODO KASPER: this is duplicate gpii.tests.lifecycleManager.mockLaunchHandler = { set: function (data) { var togo = fluid.promise(); @@ -414,7 +413,6 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt } }; - gpii.tests.lifecycleManager.createSettingsHandlerPayload = function (solutionId, settings) { if (settings === undefined) { return undefined; @@ -428,7 +426,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt ]; return togo; } - } + }; // TODO KASPER: Remove this and all references (probably) gpii.tests.lifecycleManager.assertExpectedExec = function () { @@ -476,7 +474,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt "running": setRunning } }] - } + }; }; gpii.tests.lifecycleManager.settingsHandlerExpectedInputNewSettings = { @@ -830,13 +828,12 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt gpii.tests.lifecycleManager.standardLifecycle, { "update": [ "configure" ] }), originalSettingsAfterUpdate: { - "other.application": [{ - "options": {}, - "settings": { - "mysetting": undefined - } - } - ] + "other.application": [{ + "options": {}, + "settings": { + "mysetting": undefined + } + }] }, runningAfterUpdate: true }, { @@ -888,7 +885,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt } else { // change to the format that is stoed by the mock settingshandler: expectedLastSettings = { - "org.gnome.desktop.a11y.magnifier": [ + "org.gnome.desktop.a11y.magnifier": [ { "options": {}, "settings": expSettings @@ -936,14 +933,14 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt var stopCycle = function () { jqUnit.assertDeepEq("Session not running after stop", lifecycleManager.getSession(123)); - jqUnit.assertEquals("Number of calls to launch handler", testDef.expectedLaunchHandlerCalls, gpii.tests.lifecycleManager.staticRepository.launchHandlerCalls) + jqUnit.assertEquals("Number of calls to launch handler", testDef.expectedLaunchHandlerCalls, gpii.tests.lifecycleManager.staticRepository.launchHandlerCalls); // Check that last calls to launch and settings handlers were actually the ones resetting to expected state jqUnit.assertDeepEq("checking last payload sent to settingshandler:", testDef.originalSettingsAfterUpdate || testDef.originalSettings, gpii.tests.lifecycleManager.staticRepository.settingsHandler); // Check that last calls to launch and settings handlers were actually the ones resetting to expected state gpii.tests.lifecycleManager.checkFinalSettingsPayload("checking last set launch settings", (originalRunSetting === undefined) ? undefined : { running: originalRunSetting }, gpii.tests.lifecycleManager.staticRepository.launchHandler); jqUnit.start(); - } + }; if (testDef.updatePayload) { lifecycleManager.update(gpii.tests.lifecycleManager.buildStartPayload(testDef.updatePayload), function () { @@ -971,7 +968,6 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.updateSettings)); var expectedAfterUpdate = gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.expectedSettings, test.runningAfterUpdate)); - var originalRunSetting = test.expectedLaunchHandlerCalls === 0 ? undefined : test.runningOnLogin; var originalSettingsAfterUpdate = test.originalSettingsAfterUpdate || test.originalSettings; var expectedOriginalSettingsAfterUpdate = gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, @@ -992,7 +988,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt expectedOriginalSettingsAfterUpdate: expectedOriginalSettingsAfterUpdate, runningAfterUpdate: test.runningAfterUpdate, originalSettingsAfterUpdate: gpii.tests.lifecycleManager.createSettingsHandlerPayload("org.gnome.desktop.a11y.magnifier", originalSettingsAfterUpdate) - } + }; gpii.tests.lifecycleManager.runLifecycleTest(testDef); }); @@ -1075,14 +1071,12 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt gpii.tests.lifecycleManager.initBackingMock(); var snapshotPromise = lifecycleManager.invokeSettingsHandlerGet("org.gnome.desktop.a11y.magnifier", gpii.tests.lifecycleManager.invokeSettingsHandlersRequest); var expected = { - "org.gnome.desktop.a11y.magnifier": [ - { - "settings": { - "cross-hairs-clip": false, - "cross-hairs-color": "red" - } - } - ] + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "cross-hairs-clip": false, + "cross-hairs-color": "red" + } + }] }; snapshotPromise.then(function (snapshot) { jqUnit.assertDeepEq("invokeSettingsHandlerGet produced snapshot", expected, snapshot); @@ -1101,7 +1095,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt gpii.tests.lifecycleManager.buildStartTests(); fluid.each(gpii.tests.lifecycleManager.completeLifecycleTests, function (testDef) { gpii.tests.lifecycleManager.runLifecycleTest(testDef); - }) + }); jqUnit.asyncTest("gpii.lifecycleManager.update() tests for 'stop' reference", function () { // initial payload: diff --git a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js index 38f8ac4ad..6976e8ebc 100644 --- a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js +++ b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js @@ -189,10 +189,10 @@ var fluid = fluid || require("infusion"), var leaves = gpii.matchMakerFramework.utils.computeLeaves(context.preferences); var disposed = strategy(leaves, tmpSolrecs, data, ontologyMetadata); - togo[contextId] = []; + togo[contextId] = {}; fluid.each(disposed, function (solrec, solid) { - if (solrec.disposition === "accept") { - togo[contextId].push(solid); + if (solrec.disposition === "accept" || solrec.disposition === "deactivate") { + togo[contextId][solid] = (solrec.disposition === "accept"); // true if it should be running } }); }); @@ -327,8 +327,8 @@ var fluid = fluid || require("infusion"), for (var solutionId in solutionTypeMapping[type]) { var sol = solrecs[solutionId]; if (!sol.disposition) { - sol.disposition = "reject"; - sol.dispositionReason = disposeReason || "Solution rejected due to its type of " + type; + sol.disposition = "deactivate"; + sol.dispositionReason = disposeReason || "Solution rejected (deactivated) due to its type of " + type; } } }); @@ -394,9 +394,9 @@ var fluid = fluid || require("infusion"), applications: {} }; var appBlock = togo.inferredConfiguration[contextId].applications; - fluid.each(solArray, function (solutionId) { + fluid.each(solArray, function (active, solutionId) { var content = { - active: true, + active: active, settings: fullModel.preferences.contexts[contextId].preferences }; appBlock[solutionId] = content; diff --git a/gpii/node_modules/matchMakerFramework/test/js/CanopyMatchMakerTests.js b/gpii/node_modules/matchMakerFramework/test/js/CanopyMatchMakerTests.js deleted file mode 100644 index 179323e50..000000000 --- a/gpii/node_modules/matchMakerFramework/test/js/CanopyMatchMakerTests.js +++ /dev/null @@ -1,191 +0,0 @@ -/* - * GPII Canopy MatchMaker Tests - * - * Copyright 2012 OCAD University - * Copyright 2012 Raising The Floor - International - * - * Licensed under the New BSD license. You may not use this file except in - * compliance with this License. - * - * The research leading to these results has received funding from the European Union's - * Seventh Framework Programme (FP7/2007-2013) - * under grant agreement no. 289016. - * - * You may obtain a copy of the License at - * https://github.com/GPII/universal/blob/master/LICENSE.txt - */ - -/* global jqUnit, fluid */ - -var gpii = fluid.registerNamespace("gpii"); - -(function () { - "use strict"; - - fluid.registerNamespace("gpii.tests.canopyMatchMaker"); - - var magnifier = { - "settingsHandlers": { - "myconf": { - "type": "gpii.integrationTesting.mockSettingsHandler", - "capabilities": ["display.screenEnhancement"], - "capabilitiesTransformations": { - "mag-factor": "display.screenEnhancement.magnification", - "show-cross-hairs": "display.screenEnhancement.-provisional-showCrosshairs", - "mouse-tracking": { - "transform": { - "type": "fluid.transforms.valueMapper", - "defaultInputPath": "display.screenEnhancement.tracking", - "match": { - "mouse": "centered" - } - } - } - } - } - } - }; - - var lesserMagnifier = { - "settingsHandlers": { - "myconf": { - "type": "gpii.integrationTesting.mockSettingsHandler", - "capabilitiesTransformations": { - "mag-factor": "display.screenEnhancement.magnification" - } - }, - "yourconf": { - "type": "gpii.integrationTesting.mockSettingsHandler", - "capabilities": "display.screenEnhancement.magnification" - } - } - }; - - var magnifierLeaves = [ - "display.screenEnhancement.magnification", - "display.screenEnhancement.-provisional-showCrosshairs", - "display.screenEnhancement.tracking", - "display.screenEnhancement" - ]; - - var magnifierSkeleton = { - display: { - screenEnhancement: { - magnification: {}, - "-provisional-showCrosshairs": {}, - tracking: {} - } - } - }; - - var escapedLeaves = [ - "display.screenReader.applications.nvda\\.screenReader" - ]; - - var escapedSkeleton = { - display: { - screenReader: { - applications: { - "nvda.screenReader": {} - } - } - } - }; - - var sammyProfile = { - "display": { - "screenEnhancement": { - "fontSize": 24, - "foregroundColor": "white", - "backgroundColor": "black", - "fontFace": { - "fontName": ["Comic Sans"], - "genericFontFace": "sans serif" - }, - "magnification": 2.0, - "tracking": ["mouse"], - "invertImages": true, - "-provisional-showCrosshairs": true - } - } - }; - - var sammyLeaves = [ - "display.screenEnhancement.-provisional-showCrosshairs", - "display.screenEnhancement.backgroundColor", - "display.screenEnhancement.fontFace.fontName.0", - "display.screenEnhancement.fontFace.genericFontFace", - "display.screenEnhancement.fontSize", - "display.screenEnhancement.foregroundColor", - "display.screenEnhancement.invertImages", - "display.screenEnhancement.magnification", - "display.screenEnhancement.tracking.0" - ]; - - var expandFitness = function (fitnesses) { - return fluid.transform(fitnesses, function (fit, index) { - return { - fitness: fit, - index: index - }; - }); - }; - - var extractIndices = function (solns) { - return fluid.transform(solns, function (soln) { - return soln.index; - }); - }; - - gpii.tests.canopyMatchMaker.runTests = function () { - jqUnit.module("Utilities"); - - jqUnit.test("Path Utilities", function () { - jqUnit.assertEquals("Exact depth", 0, gpii.matchMakerFramework.utils.prefixLength("display.screenEnhancement.fontSize", sammyProfile)); - jqUnit.assertEquals("Near depth", 0, gpii.matchMakerFramework.utils.prefixLength("display.screenEnhancement.fontSize", sammyProfile)); - jqUnit.assertEquals("Mid depth", -1, gpii.matchMakerFramework.utils.prefixLength("display.unrecognizable", sammyProfile)); - jqUnit.assertEquals("Far depth", -2, gpii.matchMakerFramework.utils.prefixLength("display.unrecognizable.thing", sammyProfile)); - var skeleton = gpii.matchMakerFramework.utils.pathsToSkeleton(magnifierLeaves); - jqUnit.assertDeepEq("Computed model skeleton", magnifierSkeleton, skeleton); - - var skeleton2 = gpii.matchMakerFramework.utils.pathsToSkeleton(escapedLeaves); - jqUnit.assertDeepEq("Computed model escaped skeleton", escapedSkeleton, skeleton2); - }); - - jqUnit.test("Fitness computation", function () { - var fitness = gpii.matchMaker.canopy.computeFitness(sammyLeaves, magnifierSkeleton); - var expected = [0, 0, -1, -1, -1, -1, -1, -2, -3]; - jqUnit.assertDeepEq("Computed fitness vector", expected, fitness); - - var fitnesses = [ - [-1, -3, 0], - [0, 0, 0], - [0, 0], - [0, 0, 0, 0], - [-1, -3, -1] - ]; - var solns = gpii.matchMaker.canopy.sortSolutions(expandFitness(fitnesses)); - var indices = extractIndices(solns); - var expected2 = [3, 1, 2, 0, 4]; - jqUnit.assertDeepEq("Ranked fitnesses", expected2, indices); - }); - - jqUnit.module("MatchMaker"); - jqUnit.test("Rank and dispose solutions", function () { - var solutions = [lesserMagnifier, - magnifier - ]; - var expanded = gpii.matchMakerFramework.utils.expandSolutions(solutions, { "*": "*" }); - var ranked = gpii.matchMaker.canopy.rankSolutions(sammyLeaves, expanded); - var indices = extractIndices(ranked); - var expected = [1, 0]; - jqUnit.assertDeepEq("Ranked solutions", expected, indices); - - var disposed = gpii.matchMaker.canopy.disposeSolutionsImpl(sammyLeaves, ranked); - var itions = gpii.matchMakerFramework.utils.extractDispositions(disposed); - expected = ["reject", "accept"]; - jqUnit.assertDeepEq("Disposed solutions", expected, itions); - }); - }; - -})(); diff --git a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js index f088d22eb..4b704b3ad 100644 --- a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js +++ b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js @@ -98,11 +98,11 @@ var fluid = fluid || require("infusion"), var testData = [{ description: "Tie between highest priority, rest rejected", priorities: [2, 2, 1, 1, 1], - expectedDispositions: [undefined, undefined, "reject", "reject", "reject"] + expectedDispositions: [undefined, undefined, "deactivate", "deactivate", "deactivate"] }, { description: "Single highest priority wins, rest rejected", priorities: [2, 1, 1, 1, 1], - expectedDispositions: ["accept", "reject", "reject", "reject", "reject"] + expectedDispositions: ["accept", "deactivate", "deactivate", "deactivate", "deactivate"] }, { // description: "Only solution covering all required solution types selected", // priorities: [2, 1, 2, 1, 1], @@ -110,15 +110,15 @@ var fluid = fluid || require("infusion"), // }, { description: "Highest priority selected, solution type equivalents remove", priorities: [2, 1, 3, 1, 2], - expectedDispositions: ["reject", "reject", "accept", "reject", "accept"] + expectedDispositions: ["deactivate", "deactivate", "accept", "deactivate", "accept"] }, { description: "Tie between multiple solutions of different types", priorities: [2, 1, 2, 2, 2], - expectedDispositions: [undefined, "reject", undefined, undefined, undefined] + expectedDispositions: [undefined, "deactivate", undefined, undefined, undefined] }, { description: "Tie between multiple solutions of different types #2", priorities: [2, 1, 2, 1, 2], - expectedDispositions: [undefined, "reject", undefined, "reject", undefined] + expectedDispositions: [undefined, "deactivate", undefined, "deactivate", undefined] // }, { // description: "", // priorities: [1, null, 2, null, null], diff --git a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js index ed53b5ca7..c4c68cfdf 100644 --- a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js +++ b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js @@ -287,9 +287,9 @@ var fluid = fluid || require("infusion"), { description: "Basic payloads", disposed: { - "gpii-default": [ - "mac.dummy" - ] + "gpii-default": { + "mac.dummy": true + } }, fullModel: { "userToken": "mac", diff --git a/gpii/node_modules/testing/src/Testing.js b/gpii/node_modules/testing/src/Testing.js index 36b7a8651..7beb91481 100644 --- a/gpii/node_modules/testing/src/Testing.js +++ b/gpii/node_modules/testing/src/Testing.js @@ -212,6 +212,19 @@ gpii.test.checkRestoredConfiguration = function (settingsHandlers, settingsStore }); }; +gpii.test.checkRestoredInitialState = function (initialSettings, nameResolver, onComplete) { + if (initialSettings === undefined) { + jqUnit.assertTrue("No initial settings defined, so not checking", true); + onComplete(); + return; + } + var currentSettingsPromise = gpii.test.getSettings(initialSettings, nameResolver); + currentSettingsPromise.then(function (currentSettings) { + jqUnit.assertDeepEq("Checking that initital settings are also properly reset", gpii.test.extractSettingsBlocks(initialSettings), currentSettings); + onComplete(); + }); +}; + gpii.test.common.receiveVariableResolver = function (testCaseHolder, variableResolver) { testCaseHolder.variableResolver = variableResolver; }; @@ -258,7 +271,8 @@ fluid.defaults("gpii.test.common.testCaseHolder", { onInitialStateSet: null, onInitialStateConfirmed: null, onCheckConfigurationComplete: null, - onCheckRestoredConfigurationComplete: null + onCheckRestoredConfigurationComplete: null, + onCheckRestoredInitialStateComplete: null }, distributeOptions: { "common.testCaseHolder.variableResolver": { @@ -385,6 +399,12 @@ gpii.test.checkSequence = fluid.freezeRecursive([ }, { event: "{testCaseHolder}.events.onCheckRestoredConfigurationComplete", listener: "fluid.identity" + }, { // anything in the intial state should also be restored upon logout + func: "gpii.test.checkRestoredInitialState", + args: [ "{tests}.initialState", "{nameResolver}", "{testCaseHolder}.events.onCheckRestoredInitialStateComplete.fire"] + }, { + event: "{testCaseHolder}.events.onCheckRestoredInitialStateComplete", + listener: "fluid.identity" } ]); @@ -403,7 +423,7 @@ gpii.test.push = function (array, elements) { gpii.test.buildSingleTestFixture = function (testDef, rootGrades) { testDef.gradeNames = fluid.makeArray(testDef.gradeNames).concat(fluid.makeArray(rootGrades)); - testDef.expect = 4; + testDef.expect = 5; testDef.sequence = fluid.makeArray(testDef.sequence); gpii.test.unshift(testDef.sequence, gpii.test.loginSequence); diff --git a/testData/solutions/win32.json5 b/testData/solutions/win32.json5 index 60647ff8c..3fc4d9267 100644 --- a/testData/solutions/win32.json5 +++ b/testData/solutions/win32.json5 @@ -653,6 +653,11 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { + "verifySettings": true, + "retryOptions": { + rewriteEvery: 0, + numRetries: 40 + }, "setTrue": [ { "type": "gpii.launch.exec", @@ -668,7 +673,7 @@ "getState": [ { "type": "gpii.processReporter.find", - "command": "readandwrite" + "command": "ReadAndWrite" } ] } @@ -816,6 +821,12 @@ "launcher": { "type": "gpii.windows.enableRegisteredAT", "options": { + "verifySettings": true, + "retryOptions": { + "rewriteEvery": 0, + "numRetries": 20, + "retryInterval": 1000 + }, "registryName": "magnifierpane", "queryProcess": "Magnify" } diff --git a/tests/CloseConflictingAppsTests.js b/tests/CloseConflictingAppsTests.js new file mode 100644 index 000000000..52ba5d84a --- /dev/null +++ b/tests/CloseConflictingAppsTests.js @@ -0,0 +1,266 @@ +/* + * GPII Tests for ensuring that two conflicting apps will not be launched + * + * These are integration tests for ensuring that eg. two screenreaders will not be active at the same time on + * the system. Besides the obvious case of checking that the MM doesn't launch two screenreaders on login, + * it is also tested that an already running screenreader will be closed if the matchmaker finds that another + * (conflicting) matchmaker should be launched. + * + * Copyright 2016 Raising The Floor - International + * + * Licensed under the New BSD license. You may not use this file except in + * compliance with this License. + * + * You may obtain a copy of the License at + * https://github.com/GPII/universal/blob/master/LICENSE.txt + */ +"use strict"; + +var fluid = require("infusion"), + gpii = fluid.registerNamespace("gpii"); + +fluid.require("%universal"); + +gpii.loadTestingSupport(); + +fluid.registerNamespace("gpii.tests.conflictingApps"); + +gpii.tests.conflictingApps.jawsHandlerEntry = function (running) { + return { + "com.freedomscientific.jaws": [{ + "settings": { + "running": running + }, + "options": { + "verifySettings": true, + "getState": [ + { + "type": "gpii.processReporter.find", + "command": "jfw" + } + ], + "setTrue": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\JAWS17.exe\\}\"" + } + ], + "setFalse": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "jfw.exe" + }, + { + "type": "gpii.windows.closeProcessByName", + "filename": "fsSynth32.exe" + }, + { + "type": "gpii.windows.closeProcessByName", + "filename": "jhookldr.exe" + } + ] + } + }] + }; +}; + +gpii.tests.conflictingApps.NVDAHandlerEntry = function (running) { + return { + "org.nvda-project": [{ + "settings": { + "running": running + }, + "options": { + "verifySettings": true, + "getState": [ + { + "type": "gpii.processReporter.find", + "command": "nvda" + } + ], + "setTrue": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\nvda.exe\\}\"" + } + ], + "setFalse": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "nvda_service.exe" + },{ + "type": "gpii.windows.closeProcessByName", + "filename": "nvda.exe" + } + ] + } + }] + }; +}; + +gpii.tests.conflictingApps.testDefs = [ + { + name: "Only one screenreader is launched", + userToken: "screenreader_common", + initialState: { + "gpii.launchHandlers.flexibleHandler": fluid.extend({}, + gpii.tests.conflictingApps.jawsHandlerEntry(false), + gpii.tests.conflictingApps.NVDAHandlerEntry(false)) + }, + settingsHandlers: { + + "gpii.settingsHandlers.INISettingsHandler": { + "org.nvda-project": [ + { + "settings": { + "speech.espeak.rate": 17, + "speech.espeak.volume": 75, + "speech.espeak.pitch": 15, + "speech.espeak.rateBoost": true, + "speech.symbolLevel": 300, + "speech.espeak.voice": "en\\en-wi", + "reviewCursor.followFocus": false, + "reviewCursor.followCaret": true, + "reviewCursor.followMouse": true, + "keyboard.speakTypedWords": true, + "keyboard.speakTypedCharacters": false, + "presentation.reportHelpBalloons": false, + "speech.espeak.sayCapForCapitals": true + }, + "options": { + "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", + "allowNumberSignComments": true, + "allowSubSections": true + } + } + ], + "com.freedomscientific.jaws": [ + { + "settings": { + "Voice Profiles.ActiveVoiceProfileName": "GPII", + "options.SayAllIndicateCaps": true, + "options.TypingEcho": 2 + }, + "options": { + "filename": "${{environment}.APPDATA}\\Freedom Scientific\\JAWS\\17.0\\Settings\\enu\\DEFAULT.JCF" + } + }, + + { + "settings": { + "ENU-Global.Rate": 400, + "ENU-Global.Punctuation": 3, + "ENU-Global.Pitch": 16, + "ENU-Message.Rate": 400, + "ENU-Message.Punctuation": 3, + "ENU-Message.Pitch": 16, + "ENU-Keyboard.Rate": 400, + "ENU-Keyboard.Punctuation": 3, + "ENU-Keyboard.Pitch": 16, + "ENU-PCCursor.Rate": 400, + "ENU-PCCursor.Punctuation": 3, + "ENU-PCCursor.Pitch": 16, + "ENU-JAWSCursor.Rate": 400, + "ENU-JAWSCursor.Punctuation": 3, + "ENU-JAWSCursor.Pitch": 16, + "ENU-MenuAndDialog.Rate": 400, + "ENU-MenuAndDialog.Punctuation": 3, + "ENU-MenuAndDialog.Pitch": 16 + }, + "options": { + "filename": "${{environment}.APPDATA}\\Freedom Scientific\\JAWS\\17.0\\Settings\\VoiceProfiles\\GPII.VPF" + } + } + ] + }, + "gpii.launchHandlers.flexibleHandler": fluid.extend({}, + gpii.tests.conflictingApps.jawsHandlerEntry(false), + gpii.tests.conflictingApps.NVDAHandlerEntry(true)) + } + }, { + name: "Conflicting screenreader (jaws) is closed is Only one screenreader is launched", + userToken: "screenreader_common", + initialState: { + "gpii.launchHandlers.flexibleHandler": fluid.extend({}, + gpii.tests.conflictingApps.jawsHandlerEntry(true), + gpii.tests.conflictingApps.NVDAHandlerEntry(false)) + }, + settingsHandlers: { + + "gpii.settingsHandlers.INISettingsHandler": { + "org.nvda-project": [ + { + "settings": { + "speech.espeak.rate": 17, + "speech.espeak.volume": 75, + "speech.espeak.pitch": 15, + "speech.espeak.rateBoost": true, + "speech.symbolLevel": 300, + "speech.espeak.voice": "en\\en-wi", + "reviewCursor.followFocus": false, + "reviewCursor.followCaret": true, + "reviewCursor.followMouse": true, + "keyboard.speakTypedWords": true, + "keyboard.speakTypedCharacters": false, + "presentation.reportHelpBalloons": false, + "speech.espeak.sayCapForCapitals": true + }, + "options": { + "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", + "allowNumberSignComments": true, + "allowSubSections": true + } + } + ], + "com.freedomscientific.jaws": [ + { + "settings": { + "Voice Profiles.ActiveVoiceProfileName": "GPII", + "options.SayAllIndicateCaps": true, + "options.TypingEcho": 2 + }, + "options": { + "filename": "${{environment}.APPDATA}\\Freedom Scientific\\JAWS\\17.0\\Settings\\enu\\DEFAULT.JCF" + } + }, + + { + "settings": { + "ENU-Global.Rate": 400, + "ENU-Global.Punctuation": 3, + "ENU-Global.Pitch": 16, + "ENU-Message.Rate": 400, + "ENU-Message.Punctuation": 3, + "ENU-Message.Pitch": 16, + "ENU-Keyboard.Rate": 400, + "ENU-Keyboard.Punctuation": 3, + "ENU-Keyboard.Pitch": 16, + "ENU-PCCursor.Rate": 400, + "ENU-PCCursor.Punctuation": 3, + "ENU-PCCursor.Pitch": 16, + "ENU-JAWSCursor.Rate": 400, + "ENU-JAWSCursor.Punctuation": 3, + "ENU-JAWSCursor.Pitch": 16, + "ENU-MenuAndDialog.Rate": 400, + "ENU-MenuAndDialog.Punctuation": 3, + "ENU-MenuAndDialog.Pitch": 16 + }, + "options": { + "filename": "${{environment}.APPDATA}\\Freedom Scientific\\JAWS\\17.0\\Settings\\VoiceProfiles\\GPII.VPF" + } + } + ] + }, + "gpii.launchHandlers.flexibleHandler": fluid.extend({}, + gpii.tests.conflictingApps.jawsHandlerEntry(false), + gpii.tests.conflictingApps.NVDAHandlerEntry(true)) + } + } +]; + +module.exports = gpii.test.bootstrap({ + testDefs: "gpii.tests.conflictingApps.testDefs", + configName: "gpii.tests.multiScreenreader.config", + configPath: "%universal/tests/configs" +}, ["gpii.test.integration.testCaseHolder.windows"], + module, require, __dirname); diff --git a/tests/JournalIntegrationTests.js b/tests/JournalIntegrationTests.js index 219a9a23b..0a7719d7e 100644 --- a/tests/JournalIntegrationTests.js +++ b/tests/JournalIntegrationTests.js @@ -98,6 +98,20 @@ gpii.tests.journal.initialSettings = { } }; +gpii.tests.journal.settingsAfterCrash = { + "gpii.windows.enableRegisteredAT": { + "com.microsoft.windows.magnifier": [{ + "settings": { + "running": false + }, + "options": { + "registryName": "magnifierpane", + "queryProcess": "Magnify" + } + }] + } +}; + fluid.defaults("gpii.tests.journal.solutionsRegistryAdvisor", { gradeNames: "fluid.modelComponent", model: { @@ -332,8 +346,6 @@ gpii.tests.journal.stashInitial = function (settingsHandlersPayload, settingsSto // with values all `undefined` will confuse jqUnit.assertDeepEq in gpii.test.checkConfiguration settingsHandlers["gpii.windows.spiSettingsHandler"] = fluid.filterKeys(settingsHandlers["gpii.windows.spiSettingsHandler"], "com.microsoft.windows.mouseTrailing"); settingsHandlers["gpii.windows.registrySettingsHandler"] = fluid.filterKeys(settingsHandlers["gpii.windows.registrySettingsHandler"], "com.microsoft.windows.magnifier"); - // settingsHandlers["gpii.windows.spiSettingsHandler"]["com.microsoft.windows.mouseTrailing"].length = 1; - // settingsHandlers["gpii.windows.registrySettingsHandler"]["com.microsoft.windows.magnifier"].length = 1; testCaseHolder.settingsHandlers = settingsHandlers; }; @@ -362,7 +374,7 @@ gpii.tests.journal.normalLoginFixtures = [ gpii.tests.journal.fixtures = [ { name: "Journal state and restoration", - expect: 10, + expect: 11, sequenceSegments: [ { func: "gpii.tests.journal.stashJournalId", args: "{testCaseHolder}" @@ -399,6 +411,12 @@ gpii.tests.journal.fixtures = [ }, kettle.test.startServerSequence, { + func: "gpii.test.setSettings", + args: [gpii.tests.journal.settingsAfterCrash, "{nameResolver}", "{testCaseHolder}.events.onInitialSettingsComplete.fire"] + }, { + event: "{tests}.events.onInitialSettingsComplete", + listener: "fluid.identity" + }, { func: "{listJournalsRequest}.send" }, { event: "{listJournalsRequest}.events.onComplete", @@ -487,5 +505,5 @@ gpii.tests.journal.badJournalBaseTestDef = fluid.extend({ kettle.test.bootstrapServer(gpii.test.buildSegmentedFixtures( gpii.tests.journal.fixtures, gpii.tests.journal.baseTestDef)); -kettle.test.bootstrapServer(gpii.test.buildSegmentedFixtures( - gpii.tests.journal.badJournalFixtures, gpii.tests.journal.badJournalBaseTestDef)); +// kettle.test.bootstrapServer(gpii.test.buildSegmentedFixtures( +// gpii.tests.journal.badJournalFixtures, gpii.tests.journal.badJournalBaseTestDef)); diff --git a/tests/configs/gpii.tests.multiScreenreader.config.json b/tests/configs/gpii.tests.multiScreenreader.config.json new file mode 100644 index 000000000..0ce917b80 --- /dev/null +++ b/tests/configs/gpii.tests.multiScreenreader.config.json @@ -0,0 +1,18 @@ +{ + "type": "gpii.tests.multiScreenreader.config", + "options": { + "distributeOptions": { + "multiSH.rawPreferencesDataSource": { + "record": "%universal/testData/preferences/acceptanceTests/%userToken.json", + "target": "{that rawPreferencesServer rawPreferencesDataSource}.options.path", + "priority": "after:development.rawPreferencesDataSource" + }, + "multiSH.deviceReporter": { + "record": "%universal/tests/data/multiScreenreaderDeviceReporter.json", + "target": "{that deviceReporter installedSolutionsDataSource}.options.path", + "priority": "after:development.installedSolutionsPath" + } + } + }, + "mergeConfigs": "%universal/gpii/configs/gpii.config.development.all.local.json" +} diff --git a/tests/configs/gpii.tests.multiScreenreader.config.txt b/tests/configs/gpii.tests.multiScreenreader.config.txt new file mode 100644 index 000000000..4e792098a --- /dev/null +++ b/tests/configs/gpii.tests.multiScreenreader.config.txt @@ -0,0 +1,4 @@ +gpii.tests.multiScreenreader.config.json + +Is used for the integration test CloseConflictingAppsTest. It uses the NP sets of the testData's acceptanceTests folder and a device reporter that reports only two screenreaders (Jaws and NVDA) installed. + diff --git a/tests/data/multiScreenreaderDeviceReporter.json b/tests/data/multiScreenreaderDeviceReporter.json new file mode 100644 index 000000000..5e9147038 --- /dev/null +++ b/tests/data/multiScreenreaderDeviceReporter.json @@ -0,0 +1,9 @@ +[ + { + "id": "com.freedomscientific.jaws" + }, + + { + "id": "org.nvda-project" + } +] diff --git a/tests/platform/windows/configs/gpii.tests.acceptance.windows.builtIn.config.json b/tests/platform/windows/configs/gpii.tests.acceptance.windows.builtIn.config.json index 064856ecb..c7e30261c 100644 --- a/tests/platform/windows/configs/gpii.tests.acceptance.windows.builtIn.config.json +++ b/tests/platform/windows/configs/gpii.tests.acceptance.windows.builtIn.config.json @@ -8,6 +8,6 @@ "priority": "after:development.installedSolutionsPath" } } - }, + }, "mergeConfigs": "%universal/tests/configs/gpii.tests.acceptance.localInstall.config.json" } diff --git a/tests/platform/windows/windows-builtIn-testSpec.js b/tests/platform/windows/windows-builtIn-testSpec.js index ace416f75..e648790f6 100644 --- a/tests/platform/windows/windows-builtIn-testSpec.js +++ b/tests/platform/windows/windows-builtIn-testSpec.js @@ -35,6 +35,12 @@ gpii.tests.windows.builtIn = [ "running": false }, "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20, + retryInterval: 1000 + }, "registryName": "magnifierpane", "queryProcess": "Magnify" } @@ -229,6 +235,12 @@ gpii.tests.windows.builtIn = [ "running": true }, "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20, + retryInterval: 1000 + }, "registryName": "magnifierpane", "queryProcess": "Magnify" } @@ -245,6 +257,12 @@ gpii.tests.windows.builtIn = [ "running": false }, "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20, + retryInterval: 1000 + }, "registryName": "magnifierpane", "queryProcess": "Magnify" } @@ -430,6 +448,12 @@ gpii.tests.windows.builtIn = [ "running": true }, "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20, + retryInterval: 1000 + }, "registryName": "magnifierpane", "queryProcess": "Magnify" } @@ -455,6 +479,12 @@ gpii.tests.windows.builtIn = [ "running": true }, "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20, + retryInterval: 1000 + }, "registryName": "magnifierpane", "queryProcess": "Magnify" } @@ -640,6 +670,12 @@ gpii.tests.windows.builtIn = [ "running": true }, "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20, + retryInterval: 1000 + }, "registryName": "magnifierpane", "queryProcess": "Magnify" } @@ -656,7 +692,7 @@ gpii.tests.windows.builtIn = [ } } }, { - name: "Testing os_common - magnifier running on startup and keyboard both running on startup", + name: "Testing os_common - magnifier and keyboard both running on startup", userToken: "os_common", initialState: { "gpii.windows.enableRegisteredAT": { @@ -665,6 +701,12 @@ gpii.tests.windows.builtIn = [ "running": true }, "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20, + retryInterval: 1000 + }, "registryName": "magnifierpane", "queryProcess": "Magnify" } @@ -850,6 +892,12 @@ gpii.tests.windows.builtIn = [ "running": true }, "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20, + retryInterval: 1000 + }, "registryName": "magnifierpane", "queryProcess": "Magnify" } @@ -875,9 +923,24 @@ gpii.tests.windows.builtIn = [ "running": false }, "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20, + retryInterval: 1000 + }, "registryName": "magnifierpane", "queryProcess": "Magnify" } + }], + "com.microsoft.windows.onscreenKeyboard": [{ + "settings": { + "running": false + }, + "options": { + "registryName": "osk", + "queryProcess": "osk" + } }] } }, @@ -944,6 +1007,12 @@ gpii.tests.windows.builtIn = [ "running": true }, "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20, + retryInterval: 1000 + }, "registryName": "magnifierpane", "queryProcess": "Magnify" } diff --git a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js index ceffbebb3..3a10e4348 100644 --- a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js +++ b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js @@ -24,25 +24,89 @@ gpii.loadTestingSupport(); fluid.registerNamespace("gpii.tests.deviceReporterAware.windows"); -gpii.tests.deviceReporterAware.windows = [ +gpii.tests.deviceReporterAware.windows.flexibleHandlerEntries = { + nvda: function (running) { + return { + "org.nvda-project": [{ + "settings": { + "running": running + }, + "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20, + retryInterval: 1000 + }, + "getState": [ + { + "type": "gpii.processReporter.find", + "command": "nvda" + } + ], + "setTrue": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\nvda.exe\\}\"" + } + ], + "setFalse": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "nvda_service.exe" + },{ + "type": "gpii.windows.closeProcessByName", + "filename": "nvda.exe" + } + ] + } + }] + }; + }, + readwrite: function (running) { + return { + "com.texthelp.readWriteGold": [{ + "settings": { + "running": running + }, + "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 40, + retryInterval: 1000 + }, + "setTrue": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_CURRENT_USER\\Software\\Texthelp\\Read&Write11\\InstallPath}\\ReadAndWrite.exe\"" + } + ], + "setFalse": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "ReadAndWrite.exe" + } + ], + "getState": [ + { + "type": "gpii.processReporter.find", + "command": "ReadAndWrite" + } + ] + } + }] + } + } +}; + + +gpii.tests.deviceReporterAware.windows.testDefs = [ { name: "Testing screenreader_nvda using Flat matchmaker", userToken: "screenreader_nvda", initialState: { - "gpii.launchHandlers.flexibleHandler": { - "org.nvda-project": [{ - "settings": { - "running": false - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "nvda" - }] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.deviceReporterAware.windows.flexibleHandlerEntries.nvda(false) }, gradeNames: "gpii.test.integration.deviceReporterAware.windows", settingsHandlers: { @@ -74,20 +138,7 @@ gpii.tests.deviceReporterAware.windows = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { - "org.nvda-project": [{ - "settings": { - "running": true - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "nvda" - }] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.deviceReporterAware.windows.flexibleHandlerEntries.nvda(true) }, deviceReporters: { "gpii.deviceReporter.registryKeyExists": { @@ -104,36 +155,10 @@ gpii.tests.deviceReporterAware.windows = [ userToken: "readwritegold_application1", gradeNames: "gpii.test.integration.deviceReporterAware.windows", initialState: { - "gpii.launchHandlers.flexibleHandler": { - "com.texthelp.readWriteGold": [{ - "settings": { - "running": false - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "readandwrite" - }] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.deviceReporterAware.windows.flexibleHandlerEntries.readwrite(false) }, settingsHandlers: { - "gpii.launchHandlers.flexibleHandler": { - "com.texthelp.readWriteGold": [{ - "settings": { - "running": true - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "readandwrite" - }] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.deviceReporterAware.windows.flexibleHandlerEntries.readwrite(true) }, deviceReporters: { "gpii.deviceReporter.registryKeyExists": { @@ -148,7 +173,7 @@ gpii.tests.deviceReporterAware.windows = [ ]; module.exports = gpii.test.bootstrap({ - testDefs: "gpii.tests.deviceReporterAware.windows", + testDefs: "gpii.tests.deviceReporterAware.windows.testDefs", configName: "windows-dynamicDeviceReporter-config", configPath: "%universal/tests/platform/windows/configs" }, ["gpii.test.integration.testCaseHolder.windows", "gpii.test.integration.deviceReporterAware.windows"], diff --git a/tests/platform/windows/windows-jaws-testSpec.js b/tests/platform/windows/windows-jaws-testSpec.js index 89da550e0..24693d37a 100644 --- a/tests/platform/windows/windows-jaws-testSpec.js +++ b/tests/platform/windows/windows-jaws-testSpec.js @@ -38,7 +38,8 @@ gpii.tests.windows.jaws.flexibleHandlerEntry = function (running) { "verifySettings": true, retryOptions: { rewriteEvery: 0, - numRetries: 20 + numRetries: 20, + retryInterval: 1000 }, "getState": [ { diff --git a/tests/platform/windows/windows-nvda-testSpec.js b/tests/platform/windows/windows-nvda-testSpec.js index 19a46c278..fdc6ba26d 100644 --- a/tests/platform/windows/windows-nvda-testSpec.js +++ b/tests/platform/windows/windows-nvda-testSpec.js @@ -38,7 +38,8 @@ gpii.tests.windows.nvda.flexibleHandlerEntry = function (running) { "verifySettings": true, retryOptions: { rewriteEvery: 0, - numRetries: 20 + numRetries: 20, + retryInterval: 1000 }, "getState": [ { @@ -104,107 +105,107 @@ gpii.tests.windows.nvda.testDef = [ }, "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(true) } - // }, { - // name: "Testing screenreader_nvda", - // userToken: "screenreader_nvda", - // initialState: { - // "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(false) - // }, - // settingsHandlers: { - // "gpii.settingsHandlers.INISettingsHandler": { - // "org.nvda-project": [ - // { - // "settings": { - // "speech.espeak.rate": 17, - // "speech.espeak.volume": 80, - // "speech.espeak.pitch": 60, - // "speech.espeak.rateBoost": true, - // "speech.synth": "espeak", - // "speech.outputDevice": "Microsoft Sound Mapper", - // "speech.symbolLevel": 300, - // "speech.espeak.voice": "en\\en-wi", - // "reviewCursor.followFocus": false, - // "reviewCursor.followCaret": true, - // "reviewCursor.followMouse": true, - // "keyboard.speakTypedWords": true, - // "keyboard.speakTypedCharacters": false, - // "presentation.reportHelpBalloons": false, - // "speech.espeak.sayCapForCapitals": true - // }, - // "options": { - // "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", - // "allowNumberSignComments": true, - // "allowSubSections": true - // } - // } - // ] - // }, - // "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(true) - // } - // }, { - // name: "Testing screenreader_common", - // userToken: "screenreader_common", - // initialState: { - // "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(false) - // }, - // settingsHandlers: { - // "gpii.settingsHandlers.INISettingsHandler": { - // "org.nvda-project": [ - // { - // "settings": { - // "speech.espeak.rate": 17, - // "speech.espeak.volume": 75, - // "speech.espeak.pitch": 15, - // "speech.espeak.rateBoost": true, - // "speech.symbolLevel": 300, - // "speech.espeak.voice": "en\\en-wi", - // "reviewCursor.followFocus": false, - // "reviewCursor.followCaret": true, - // "reviewCursor.followMouse": true, - // "keyboard.speakTypedWords": true, - // "keyboard.speakTypedCharacters": false, - // "presentation.reportHelpBalloons": false, - // "speech.espeak.sayCapForCapitals": true - // }, - // "options": { - // "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", - // "allowNumberSignComments": true, - // "allowSubSections": true - // } - // } - // ] - // }, - // "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(true) - // } - // }, { - // name: "Testing screenreader_orca", - // userToken: "screenreader_orca", - // initialState: { - // "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(false) - // }, - // settingsHandlers: { - // "gpii.settingsHandlers.INISettingsHandler": { - // "org.nvda-project": [ - // { - // "settings": { - // "speech.symbolLevel": 300, - // "speech.espeak.rate": 17, - // "speech.espeak.voice": "en\\en-wi", - // "keyboard.speakTypedWords": true, - // "speech.espeak.rateBoost": true, - // "keyboard.speakTypedCharacters": false, - // "presentation.reportHelpBalloons": false - // }, - // "options": { - // "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", - // "allowNumberSignComments": true, - // "allowSubSections": true - // } - // } - // ] - // }, - // "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(true) - // } + }, { + name: "Testing screenreader_nvda", + userToken: "screenreader_nvda", + initialState: { + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(false) + }, + settingsHandlers: { + "gpii.settingsHandlers.INISettingsHandler": { + "org.nvda-project": [ + { + "settings": { + "speech.espeak.rate": 17, + "speech.espeak.volume": 80, + "speech.espeak.pitch": 60, + "speech.espeak.rateBoost": true, + "speech.synth": "espeak", + "speech.outputDevice": "Microsoft Sound Mapper", + "speech.symbolLevel": 300, + "speech.espeak.voice": "en\\en-wi", + "reviewCursor.followFocus": false, + "reviewCursor.followCaret": true, + "reviewCursor.followMouse": true, + "keyboard.speakTypedWords": true, + "keyboard.speakTypedCharacters": false, + "presentation.reportHelpBalloons": false, + "speech.espeak.sayCapForCapitals": true + }, + "options": { + "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", + "allowNumberSignComments": true, + "allowSubSections": true + } + } + ] + }, + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(true) + } + }, { + name: "Testing screenreader_common", + userToken: "screenreader_common", + initialState: { + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(false) + }, + settingsHandlers: { + "gpii.settingsHandlers.INISettingsHandler": { + "org.nvda-project": [ + { + "settings": { + "speech.espeak.rate": 17, + "speech.espeak.volume": 75, + "speech.espeak.pitch": 15, + "speech.espeak.rateBoost": true, + "speech.symbolLevel": 300, + "speech.espeak.voice": "en\\en-wi", + "reviewCursor.followFocus": false, + "reviewCursor.followCaret": true, + "reviewCursor.followMouse": true, + "keyboard.speakTypedWords": true, + "keyboard.speakTypedCharacters": false, + "presentation.reportHelpBalloons": false, + "speech.espeak.sayCapForCapitals": true + }, + "options": { + "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", + "allowNumberSignComments": true, + "allowSubSections": true + } + } + ] + }, + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(true) + } + }, { + name: "Testing screenreader_orca", + userToken: "screenreader_orca", + initialState: { + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(false) + }, + settingsHandlers: { + "gpii.settingsHandlers.INISettingsHandler": { + "org.nvda-project": [ + { + "settings": { + "speech.symbolLevel": 300, + "speech.espeak.rate": 17, + "speech.espeak.voice": "en\\en-wi", + "keyboard.speakTypedWords": true, + "speech.espeak.rateBoost": true, + "keyboard.speakTypedCharacters": false, + "presentation.reportHelpBalloons": false + }, + "options": { + "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", + "allowNumberSignComments": true, + "allowSubSections": true + } + } + ] + }, + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(true) + } } ]; diff --git a/tests/platform/windows/windows-readWrite-testSpec.js b/tests/platform/windows/windows-readWrite-testSpec.js index 77a00f367..755663af5 100644 --- a/tests/platform/windows/windows-readWrite-testSpec.js +++ b/tests/platform/windows/windows-readWrite-testSpec.js @@ -19,40 +19,55 @@ fluid.require("%universal"); gpii.loadTestingSupport(); -fluid.registerNamespace("gpii.tests.windows"); +fluid.registerNamespace("gpii.tests.windows.readwrite"); -gpii.tests.windows.readWrite = [ +// To avoid duplicating this entire piece in each test. Given a true or false value +// as input, this will return a settingshandler entry, containing all the options from +// the solutions registry entry for NVDAs launchHandler, with a settings block with +// running: X - where X is replaced with the input parameter +gpii.tests.windows.readwrite.flexibleHandlerEntry = function (running) { + return { + "com.texthelp.readWriteGold": [{ + "settings": { + "running": running + }, + "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 40, + retryInterval: 1000 + }, + "setTrue": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_CURRENT_USER\\Software\\Texthelp\\Read&Write11\\InstallPath}\\ReadAndWrite.exe\"" + } + ], + "setFalse": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "ReadAndWrite.exe" + } + ], + "getState": [ + { + "type": "gpii.processReporter.find", + "command": "ReadAndWrite" + } + ] + } + }] + }; +}; + + +gpii.tests.windows.readwrite.testDefs = [ { name: "Testing rwg1 - running on login", userToken: "rwg1", initialState: { - "gpii.launchHandlers.flexibleHandler": { - "com.texthelp.readWriteGold": [{ - "settings": { - "running": true - }, - "options": { - "setTrue": [ - { - "type": "gpii.launch.exec", - "command": "\"${{registry}.HKEY_CURRENT_USER\\Software\\Texthelp\\Read&Write11\\InstallPath}\\ReadAndWrite.exe\"" - } - ], - "setFalse": [ - { - "type": "gpii.windows.closeProcessByName", - "filename": "ReadAndWrite.exe" - } - ], - "getState": [ - { - "type": "gpii.processReporter.find", - "command": "readandwrite" - } - ] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.readwrite.flexibleHandlerEntry(true) }, settingsHandlers: { "gpii.settingsHandlers.XMLHandler": { @@ -86,52 +101,13 @@ gpii.tests.windows.readWrite = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { - "com.texthelp.readWriteGold": [{ - "settings": { - "running": true - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "readandwrite" - }] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.readwrite.flexibleHandlerEntry(true) } }, { name: "Testing rwg1", userToken: "rwg1", initialState: { - "gpii.launchHandlers.flexibleHandler": { - "com.texthelp.readWriteGold": [{ - "settings": { - "running": false - }, - "options": { - "setTrue": [ - { - "type": "gpii.launch.exec", - "command": "\"${{registry}.HKEY_CURRENT_USER\\Software\\Texthelp\\Read&Write11\\InstallPath}\\ReadAndWrite.exe\"" - } - ], - "setFalse": [ - { - "type": "gpii.windows.closeProcessByName", - "filename": "ReadAndWrite.exe" - } - ], - "getState": [ - { - "type": "gpii.processReporter.find", - "command": "readandwrite" - } - ] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.readwrite.flexibleHandlerEntry(false) }, settingsHandlers: { "gpii.settingsHandlers.XMLHandler": { @@ -165,52 +141,13 @@ gpii.tests.windows.readWrite = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { - "com.texthelp.readWriteGold": [{ - "settings": { - "running": true - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "readandwrite" - }] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.readwrite.flexibleHandlerEntry(true) } }, { name: "Testing rwg2", userToken: "rwg2", initialState: { - "gpii.launchHandlers.flexibleHandler": { - "com.texthelp.readWriteGold": [{ - "settings": { - "running": false - }, - "options": { - "setTrue": [ - { - "type": "gpii.launch.exec", - "command": "\"${{registry}.HKEY_CURRENT_USER\\Software\\Texthelp\\Read&Write11\\InstallPath}\\ReadAndWrite.exe\"" - } - ], - "setFalse": [ - { - "type": "gpii.windows.closeProcessByName", - "filename": "ReadAndWrite.exe" - } - ], - "getState": [ - { - "type": "gpii.processReporter.find", - "command": "readandwrite" - } - ] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.readwrite.flexibleHandlerEntry(false) }, settingsHandlers: { "gpii.settingsHandlers.XMLHandler": { @@ -246,26 +183,13 @@ gpii.tests.windows.readWrite = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { - "com.texthelp.readWriteGold": [{ - "settings": { - "running": true - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "readandwrite" - }] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.readwrite.flexibleHandlerEntry(true) } } ]; module.exports = gpii.test.bootstrap({ - testDefs: "gpii.tests.windows.readWrite", + testDefs: "gpii.tests.windows.readwrite.testDefs", configName: "gpii.tests.acceptance.windows.readWrite.config", configPath: "%universal/tests/platform/windows/configs" }, ["gpii.test.integration.testCaseHolder.windows"], From c4ecb80a9e085f906618903c51d40c35e5ee4e70 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 19 Apr 2017 09:50:30 +0200 Subject: [PATCH 15/26] GPII-2106: Added reference to JIRA for which a test case showed fix --- .../lifecycleManager/test/js/LifecycleManagerTests.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index 4e0ae3c52..fea9be16d 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -498,7 +498,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt }; gpii.tests.lifecycleManager.startTestDefs = [{ - name: "Solution with only start and stop blocks", + name: "Solution with only start and stop blocks (GPII-2106)", basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( "org.gnome.desktop.a11y.magnifier", { @@ -785,7 +785,6 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt }]; - gpii.tests.lifecycleManager.completeLifecycleTests = [{ name: "Updating with normal reference to settingsHandler block, and a an application not in the original settings applied to the system", expect: 9, From eb2a8c3993b360c72fa1123f79876225d509fc30 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 19 Apr 2017 16:10:22 +0200 Subject: [PATCH 16/26] GPII-1230: Linted and cleaned code a bit --- documentation/CanopyMatchMaker.md | 7 +- documentation/MatchMakerFramework.md | 8 +- ....config.all.development.pr.production.json | 15 -- ...i.config.all.development.pr.production.txt | 23 --- .../test/js/LifecycleManagerTests.js | 17 -- gpii/node_modules/processReporter/README.md | 55 +----- gpii/node_modules/testing/src/Testing.js | 3 - .../processReporter/runningSolutions.json | 172 ------------------ tests/JournalIntegrationTests.js | 4 +- .../windows-dynamicDeviceReporter-testSpec.js | 2 +- .../windows/windows-readWrite-testSpec.js | 2 +- 11 files changed, 16 insertions(+), 292 deletions(-) delete mode 100644 gpii/configs/gpii.config.all.development.pr.production.json delete mode 100644 gpii/configs/gpii.config.all.development.pr.production.txt delete mode 100644 testData/processReporter/runningSolutions.json diff --git a/documentation/CanopyMatchMaker.md b/documentation/CanopyMatchMaker.md index 51df9a45f..b0aed4d79 100644 --- a/documentation/CanopyMatchMaker.md +++ b/documentation/CanopyMatchMaker.md @@ -25,13 +25,16 @@ To ensure that several conflicting solutions (e.g. two screenreaders) are not la The apptology is described in more details here: [Apptology.md](Apptology.md). +## Dispositions +As described below, the matchmaker will assign a disposition to each solution based on priority and canopy matching. There are three dispositions available: "accept", "reject" and "deactivate". "accept" means that the solution will be accepted (and started, if relevant for that solution). "reject" means we do not do anything to the solution. "deactivate" means that we ensure that the solution is not running (i.e. running stop if required). The latter case is relevant for solutions that are conflicting with other solutions that the user might need. + ## Disposing from prioriy: Explicit priorities are declared in the NP sets metadata section and will always be a floating point value of 1024 or more. Implicit priorities are deduced from application specific settings. When a user has application specific settings for a solution a priority of 512 is set for that solution. Goes through all solutions from high priority to low. If a solution already has a disposition, it is ignored. Else it will be selected (accepted). Any solution with the same type, but a lower priority (or no priority) will be rejected. If there are two or more solutions of the same priority _and_ the same type (even partly), these will be considered a "tie". All lower-priority solutions of this type will still be rejected. The tied solutions will have their current disposition and priority removed and left to be disposed by some other disposal algorithm. ## Disposing from Canopy -The Canopy matching strategy is used for deciding how to dispose solutions in case no priorities are available or there is a priority-tie between two applications of the same type. +The Canopy matching strategy is used for deciding how to dispose solutions in case no priorities are available or there is a priority-tie between two applications of the same type. * The canopy approach is based on a vectorial "fitness measure" of a solution plus a lexicographical ordering * It is similar to the strategy used in resolving CSS rules. @@ -45,7 +48,7 @@ The Canopy matching strategy is used for deciding how to dispose solutions in ca * Compute capabilities of solution * Compute vector of prefix depths for each leaf el path from NP set * Sort vector in descending order of fitness ("fitness vector") -* Rank solutions by fitness using lexicographic ordering +* Rank solutions by fitness using lexicographic ordering *The canopy matching* * Compute fitness vectors for each solution and sort in rank order diff --git a/documentation/MatchMakerFramework.md b/documentation/MatchMakerFramework.md index 9a4b3f9c1..65dcfbca6 100644 --- a/documentation/MatchMakerFramework.md +++ b/documentation/MatchMakerFramework.md @@ -46,7 +46,7 @@ Like all other Kettle apps, the Matchmaker Framework is defined by a config file ## API: -The matchmakers that can be called from the Matchmaker Framework need to adhere to the following API. +The matchmakers that can be called from the Matchmaker Framework need to adhere to the following API. ### URL: `/match` @@ -109,7 +109,7 @@ The input for these POST requests will be in the following format. Note that it } ] }, - environmentReporter: { + environmentReporter: { "http://registry.gpii.net/terms/environment/brightness": 60, "http://registry.gpii.net/terms/environment/sound": -6 "http://registry.gpii.net/terms/environment/timeOfDay": "18:29:00" @@ -121,7 +121,7 @@ The input for these POST requests will be in the following format. Note that it "gpii-default", "nighttime-at-home" ], - inverseCapabilities: { + inverseCapabilities: { "com.microsoft.windows.cursors": { "http://registry.gpii.net/common/mouseTrailing": 0.8, (...), @@ -148,7 +148,7 @@ The input for these POST requests will be in the following format. Note that it ### Return payload -The return payload from at call to `/match` should be in the following format: +The return payload from at call to `/match` should be in the following format. The "active" key expresses whether the application should be set to running. A `true` value means that it should be running, `undefined` means we leave it in its current run state and `false` mean we should actively ensure that it is not running. ``` { diff --git a/gpii/configs/gpii.config.all.development.pr.production.json b/gpii/configs/gpii.config.all.development.pr.production.json deleted file mode 100644 index e07369298..000000000 --- a/gpii/configs/gpii.config.all.development.pr.production.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "type": "all.development.pr.production", - "options": { - "distributeOptions": { - "gpii.config.deviceReporter.flowManager": { - "record": "{flowManager}.solutionsRegistryDataSource", - "target": "{that gpii.deviceReporter.live}.options.components.solutionsRegistryDataSource" - } - } - }, - "mergeConfigs": [ - "%deviceReporter/configs/gpii.deviceReporter.config.production.json", - "%universal/gpii/configs/gpii.config.development.base.local.json" - ] -} diff --git a/gpii/configs/gpii.config.all.development.pr.production.txt b/gpii/configs/gpii.config.all.development.pr.production.txt deleted file mode 100644 index 70b67de80..000000000 --- a/gpii/configs/gpii.config.all.development.pr.production.txt +++ /dev/null @@ -1,23 +0,0 @@ -all.development.pr.production.json -================================== - -This configuration runs the entire system locally and in development mode with the exception of the processReporter, -which runs in production mode. - -This mean that: -* All storage is on the local filesystem (as opposed to couchDB servers/remote URLs) -* The following components are running on the local machine: -** flowManager -** preferencesServer -** OntologyHandler -** rawPreferencesServer (reading preferences from file) -** solutionsRegistry (reading registry from file) -** deviceReporter (reading device context info from file) -** processReporter (reading processes dynamically) -** matchMakerFramework -** flatMatchMaker -** lifecycleManager - -Notes on testing: -This setup is used as a basis for the platform specific acceptance tests that make use of a dynamic process reporter. -Since the acceptance tests might use slightly different paths for the tests (ie. a special folder for reading prefs and solutionsRegistry), what is actually being used for testing is a slight variation of this config. For more details, see the txt files describing the configs in the acceptance tests folder of both universal and the platform specific repositories. diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index fea9be16d..ab2d935c2 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -428,23 +428,6 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt } }; - // TODO KASPER: Remove this and all references (probably) - gpii.tests.lifecycleManager.assertExpectedExec = function () { - jqUnit.assertDeepEq("Exec handler fired with expected arguments", { - "command": gpii.tests.lifecycleManager.fakeEnvironment.JAWS_DIR + "jaws.exe", - args: ["-settingsDirectory", gpii.tests.lifecycleManager.fakeEnvironment.WINDIR] - }, gpii.tests.lifecycleManager.staticRepository.execHandler); - }; - - gpii.tests.lifecycleManager.assertNoExec = function () { - jqUnit.assertUndefined("Exec handler has not been fired", - gpii.tests.lifecycleManager.staticRepository.execHandler); - }; - - gpii.tests.lifecycleManager.assertExpectedSettingsHandler = function (message, expected) { - jqUnit.assertDeepEq("expected input sent to settingsHandler" + message, expected, gpii.tests.lifecycleManager.staticRepository.settingsHandler); - }; - gpii.tests.lifecycleManager.settingsHandlerOriginalSystemSettings = { "org.gnome.desktop.a11y.magnifier": [{ "settings": { diff --git a/gpii/node_modules/processReporter/README.md b/gpii/node_modules/processReporter/README.md index 31f41d051..c5bacc17a 100644 --- a/gpii/node_modules/processReporter/README.md +++ b/gpii/node_modules/processReporter/README.md @@ -1,21 +1,7 @@ Process Reporter === -A server app deployed with a node.js server that returns the running status of a solution. - -### Process Reporter API - -The app currently supports the following urls: - - {urlToProcessReporterServer}/processes // GET ONLY - {urlToProcessReporterServer}/processes/{solution} // GET ONLY - -The first form cycles through the solutions registry, and for each entry, determines if the associated processes are running. The second form reports only the solution requested, for example: - - {urlToProcessReporterServer}/processes/org.gnome.desktop.a11y.magnifier - -In both cases, the Process Reporter uses the information stored in the `isRunning` block of a solutions registry entry. For example, the `isRunning` block for the Orca screen reader (the solution entry `org.gnome.orca`) is as -follows: +The Process Reporter uses the information stored in the `isRunning` block of a solutions registry entry to decide whether a solution is running. For example, the `isRunning` block for the Linux screen reader Orca (the solution entry `org.gnome.orca`) is as follows: ``` "isRunning": [ { @@ -25,47 +11,12 @@ follows: ] ``` -The payload returned is an array of solutions and their run state, followed by the platform: -``` -{ - "solutions": [ - { - "id": "org.gnome.desktop.a11y.applications", - "running": true - }, - { - "id": "org.gnome.orca", - "running": false - }, - ... - ], - "OS": - { - "id": "linux", - "version": "4.5.7-300.fc24.x86-64" -}} -``` - -If the status of only one solution is requested, then the payload is limited to that solution: +The main function is `gpii.processReporter.handleIsRunning`, which given a solutions registry entry will return `true` or `false` depending on whether the solution is running. -``` -{ - "solutions": - { - "id": "org.gnome.orca", - "running":false - }, - "OS": - { - "id": "linux", - "version": "4.5.7-300.fc24.x86-64" - } -} -``` ### Special cases -If the solutions registry entry does not have an `isRunning` block, then the solution is skipped and nothing is reported about its run-state. NOTE: This may be incorrect, and is currently under review. +If the solutions registry entry does not have an `isRunning` block, then `gpii.processReporter.handleIsRunning` will return undefined. Most solutions run-state is based on a corresponding entry in the underlying OS's process or tasklist table. For example, the Linux/GNOME solution `org.gnome.orca` is running if the `orca` screen reader process is running. Similarly, on Windows, `org.nvda-project` is running if there is an `nvda` process in the tasklist. Some solutions, however, are not strictly process-oriented. An example is the GNOME Shell screen magnifier (solution `org.gnome.desktop.a11y.magnifier`). The magnifier is not a separate process, but is built into GNOME Shell. The magnifier is running if (1) the `gnome-shell` process is running and (2) the `org.gnome.desktop.a11y.applications screen-magnifier-enabled` GSetting is `true`. diff --git a/gpii/node_modules/testing/src/Testing.js b/gpii/node_modules/testing/src/Testing.js index 7beb91481..d25911b71 100644 --- a/gpii/node_modules/testing/src/Testing.js +++ b/gpii/node_modules/testing/src/Testing.js @@ -192,9 +192,6 @@ gpii.test.checkConfiguration = function (settingsHandlers, nameResolver, onCompl configPromise.then(function (config) { var noOptions = gpii.test.extractSettingsBlocks(settingsHandlers); jqUnit.assertDeepEq(customMsg || "Checking that settings are set", noOptions, config); - // console.log(JSON.stringify(noOptions, null, 2)) - // console.log("VS") - // console.log(JSON.stringify(config, null, 2)) onComplete(); }); }; diff --git a/testData/processReporter/runningSolutions.json b/testData/processReporter/runningSolutions.json deleted file mode 100644 index 8abfd8459..000000000 --- a/testData/processReporter/runningSolutions.json +++ /dev/null @@ -1,172 +0,0 @@ -[ - { - "id": "org.gnome.desktop.interface", - "runnning": true - }, - - { - "id": "org.gnome.shell.overrides", - "runnning": true - }, - - { - "id": "org.gnome.desktop.wm.preferences", - "runnning": true - }, - - { - "id": "org.gnome.nautilus", - "runnning": true - }, - - { - "id": "org.gnome.desktop.a11y.keyboard", - "runnning": true - }, - - { - "id": "org.gnome.desktop.a11y.applications.onscreen-keyboard", - "runnning": true - }, - - { - "id": "org.gnome.orca", - "runnning": true - }, - - { - "id": "org.gnome.desktop.a11y.magnifier", - "runnning": true - }, - - { - "id": "com.microsoft.windows.magnifier", - "runnning": true - }, - - { - "id": "com.microsoft.windows.onscreenKeyboard", - "runnning": true - }, - - { - "id": "org.nvda-project", - "runnning": true - }, - - { - "id": "org.gnome.desktop.interface", - "runnning": true - }, - - { - "id": "org.gnome.nautilus", - "runnning": true - }, - - { - "id": "trace.easyOne.communicator.windows", - "runnning": true - }, - - { - "id": "trace.easyOne.communicator.linux", - "runnning": true - }, - - { - "id": "trace.easyOne.sudan.windows", - "runnning": true - }, - - { - "id": "trace.easyOne.sudan.linux", - "runnning": true - }, - - { - "id": "webinsight.webAnywhere.windows", - "runnning": true - }, - - { - "id": "webinsight.webAnywhere.linux", - "runnning": true - }, - - { - "id": "com.texthelp.readWriteGold", - "runnning": true - }, - - { - "id": "net.opendirective.maavis", - "runnning": true - }, - - { - "id": "com.microsoft.windows.highContrast", - "runnning": true - }, - - { - "id": "com.microsoft.windows.mouseTrailing", - "runnning": true - }, - - { - "id": "com.microsoft.windows.cursors", - "runnning": true - }, - - { - "id": "com.android.activitymanager", - "runnning": true - }, - - { - "id": "com.android.talkback", - "runnning": true - }, - - { - "id": "com.android.freespeech", - "runnning": true - }, - - { - "id": "org.chrome.cloud4chrome", - "runnning": true - }, - - { - "id": "com.android.settings.secure", - "runnning": true - }, - - { - "id": "com.android.audioManager", - "runnning": true - }, - - { - "id": "com.android.persistentConfiguration", - "runnning": true - }, - - { - "id": "org.alsa-project", - "runnning": true - }, - - { - "id": "org.freedesktop.xrandr", - "runnning": true - }, - - { - "id": "com.android.settings.system", - "runnning": true - } - -] diff --git a/tests/JournalIntegrationTests.js b/tests/JournalIntegrationTests.js index 0a7719d7e..f649d934b 100644 --- a/tests/JournalIntegrationTests.js +++ b/tests/JournalIntegrationTests.js @@ -505,5 +505,5 @@ gpii.tests.journal.badJournalBaseTestDef = fluid.extend({ kettle.test.bootstrapServer(gpii.test.buildSegmentedFixtures( gpii.tests.journal.fixtures, gpii.tests.journal.baseTestDef)); -// kettle.test.bootstrapServer(gpii.test.buildSegmentedFixtures( -// gpii.tests.journal.badJournalFixtures, gpii.tests.journal.badJournalBaseTestDef)); +kettle.test.bootstrapServer(gpii.test.buildSegmentedFixtures( + gpii.tests.journal.badJournalFixtures, gpii.tests.journal.badJournalBaseTestDef)); diff --git a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js index 3a10e4348..12f2fd06b 100644 --- a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js +++ b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js @@ -96,7 +96,7 @@ gpii.tests.deviceReporterAware.windows.flexibleHandlerEntries = { ] } }] - } + }; } }; diff --git a/tests/platform/windows/windows-readWrite-testSpec.js b/tests/platform/windows/windows-readWrite-testSpec.js index 755663af5..7d6878adf 100644 --- a/tests/platform/windows/windows-readWrite-testSpec.js +++ b/tests/platform/windows/windows-readWrite-testSpec.js @@ -183,7 +183,7 @@ gpii.tests.windows.readwrite.testDefs = [ } ] }, - "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.readwrite.flexibleHandlerEntry(true) + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.readwrite.flexibleHandlerEntry(true) } } ]; From 1afe72434ded0c1e7ca8fd68949b4e4c089eed15 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 19 Apr 2017 18:12:34 +0200 Subject: [PATCH 17/26] GPII-1230: Fixed failing web-based test --- .../lifecycleManager/test/js/LifecycleManagerTests.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index ab2d935c2..42923b8ab 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -1042,7 +1042,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt var expected = gpii.tests.lifecycleManager.settingsToChanges(gpii.tests.lifecycleManager.invokeSettingsHandlersExpectedSnapshot); snapshotPromise.then(function (snapshot) { jqUnit.assertDeepEq("invokeSettingsHandlers produced snapshot", expected, snapshot); - gpii.tests.lifecycleManager.assertExpectedSettingsHandler(" - standalone", gpii.tests.lifecycleManager.settingsHandlerExpectedInputNewSettings); + jqUnit.assertDeepEq("expected input sent to settingsHandler", gpii.tests.lifecycleManager.settingsHandlerExpectedInputNewSettings, gpii.tests.lifecycleManager.staticRepository.settingsHandler); jqUnit.start(); }); }); From 6db70de4b5c489f6e68e288b4322ddd6331b6f32 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 19 Apr 2017 18:14:32 +0200 Subject: [PATCH 18/26] GPII-1230: Fixed failing web based test --- .../html/PrivacySettings-test.html | 1 + .../test/js/LifecycleManagerTests.js | 68 +------------------ 2 files changed, 2 insertions(+), 67 deletions(-) diff --git a/gpii/node_modules/gpii-oauth2/gpii-oauth2-authz-server/webTests/components/privacySettings/html/PrivacySettings-test.html b/gpii/node_modules/gpii-oauth2/gpii-oauth2-authz-server/webTests/components/privacySettings/html/PrivacySettings-test.html index 5a1d5296b..9e2962eb5 100644 --- a/gpii/node_modules/gpii-oauth2/gpii-oauth2-authz-server/webTests/components/privacySettings/html/PrivacySettings-test.html +++ b/gpii/node_modules/gpii-oauth2/gpii-oauth2-authz-server/webTests/components/privacySettings/html/PrivacySettings-test.html @@ -46,6 +46,7 @@ + diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index ab2d935c2..ff7299d0c 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -1042,7 +1042,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt var expected = gpii.tests.lifecycleManager.settingsToChanges(gpii.tests.lifecycleManager.invokeSettingsHandlersExpectedSnapshot); snapshotPromise.then(function (snapshot) { jqUnit.assertDeepEq("invokeSettingsHandlers produced snapshot", expected, snapshot); - gpii.tests.lifecycleManager.assertExpectedSettingsHandler(" - standalone", gpii.tests.lifecycleManager.settingsHandlerExpectedInputNewSettings); + jqUnit.assertDeepEq("expected input sent to settingsHandler", gpii.tests.lifecycleManager.settingsHandlerExpectedInputNewSettings, gpii.tests.lifecycleManager.staticRepository.settingsHandler); jqUnit.start(); }); }); @@ -1078,71 +1078,5 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt fluid.each(gpii.tests.lifecycleManager.completeLifecycleTests, function (testDef) { gpii.tests.lifecycleManager.runLifecycleTest(testDef); }); - - jqUnit.asyncTest("gpii.lifecycleManager.update() tests for 'stop' reference", function () { - // initial payload: - var startPayload = fluid.extend(true, {}, gpii.tests.lifecycleManager.userOptions, { - lifecycleInstructions: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "red" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "stop" ] }) - }); - - gpii.tests.lifecycleManager.setup(); - jqUnit.expect(4); - - var lifecycleManager = gpii.lifecycleManager(gpii.tests.lifecycleManager.testOptions); - gpii.tests.lifecycleManager.initBackingMock(); - - lifecycleManager.start(startPayload, function (success) { - jqUnit.assertTrue("gpii.lifecycleManager.start() succeeds", success); - // check that things have 'started' - gpii.tests.lifecycleManager.assertExpectedExec(); - - lifecycleManager.update(startPayload, function () { - // check that things have 'stopped' - jqUnit.assertEquals("Expected pid has been sent to kill handler", - 8839, gpii.tests.lifecycleManager.staticRepository.killHandler.pid); - lifecycleManager.stop(gpii.tests.lifecycleManager.userOptions, function () { - gpii.tests.lifecycleManager.assertNoActiveSessions(lifecycleManager, "no active sessions running after stop"); - jqUnit.start(); - }); - }); - }); - }); - - jqUnit.asyncTest("gpii.lifecycleManager.update() tests for 'stop' and 'start' reference", function () { - // initial payload: - var startPayload = fluid.extend(true, {}, gpii.tests.lifecycleManager.userOptions, { - lifecycleInstructions: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "red" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "stop", "start" ] }) - }); - - gpii.tests.lifecycleManager.setup(); - jqUnit.expect(5); - - var lifecycleManager = gpii.lifecycleManager(gpii.tests.lifecycleManager.testOptions); - gpii.tests.lifecycleManager.initBackingMock(); - - lifecycleManager.start(startPayload, function (success) { - jqUnit.assertTrue("gpii.lifecycleManager.start() succeeds", success); - // check that things have 'started' - gpii.tests.lifecycleManager.assertExpectedExec(); - - lifecycleManager.update(startPayload, function () { - // check that things have 'stopped' - jqUnit.assertEquals("Expected pid has been sent to kill handler", - 8839, gpii.tests.lifecycleManager.staticRepository.killHandler.pid); - gpii.tests.lifecycleManager.assertExpectedExec(); - - lifecycleManager.stop(gpii.tests.lifecycleManager.userOptions, function () { - gpii.tests.lifecycleManager.assertNoActiveSessions(lifecycleManager, "no active sessions running after stop"); - jqUnit.start(); - }); - }); - }); - }); }; })(); From fed0fe06ad77a2bc30737548ec85fa873a0a95f9 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 19 Apr 2017 18:44:47 +0200 Subject: [PATCH 19/26] GPII-1230: Removed outdated multiSH stuff --- .../lifecycleManager/test/js/LifecycleManagerTests.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index ff7299d0c..d6c2b3ccc 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -196,7 +196,6 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt "otherSetting": "bar" } }, - isMultiSH: true, response: [{ "settings": { "weirdSetting": "foo" @@ -1014,7 +1013,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt jqUnit.test("gpii.lifecycleManager.specToSettingsHandler()", function () { fluid.each(gpii.tests.lifecycleManager.specToSettingsHandlerTests, function (spec, name) { jqUnit.expect(1); - var response = gpii.lifecycleManager.specToSettingsHandler("fake.solution", spec.request, spec.isMultiSH); + var response = gpii.lifecycleManager.specToSettingsHandler("fake.solution", spec.request); jqUnit.assertDeepEq(name, { "fake.solution": spec.response }, response); }); }); From c87f07ebd9c08e51ce46a36c9ec10004b846b171 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Thu, 27 Jul 2017 13:13:06 +0200 Subject: [PATCH 20/26] GPII-1230: Updated with latest master --- .dockerignore | 13 +++++ Dockerfile | 21 ++++--- README.md | 53 ++++++++++++++---- .../gpii.flowManager.config.production.json | 9 +++ ...i.preferencesServer.config.production.json | 20 ++++++- gpii/node_modules/testing/src/Integration.js | 3 + package.json | 8 +-- .../acceptanceTests/xrandr.json | 5 ++ .../acceptanceTests/os_gnome_display.json | 17 ++++++ .../org_freedesktop_xrandr.md | 34 +++++++++++ tests/platform/index-linux.js | 3 +- ....tests.acceptance.linux.xrandr.config.json | 13 +++++ tests/platform/linux/linux-xrandr-testSpec.js | 56 +++++++++++++++++++ .../platform/linux/linux-xrandr-testSpec.txt | 8 +++ 14 files changed, 235 insertions(+), 28 deletions(-) create mode 100644 testData/deviceReporter/acceptanceTests/xrandr.json create mode 100644 testData/preferences/acceptanceTests/os_gnome_display.json create mode 100644 testData/solutions/solutionsDescription/org_freedesktop_xrandr.md create mode 100644 tests/platform/linux/configs/gpii.tests.acceptance.linux.xrandr.config.json create mode 100644 tests/platform/linux/linux-xrandr-testSpec.js create mode 100644 tests/platform/linux/linux-xrandr-testSpec.txt diff --git a/.dockerignore b/.dockerignore index 6b8710a71..15dbf3325 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,14 @@ .git +node_modules +.vagrant + +npm-debug.log +*.bak + +browserify +report.tap +coverage +.nyc_output +instrumented +reports +.idea/ diff --git a/Dockerfile b/Dockerfile index aa47084ae..024de9f2f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,14 @@ -FROM inclusivedesign/nodejs:lts +FROM node:8-alpine -WORKDIR /etc/ansible/playbooks +WORKDIR /app +COPY . /app -COPY provisioning/* /etc/ansible/playbooks/ +RUN apk add --no-cache --virtual build-dependencies python make git g++ && \ + npm install && \ + chown -R node:node . && \ + npm cache clean --force && \ + apk del build-dependencies -ENV INSTALL_DIR=/opt/gpii/node_modules/universal +USER node -ENV UNIVERSAL_VARS_FILE=docker-vars.yml - -COPY . $INSTALL_DIR - -RUN ansible-playbook playbook.yml --tags "install,configure" - -CMD ["/bin/bash"] +CMD ["npm","start"] diff --git a/README.md b/README.md index 8bcc14193..4632a22e9 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,42 @@ If all is well, you will see a message like Note that this installation will not include any OS-specific features, but can be used to verify system function with basic preference sets which only start solutions which require filesystem-based configuration (XML, JSON or .INI files). +Environment Variables +--------------------- + +Through the use of Kettle [resolvers](https://github.com/fluid-project/kettle/blob/master/docs/ConfigsAndApplications.md#referring-to-external-data-via-resolvers), some pre-defined configuration files offer the ability to read environment variables to change commonly used settings. + +#### Preferences Server + +The Preferences Server with the `gpii.config.cloudBased.flowManager.production` configuration uses the following variables: + + * `GPII_PREFERENCES_LISTEN_PORT`: TCP port to listen on (default: 8081) + * `GPII_PREFERENCES_DATASOURCE_URL`: Location of CouchDB database (default: http://localhost:5984/preferences/%userToken) + +Example: + +``` +GPII_PREFERENCES_LISTEN_PORT=9090 \ +GPII_PREFERENCES_DATASOURCE_URL=https://localhost:5984/%userToken \ +NODE_ENV=gpii.config.cloudBased.flowManager.production \ +npm start +``` +#### Flow Manager + +The Flow Manager with the `gpii.config.cloudBased.flowManager.production` configuration uses the following variables: + + * `GPII_FLOWMANAGER_LISTEN_PORT`: TCP port to listen on (default: 8081) + * `GPII_FLOWMANAGER_PREFERENCES_URL`: Location of the Preferences Server (default: https://preferences.gpii.net/preferences/%userToken) + +Example: + +``` +GPII_FLOWMANAGER_LISTEN_PORT=9091 \ +GPII_FLOWMANAGER_PREFERENCES_URL=http://localhost:9090/preferences/%userToken \ +NODE_ENV=gpii.config.cloudBased.flowManager.production \ +npm start +``` + Recovering From System Corruption Using the Journal --------------------------------------------------- @@ -160,11 +196,14 @@ we use a `pretest` script to clean up previous coverage data before we run the t compile the actual report. You should not need to run the `pretest` scripts manually before running either the node or browser tests, or to run the `posttest` scripts afterward. -Building Docker Images ----------------------- +Docker Containers +----------------- -The Dockerfile can be used to build a containerized version of GPII Universal, at this time primarily for use by -downstream containers running components such the Preferences Server and Flow Manager in standalone cloud configuration. +The provided Dockerfile can be used to run GPII Universal directly. + +#### Build image + +To build a Docker image simply run: `docker build -t my-universal .` The following command can be used to build an image locally as long as it is run relative to the repository's `Dockerfile`: @@ -180,9 +219,3 @@ Universal image you can use this command: Or use the following command to download a particular image identified using a Git commit hash: `docker pull gpii/universal:` - -Additional notes: - -* The Docker image is built within the container using the [same Ansible role](https://github.com/idi-ops/ansible-nodejs) used to provision VMs, to simplify the management of different environments. -* Universal is installed to /opt/gpii/node_modules/universal to allow the node-based test cases to resolve. Regarding the tests: - * Currently, the node-based tests are always run when this container is built. If you would like to turn this off for local debugging or faster building, remove the `npm test` item in the `nodejs_app_commands` list in `provisioning/docker-vars.yml` diff --git a/gpii/node_modules/flowManager/configs/gpii.flowManager.config.production.json b/gpii/node_modules/flowManager/configs/gpii.flowManager.config.production.json index 1056bc189..4537d0348 100644 --- a/gpii/node_modules/flowManager/configs/gpii.flowManager.config.production.json +++ b/gpii/node_modules/flowManager/configs/gpii.flowManager.config.production.json @@ -16,6 +16,15 @@ "record": "@expand:kettle.resolvers.env(GPII_FLOWMANAGER_PREFERENCES_URL)", "target": "{that flowManager preferencesDataSource}.options.url", "priority": "after:preferencesDataSource.productionDataSource" + }, + "distributePort.productionPort": { + "record": 8081, + "target": "{that kettle.server}.options.port" + }, + "distributePort.productionEnvPort": { + "record": "@expand:kettle.resolvers.env(GPII_FLOWMANAGER_LISTEN_PORT)", + "target": "{that kettle.server}.options.port", + "priority": "after:distributePort.productionPort" } } }, diff --git a/gpii/node_modules/preferencesServer/configs/gpii.preferencesServer.config.production.json b/gpii/node_modules/preferencesServer/configs/gpii.preferencesServer.config.production.json index 6e567d5b5..d645bd658 100644 --- a/gpii/node_modules/preferencesServer/configs/gpii.preferencesServer.config.production.json +++ b/gpii/node_modules/preferencesServer/configs/gpii.preferencesServer.config.production.json @@ -3,7 +3,7 @@ "options": { "gradeNames": "fluid.component", "distributeOptions": { - "rawPreferencesDataSource": { + "rawPreferencesDataSource.productionDataSource": { "record": { "type": "kettle.dataSource.URL", "options": { @@ -13,13 +13,29 @@ }, "target": "{that preferencesServer rawPreferencesDataSource}" }, + "rawPreferencesDataSource.productionEnvUrl": { + "record": { + "type": "kettle.dataSource.URL", + "options": { + "gradeNames": "kettle.dataSource.CouchDB", + "url": "@expand:kettle.resolvers.env(GPII_PREFERENCES_DATASOURCE_URL)" + } + }, + "target": "{that preferencesServer rawPreferencesDataSource}", + "priority": "after:rawPreferencesDataSource.productionDataSource" + }, "logging": { "record": true, "target": "{that kettle.server}.options.logging" }, - "distributePort": { + "distributePort.productionPort": { "record": 8081, "target": "{that kettle.server}.options.port" + }, + "distributePort.productionEnvPort": { + "record": "@expand:kettle.resolvers.env(GPII_PREFERENCES_LISTEN_PORT)", + "target": "{that kettle.server}.options.port", + "priority": "after:distributePort.productionPort" } } }, diff --git a/gpii/node_modules/testing/src/Integration.js b/gpii/node_modules/testing/src/Integration.js index 9cac9d2d1..72c3fd5c3 100644 --- a/gpii/node_modules/testing/src/Integration.js +++ b/gpii/node_modules/testing/src/Integration.js @@ -409,6 +409,9 @@ fluid.defaults("gpii.test.integration.mockSettingsHandlerRegistry.linux", { }, "gpii.gsettings.launch": { optionsPathKey: gpii.test.integration.gsettingsLaunchKey + }, + "gpii.xrandr": { + optionsPathKey: "NONE" } } }); diff --git a/package.json b/package.json index 22b1f083e..c867b334a 100644 --- a/package.json +++ b/package.json @@ -13,12 +13,12 @@ "express-session": "1.15.3", "fluid-resolve": "1.2.0", "glob": "7.1.2", - "gpii-pouchdb": "1.0.2", - "infusion": "3.0.0-dev.20170322T234120Z.278de35", + "gpii-pouchdb": "1.0.4", + "infusion": "3.0.0-dev.20170713T172705Z.330ed53", "ini": "git://github.com/GPII/ini.git#be8a04aa22f5ad9321ebcbba7740314a53bc8ab2", "json5": "0.5.1", - "kettle": "1.6.0", - "node-jqunit": "1.1.4", + "kettle": "1.6.2", + "node-jqunit": "1.1.5", "node-uuid": "1.4.8", "mkdirp": "0.5.1", "oauth2orize": "1.8.0", diff --git a/testData/deviceReporter/acceptanceTests/xrandr.json b/testData/deviceReporter/acceptanceTests/xrandr.json new file mode 100644 index 000000000..c0e254ce5 --- /dev/null +++ b/testData/deviceReporter/acceptanceTests/xrandr.json @@ -0,0 +1,5 @@ +[ + { + "id": "org.freedesktop.xrandr" + } +] diff --git a/testData/preferences/acceptanceTests/os_gnome_display.json b/testData/preferences/acceptanceTests/os_gnome_display.json new file mode 100644 index 000000000..f6278b4ab --- /dev/null +++ b/testData/preferences/acceptanceTests/os_gnome_display.json @@ -0,0 +1,17 @@ +{ + "flat": { + "contexts": { + "gpii-default": { + "name": "Default preferences", + "preferences": { + "http://registry.gpii.net/applications/org.freedesktop.xrandr": { + "screen-resolution": { + "width": 800, + "height": 600 + } + } + } + } + } + } +} \ No newline at end of file diff --git a/testData/solutions/solutionsDescription/org_freedesktop_xrandr.md b/testData/solutions/solutionsDescription/org_freedesktop_xrandr.md new file mode 100644 index 000000000..e80f400a7 --- /dev/null +++ b/testData/solutions/solutionsDescription/org_freedesktop_xrandr.md @@ -0,0 +1,34 @@ +# X.Org XRandR + +## Details + +* __Name__: X.Org XRandR +* __Id__: org.freedesktop.xrandr +* __Platform__: GNU/Linux +* __Contact__: Joseph Scheuhammer + +## Description +__XRandR__ ("resize and rotate") is an extension to the X11 protocol that provides the ability to resize, rotate, and/or reflect the root window of a screen. +XRandR is free software developed under the umbrella of the X.org foundation, and maintained by the freedesktop.org. + +You'll find more information at: + + * [XRandR at X.org's wiki](https://www.x.org/wiki/Projects/XRandR/) + * [Source code at freedesktop's git repository](https://cgit.freedesktop.org/xorg/app/xrandr/) + +## Integration +XRandR is used by the GPII personalization framework as a display settings handler to change the screen resolution on GNOME/Linux desktops. + +To ensure that the solution is well integrated, there are Acceptance Tests (_tests/platform/linux/linux-xrandr-testSpec.js_) as well as tests of XRandR at a settings handler-level (_gpii/node_modules/xrandr/test/xrandrSettingsHandlerTests.js_). The latter are located in the linux repository. + +## Testing +When using an NP set that makes use of a display settings handler to change the screen resolution, XRandR should launch and re-configure the display resolution using the settings included in that NP set. + +### os_gnome_display + +The expected behaviour of using the NP set located at universal's _testData/preferences/acceptanceTests/os_gnome_display.json_ is: + +* When logging in, XRandR should be launched to change the screen resolution as specified in the above json file. In this particular case, it should change to 800 pixels wide by 600 pixels high. + +* When logging out, XRandR should launch again to restore the screen resolution to its original width and height. + diff --git a/tests/platform/index-linux.js b/tests/platform/index-linux.js index 4ce912522..87366ccb7 100644 --- a/tests/platform/index-linux.js +++ b/tests/platform/index-linux.js @@ -24,5 +24,6 @@ module.exports = [ "linux/linux-builtIn-testSpec.js", "linux/linux-orca-testSpec.js", "linux/linux-chrome-testSpec.js", - "linux/linux-dynamicDeviceReporter-testSpec.js" + "linux/linux-dynamicDeviceReporter-testSpec.js", + "linux/linux-xrandr-testSpec.js" ]; diff --git a/tests/platform/linux/configs/gpii.tests.acceptance.linux.xrandr.config.json b/tests/platform/linux/configs/gpii.tests.acceptance.linux.xrandr.config.json new file mode 100644 index 000000000..e724d8d2e --- /dev/null +++ b/tests/platform/linux/configs/gpii.tests.acceptance.linux.xrandr.config.json @@ -0,0 +1,13 @@ +{ + "type": "gpii.tests.acceptance.linux.xrandr", + "options": { + "distributeOptions": { + "acceptance.installedSolutionsPath": { + "record": "%universal/testData/deviceReporter/acceptanceTests/xrandr.json", + "target": "{that deviceReporter installedSolutionsDataSource}.options.path", + "priority": "after:development.installedSolutionsPath" + } + } + }, + "mergeConfigs": "%universal/tests/configs/gpii.tests.acceptance.localInstall.config.json" +} diff --git a/tests/platform/linux/linux-xrandr-testSpec.js b/tests/platform/linux/linux-xrandr-testSpec.js new file mode 100644 index 000000000..06ea7b4b8 --- /dev/null +++ b/tests/platform/linux/linux-xrandr-testSpec.js @@ -0,0 +1,56 @@ +/* +GPII Acceptance Testing + +Copyright 2017 Inclusive Design Research Centre, OCAD University. + +Licensed under the New BSD license. You may not use this file except in +compliance with this License. + +You may obtain a copy of the License at +https://github.com/GPII/universal/blob/master/LICENSE.txt + +The R&D leading to these results received funding from the +Department of Education - Grant H421A150005 (GPII-APCP). However, +these results do not necessarily represent the policy of the +Department of Education, and you should not assume endorsement by the +Federal Government. +*/ + +"use strict"; + +var fluid = require("infusion"), + gpii = fluid.registerNamespace("gpii"); + +fluid.require("%universal"); + +gpii.loadTestingSupport(); + +fluid.registerNamespace("gpii.tests.acceptance.linux.xrandr"); + +gpii.tests.acceptance.linux.xrandr.testDefs = fluid.freezeRecursive([ + { + name: "Testing os_linux_display using default matchmaker", + userToken: "os_gnome_display", + settingsHandlers: { + "gpii.xrandr": { + "some.app.id": [{ + "settings": { + "screen-resolution": { + "width": 800, + "height": 600 + } + } + }] + } + }, + processes: [] + } +]); + +module.exports = gpii.test.bootstrap({ + testDefs: "gpii.tests.acceptance.linux.xrandr.testDefs", + configName: "gpii.tests.acceptance.linux.xrandr.config", + configPath: "%universal/tests/platform/linux/configs" +}, ["gpii.test.integration.testCaseHolder.linux"], + module, require, __dirname); + diff --git a/tests/platform/linux/linux-xrandr-testSpec.txt b/tests/platform/linux/linux-xrandr-testSpec.txt new file mode 100644 index 000000000..981cdae8d --- /dev/null +++ b/tests/platform/linux/linux-xrandr-testSpec.txt @@ -0,0 +1,8 @@ +AcceptanceTests_xrandr.js + +Description: + +This tests the functionality of GNOME/Linux XRandR bridge, or the linux display +settings handler. It tests the system using one NP set: + (1) os_gnome_display: application specific gnome settings. + From 4b85dc483e40f5275572b8325f7a3d9b240d9e32 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Mon, 4 Sep 2017 12:50:06 +0200 Subject: [PATCH 21/26] GPII-1230: Factored out the selection of restore actions --- .../lifecycleManager/src/LifecycleManager.js | 45 ++++++++++++------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index 5fa9986b0..7cc93d7ac 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -544,6 +544,34 @@ var gpii = fluid.registerNamespace("gpii"); return fluid.promise.sequence(promises); }; + /** + * Based on the current state of an application (ie. if it is running or not), and the recorded state + * this function returns an array of actions for the lifecycle manager to run to get it to its + * recorded state + * + * @param currentRunState {boolean}: True if application is currently running + * @param recordedRunState {boolean}: True if application was running on login + * @return {Array} An array of actions (strings) that needs to be run to restore the application + * to its original state + */ + gpii.lifecycleManager.selectRestoreActions = function (currentRunState, recordedRunState) { + var actions; + if (currentRunState === true) { // if it's already running + if (recordedRunState === false) { // and it was not running on start + actions = [ "stop", "restore" ]; + } else { // else update it + actions = [ "update" ]; + } + } else { // if it is not running + if (recordedRunState === true) { // and it was running when we started + actions = [ "restore", "start" ]; + } else { // just restore settings + actions = [ "restore" ]; + } + } + return actions; + }; + /** Common utility used by gpii.lifecycleManager.stop and gpii.lifecycleManager.restoreSnapshot * @param session {gpii.lifecycleManager.session} which must contain * * A `originalSettings` snapshot in its model @@ -561,26 +589,11 @@ var gpii = fluid.registerNamespace("gpii"); }); tasks.push(function () { if (!fluid.isDestroyed(that)) { // See above comment for GPII-580 - // if solution is already running, call "update" directive - else use "start" directive var solutionRecord = gpii.lifecycleManager.transformSolutionSettings(changesSolutionRecord, gpii.settingsHandlers.changesToSettings); var recordedRunState = gpii.lifecycleManager.getSolutionRunningStateFromSnapshot(solutionRecord); var currentRunState = session.model.runningOnLogin[solutionId]; - var actions; - if (currentRunState === true) { // if it's already running - if (recordedRunState === false) { // and it was not running on start - actions = [ "stop", "restore" ]; - } else { // else update it - actions = [ "update" ]; - } - } else { // if it is not running - if (recordedRunState === true) { // and it was running when we started - actions = [ "restore", "start" ]; - } else { // just restore settings - actions = [ "restore" ]; - } - } - + var actions = gpii.lifecycleManager.selectRestoreActions(currentRunState, recordedRunState); // build structure for returned values (for later reset) return that.applySolution(solutionId, solutionRecord, session, actions, rootAction); } From 19f7889999efd740fbd9af1281ebbb3b0e27bf39 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 6 Sep 2017 16:35:52 +0200 Subject: [PATCH 22/26] GPII-1230: Addressed most of Antranigs comments --- .../test/CanopyMatchMakerTests.js | 2 +- .../lifecycleManager/src/LifecycleManager.js | 35 ++++------- .../test/js/LifecycleManagerTests.js | 22 ++++++- .../settingsHandlers/src/LaunchHandlers.js | 19 +++++- .../src/settingsHandlerUtilities.js | 26 ++++++++ .../web/js/SettingsHandlerUtilitiesTests.js | 61 +++++++++++++++++++ gpii/node_modules/testing/src/Testing.js | 10 +-- .../transformer/src/js/Transformer.js | 19 +----- .../test/html/TransformerTests.html | 1 + .../transformer/test/js/TransformerTests.js | 60 ------------------ .../deviceReporter/installedSolutions.json | 6 +- tests/DeviceReporterErrorTests.js | 2 +- tests/PayloadSizeTest.js | 2 +- .../windows/windows-builtIn-testSpec.js | 12 ++-- 14 files changed, 157 insertions(+), 120 deletions(-) diff --git a/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js b/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js index cd941c87b..7ebcb56f0 100644 --- a/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js +++ b/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js @@ -429,7 +429,7 @@ var matchFixtures = [ "fakemag2": { "active": false, "settings": { - "http://registry.gpii.net/applications/fakemag2": {}, + "http://registry.gpii.net/applications/fakemag2": {} } } } diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index 7cc93d7ac..cc6afb1ce 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -545,26 +545,30 @@ var gpii = fluid.registerNamespace("gpii"); }; /** - * Based on the current state of an application (ie. if it is running or not), and the recorded state + * Based on the current state of an application (ie. if it is running or not) and the desired state, * this function returns an array of actions for the lifecycle manager to run to get it to its * recorded state * * @param currentRunState {boolean}: True if application is currently running - * @param recordedRunState {boolean}: True if application was running on login + * @param desiredRunState {boolean}: True if application should be running + * @param isRestore {boolean}: If this is true, a "restore" will be used as the configuration action + * in the array that is returned. Else a "configure" will be used. In general, isRestore should be provided and + * true only of this is called by the logout/restore functionality of the system. * @return {Array} An array of actions (strings) that needs to be run to restore the application * to its original state */ - gpii.lifecycleManager.selectRestoreActions = function (currentRunState, recordedRunState) { + gpii.lifecycleManager.calculateLifecycleActions = function (currentRunState, desiredRunState, isRestore) { + var configurationType = isRestore ? "restore" : "configure"; var actions; if (currentRunState === true) { // if it's already running - if (recordedRunState === false) { // and it was not running on start - actions = [ "stop", "restore" ]; + if (desiredRunState === false) { // and it was not running on start + actions = [ "stop", configurationType ]; } else { // else update it actions = [ "update" ]; } } else { // if it is not running - if (recordedRunState === true) { // and it was running when we started - actions = [ "restore", "start" ]; + if (desiredRunState === true) { // and it was running when we started + actions = [ configurationType, "start" ]; } else { // just restore settings actions = [ "restore" ]; } @@ -593,7 +597,7 @@ var gpii = fluid.registerNamespace("gpii"); var recordedRunState = gpii.lifecycleManager.getSolutionRunningStateFromSnapshot(solutionRecord); var currentRunState = session.model.runningOnLogin[solutionId]; - var actions = gpii.lifecycleManager.selectRestoreActions(currentRunState, recordedRunState); + var actions = gpii.lifecycleManager.calculateLifecycleActions(currentRunState, recordedRunState, true); // build structure for returned values (for later reset) return that.applySolution(solutionId, solutionRecord, session, actions, rootAction); } @@ -786,20 +790,7 @@ var gpii = fluid.registerNamespace("gpii"); if (!fluid.isDestroyed(that)) { // See above comment for GPII-580 // if solution is already running, call "update" directive - else use "start" directive var isRunning = session.model.runningOnLogin[solutionId]; - var actions; - if (isRunning === true) { // if it's already running - if (solution.active === false) { // and it shouldn't - actions = [ "stop", "configure" ]; - } else { // else call "update" to make changes apply to a running solutions - actions = [ "update" ]; - } - } else { // if it is not running - if (solution.active === true) { // and we want it to run - actions = [ "configure", "start" ]; - } else { // else just configure it - actions = [ "configure" ]; - } - } + var actions = gpii.lifecycleManager.calculateLifecycleActions(isRunning, solution.active); // build structure for returned values (for later reset) return that.applySolution(solutionId, solution, session, actions, "start"); diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index 2960ad015..1632fae46 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -64,6 +64,24 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt return togo; }; + /** + * Used by a bunch of the tests to avoid having to write out the almost-identical full set of lifecycle + * instructions for each test. Instead one can have a "base set" of lifecycle instructions + * that can be shared across multiple tests/multiple phases of a single test, and then use + * this function to extend base set to match the specific test/test phase. + * + * The function takes an unlimited number of arguments. The first argument is mandatory and must + * be a set of lifecycle instructions entries keyed by solution ids. While the system wont explode + * if entries for multiple solutions are provided, only the "first" solution entry will be + * extended. The remaining arguments will be fluid.extended onto the first argument. + * + * @currentInstructions {Object} a set of lifecycle instructions keyed by a solution id. For example, + * this could be the output of the buildLifecycleInstructions function. + * @arguments {..Object..} The remaining arguments should be valid lifecycleInstructions that will + * be extended onto the original + * @return {Object} The original lifecycle instructions, but with the remaining arguments fluid.extend'ed + * onto the first solution entry in the currentInstructions + */ gpii.tests.lifecycleManager.extendLifecycleInstructions = function (currentInstructions) { var togo = fluid.copy(currentInstructions); var solId = Object.keys(currentInstructions)[0]; @@ -617,7 +635,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt expectedSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, expectedLaunchHandlerCalls: 2 }, { - name: "single pref changed without 'update' directive in solution registry entry", + name: "single pref changed without 'update' directive in solution registry entry", basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( "org.gnome.desktop.a11y.magnifier", gpii.tests.lifecycleManager.standardLifecycle @@ -1057,7 +1075,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt var ret = lifecycleManager.update(gpii.tests.lifecycleManager.startPayload); jqUnit.expect(1); ret.then(function (text) { - jqUnit.assertTrue("User with token 123 has no active session, so ignoring update request", true); + jqUnit.assertEquals("Response correct", text, "User with token 123 has no active session, so ignoring update request"); }); }); diff --git a/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js b/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js index cc9fb6b57..aab4720b1 100644 --- a/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js +++ b/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js @@ -15,10 +15,25 @@ var fluid = fluid || require("infusion"), gpii = fluid.registerNamespace("gpii"); -fluid.registerNamespace("gpii.launchHandlers"); +/** + * The flexibleHandler is a highly customizable launch handler that is implemented to handle all + * the cases in which a solutions launch-cycle is too complex or specific to efficiently be handled + * in one of the standard launchHandlers. + * + * Besides the normal launch handler options like retryOptions and verifySettings, the flexible handler + * supports three directives: `getState`, `setTrue` and `setFalse`. + * + * `getState`: equals the launchHandlers "get" functionality, and should return a boolean value indicating + * whether the application is running or not. The content of this directive will be sent to the + * processReporters' handleIsRunning function + * `setTrue`: Is run when a "true" value is sent to the launch handler. The content of this block should + * be an array of objects that can be run as graded functions in infusion. The result of runnings these + * blocks should be that the application is running + * `setFalse`: Identical to `setTrue` but is run when a "false" is sent to the launch handler. The result from + * running the blocks in this directive should be that the application is closed/not running. + */ fluid.registerNamespace("gpii.launchHandlers.flexibleHandler"); - gpii.launchHandlers.flexibleHandler.set = function (payload) { return fluid.transform(payload, function (allSettingsBlocks, solutionId) { return fluid.transform(allSettingsBlocks, function (handlerData) { diff --git a/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js b/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js index 59a6e840f..54d68abce 100644 --- a/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js +++ b/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js @@ -55,6 +55,32 @@ gpii.toPromise = function (value) { fluid.registerNamespace("gpii.settingsHandlers"); +/** + * Filters out all the settings from the `settings` argument which are + * not in the `supportedSettings` argument + * + * @param settings {Object} Object in which each key is a setting name that is to be filtered. This + * object will be modified. + * @param supportedSettings {Object} Object in which each key is a setting name that will be filtered by + * @return {Object} the `settings`, filtered by the `supportedSettings` entries, meaning that + * any setting that is not in supportedSettings will not be in the return object. + */ +gpii.settingsHandlers.filterSupportedSettings = function (settings, supportedSettings) { + if (supportedSettings === undefined || settings === undefined) { + return settings; + } else { + var filteredSettings = {}; + // we cant simply use fluid.filterKeys because that wont handle the cases where + // there are 'undefined' values for the keys in handlerSpec.settings + for (var settingName in supportedSettings) { + if (settingName in settings) { + filteredSettings[settingName] = settings[settingName]; + } + } + return filteredSettings; + } +}; + // TODO: These utilities all clearly form part of some wider idiom of "payload handling" without some underpinnings // for which they are rather hard to follow. For example, they could benefit from some form of "JSON type system" // (whether provided via JSON schema or otherwise) in order to provide landmarks within the payloads, as well diff --git a/gpii/node_modules/settingsHandlers/test/web/js/SettingsHandlerUtilitiesTests.js b/gpii/node_modules/settingsHandlers/test/web/js/SettingsHandlerUtilitiesTests.js index d88a96cbe..d41c32833 100644 --- a/gpii/node_modules/settingsHandlers/test/web/js/SettingsHandlerUtilitiesTests.js +++ b/gpii/node_modules/settingsHandlers/test/web/js/SettingsHandlerUtilitiesTests.js @@ -26,6 +26,67 @@ fluid.registerNamespace("gpii.tests"); fluid.registerNamespace("gpii.tests.settingsHandlersUtilitiesTests"); + gpii.tests.settingsHandlersUtilitiesTests.filterSupportedSettingsSpecs = { + "If supportedSettings is undefined, return settings": { + settings: { + "weirdSetting": "foo" + }, + supportedSettings: undefined, + expected: { + "weirdSetting": "foo" + } + }, + "If settings is undefined, return undefined": { + settings: undefined, + supportedSettings: { + "weirdSetting": {} + }, + expected: undefined + }, + "Filter by supportedSettings": { + settings: { + "weirdSetting": "foo", + "otherSetting": "bar" + }, + supportedSettings: { + "weirdSetting": {} + }, + expected: { + "weirdSetting": "foo" + } + }, + "If supportedSettings directive is present - test no matching": { + settings: { + "weirdSetting": "foo", + "otherSetting": "bar" + }, + supportedSettings: { + "thirdSetting": {} + }, + expected: {} + }, + "Works with `undefined` values for settings (required when restoring)": { + settings: { + "weirdSetting": undefined, + "otherSetting": undefined + }, + supportedSettings: { + "weirdSetting": {} + }, + expected: { + "weirdSetting": undefined + } + } + }; + + jqUnit.test("filterSupportedSettings tests", function () { + fluid.each(gpii.tests.settingsHandlersUtilitiesTests, function (test, name) { + var result = gpii.settingsHandlers.filterSupportedSettings(test.settings, test.supportedSettings); + jqUnit.assertDeepEq(name, test.expected, result); + }); + }); + + jqUnit.test("settingsHandlers.setSettings", function () { // check simple json structure var result = gpii.settingsHandlers.setSettings( diff --git a/gpii/node_modules/testing/src/Testing.js b/gpii/node_modules/testing/src/Testing.js index 31616ebc8..300851199 100644 --- a/gpii/node_modules/testing/src/Testing.js +++ b/gpii/node_modules/testing/src/Testing.js @@ -144,8 +144,6 @@ gpii.test.operateSettings = function (settingsHandlers, nameResolver, method) { fluid.each(settingsHandlers, function (handlerBlock, handlerID) { var resolvedName = nameResolver ? nameResolver.resolveName(handlerID, "settingsHandler") : handlerID; var response = gpii.settingsHandlers.dispatchSettingsHandler(resolvedName, handlerBlock, method); - - // var response = fluid.invokeGlobalFunction(resolvedName + "." + method, [handlerBlock]); ret[handlerID] = response; }); var togo = gpii.test.settleStructure(ret); @@ -155,7 +153,11 @@ gpii.test.operateSettings = function (settingsHandlers, nameResolver, method) { return togo; }; -gpii.test.setInitialState = function (settingsHandlers, nameResolver, onComplete) { +/** + * Used for settings the initial settings of an application. This is among other used for tests + * where an application needs to be running on user login + */ +gpii.test.setInitialSettingsState = function (settingsHandlers, nameResolver, onComplete) { var promise = gpii.test.setSettings(settingsHandlers, nameResolver); promise.then(onComplete); }; @@ -339,7 +341,7 @@ gpii.test.initalStateSequence = fluid.freezeRecursive([ func: "gpii.test.expandSettings", args: [ "{tests}", "initialState" ] }, { - func: "gpii.test.setInitialState", + func: "gpii.test.setInitialSettingsState", args: [ "{tests}.initialState", "{nameResolver}", "{testCaseHolder}.events.onInitialStateSet.fire"] }, { event: "{testCaseHolder}.events.onInitialStateSet", diff --git a/gpii/node_modules/transformer/src/js/Transformer.js b/gpii/node_modules/transformer/src/js/Transformer.js index 247cb102a..3eab90ef4 100644 --- a/gpii/node_modules/transformer/src/js/Transformer.js +++ b/gpii/node_modules/transformer/src/js/Transformer.js @@ -32,23 +32,6 @@ var fluid = fluid || require("infusion"), } }); - gpii.transformer.filterSupportedSettings = function (settings, supportedSettings) { - if (supportedSettings === undefined || settings === undefined) { - return settings; - } else { - var filteredSettings = {}; - // we cant simply use fluid.filterKeys because that wont handle the cases where - // there are 'undefined' values for the keys in handlerSpec.settings - for (var settingName in supportedSettings) { - if (settingName in settings) { - filteredSettings[settingName] = settings[settingName]; - } - } - return filteredSettings; - } - }; - - /** * Helper function for `gpii.transformer.configurationToSettings`. Used to modify the settings handler * blocks to be in the format required (i.e. including the application specific settings to be @@ -63,7 +46,7 @@ var fluid = fluid || require("infusion"), */ gpii.transformer.transformOneSettingsHandler = function (settingsHandler, oneUserSolution, solutionId) { var appSettings = oneUserSolution.settings["http://registry.gpii.net/applications/" + solutionId]; - var settings = gpii.transformer.filterSupportedSettings(fluid.copy(appSettings), settingsHandler.supportedSettings); + var settings = gpii.settingsHandlers.filterSupportedSettings(fluid.copy(appSettings), settingsHandler.supportedSettings); if (settingsHandler.capabilitiesTransformations) { var inferred = fluid.model.transformWithRules(oneUserSolution.settings, settingsHandler.capabilitiesTransformations); diff --git a/gpii/node_modules/transformer/test/html/TransformerTests.html b/gpii/node_modules/transformer/test/html/TransformerTests.html index fa0cb2373..89f60b398 100644 --- a/gpii/node_modules/transformer/test/html/TransformerTests.html +++ b/gpii/node_modules/transformer/test/html/TransformerTests.html @@ -19,6 +19,7 @@ + diff --git a/gpii/node_modules/transformer/test/js/TransformerTests.js b/gpii/node_modules/transformer/test/js/TransformerTests.js index df903729e..b174aadea 100644 --- a/gpii/node_modules/transformer/test/js/TransformerTests.js +++ b/gpii/node_modules/transformer/test/js/TransformerTests.js @@ -565,66 +565,6 @@ fluid.setLogging(true); }); }); - gpii.tests.transformer.filterSupportedSettingsSpecs = { - "If supportedSettings is undefined, return settings": { - settings: { - "weirdSetting": "foo" - }, - supportedSettings: undefined, - expected: { - "weirdSetting": "foo" - } - }, - "If settings is undefined, return undefined": { - settings: undefined, - supportedSettings: { - "weirdSetting": {} - }, - expected: undefined - }, - "Filter by supportedSettings": { - settings: { - "weirdSetting": "foo", - "otherSetting": "bar" - }, - supportedSettings: { - "weirdSetting": {} - }, - expected: { - "weirdSetting": "foo", - } - }, - "If supportedSettings directive is present - test no matching": { - settings: { - "weirdSetting": "foo", - "otherSetting": "bar" - }, - supportedSettings: { - "thirdSetting": {} - }, - expected: {} - }, - "Works with `undefined` values for settings (required when restoring)": { - settings: { - "weirdSetting": undefined, - "otherSetting": undefined - }, - supportedSettings: { - "weirdSetting": {} - }, - expected: { - "weirdSetting": undefined, - } - } - }; - - jqUnit.test("filterSupportedSettings tests", function () { - fluid.each(gpii.tests.transformer.filterSupportedSettingsSpecs, function (test, name) { - var result = gpii.transformer.filterSupportedSettings(test.settings, test.supportedSettings); - jqUnit.assertDeepEq(name, test.expected, result); - }); - }); - /* --------------- gpii.transformer.timeInRange tests -------------------- */ gpii.tests.transformer.timeInRangeTests = { rules: { diff --git a/testData/deviceReporter/installedSolutions.json b/testData/deviceReporter/installedSolutions.json index a92724091..99a224b7e 100644 --- a/testData/deviceReporter/installedSolutions.json +++ b/testData/deviceReporter/installedSolutions.json @@ -1,14 +1,14 @@ [ { - "id": "org.gnome.desktop.interface" + "id": "fakemag1" }, { - "id": "org.gnome.shell.overrides" + "id": "fakemag2" }, { - "id": "org.gnome.desktop.wm.preferences" + "id": "fakescreenreader1" }, { diff --git a/tests/DeviceReporterErrorTests.js b/tests/DeviceReporterErrorTests.js index e1f27e957..059b879ab 100644 --- a/tests/DeviceReporterErrorTests.js +++ b/tests/DeviceReporterErrorTests.js @@ -20,7 +20,7 @@ var fluid = require("infusion"), gpii = fluid.registerNamespace("gpii"), kettle = fluid.registerNamespace("kettle"); -fluid.require("%universal") +fluid.require("%universal"); gpii.loadTestingSupport(); diff --git a/tests/PayloadSizeTest.js b/tests/PayloadSizeTest.js index 20bb06269..9ca26dbee 100644 --- a/tests/PayloadSizeTest.js +++ b/tests/PayloadSizeTest.js @@ -17,7 +17,7 @@ var fluid = require("infusion"), gpii = fluid.registerNamespace("gpii"), kettle = fluid.registerNamespace("kettle"); -fluid.require("%universal") +fluid.require("%universal"); gpii.loadTestingSupport(); diff --git a/tests/platform/windows/windows-builtIn-testSpec.js b/tests/platform/windows/windows-builtIn-testSpec.js index 0e9269348..386da3c80 100644 --- a/tests/platform/windows/windows-builtIn-testSpec.js +++ b/tests/platform/windows/windows-builtIn-testSpec.js @@ -368,11 +368,11 @@ gpii.tests.windows.builtIn = [ "settings": { "FilterKeysEnable": { "path": "pvParam.dwFlags.FKF_FILTERKEYSON", - "value": true + "value": false }, "BounceKeysInterval": { "path": "pvParam.iBounceMSec", - "value": 1000 + "value": 0 } }, "options": { @@ -590,11 +590,11 @@ gpii.tests.windows.builtIn = [ "settings": { "FilterKeysEnable": { "path": "pvParam.dwFlags.FKF_FILTERKEYSON", - "value": true + "value": false }, "BounceKeysInterval": { "path": "pvParam.iBounceMSec", - "value": 1000 + "value": 0 } }, "options": { @@ -812,11 +812,11 @@ gpii.tests.windows.builtIn = [ "settings": { "FilterKeysEnable": { "path": "pvParam.dwFlags.FKF_FILTERKEYSON", - "value": true + "value": false }, "BounceKeysInterval": { "path": "pvParam.iBounceMSec", - "value": 1000 + "value": 0 } }, "options": { From 44e13f82542b46a17ea9f1c2cc651ab73e3c7e0f Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Thu, 14 Sep 2017 18:49:25 +0200 Subject: [PATCH 23/26] GPII-1230: Dispose options from matchmaker are now only accept and reject again --- .../src/CanopyMatchMakerUtilities.js | 3 ++- .../flatMatchMaker/src/FlatMatchMaker.js | 5 +++- .../src/MatchMakerUtilities.js | 11 +++++--- ...hMakerUtilitiesDisposeFromPriorityTests.js | 25 +++++++++++-------- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js b/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js index 349b1c69b..b08f88afd 100644 --- a/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js +++ b/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js @@ -103,7 +103,7 @@ gpii.canopyMatchMaker.utils.disposeFromCanopy = function (leaves, ranked, solrec for (var i = 0; i < ranked.length; ++i) { var sol = solrecs[ranked[i]]; - if (sol.disposition === "reject" || sol.disposition === "deactivate") { + if (sol.disposition === "reject" || sol.active === false) { continue; } @@ -117,6 +117,7 @@ gpii.canopyMatchMaker.utils.disposeFromCanopy = function (leaves, ranked, solrec } if (inCanopy) { sol.disposition = "accept"; + sol.active = true; sol.dispositionReason = "Was the solution of this type that best fit user preferences"; gpii.matchMakerFramework.utils.rejectFromTypes(data.solutionTypes[sol.index], data.solutionTypeMapping, solrecs, "Another solution (" + sol.index + diff --git a/gpii/node_modules/flatMatchMaker/src/FlatMatchMaker.js b/gpii/node_modules/flatMatchMaker/src/FlatMatchMaker.js index 28a4955a8..ce66ccf46 100644 --- a/gpii/node_modules/flatMatchMaker/src/FlatMatchMaker.js +++ b/gpii/node_modules/flatMatchMaker/src/FlatMatchMaker.js @@ -99,7 +99,10 @@ if (solrec.priority !== undefined) { accepted = true; } - solrec.disposition = accepted ? "accept" : "reject"; + fluid.extend(solrec, { + disposition: accepted ? "accept" : "reject", + active: accepted ? true : false // always true if accepted + }); }); return solrecs; }; diff --git a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js index 4c614cf5e..c4ffcf51d 100644 --- a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js +++ b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js @@ -191,8 +191,8 @@ var fluid = fluid || require("infusion"), var disposed = strategy(leaves, tmpSolrecs, data, ontologyMetadata); togo[contextId] = {}; fluid.each(disposed, function (solrec, solid) { - if (solrec.disposition === "accept" || solrec.disposition === "deactivate") { - togo[contextId][solid] = (solrec.disposition === "accept"); // true if it should be running + if (solrec.disposition === "accept") { // only output accepted solutions + togo[contextId][solid] = solrec.active; // true if it should be running } }); }); @@ -270,6 +270,7 @@ var fluid = fluid || require("infusion"), // if no ties, mark the current solution as "accept" if (tied.length === 0) { solrecs[solutionId].disposition = "accept"; + solrecs[solutionId].active = true; solrecs[solutionId].dispositionReason = "Has a higher priority (" + priority + ") than any solution of the same type"; } else { @@ -301,6 +302,7 @@ var fluid = fluid || require("infusion"), delete solrecs[tiedSolutionId].priority; delete solrecs[tiedSolutionId].disposition; delete solrecs[tiedSolutionId].dispositionReason; + delete solrecs[tiedSolutionId].active; }); }; @@ -327,8 +329,9 @@ var fluid = fluid || require("infusion"), for (var solutionId in solutionTypeMapping[type]) { var sol = solrecs[solutionId]; if (!sol.disposition) { - sol.disposition = "deactivate"; - sol.dispositionReason = disposeReason || "Solution rejected (deactivated) due to its type of " + type; + sol.disposition = "accept"; + sol.active = false; + sol.dispositionReason = disposeReason || "Solution accepted but deactivated due to its type of " + type; } } }); diff --git a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js index 4b704b3ad..8827bf34e 100644 --- a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js +++ b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js @@ -92,37 +92,39 @@ var fluid = fluid || require("infusion"), } }; - // "undefined" disposition means that the solution is either tied with another solution - // or not present on the device. Decisions are based on priority and solution type - see + // `undefined` disposition means that the solution is either tied with another solution + // or not present on the device. `true` means that the solution should be configured and + // launched on startup, and `false` means configured but NOT launched on startup. + // Decisions are based on priority and solution type - see // the data block above. var testData = [{ description: "Tie between highest priority, rest rejected", priorities: [2, 2, 1, 1, 1], - expectedDispositions: [undefined, undefined, "deactivate", "deactivate", "deactivate"] + expectedDispositions: [undefined, undefined, false, false, false] }, { description: "Single highest priority wins, rest rejected", priorities: [2, 1, 1, 1, 1], - expectedDispositions: ["accept", "deactivate", "deactivate", "deactivate", "deactivate"] + expectedDispositions: [true, false, false, false, false] }, { // description: "Only solution covering all required solution types selected", // priorities: [2, 1, 2, 1, 1], - // expectedDispositions: ["accept", "reject", "reject", "reject", "reject"] + // expectedDispositions: [true, "reject", "reject", "reject", "reject"] // }, { description: "Highest priority selected, solution type equivalents remove", priorities: [2, 1, 3, 1, 2], - expectedDispositions: ["deactivate", "deactivate", "accept", "deactivate", "accept"] + expectedDispositions: [false, false, true, false, true] }, { description: "Tie between multiple solutions of different types", priorities: [2, 1, 2, 2, 2], - expectedDispositions: [undefined, "deactivate", undefined, undefined, undefined] + expectedDispositions: [undefined, false, undefined, undefined, undefined] }, { description: "Tie between multiple solutions of different types #2", priorities: [2, 1, 2, 1, 2], - expectedDispositions: [undefined, "deactivate", undefined, "deactivate", undefined] + expectedDispositions: [undefined, false, undefined, false, undefined] // }, { // description: "", // priorities: [1, null, 2, null, null], - // expectedDispositions: ["accept", undefined, "reject", undefined, undefined] + // expectedDispositions: [true, undefined, "reject", undefined, undefined] }]; @@ -168,8 +170,9 @@ var fluid = fluid || require("infusion"), gpii.matchMakerFramework.utils.disposeFromPriority(input.solrecs, input.data); fluid.each(fullData.solIds, function (solId, index) { - var msg = "Expecting solution " + solId + " to have disposition: " + expectedDispositions[index]; - jqUnit.assertEquals(msg, expectedDispositions[index], input.solrecs[solId].disposition); + var msg = "Expecting solution " + solId + " to be: " + expectedDispositions[index]; + var actual = input.solrecs[solId].disposition ? input.solrecs[solId].active : undefined; + jqUnit.assertEquals(msg, expectedDispositions[index], actual); }); }; From 1b5616c12e61424e53b1b9055f8a7ca2def3c36c Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 20 Dec 2017 15:10:45 +0100 Subject: [PATCH 24/26] GPII-1230: Updated windows tests to work with latest changes in registered AT handler --- testData/solutions/win32.json5 | 4 ++-- .../windows/windows-builtIn-testSpec.js | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/testData/solutions/win32.json5 b/testData/solutions/win32.json5 index 22df54af1..e4dcd58f2 100644 --- a/testData/solutions/win32.json5 +++ b/testData/solutions/win32.json5 @@ -970,7 +970,7 @@ "retryInterval": 1000 }, "registryName": "magnifierpane", - "queryProcess": "Magnify" + "queryProcess": "Magnify.exe" } } }, @@ -1044,7 +1044,7 @@ "type": "gpii.windows.enableRegisteredAT", "options": { "registryName": "osk", - "queryProcess": "osk" + "queryProcess": "osk.exe" } } }, diff --git a/tests/platform/windows/windows-builtIn-testSpec.js b/tests/platform/windows/windows-builtIn-testSpec.js index 386da3c80..6943adcb9 100644 --- a/tests/platform/windows/windows-builtIn-testSpec.js +++ b/tests/platform/windows/windows-builtIn-testSpec.js @@ -42,7 +42,7 @@ gpii.tests.windows.builtIn = [ retryInterval: 1000 }, "registryName": "magnifierpane", - "queryProcess": "Magnify" + "queryProcess": "Magnify.exe" } }] } @@ -266,7 +266,7 @@ gpii.tests.windows.builtIn = [ retryInterval: 1000 }, "registryName": "magnifierpane", - "queryProcess": "Magnify" + "queryProcess": "Magnify.exe" } }] } @@ -288,7 +288,7 @@ gpii.tests.windows.builtIn = [ retryInterval: 1000 }, "registryName": "magnifierpane", - "queryProcess": "Magnify" + "queryProcess": "Magnify.exe" } }], "com.microsoft.windows.onscreenKeyboard": [{ @@ -479,7 +479,7 @@ gpii.tests.windows.builtIn = [ retryInterval: 1000 }, "registryName": "magnifierpane", - "queryProcess": "Magnify" + "queryProcess": "Magnify.exe" } }], "com.microsoft.windows.onscreenKeyboard": [{ @@ -510,7 +510,7 @@ gpii.tests.windows.builtIn = [ retryInterval: 1000 }, "registryName": "magnifierpane", - "queryProcess": "Magnify" + "queryProcess": "Magnify.exe" } }], "com.microsoft.windows.onscreenKeyboard": [{ @@ -701,7 +701,7 @@ gpii.tests.windows.builtIn = [ retryInterval: 1000 }, "registryName": "magnifierpane", - "queryProcess": "Magnify" + "queryProcess": "Magnify.exe" } }], "com.microsoft.windows.onscreenKeyboard": [{ @@ -732,7 +732,7 @@ gpii.tests.windows.builtIn = [ retryInterval: 1000 }, "registryName": "magnifierpane", - "queryProcess": "Magnify" + "queryProcess": "Magnify.exe" } }], "com.microsoft.windows.onscreenKeyboard": [{ @@ -923,7 +923,7 @@ gpii.tests.windows.builtIn = [ retryInterval: 1000 }, "registryName": "magnifierpane", - "queryProcess": "Magnify" + "queryProcess": "Magnify.exe" } }], "com.microsoft.windows.onscreenKeyboard": [{ @@ -954,7 +954,7 @@ gpii.tests.windows.builtIn = [ retryInterval: 1000 }, "registryName": "magnifierpane", - "queryProcess": "Magnify" + "queryProcess": "Magnify.exe" } }], "com.microsoft.windows.onscreenKeyboard": [{ @@ -1038,7 +1038,7 @@ gpii.tests.windows.builtIn = [ retryInterval: 1000 }, "registryName": "magnifierpane", - "queryProcess": "Magnify" + "queryProcess": "Magnify.exe" } }] } From c2e06fc75b304217620a1d945c6b069b8bc09d3e Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 20 Dec 2017 18:18:48 +0100 Subject: [PATCH 25/26] GPII-1230: Fixed remaining instances of queryProcess without .exe --- tests/JournalIntegrationTests.js | 4 ++-- tests/platform/windows/windows-builtIn-testSpec.js | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/JournalIntegrationTests.js b/tests/JournalIntegrationTests.js index 7065bbf0b..8cfc89838 100644 --- a/tests/JournalIntegrationTests.js +++ b/tests/JournalIntegrationTests.js @@ -93,7 +93,7 @@ gpii.tests.journal.initialSettings = { }, "options": { "registryName": "magnifierpane", - "queryProcess": "Magnify" + "queryProcess": "Magnify.exe" } }] } @@ -107,7 +107,7 @@ gpii.tests.journal.settingsAfterCrash = { }, "options": { "registryName": "magnifierpane", - "queryProcess": "Magnify" + "queryProcess": "Magnify.exe" } }] } diff --git a/tests/platform/windows/windows-builtIn-testSpec.js b/tests/platform/windows/windows-builtIn-testSpec.js index 6943adcb9..b2549e410 100644 --- a/tests/platform/windows/windows-builtIn-testSpec.js +++ b/tests/platform/windows/windows-builtIn-testSpec.js @@ -297,7 +297,7 @@ gpii.tests.windows.builtIn = [ }, "options": { "registryName": "osk", - "queryProcess": "osk" + "queryProcess": "osk.exe" } }] } @@ -488,7 +488,7 @@ gpii.tests.windows.builtIn = [ }, "options": { "registryName": "osk", - "queryProcess": "osk" + "queryProcess": "osk.exe" } }] } @@ -519,7 +519,7 @@ gpii.tests.windows.builtIn = [ }, "options": { "registryName": "osk", - "queryProcess": "osk" + "queryProcess": "osk.exe" } }] } @@ -710,7 +710,7 @@ gpii.tests.windows.builtIn = [ }, "options": { "registryName": "osk", - "queryProcess": "osk" + "queryProcess": "osk.exe" } }] } @@ -741,7 +741,7 @@ gpii.tests.windows.builtIn = [ }, "options": { "registryName": "osk", - "queryProcess": "osk" + "queryProcess": "osk.exe" } }] } @@ -932,7 +932,7 @@ gpii.tests.windows.builtIn = [ }, "options": { "registryName": "osk", - "queryProcess": "osk" + "queryProcess": "osk.exe" } }] } @@ -963,7 +963,7 @@ gpii.tests.windows.builtIn = [ }, "options": { "registryName": "osk", - "queryProcess": "osk" + "queryProcess": "osk.exe" } }] } From a389459a3d08774eee13efbf730fc0b101524b31 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 7 Feb 2018 15:15:03 +0100 Subject: [PATCH 26/26] GPII-1230: Halfway through renaming from settingsHandlers to handlers --- documentation/FlowManager.md | 2 +- documentation/SolutionsRegistryFormat.md | 8 ++-- .../test/data/full_mm_payload1.json | 4 +- .../test/data/full_mm_payload2.json | 8 ++-- .../web/js/CanopyMatchMakerUtilitiesTests.js | 8 ++-- .../test/data/standardMMInput.json | 6 +-- .../test/data/standardMMOutput.json | 4 +- .../test/FlatMatchMakerTests.js | 4 +- .../test/data/full_mm_payload1.json | 4 +- .../browserChannel_solutionsRegistry.json | 4 +- .../test/data/matchmaker.output.payload.json | 28 ++++++------- .../test/data/update_solutionsRegistry.json | 2 +- .../lifecycleManager/src/LifecycleManager.js | 14 +++---- .../test/js/LifecycleManagerTests.js | 6 +-- .../test/js/MatchMakerUtilitiesTests.js | 12 +++--- .../transformer/test/js/TransformerTests.js | 24 +++++------ testData/solutions/android.json5 | 16 +++---- testData/solutions/darwin.json5 | 6 +-- testData/solutions/linux.json5 | 28 ++++++------- testData/solutions/web.json5 | 14 +++---- testData/solutions/win32.json5 | 42 +++++++++---------- tests/data/multiSHSolutionRegistry.json | 2 +- tests/shared/ContextIntegrationTestDefs.js | 10 ++--- tests/shared/PCPIntegrationTestDefs.js | 8 ++-- 24 files changed, 132 insertions(+), 132 deletions(-) diff --git a/documentation/FlowManager.md b/documentation/FlowManager.md index 5be1ee654..6ee2d47b5 100644 --- a/documentation/FlowManager.md +++ b/documentation/FlowManager.md @@ -115,7 +115,7 @@ OR if the last login/logout process for finished less than 5 seconds a } ] }, - "settingsHandlers": { + "handlers": { "configs": { "type": "gpii.settingsHandlers.INISettingsHandler", "options": { diff --git a/documentation/SolutionsRegistryFormat.md b/documentation/SolutionsRegistryFormat.md index 699c1418d..75ef3c7bc 100644 --- a/documentation/SolutionsRegistryFormat.md +++ b/documentation/SolutionsRegistryFormat.md @@ -7,7 +7,7 @@ Each entry in the solution registry should have a unique ID (`Solution.id` in th "Solution.id": { "name": "My Solution" "contexts": { ... }, - "settingsHandlers": { ... }, + "handlers": { ... }, "configure": [ .. ], "restore": [ .. ], "update": [ .. ], @@ -38,12 +38,12 @@ The `contexts` block describes what the required context is for the solution to } ``` -### settingsHandlers -The `settingsHandlers` block is unique and one of the most important blocks in the solutions registry entry. It consists of zero or more settingsHandler entries, each keyed by an arbitrary name (that is unique within this solutions settingsHandlers block). Inside each settingsHandler entry, the properties for that settingsHandler is provided. The entries in the settingsHandlers block can be referred to from the other lifecycle blocks of the solutions registry entry. The settingsHandlers block is mandatory. +### handlers +The `handlers` block is unique and one of the most important blocks in the solutions registry entry. It consists of zero or more settingsHandler or LaunchHandler entries, each keyed by an arbitrary name (that is unique within this solutions handlers block). Inside each handler entry, the properties for that handler is provided. The entries in the settingsHandlers block can be referred to from the other lifecycle blocks of the solutions registry entry. The handlers block is mandatory. **Example settingsHandlers block**: ``` -"settingsHandlers": { +"handlers": { "myconf": { "type": "gpii.settingsHandlers.INISettingsHandler", "options": { diff --git a/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload1.json b/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload1.json index 6f2dc7e5f..b1d19afe8 100644 --- a/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload1.json +++ b/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload1.json @@ -37,7 +37,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "myconf": { "type": "gpii.settingsHandlers.JSONSettingsHandler.set", "options": { @@ -68,7 +68,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "otherconf": { "type": "gpii.settingsHandlers.noSettings", "capabilities": [] diff --git a/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload2.json b/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload2.json index 178fb961b..f4ec155aa 100644 --- a/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload2.json +++ b/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload2.json @@ -34,7 +34,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.settingsHandlers.JSONSettingsHandler", "options": { @@ -59,7 +59,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.settingsHandlers.JSONSettingsHandler", "options": { @@ -98,7 +98,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.settingsHandlers.JSONSettingsHandler", "options": { @@ -125,7 +125,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.settingsHandlers.JSONSettingsHandler", "options": { diff --git a/gpii/node_modules/canopyMatchMaker/test/web/js/CanopyMatchMakerUtilitiesTests.js b/gpii/node_modules/canopyMatchMaker/test/web/js/CanopyMatchMakerUtilitiesTests.js index d27d56b1c..53a929942 100644 --- a/gpii/node_modules/canopyMatchMaker/test/web/js/CanopyMatchMakerUtilitiesTests.js +++ b/gpii/node_modules/canopyMatchMaker/test/web/js/CanopyMatchMakerUtilitiesTests.js @@ -26,7 +26,7 @@ var gpii = fluid.registerNamespace("gpii"); fluid.registerNamespace("gpii.tests.canopyMatchMaker"); var magnifier = { - "settingsHandlers": { + "handlers": { "myconf": { "type": "gpii.integrationTesting.mockSettingsHandler", "capabilities": ["display.screenEnhancement"], @@ -48,7 +48,7 @@ var magnifier = { }; var lesserMagnifier = { - "settingsHandlers": { + "handlers": { "myconf": { "type": "gpii.integrationTesting.mockSettingsHandler", "capabilitiesTransformations": { @@ -200,7 +200,7 @@ var disposeStrategyFixtures = [ "solution": { "name": "Test dummy", "contexts": {}, - "settingsHandlers": { + "handlers": { "myconf": { "type": "gpii.settingsHandlers.JSONSettingsHandler.set", "options": { @@ -239,7 +239,7 @@ var disposeStrategyFixtures = [ "solution": { "name": "Test dummy 2", "contexts": {}, - "settingsHandlers": { + "handlers": { "myconf": { "type": "gpii.settingsHandlers.noSettings", "capabilities": [] diff --git a/gpii/node_modules/contextManager/test/data/standardMMInput.json b/gpii/node_modules/contextManager/test/data/standardMMInput.json index 9a7ad1570..3fa02bbdb 100644 --- a/gpii/node_modules/contextManager/test/data/standardMMInput.json +++ b/gpii/node_modules/contextManager/test/data/standardMMInput.json @@ -68,7 +68,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configuration1": { "type": "gpii.settingsHandlers.INISettingsHandler", "options": { @@ -148,7 +148,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configs": { "type": "gpii.settingsHandlers.INISettingsHandler", "options": { @@ -252,7 +252,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configure": { "type": "gpii.windows.spiSettingsHandler", "options": { diff --git a/gpii/node_modules/contextManager/test/data/standardMMOutput.json b/gpii/node_modules/contextManager/test/data/standardMMOutput.json index cf518c076..2b2405707 100644 --- a/gpii/node_modules/contextManager/test/data/standardMMOutput.json +++ b/gpii/node_modules/contextManager/test/data/standardMMOutput.json @@ -13,7 +13,7 @@ ] }, "active": true, - "settingsHandlers": { + "handlers": { "configs": { "type": "gpii.settingsHandlers.INISettingsHandler", "options": { @@ -128,7 +128,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configure": { "type": "gpii.windows.spiSettingsHandler", "options": { diff --git a/gpii/node_modules/flatMatchMaker/test/FlatMatchMakerTests.js b/gpii/node_modules/flatMatchMaker/test/FlatMatchMakerTests.js index 328263549..89e9e7053 100644 --- a/gpii/node_modules/flatMatchMaker/test/FlatMatchMakerTests.js +++ b/gpii/node_modules/flatMatchMaker/test/FlatMatchMakerTests.js @@ -55,7 +55,7 @@ "solution": { "name": "Test dummy", "contexts": {}, - "settingsHandlers": { + "handlers": { "myconf": { "type": "gpii.settingsHandlers.JSONSettingsHandler.set", "options": { @@ -94,7 +94,7 @@ "solution": { "name": "Test dummy 2", "contexts": {}, - "settingsHandlers": { + "handlers": { "myconf": { "type": "gpii.settingsHandlers.noSettings", "capabilities": [] diff --git a/gpii/node_modules/flatMatchMaker/test/data/full_mm_payload1.json b/gpii/node_modules/flatMatchMaker/test/data/full_mm_payload1.json index 6f2dc7e5f..b1d19afe8 100644 --- a/gpii/node_modules/flatMatchMaker/test/data/full_mm_payload1.json +++ b/gpii/node_modules/flatMatchMaker/test/data/full_mm_payload1.json @@ -37,7 +37,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "myconf": { "type": "gpii.settingsHandlers.JSONSettingsHandler.set", "options": { @@ -68,7 +68,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "otherconf": { "type": "gpii.settingsHandlers.noSettings", "capabilities": [] diff --git a/gpii/node_modules/flowManager/test/data/browserChannel_solutionsRegistry.json b/gpii/node_modules/flowManager/test/data/browserChannel_solutionsRegistry.json index 0f06106c9..cbc13b73d 100644 --- a/gpii/node_modules/flowManager/test/data/browserChannel_solutionsRegistry.json +++ b/gpii/node_modules/flowManager/test/data/browserChannel_solutionsRegistry.json @@ -9,7 +9,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "conf": { "type": "gpii.settingsHandlers.webSockets", "options": { @@ -34,7 +34,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "conf": { "type": "gpii.settingsHandlers.webSockets", "options": { diff --git a/gpii/node_modules/flowManager/test/data/matchmaker.output.payload.json b/gpii/node_modules/flowManager/test/data/matchmaker.output.payload.json index 363a29558..559f33fed 100644 --- a/gpii/node_modules/flowManager/test/data/matchmaker.output.payload.json +++ b/gpii/node_modules/flowManager/test/data/matchmaker.output.payload.json @@ -181,7 +181,7 @@ } ] }, - "settingsHandlers": [ + "handlers": [ { "type": "gpii.gsettings", "options": { @@ -256,7 +256,7 @@ } ] }, - "settingsHandlers": [ + "handlers": [ { "type": "gpii.gsettings", "capabilities": [], @@ -338,7 +338,7 @@ } ] }, - "settingsHandlers": [ + "handlers": [ { "type": "gpii.gsettings", "capabilities": [], @@ -375,7 +375,7 @@ } ] }, - "settingsHandlers": [ + "handlers": [ { "type": "gpii.settingsHandlers.noSettings", "capabilities": [ @@ -414,7 +414,7 @@ } ] }, - "settingsHandlers": [ + "handlers": [ { "type": "gpii.gsettings", "capabilities": [], @@ -489,7 +489,7 @@ } ] }, - "settingsHandlers": [ + "handlers": [ { "type": "gpii.gsettings", "capabilities": [], @@ -523,7 +523,7 @@ } ] }, - "settingsHandlers": [ + "handlers": [ { "type": "gpii.gsettings", "capabilities": [], @@ -557,7 +557,7 @@ } ] }, - "settingsHandlers": [ + "handlers": [ { "type": "gpii.orca", "options": { @@ -1070,7 +1070,7 @@ } ] }, - "settingsHandlers": [ + "handlers": [ { "type": "gpii.alsa", "capabilities": [], @@ -1118,7 +1118,7 @@ } ] }, - "settingsHandlers": [ + "handlers": [ { "type": "gpii.settingsHandlers.noSettings", "capabilities": [ @@ -1165,7 +1165,7 @@ } ] }, - "settingsHandlers": [ + "handlers": [ { "type": "gpii.settingsHandlers.noSettings", "capabilities": [ @@ -1212,7 +1212,7 @@ } ] }, - "settingsHandlers": [ + "handlers": [ { "type": "gpii.settingsHandlers.noSettings", "capabilities": [ @@ -1251,7 +1251,7 @@ } ] }, - "settingsHandlers": [ + "handlers": [ { "type": "gpii.xrandr", "capabilities": [] @@ -1276,7 +1276,7 @@ } ] }, - "settingsHandlers": [ + "handlers": [ { "type": "gpii.settingsHandlers.webSockets", "options": { diff --git a/gpii/node_modules/flowManager/test/data/update_solutionsRegistry.json b/gpii/node_modules/flowManager/test/data/update_solutionsRegistry.json index af7ccf22d..fb9112e81 100644 --- a/gpii/node_modules/flowManager/test/data/update_solutionsRegistry.json +++ b/gpii/node_modules/flowManager/test/data/update_solutionsRegistry.json @@ -9,7 +9,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "myconf": { "type": "gpii.settingsHandlers.noSettings", "capabilities": [], diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index 1acd5ba1f..fef7b589c 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -323,7 +323,7 @@ var gpii = fluid.registerNamespace("gpii"); /** Remove all the settings blocks from a solutions registry entry */ gpii.lifecycleManager.removeSettingsBlocks = function (solutionEntry) { - solutionEntry.settingsHandlers = fluid.transform(solutionEntry.settingsHandlers, function (handler) { + solutionEntry.handlers = fluid.transform(solutionEntry.handlers, function (handler) { return fluid.filterKeys(handler, "settings", true); }); return solutionEntry; @@ -341,7 +341,7 @@ var gpii = fluid.registerNamespace("gpii"); // This is particularly relevant for launch handlers, where we will need to run the "get" directives on logout to decide // whether we an application is running or not, and consequently, whether to run the "update" or "stop" block // toSnapshot.settingsHandlers = {}; - toSnapshot.settingsHandlers[settingsHandlerBlockName] = snapshot; + toSnapshot.handlers[settingsHandlerBlockName] = snapshot; // keep the settings that are already stored from the // original snapshot, but augment it with any settings from the new snapshot // that were not present in the original snapshot. @@ -385,7 +385,7 @@ var gpii = fluid.registerNamespace("gpii"); * that will be resolved once the settings are successfully set. */ gpii.lifecycleManager.executeSettingsAction = function (that, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction) { - var settingsHandlerBlock = solutionRecord.settingsHandlers[settingsHandlerBlockName]; + var settingsHandlerBlock = solutionRecord.handlers[settingsHandlerBlockName]; if (settingsHandlerBlock === undefined) { fluid.fail("Reference to non-existing settingsHandler block named " + settingsHandlerBlockName + " in solution " + solutionId); @@ -419,7 +419,7 @@ var gpii = fluid.registerNamespace("gpii"); */ gpii.lifecycleManager.transformSolutionSettings = function (solutionSettings, transformer) { var togo = fluid.copy(solutionSettings); // safe since armoured - togo.settingsHandlers = fluid.transform(solutionSettings.settingsHandlers, function (handlerBlock) { + togo.handlers = fluid.transform(solutionSettings.handlers, function (handlerBlock) { return gpii.settingsHandlers.transformOneSolutionSettings(handlerBlock, transformer); }); return togo; @@ -511,14 +511,14 @@ var gpii = fluid.registerNamespace("gpii"); if (actionBlock === "isRunning") { // if we're just checking for the run state, dont actually modify the solutionRecord with settings: var tmpSolutionRecord = fluid.copy(solutionRecord); - fluid.set(tmpSolutionRecord, [ "settingsHandlers", settingsHandlerBlockName, "settings"], { running: null }); + fluid.set(tmpSolutionRecord, [ "handlers", settingsHandlerBlockName, "settings"], { running: null }); return gpii.lifecycleManager.executeSettingsAction(that, solutionId, tmpSolutionRecord, session, settingsHandlerBlockName, rootAction); } else { // if this is related to launching, overwrite entry with the appropriate settings, // that is: { running: true } if we're in a start block, else { running: false } if (actionBlock === "start" || actionBlock === "stop") { var launchSettings = { running: actionBlock === "start" ? true : false }; - fluid.set(solutionRecord, [ "settingsHandlers", settingsHandlerBlockName, "settings"], launchSettings); + fluid.set(solutionRecord, [ "handlers", settingsHandlerBlockName, "settings"], launchSettings); } return gpii.lifecycleManager.executeSettingsAction(that, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction); } @@ -664,7 +664,7 @@ var gpii = fluid.registerNamespace("gpii"); var isRunningBlock = fluid.makeArray(solutionSnapshot.isRunning)[0]; if (isRunningBlock && isRunningBlock.indexOf("settings.") === 0) { var settingsHandlerBlockName = isRunningBlock.substring("settings.".length); - var recordedState = fluid.get(solutionSnapshot, ["settingsHandlers", settingsHandlerBlockName, "settings", "running"]); + var recordedState = fluid.get(solutionSnapshot, ["ha", settingsHandlerBlockName, "settings", "running"]); return recordedState; } }; diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index 2176bf5cc..dd450f99c 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -95,7 +95,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt gpii.tests.lifecycleManager.buildSettingsHandlersEntry = function (settings, setRunning) { var togo = { - "settingsHandlers": { + "handlers": { "myconf": { "type": "gpii.tests.lifecycleManager.mockSettingsHandler", "options": {} @@ -107,10 +107,10 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt } }; if (settings !== undefined) { - fluid.set(togo, [ "settingsHandlers", "myconf", "settings" ], settings); + fluid.set(togo, [ "handlers", "myconf", "settings" ], settings); } if (setRunning !== undefined) { - fluid.set(togo, [ "settingsHandlers", "launcher", "settings" ], { running: setRunning }); + fluid.set(togo, [ "handlers", "launcher", "settings" ], { running: setRunning }); } return togo; }; diff --git a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js index d40719ccb..6761812a2 100644 --- a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js +++ b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js @@ -190,7 +190,7 @@ var fluid = fluid || require("infusion"), model: { "name": "GNOME Shell Magnifier", "contexts": {}, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.gsettings", "options": { @@ -330,7 +330,7 @@ var fluid = fluid || require("infusion"), } ] }, - "settingsHandlers": { + "handlers": { "myconf": { "type": "gpii.settingsHandlers.JSONSettingsHandler.set", "options": { @@ -361,7 +361,7 @@ var fluid = fluid || require("infusion"), } ] }, - "settingsHandlers": { + "handlers": { "otherconf": { "type": "gpii.settingsHandlers.noSettings", "capabilities": [] @@ -573,7 +573,7 @@ var fluid = fluid || require("infusion"), } ] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.settingsHandlers.JSONSettingsHandler", "options": { @@ -610,7 +610,7 @@ var fluid = fluid || require("infusion"), } ] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.settingsHandlers.JSONSettingsHandler", "options": { @@ -648,7 +648,7 @@ var fluid = fluid || require("infusion"), } ] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.settingsHandlers.JSONSettingsHandler", "options": { diff --git a/gpii/node_modules/transformer/test/js/TransformerTests.js b/gpii/node_modules/transformer/test/js/TransformerTests.js index 6d3dd4eb1..5a313314f 100644 --- a/gpii/node_modules/transformer/test/js/TransformerTests.js +++ b/gpii/node_modules/transformer/test/js/TransformerTests.js @@ -37,7 +37,7 @@ fluid.setLogging(true); } ] }, - "settingsHandlers": { + "handlers": { "conf": { "type": "gpii.windows.registrySettingsHandler.set", "options": { @@ -138,7 +138,7 @@ fluid.setLogging(true); } ] }, - "settingsHandlers": { + "handlers": { "myconf": { "type": "gpii.settingsHandlers.XMLHandler.set", "options": { @@ -230,7 +230,7 @@ fluid.setLogging(true); "stop": testSolutionsEntry["com.microsoft.windows.magnifier"].stop, "configure": testSolutionsEntry["com.microsoft.windows.magnifier"].configure, "restore": testSolutionsEntry["com.microsoft.windows.magnifier"].restore, - "settingsHandlers": { + "handlers": { "conf": { "type": "gpii.windows.registrySettingsHandler.set", "options": { @@ -283,7 +283,7 @@ fluid.setLogging(true); "stop": testSolutionsEntry["com.microsoft.windows.magnifier"].stop, "configure": testSolutionsEntry["com.microsoft.windows.magnifier"].configure, "restore": testSolutionsEntry["com.microsoft.windows.magnifier"].restore, - "settingsHandlers": { + "handlers": { "conf": { "type": "gpii.windows.registrySettingsHandler.set", "options": { @@ -330,7 +330,7 @@ fluid.setLogging(true); "stop": testSolutionsEntry["com.microsoft.windows.magnifier"].stop, "configure": testSolutionsEntry["com.microsoft.windows.magnifier"].configure, "restore": testSolutionsEntry["com.microsoft.windows.magnifier"].restore, - "settingsHandlers": { + "handlers": { "conf": { "type": "gpii.windows.registrySettingsHandler.set", "options": { @@ -378,7 +378,7 @@ fluid.setLogging(true); "stop": testSolutionsEntry["com.microsoft.windows.magnifier"].stop, "configure": testSolutionsEntry["com.microsoft.windows.magnifier"].configure, "restore": testSolutionsEntry["com.microsoft.windows.magnifier"].restore, - "settingsHandlers": { + "handlers": { "conf": { "type": "gpii.windows.registrySettingsHandler.set", "options": { @@ -425,7 +425,7 @@ fluid.setLogging(true); "stop": testSolutionsEntry["com.microsoft.windows.magnifier"].stop, "configure": testSolutionsEntry["com.microsoft.windows.magnifier"].configure, "restore": testSolutionsEntry["com.microsoft.windows.magnifier"].restore, - "settingsHandlers": { + "handlers": { "conf": { "type": "gpii.windows.registrySettingsHandler.set", "options": { @@ -473,7 +473,7 @@ fluid.setLogging(true); "stop": testSolutionsEntry["com.microsoft.windows.magnifier"].stop, "configure": testSolutionsEntry["com.microsoft.windows.magnifier"].configure, "restore": testSolutionsEntry["com.microsoft.windows.magnifier"].restore, - "settingsHandlers": { + "handlers": { "conf": { "type": "gpii.windows.registrySettingsHandler.set", "options": { @@ -522,7 +522,7 @@ fluid.setLogging(true); "stop": testSolutionsEntry["com.microsoft.windows.magnifier"].stop, "configure": testSolutionsEntry["com.microsoft.windows.magnifier"].configure, "restore": testSolutionsEntry["com.microsoft.windows.magnifier"].restore, - "settingsHandlers": { + "handlers": { "conf": { "type": "gpii.windows.registrySettingsHandler.set", "options": { @@ -570,7 +570,7 @@ fluid.setLogging(true); "stop": testSolutionsEntry["com.microsoft.windows.magnifier"].stop, "configure": testSolutionsEntry["com.microsoft.windows.magnifier"].configure, "restore": testSolutionsEntry["com.microsoft.windows.magnifier"].restore, - "settingsHandlers": { + "handlers": { "conf": { "type": "gpii.windows.registrySettingsHandler.set", "options": { @@ -622,7 +622,7 @@ fluid.setLogging(true); "stop": testSolutionsEntry["com.microsoft.windows.magnifier"].stop, "configure": testSolutionsEntry["com.microsoft.windows.magnifier"].configure, "restore": testSolutionsEntry["com.microsoft.windows.magnifier"].restore, - "settingsHandlers": { + "handlers": { "conf": { "type": "gpii.windows.registrySettingsHandler.set", "options": { @@ -652,7 +652,7 @@ fluid.setLogging(true); "stop": testSolutionsEntry["eu.singularlogic.pixelsense.sociable"].stop, "configure": testSolutionsEntry["eu.singularlogic.pixelsense.sociable"].configure, "restore": testSolutionsEntry["eu.singularlogic.pixelsense.sociable"].restore, - "settingsHandlers": { + "handlers": { "myconf": { "type": "gpii.settingsHandlers.XMLHandler.set", "options": { diff --git a/testData/solutions/android.json5 b/testData/solutions/android.json5 index a0eb70690..33d9f3e46 100644 --- a/testData/solutions/android.json5 +++ b/testData/solutions/android.json5 @@ -7,7 +7,7 @@ "version": ">=0.1" }] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.settingsHandlers.noSettings", "capabilities": [ @@ -42,7 +42,7 @@ "version": ">=0.1" }] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.settingsHandlers.noSettings", "capabilities": [ @@ -85,7 +85,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.androidPersistentConfiguration", "supportedSettings": { @@ -189,7 +189,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.androidAudioManager.volume", "supportedSettings": { @@ -244,7 +244,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.androidSettings", "options": { @@ -313,7 +313,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.androidSettings", "options": { @@ -398,7 +398,7 @@ "version": ">=0.1" }] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.settingsHandlers.XMLHandler", "supportedSettings": { @@ -490,7 +490,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.settingsHandlers.noSettings", "supportedSettings": { diff --git a/testData/solutions/darwin.json5 b/testData/solutions/darwin.json5 index c5117ea61..98d09b9a8 100644 --- a/testData/solutions/darwin.json5 +++ b/testData/solutions/darwin.json5 @@ -8,7 +8,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.settingsHandlers.JSONSettingsHandler", "options": { @@ -46,7 +46,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.settingsHandlers.JSONSettingsHandler", "options": { @@ -85,7 +85,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.settingsHandlers.JSONSettingsHandler", "options": { diff --git a/testData/solutions/linux.json5 b/testData/solutions/linux.json5 index 29dda8842..85e755e11 100644 --- a/testData/solutions/linux.json5 +++ b/testData/solutions/linux.json5 @@ -9,7 +9,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.gsettings", "options": { @@ -131,7 +131,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.gsettings", "supportedSettings": { @@ -252,7 +252,7 @@ }] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.gsettings", "supportedSettings": { @@ -290,7 +290,7 @@ "version": ">=2.6.26" }] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.settingsHandlers.noSettings", "capabilities": [ @@ -332,7 +332,7 @@ "version": ">=2.6.26" }] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.gsettings", "supportedSettings": { @@ -416,7 +416,7 @@ }] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.gsettings", "capabilities": [], @@ -448,7 +448,7 @@ }] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.gsettings", "capabilities": [ @@ -480,7 +480,7 @@ "version": ">=2.6.26" }] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.orca", "options": { @@ -1145,7 +1145,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.alsa", "supportedSettings": { @@ -1194,7 +1194,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.settingsHandlers.noSettings", "capabilities": [ @@ -1253,7 +1253,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.settingsHandlers.noSettings", "capabilities": [ @@ -1312,7 +1312,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.settingsHandlers.noSettings", "capabilities": [ @@ -1369,7 +1369,7 @@ "version": ">=2.6.26" }] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.xrandr", "capabilities": [], @@ -1394,7 +1394,7 @@ "version": ">=5.0" }] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.settingsHandlers.webSockets", "options": { diff --git a/testData/solutions/web.json5 b/testData/solutions/web.json5 index 5ffe0c141..5f0c80442 100644 --- a/testData/solutions/web.json5 +++ b/testData/solutions/web.json5 @@ -8,7 +8,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "myconf": { "type": "gpii.settingsHandlers.noSettings", "supportedSettings": { @@ -79,7 +79,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "myconf": { "type": "gpii.settingsHandlers.noSettings", "supportedSettings": { @@ -187,7 +187,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "conf": { "type": "gpii.settingsHandlers.noSettings", "supportedSettings": { @@ -283,7 +283,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "conf": { "type": "gpii.settingsHandlers.noSettings", "supportedSettings": { @@ -356,7 +356,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "conf": { "type": "gpii.settingsHandlers.noSettings", "supportedSettings": { @@ -424,7 +424,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "conf": { "type": "gpii.settingsHandlers.noSettings", "supportedSettings": { @@ -501,7 +501,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "conf": { "type": "gpii.settingsHandlers.noSettings", "supportedSettings": { diff --git a/testData/solutions/win32.json5 b/testData/solutions/win32.json5 index e4dcd58f2..384990f7b 100644 --- a/testData/solutions/win32.json5 +++ b/testData/solutions/win32.json5 @@ -8,7 +8,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configuration1": { "type": "gpii.settingsHandlers.INISettingsHandler", "options": { @@ -693,7 +693,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.settingsHandlers.XMLHandler", "options": { @@ -805,7 +805,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configure": { "type": "gpii.windows.registrySettingsHandler", "options": { @@ -1011,7 +1011,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configure": { "type": "gpii.windows.registrySettingsHandler", "options": { @@ -1086,7 +1086,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configure": { "type": "gpii.windows.registrySettingsHandler", "options": { @@ -1362,7 +1362,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configs": { "type": "gpii.settingsHandlers.INISettingsHandler", "options": { @@ -1815,7 +1815,7 @@ ] }, - "settingsHandlers": { + "handlers": { "configure": { "type": "gpii.settingsHandlers.noSettings", "capabilities": [ @@ -1872,7 +1872,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configure": { "type": "gpii.settingsHandlers.noSettings", "capabilities": [ @@ -1922,7 +1922,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configure": { "type": "gpii.settingsHandlers.noSettings", "capabilities": [ @@ -1973,7 +1973,7 @@ ] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.settingsHandlers.JSONSettingsHandler", "options": { @@ -2102,7 +2102,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configure": { "type": "gpii.windows.spiSettingsHandler", "options": { @@ -2220,7 +2220,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configure": { "type": "gpii.windows.spiSettingsHandler", "options": { @@ -2280,7 +2280,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configure": { "type": "gpii.windows.spiSettingsHandler", "options": { @@ -2497,7 +2497,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configure": { "type": "gpii.windows.spiSettingsHandler", "options": { @@ -2642,7 +2642,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configure": { "type": "gpii.windows.spiSettingsHandler", "options": { @@ -2715,7 +2715,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.windows.displaySettingsHandler", "capabilities": [ @@ -2757,7 +2757,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configure": { "type": "gpii.windows.displaySettingsHandler", "supportedSettings": { @@ -2809,7 +2809,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configure": { "type": "gpii.windows.registrySettingsHandler", "options": { @@ -3137,7 +3137,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.settingsHandlers.XMLHandler", "options": { @@ -3241,7 +3241,7 @@ "version": ">=5.0" }] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.settingsHandlers.webSockets", "options": { @@ -3368,7 +3368,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configure": { "type": "gpii.settingsHandlers.noSettings", "liveness": "OSRestart", diff --git a/tests/data/multiSHSolutionRegistry.json b/tests/data/multiSHSolutionRegistry.json index a1d593921..23c7565c7 100644 --- a/tests/data/multiSHSolutionRegistry.json +++ b/tests/data/multiSHSolutionRegistry.json @@ -8,7 +8,7 @@ } ] }, - "settingsHandlers": { + "handlers": { "configuration": { "type": "gpii.settingsHandlers.JSONSettingsHandler", "options": { diff --git a/tests/shared/ContextIntegrationTestDefs.js b/tests/shared/ContextIntegrationTestDefs.js index 645ce09f6..a00e7ea2b 100644 --- a/tests/shared/ContextIntegrationTestDefs.js +++ b/tests/shared/ContextIntegrationTestDefs.js @@ -92,7 +92,7 @@ gpii.tests.contextIntegration.data = { "http://registry.gpii.net/common/environment/illuminance": 200, "http://registry.gpii.net/common/environment/auditory.noise": 10000 }, - "settingsHandlers": { + "handlers": { "gpii.gsettings": { "data": [{ "settings": { @@ -117,7 +117,7 @@ gpii.tests.contextIntegration.data = { "http://registry.gpii.net/common/environment/illuminance": 500, "http://registry.gpii.net/common/environment/auditory.noise": 10000 }, - "settingsHandlers": { + "handlers": { "gpii.gsettings": { "data": [{ "settings": { @@ -138,7 +138,7 @@ gpii.tests.contextIntegration.data = { } }, "onlyBright": { // if user logs in when brightness is active from the beginning - only expect mag - "settingsHandlers": { + "handlers": { "gpii.gsettings": { "data": [{ "settings": { @@ -156,7 +156,7 @@ gpii.tests.contextIntegration.data = { "http://registry.gpii.net/common/environment/illuminance": 200, "http://registry.gpii.net/common/environment/auditory.noise": 30000 }, - "settingsHandlers": { + "handlers": { "gpii.gsettings": { "data": [{ "settings": { @@ -181,7 +181,7 @@ gpii.tests.contextIntegration.data = { "http://registry.gpii.net/common/environment/illuminance": 500, "http://registry.gpii.net/common/environment/auditory.noise": 30000 }, - "settingsHandlers": { + "handlers": { "gpii.gsettings": { "data": [{ "settings": { diff --git a/tests/shared/PCPIntegrationTestDefs.js b/tests/shared/PCPIntegrationTestDefs.js index 2372313c3..772012464 100644 --- a/tests/shared/PCPIntegrationTestDefs.js +++ b/tests/shared/PCPIntegrationTestDefs.js @@ -66,7 +66,7 @@ gpii.tests.pcpIntegration.connectionSucceeded = function (data) { gpii.tests.pcpIntegration.data = { initial: { - "settingsHandlers": { + "handlers": { "gpii.gsettings": { "data": [{ "settings": { @@ -87,7 +87,7 @@ gpii.tests.pcpIntegration.data = { } }, afterChange1: { - "settingsHandlers": { + "handlers": { "gpii.gsettings": { "data": [{ "settings": { @@ -108,7 +108,7 @@ gpii.tests.pcpIntegration.data = { } }, afterChange2: { - "settingsHandlers": { + "handlers": { "gpii.gsettings": { "data": [{ "settings": { @@ -129,7 +129,7 @@ gpii.tests.pcpIntegration.data = { } }, bright: { - "settingsHandlers": { + "handlers": { "gpii.gsettings": { "data": [{ "settings": {