diff --git a/README.md b/README.md
index 98f0511..7705c70 100644
--- a/README.md
+++ b/README.md
@@ -63,6 +63,8 @@ browserOptions: # optional - will use default EasyRepro options if not set
height: 1080
startMaximized: false
driversPath: ChromeWebDriver # optional - [Recommended when running tests from Azure DevOps Microsoft-hosted agent](https://docs.microsoft.com/en-us/azure/devops/pipelines/test/continuous-test-selenium?view=azure-devops#decide-how-you-will-deploy-and-test-your-app)
+ additionalCapabilities: # optional - additional capabilities to pass to the WebDriver
+ capabilityName: capabilityValue
applicationUser: # optional - populate if creating test data for users other than the current user
tenantId: SPECFLOW_POWERAPPS_TENANTID optional # mandatory
clientId: SPECFLOW_POWERAPPS_CLIENTID # mandatory
diff --git a/bindings/src/Capgemini.PowerApps.SpecFlowBindings/Configuration/BrowserOptionsWithProfileSupport.cs b/bindings/src/Capgemini.PowerApps.SpecFlowBindings/Configuration/BrowserOptionsWithProfileSupport.cs
index 1a4cdad..bfae4ec 100644
--- a/bindings/src/Capgemini.PowerApps.SpecFlowBindings/Configuration/BrowserOptionsWithProfileSupport.cs
+++ b/bindings/src/Capgemini.PowerApps.SpecFlowBindings/Configuration/BrowserOptionsWithProfileSupport.cs
@@ -1,21 +1,40 @@
namespace Capgemini.PowerApps.SpecFlowBindings.Configuration
{
using System;
+ using System.Collections.Generic;
using System.IO;
+ using Capgemini.PowerApps.SpecFlowBindings.Extensions;
using Microsoft.Dynamics365.UIAutomation.Browser;
+ using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
+ using OpenQA.Selenium.Edge;
using OpenQA.Selenium.Firefox;
+ using OpenQA.Selenium.IE;
///
- /// Extends the EasyRepro class with additonal support for chrome profiles.
+ /// Extends the EasyRepro class with support for additional configuration.
///
public class BrowserOptionsWithProfileSupport : BrowserOptions, ICloneable
{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public BrowserOptionsWithProfileSupport()
+ : base()
+ {
+ this.AdditionalCapabilities = new Dictionary();
+ }
+
///
/// Gets or sets the directory to use as the user profile.
///
public string ProfileDirectory { get; set; }
+ ///
+ /// Gets or sets the additional capabilities.
+ ///
+ public Dictionary AdditionalCapabilities { get; set; }
+
///
public object Clone()
{
@@ -32,6 +51,8 @@ public override ChromeOptions ToChrome()
options.AddArgument($"--user-data-dir={this.ProfileDirectory}");
}
+ this.AddAdditionalCapabilities(options);
+
return options;
}
@@ -46,7 +67,37 @@ public override FirefoxOptions ToFireFox()
options.AddArgument($"-profile \"{this.ProfileDirectory}\"");
}
+ this.AddAdditionalCapabilities(options);
+
return options;
}
+
+ ///
+ public override EdgeOptions ToEdge()
+ {
+ var options = base.ToEdge();
+
+ this.AddAdditionalCapabilities(options);
+
+ return options;
+ }
+
+ ///
+ public override InternetExplorerOptions ToInternetExplorer()
+ {
+ var options = base.ToInternetExplorer();
+
+ this.AddAdditionalCapabilities(options);
+
+ return options;
+ }
+
+ private void AddAdditionalCapabilities(DriverOptions options)
+ {
+ foreach (var desiredCapability in this.AdditionalCapabilities)
+ {
+ options.AddGlobalCapability(desiredCapability.Key, desiredCapability.Value);
+ }
+ }
}
}
diff --git a/bindings/src/Capgemini.PowerApps.SpecFlowBindings/Extensions/DriverOptionsExtensions.cs b/bindings/src/Capgemini.PowerApps.SpecFlowBindings/Extensions/DriverOptionsExtensions.cs
new file mode 100644
index 0000000..c816056
--- /dev/null
+++ b/bindings/src/Capgemini.PowerApps.SpecFlowBindings/Extensions/DriverOptionsExtensions.cs
@@ -0,0 +1,38 @@
+namespace Capgemini.PowerApps.SpecFlowBindings.Extensions
+{
+ using OpenQA.Selenium;
+ using OpenQA.Selenium.Chrome;
+ using OpenQA.Selenium.Firefox;
+ using OpenQA.Selenium.IE;
+
+ ///
+ /// Extensions to the class.
+ ///
+ public static class DriverOptionsExtensions
+ {
+ ///
+ /// Adds a global capability to driver options.
+ ///
+ /// The driver options.
+ /// The name of the capability.
+ /// The value of the capability.
+ internal static void AddGlobalCapability(this DriverOptions options, string name, object value)
+ {
+ switch (options)
+ {
+ case ChromeOptions chromeOptions:
+ chromeOptions.AddAdditionalCapability(name, value, true);
+ break;
+ case FirefoxOptions firefoxOptions:
+ firefoxOptions.AddAdditionalCapability(name, value, true);
+ break;
+ case InternetExplorerOptions internetExplorerOptions:
+ internetExplorerOptions.AddAdditionalCapability(name, value, true);
+ break;
+ default:
+ options.AddAdditionalCapability(name, value);
+ break;
+ }
+ }
+ }
+}
diff --git a/bindings/tests/Capgemini.PowerApps.SpecFlowBindings.UiTests/power-apps-bindings.yml b/bindings/tests/Capgemini.PowerApps.SpecFlowBindings.UiTests/power-apps-bindings.yml
index b6950e2..0a62001 100644
--- a/bindings/tests/Capgemini.PowerApps.SpecFlowBindings.UiTests/power-apps-bindings.yml
+++ b/bindings/tests/Capgemini.PowerApps.SpecFlowBindings.UiTests/power-apps-bindings.yml
@@ -7,6 +7,8 @@ browserOptions:
height: 1080
startMaximized: false
driversPath: ChromeWebDriver
+ additionalCapabilities:
+ capabilityName: capabilityVaue
applicationUser:
tenantId: POWERAPPS_SPECFLOW_BINDINGS_TEST_TENANTID
clientId: POWERAPPS_SPECFLOW_BINDINGS_TEST_CLIENTID