diff --git a/api.d.ts b/api.d.ts index 8d32e84..75de313 100644 --- a/api.d.ts +++ b/api.d.ts @@ -238,6 +238,11 @@ export interface STF_API { */ env?: Object + /** + * A flags object override for testing with specific feature toggle setting. + */ + flags?: Object + /** * Definition of SAP Web IDE plugin transformation that happens BEFORE * any plugins are registered in the "pluginRegistry". This allows using mock diff --git a/resources/local_env/webide_starter.js b/resources/local_env/webide_starter.js index 62457ff..c40c3ac 100644 --- a/resources/local_env/webide_starter.js +++ b/resources/local_env/webide_starter.js @@ -91,6 +91,7 @@ var DEFAULT_START_WEBIDE_OPTIONS = { extra_url_params: {}, backend: "IN_MEMORY", env: localEnvJson, + flags: {}, featureConfig: DEFAULT_FEATURE_CONFIG } @@ -223,7 +224,11 @@ function startWebIDE(options) { actualOptions.featureConfig ) - iframe.contentWindow.WEB_IDE_ENV_JSON_OVERRIDE = actualOptions.env + iframe.contentWindow.WEB_IDE_ENV_JSON_OVERRIDE = _.assign( + {}, + actualOptions.env, + { flags: actualOptions.flags } + ) return deferred.promise.then(function(PluginRegistry) { return { diff --git a/resources/tests/serviceTestFramework.js b/resources/tests/serviceTestFramework.js index 2459960..08f2e6b 100644 --- a/resources/tests/serviceTestFramework.js +++ b/resources/tests/serviceTestFramework.js @@ -143,6 +143,7 @@ define("STF", [ pluginsTransformDef: { add: [], remove: [] }, mocks: [IN_MEMORY_BACKEND], env: localEnvJson, + flags: {}, html: "/base/node_modules/webide/src/main/webapp/index.html", ui5Root: "https://sapui5.hana.ondemand.com/" + ui5Version.version + "/resources/", @@ -257,7 +258,11 @@ define("STF", [ ) iframe.contentWindow.WEB_IDE_FEATURE_CONFIG_OVERRIDE = actualOptions.featureConfig - iframe.contentWindow.WEB_IDE_ENV_JSON_OVERRIDE = actualOptions.env + iframe.contentWindow.WEB_IDE_ENV_JSON_OVERRIDE = _.assign( + {}, + actualOptions.env, + { flags: actualOptions.flags } + ) return serviceRegistryDeferred.promise.then(function(PluginRegistry) { window.WEB_IDE_PLUGIN_REG[suiteName] = PluginRegistry