diff --git a/Microsoft.Dynamics365.UIAutomation.Browser/BrowserOptions.cs b/Microsoft.Dynamics365.UIAutomation.Browser/BrowserOptions.cs index 9dfd695d..7ce31d19 100644 --- a/Microsoft.Dynamics365.UIAutomation.Browser/BrowserOptions.cs +++ b/Microsoft.Dynamics365.UIAutomation.Browser/BrowserOptions.cs @@ -16,11 +16,12 @@ public class BrowserOptions { public BrowserOptions() { + this.TimeFactor = 1.0f; this.DriversPath = Path.Combine(Directory.GetCurrentDirectory()); //, @"Drivers\"); this.DownloadsPath = null; this.BrowserType = BrowserType.IE; - this.PageLoadTimeout = new TimeSpan(0, 3, 0); - this.CommandTimeout = TimeSpan.FromMinutes(20); + this.PageLoadTimeout = TimeSpan.FromMinutes(3); + this.CommandTimeout = TimeSpan.FromMinutes(5); this.StartMaximized = true; this.FireEvents = false; this.TraceSource = Constants.DefaultTraceSource; @@ -51,6 +52,7 @@ public BrowserOptions() this.CookieСontrolsMode = 0; } + public float TimeFactor { get; set; } public BrowserType RemoteBrowserType { get; set; } public Uri RemoteHubServer { get; set; } public BrowserType BrowserType { get; set; } @@ -60,7 +62,7 @@ public BrowserOptions() public bool PrivateMode { get; set; } public bool CleanSession { get; set; } public TimeSpan PageLoadTimeout { get; set; } - public TimeSpan CommandTimeout { get; set; } = TimeSpan.FromMinutes(20); + public TimeSpan CommandTimeout { get; set; } /// /// When the browser will open maximized at the highest supported resolution. /// @@ -104,6 +106,7 @@ public BrowserOptions() /// Please raise any issues with this TestMode being enabled to the Microsoft/EasyRepro community on GitHub for review. /// public bool UCITestMode { get; set; } + public string[] ExtraChromeArguments { get; set; } /// /// Gets or sets the Performance Mode to enable performance center telemetry. @@ -128,6 +131,11 @@ public virtual ChromeOptions ToChrome() { options.AddArgument("--incognito"); } + else + { + var tempPath = Path.GetTempPath(); + options.AddArguments($"--user-data-dir={tempPath}\\EasyRepro"); + } if (this.Headless) { @@ -215,8 +223,13 @@ public virtual ChromeOptions ToChrome() { options.AddUserProfilePreference("download.default_directory", DownloadsPath); } + + options.AddUserProfilePreference("profile.cookie_controls_mode", this.CookieСontrolsMode); + + if (ExtraChromeArguments != null) + foreach (var argument in ExtraChromeArguments) + options.AddArgument(argument); - options.AddUserProfilePreference("profile.cookie_controls_mode", this.CookieСontrolsMode); return options; } @@ -252,10 +265,7 @@ public virtual InternetExplorerOptions ToInternetExplorer() public virtual FirefoxOptions ToFireFox() { - var options = new FirefoxOptions() - { - - }; + var options = new FirefoxOptions(); if (!string.IsNullOrEmpty(DownloadsPath)) { diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/1_Lab_TestsClass.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/1_Lab_TestsClass.cs index 8e382a6c..c561875c 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/1_Lab_TestsClass.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/1_Lab_TestsClass.cs @@ -21,6 +21,9 @@ public void NotUsing_TheBaseClass() { var options = TestSettings.Options; options.PrivateMode = true; + options.TimeFactor = 1.5f; + options.ExtraChromeArguments = new[] { "--disable-geolocation" }; + options.UCIPerformanceMode = false; // <= you can also change other settings here, for this tests only var client = new WebClient(options);