diff --git a/src/Legerity.Android/AndroidByExtras.cs b/src/Legerity.Android/AndroidByExtras.cs index 3847c980..04fe14b3 100644 --- a/src/Legerity.Android/AndroidByExtras.cs +++ b/src/Legerity.Android/AndroidByExtras.cs @@ -1,7 +1,5 @@ namespace Legerity.Android; -using OpenQA.Selenium.Appium.Android.UiAutomator; - /// /// Defines a collection of extra locator constraints for . /// @@ -26,4 +24,4 @@ public static By PartialContentDescription(string contentDesc) { return new ByAndroidUIAutomator(new AndroidUiSelector().DescriptionContains(contentDesc)); } -} \ No newline at end of file +} diff --git a/src/Legerity.Android/Elements/AndroidElementWrapper.cs b/src/Legerity.Android/Elements/AndroidElementWrapper.cs index fd17bc86..305e12ce 100644 --- a/src/Legerity.Android/Elements/AndroidElementWrapper.cs +++ b/src/Legerity.Android/Elements/AndroidElementWrapper.cs @@ -1,9 +1,7 @@ namespace Legerity.Android.Elements; using System; - using Exceptions; -using OpenQA.Selenium.Support.UI; /// /// Defines an element wrapper for an Android . diff --git a/src/Legerity.Android/Elements/Core/CheckBox.cs b/src/Legerity.Android/Elements/Core/CheckBox.cs index c7178f5f..a0d519bc 100644 --- a/src/Legerity.Android/Elements/Core/CheckBox.cs +++ b/src/Legerity.Android/Elements/Core/CheckBox.cs @@ -69,4 +69,4 @@ public virtual void CheckOff() Click(); } -} \ No newline at end of file +} diff --git a/src/Legerity.Android/Elements/Core/DatePicker.cs b/src/Legerity.Android/Elements/Core/DatePicker.cs index d4e2bb31..b9da2dba 100644 --- a/src/Legerity.Android/Elements/Core/DatePicker.cs +++ b/src/Legerity.Android/Elements/Core/DatePicker.cs @@ -10,7 +10,7 @@ namespace Legerity.Android.Elements.Core; /// public class DatePicker : AndroidElementWrapper { - private readonly Dictionary months = new() + private readonly Dictionary _months = new() { { "Jan", "01" }, { "Feb", "02" }, @@ -65,13 +65,15 @@ public DatePicker(WebElement element) /// Gets the element associated with the next month button. /// /// Thrown when no element matches the expected locator. - public virtual Button NextMonthButton => Element.FindElementByAndroidUIAutomator("UiSelector().description(\"Next month\")"); + public virtual Button NextMonthButton => + Element.FindElementByAndroidUIAutomator("UiSelector().description(\"Next month\")"); /// /// Gets the element associated with the previous month button. /// /// Thrown when no element matches the expected locator. - public virtual Button PreviousMonthButton => Element.FindElementByAndroidUIAutomator("UiSelector().description(\"Previous month\")"); + public virtual Button PreviousMonthButton => + Element.FindElementByAndroidUIAutomator("UiSelector().description(\"Previous month\")"); /// /// Gets the selected date/time value. @@ -143,7 +145,7 @@ private DateTime GetCurrentViewDate(string currentDate, string currentYear) var currentDateSplit = currentDate.Split(',').ToList(); var currentMonthPart = currentDateSplit.LastOrDefault(); - months.TryGetValue( + _months.TryGetValue( string.Join(string.Empty, (currentMonthPart ?? string.Empty).Where(char.IsLetter)).Trim(), out var month); diff --git a/src/Legerity.Android/Elements/Core/EditText.cs b/src/Legerity.Android/Elements/Core/EditText.cs index b924d1f8..77440513 100644 --- a/src/Legerity.Android/Elements/Core/EditText.cs +++ b/src/Legerity.Android/Elements/Core/EditText.cs @@ -70,4 +70,4 @@ public virtual void ClearText() Click(); Element.Clear(); } -} \ No newline at end of file +} diff --git a/src/Legerity.Android/Elements/Core/RadioButton.cs b/src/Legerity.Android/Elements/Core/RadioButton.cs index ad598ed8..339e44e6 100644 --- a/src/Legerity.Android/Elements/Core/RadioButton.cs +++ b/src/Legerity.Android/Elements/Core/RadioButton.cs @@ -37,4 +37,4 @@ public static implicit operator RadioButton(WebElement element) { return new RadioButton(element); } -} \ No newline at end of file +} diff --git a/src/Legerity.Android/Elements/Core/Spinner.cs b/src/Legerity.Android/Elements/Core/Spinner.cs index 732bb0eb..f652ca4d 100644 --- a/src/Legerity.Android/Elements/Core/Spinner.cs +++ b/src/Legerity.Android/Elements/Core/Spinner.cs @@ -35,7 +35,7 @@ public static implicit operator Spinner(WebElement element) { return new Spinner(element); } - + /// /// Selects an item in the combo-box with the specified item name. /// @@ -53,7 +53,7 @@ public virtual void SelectItem(string name) var locator = new ByAndroidUIAutomator( $"new UiScrollable(new UiSelector()).scrollIntoView(new UiSelector().text(\"{name}\"));"); - WebElement item = Driver.FindElement(locator); + var item = Driver.FindElement(locator); item.Click(); } @@ -73,7 +73,7 @@ public virtual void SelectItemByPartialName(string partialName) var locator = new ByAndroidUIAutomator( $"new UiScrollable(new UiSelector()).scrollIntoView(new UiSelector().textContains(\"{partialName}\"));"); - WebElement item = Driver.FindElement(locator); + var item = Driver.FindElement(locator); item.Click(); } @@ -84,4 +84,4 @@ private string GetSelectedItem() TextView textElement = FindElement(By.ClassName("android.widget.TextView")); return textElement.Text; } -} \ No newline at end of file +} diff --git a/src/Legerity.Android/Elements/Core/Switch.cs b/src/Legerity.Android/Elements/Core/Switch.cs index fa623064..45abb2a8 100644 --- a/src/Legerity.Android/Elements/Core/Switch.cs +++ b/src/Legerity.Android/Elements/Core/Switch.cs @@ -37,7 +37,7 @@ public static implicit operator Switch(WebElement element) { return new Switch(element); } - + /// /// Toggles the switch on. /// @@ -69,4 +69,4 @@ public virtual void ToggleOff() Click(); } -} \ No newline at end of file +} diff --git a/src/Legerity.Android/Elements/Core/TextView.cs b/src/Legerity.Android/Elements/Core/TextView.cs index 19e3b8e7..4a1514b2 100644 --- a/src/Legerity.Android/Elements/Core/TextView.cs +++ b/src/Legerity.Android/Elements/Core/TextView.cs @@ -35,4 +35,4 @@ public static implicit operator TextView(WebElement element) { return new TextView(element); } -} \ No newline at end of file +} diff --git a/src/Legerity.Android/Elements/Core/ToggleButton.cs b/src/Legerity.Android/Elements/Core/ToggleButton.cs index 0603fb5d..38d78a71 100644 --- a/src/Legerity.Android/Elements/Core/ToggleButton.cs +++ b/src/Legerity.Android/Elements/Core/ToggleButton.cs @@ -69,4 +69,4 @@ public virtual void ToggleOff() Click(); } -} \ No newline at end of file +} diff --git a/src/Legerity.Android/Extensions/AndroidElementWrapperExtensions.cs b/src/Legerity.Android/Extensions/AndroidElementWrapperExtensions.cs index af37ab21..33b7e338 100644 --- a/src/Legerity.Android/Extensions/AndroidElementWrapperExtensions.cs +++ b/src/Legerity.Android/Extensions/AndroidElementWrapperExtensions.cs @@ -2,7 +2,6 @@ namespace Legerity.Android.Extensions; using System; using Elements; -using OpenQA.Selenium.Support.UI; /// /// Defines a collection of extensions for objects. diff --git a/src/Legerity.Android/Extensions/AttributeExtensions.cs b/src/Legerity.Android/Extensions/AttributeExtensions.cs index d3cfbf5f..52a3eb7d 100644 --- a/src/Legerity.Android/Extensions/AttributeExtensions.cs +++ b/src/Legerity.Android/Extensions/AttributeExtensions.cs @@ -58,4 +58,4 @@ public static bool GetCheckedState(this IElementWrapper elem { return GetCheckedState(element.Element); } -} \ No newline at end of file +} diff --git a/src/Legerity.Android/Extensions/ElementExtensions.cs b/src/Legerity.Android/Extensions/ElementExtensions.cs index 7281f913..6d1bc7b7 100644 --- a/src/Legerity.Android/Extensions/ElementExtensions.cs +++ b/src/Legerity.Android/Extensions/ElementExtensions.cs @@ -7,4 +7,4 @@ public static WebElement FindElementByAndroidUIAutomator(this WebElement element { return element.FindElement(MobileBy.AndroidUIAutomator(selector)) as WebElement; } -} \ No newline at end of file +} diff --git a/src/Legerity.Android/Extensions/LegerityTestClassExtensions.cs b/src/Legerity.Android/Extensions/LegerityTestClassExtensions.cs index 9a25c4f1..51fed535 100644 --- a/src/Legerity.Android/Extensions/LegerityTestClassExtensions.cs +++ b/src/Legerity.Android/Extensions/LegerityTestClassExtensions.cs @@ -75,4 +75,4 @@ public static AndroidDriver StartAndroidApp( return testClass.StartApp(options, waitUntil, waitUntilTimeout, waitUntilRetries) as AndroidDriver; } -} \ No newline at end of file +} diff --git a/src/Legerity.Android/GlobalUsings.cs b/src/Legerity.Android/GlobalUsings.cs index 0f3218a6..f8d561d0 100644 --- a/src/Legerity.Android/GlobalUsings.cs +++ b/src/Legerity.Android/GlobalUsings.cs @@ -3,4 +3,5 @@ global using OpenQA.Selenium; global using OpenQA.Selenium.Appium; global using OpenQA.Selenium.Appium.Android; -global using OpenQA.Selenium.Remote; +global using OpenQA.Selenium.Appium.Android.UiAutomator; +global using OpenQA.Selenium.Support.UI; diff --git a/src/Legerity.Core/Android/AndroidAppManagerOptions.cs b/src/Legerity.Core/Android/AndroidAppManagerOptions.cs index 7be18c0c..ba4b206c 100644 --- a/src/Legerity.Core/Android/AndroidAppManagerOptions.cs +++ b/src/Legerity.Core/Android/AndroidAppManagerOptions.cs @@ -1,8 +1,6 @@ namespace Legerity.Android; using System.Collections.Generic; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Enums; /// /// Defines a specific for an Android application. @@ -241,7 +239,7 @@ private string GetOptionDetails() if (AdditionalOptions != null) { - foreach ((var name, var value) in AdditionalOptions) + foreach (var (name, value) in AdditionalOptions) { options.Add($"{name} [{value}]"); } diff --git a/src/Legerity.Core/AppManager.cs b/src/Legerity.Core/AppManager.cs index 9509cb02..a2cb913f 100644 --- a/src/Legerity.Core/AppManager.cs +++ b/src/Legerity.Core/AppManager.cs @@ -7,24 +7,16 @@ namespace Legerity; using Extensions; using Helpers; using IOS; +using Legerity.Windows.Helpers; using Web; using Windows; -using Legerity.Windows.Helpers; -using OpenQA.Selenium.Appium.Android; -using OpenQA.Selenium.Appium.iOS; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Chrome; -using OpenQA.Selenium.Edge; -using OpenQA.Selenium.Firefox; -using OpenQA.Selenium.IE; -using OpenQA.Selenium.Safari; /// /// Defines a manager for the application under test. /// public static class AppManager { - private static readonly List StartedApps = new(); + private static readonly List s_startedApps = new(); /// /// Gets the instance of the started Windows application. @@ -72,7 +64,7 @@ public static class AppManager /// /// Gets the instances of started applications. /// - public static IReadOnlyCollection Apps => StartedApps; + public static IReadOnlyCollection Apps => s_startedApps; /// /// Starts the application ready for testing. @@ -118,97 +110,17 @@ public static WebDriver StartApp( switch (opts) { case WebAppManagerOptions webOpts: - { - app = webOpts.DriverType switch - { - WebAppDriverType.Chrome => new ChromeDriver( - webOpts.DriverUri, - webOpts.DriverOptions as ChromeOptions ?? new ChromeOptions()), - WebAppDriverType.Firefox => new FirefoxDriver( - webOpts.DriverUri, - webOpts.DriverOptions as FirefoxOptions ?? new FirefoxOptions()), - WebAppDriverType.Opera => new ChromeDriver( - webOpts.DriverUri, - webOpts.DriverOptions as ChromeOptions ?? new ChromeOptions()), - WebAppDriverType.Safari => new SafariDriver( - webOpts.DriverUri, - webOpts.DriverOptions as SafariOptions ?? new SafariOptions()), - WebAppDriverType.Edge => new EdgeDriver( - webOpts.DriverUri, - webOpts.DriverOptions as EdgeOptions ?? new EdgeOptions()), - WebAppDriverType.InternetExplorer => new InternetExplorerDriver( - webOpts.DriverUri, - webOpts.DriverOptions as InternetExplorerOptions ?? new InternetExplorerOptions()), - WebAppDriverType.EdgeChromium => new EdgeDriver( - webOpts.DriverUri, - webOpts.DriverOptions as EdgeOptions ?? new EdgeOptions()), - _ => null - }; - - VerifyAppDriver(app, webOpts); - - if (webOpts.Maximize) - { - app.Manage().Window.Maximize(); - } - else - { - app.Manage().Window.Size = webOpts.DesiredSize; - } - - app.Url = webOpts.Url; + app = StartWebApp(webOpts); break; - } - case WindowsAppManagerOptions winOpts: - { - if (winOpts.LaunchWinAppDriver) - { - WinAppDriverHelper.Run(); - } - - app = new WindowsDriver( - new Uri(winOpts.DriverUri), - winOpts.AppiumOptions); - - VerifyAppDriver(app, winOpts); - - if (winOpts.Maximize) - { - app.Manage().Window.Maximize(); - } - + app = StartWindowsApp(winOpts); break; - } - case AndroidAppManagerOptions androidOpts: - { - if (androidOpts.LaunchAppiumServer) - { - AppiumServerHelper.Run(); - } - - app = new AndroidDriver( - new Uri(androidOpts.DriverUri), - androidOpts.AppiumOptions); - - VerifyAppDriver(app, androidOpts); + app = StartAndroidApp(androidOpts); break; - } - case IOSAppManagerOptions iosOpts: - { - if (iosOpts.LaunchAppiumServer) - { - AppiumServerHelper.Run(); - } - - app = new IOSDriver(new Uri(iosOpts.DriverUri), iosOpts.AppiumOptions); - - VerifyAppDriver(app, iosOpts); + app = StartIOSApp(iosOpts); break; - } - default: VerifyAppDriver(null, opts); break; @@ -232,7 +144,7 @@ public static WebDriver StartApp( } App = app; - StartedApps.Add(app); + s_startedApps.Add(app); return app; } @@ -260,7 +172,7 @@ public static void StopApp(bool stopServer = true) public static void StopApp(WebDriver app, bool stopServer = false) { app?.Quit(); - StartedApps.Remove(app); + s_startedApps.Remove(app); if (!stopServer) { @@ -276,8 +188,101 @@ public static void StopApp(WebDriver app, bool stopServer = false) /// public static void StopApps() { - StartedApps.ForEach(driver => driver?.Quit()); - StartedApps.Clear(); + s_startedApps.ForEach(driver => driver?.Quit()); + s_startedApps.Clear(); + } + + + private static WebDriver StartIOSApp(IOSAppManagerOptions iosOpts) + { + if (iosOpts.LaunchAppiumServer) + { + AppiumServerHelper.Run(); + } + + var app = new IOSDriver(new Uri(iosOpts.DriverUri), iosOpts.AppiumOptions); + + VerifyAppDriver(app, iosOpts); + return app; + } + + private static WebDriver StartAndroidApp(AndroidAppManagerOptions androidOpts) + { + if (androidOpts.LaunchAppiumServer) + { + AppiumServerHelper.Run(); + } + + var app = new AndroidDriver( + new Uri(androidOpts.DriverUri), + androidOpts.AppiumOptions); + + VerifyAppDriver(app, androidOpts); + return app; + } + + private static WebDriver StartWindowsApp(WindowsAppManagerOptions winOpts) + { + if (winOpts.LaunchWinAppDriver) + { + WinAppDriverHelper.Run(); + } + + var app = new WindowsDriver( + new Uri(winOpts.DriverUri), + winOpts.AppiumOptions); + + VerifyAppDriver(app, winOpts); + + if (winOpts.Maximize) + { + app.Manage().Window.Maximize(); + } + + return app; + } + + private static WebDriver StartWebApp(WebAppManagerOptions webOpts) + { + WebDriver app = webOpts.DriverType switch + { + WebAppDriverType.Chrome => new ChromeDriver( + webOpts.DriverUri, + webOpts.DriverOptions as ChromeOptions ?? new ChromeOptions()), + WebAppDriverType.Firefox => new FirefoxDriver( + webOpts.DriverUri, + webOpts.DriverOptions as FirefoxOptions ?? new FirefoxOptions()), + WebAppDriverType.Opera => new ChromeDriver( + webOpts.DriverUri, + webOpts.DriverOptions as OperaChromiumOptions ?? new OperaChromiumOptions()), + WebAppDriverType.Safari => new SafariDriver( + webOpts.DriverUri, + webOpts.DriverOptions as SafariOptions ?? new SafariOptions()), + WebAppDriverType.Edge => new EdgeDriver( + webOpts.DriverUri, + webOpts.DriverOptions as EdgeOptions ?? new EdgeOptions()), + WebAppDriverType.InternetExplorer => new InternetExplorerDriver( + webOpts.DriverUri, + webOpts.DriverOptions as InternetExplorerOptions ?? new InternetExplorerOptions()), + WebAppDriverType.EdgeChromium => new EdgeDriver( + webOpts.DriverUri, + webOpts.DriverOptions as EdgeOptions ?? new EdgeOptions()), + _ => null + }; + + VerifyAppDriver(app, webOpts); + + if (webOpts.Maximize) + { + app!.Manage().Window.Maximize(); + } + else + { + app!.Manage().Window.Size = webOpts.DesiredSize; + } + + app.Url = webOpts.Url; + return app; } /// Thrown when the driver could not be verified. @@ -288,7 +293,7 @@ private static void VerifyAppDriver(WebDriver app, AppManagerOptions opts) throw new DriverLoadFailedException(opts); } - // Set implicit timeout to 2 seconds to make element search to retry every 500 ms for at most three times. + // Set implicit timeout to make element search retry every x ms. app.Manage().Timeouts().ImplicitWait = opts.ImplicitWait; } } diff --git a/src/Legerity.Core/AppManagerOptions.cs b/src/Legerity.Core/AppManagerOptions.cs index 34a7a69c..41c34d74 100644 --- a/src/Legerity.Core/AppManagerOptions.cs +++ b/src/Legerity.Core/AppManagerOptions.cs @@ -34,4 +34,4 @@ public override string ToString() { return $"Driver URI [{DriverUri}]"; } -} \ No newline at end of file +} diff --git a/src/Legerity.Core/AppiumManagerOptions.cs b/src/Legerity.Core/AppiumManagerOptions.cs index 0cfda922..2f822215 100644 --- a/src/Legerity.Core/AppiumManagerOptions.cs +++ b/src/Legerity.Core/AppiumManagerOptions.cs @@ -1,7 +1,5 @@ namespace Legerity; -using OpenQA.Selenium.Appium; - /// /// Defines a base model that represents Appium specific configuration options for the . /// @@ -37,7 +35,7 @@ public virtual void Configure() return; } - foreach ((var capabilityName, var capabilityValue) in AdditionalOptions) + foreach (var (capabilityName, capabilityValue) in AdditionalOptions) { AppiumOptions.AddAdditionalAppiumOption(capabilityName, capabilityValue); } diff --git a/src/Legerity.Core/ByAll.cs b/src/Legerity.Core/ByAll.cs index 10bb520f..5c403e23 100644 --- a/src/Legerity.Core/ByAll.cs +++ b/src/Legerity.Core/ByAll.cs @@ -18,7 +18,7 @@ namespace Legerity; /// public class ByAll : By { - private readonly By[] locators; + private readonly By[] _locators; /// /// Initializes a new instance of the class. @@ -26,7 +26,7 @@ public class ByAll : By /// The locators to find all references of. public ByAll(params By[] locators) { - this.locators = locators; + _locators = locators; } /// Finds the first element matching the criteria. @@ -50,13 +50,13 @@ public override IWebElement FindElement(ISearchContext context) /// matching the current criteria, or an empty list if nothing matches. public override ReadOnlyCollection FindElements(ISearchContext context) { - if (locators.Length == 0) + if (_locators.Length == 0) { return new List().AsReadOnly(); } IEnumerable elements = null; - foreach (var locator in locators) + foreach (var locator in _locators) { var foundElements = locator.FindElements(context); if (foundElements.Count == 0) diff --git a/src/Legerity.Core/ByExtras.cs b/src/Legerity.Core/ByExtras.cs index aaa46601..17e84b5b 100644 --- a/src/Legerity.Core/ByExtras.cs +++ b/src/Legerity.Core/ByExtras.cs @@ -24,4 +24,4 @@ public static By PartialText(string text) { return By.XPath($".//*[contains(text(),'{text}')]"); } -} \ No newline at end of file +} diff --git a/src/Legerity.Core/ByNested.cs b/src/Legerity.Core/ByNested.cs index cf152774..34eeb6f4 100644 --- a/src/Legerity.Core/ByNested.cs +++ b/src/Legerity.Core/ByNested.cs @@ -15,7 +15,7 @@ namespace Legerity; /// public class ByNested : By { - private readonly By[] locators; + private readonly By[] _locators; /// /// Initializes a new instance of the class. @@ -23,7 +23,7 @@ public class ByNested : By /// The locators in nesting sequence to find references of. public ByNested(params By[] locators) { - this.locators = locators; + _locators = locators; } /// Finds the first element matching the criteria. @@ -47,13 +47,13 @@ public override IWebElement FindElement(ISearchContext context) /// matching the current criteria, or an empty list if nothing matches. public override ReadOnlyCollection FindElements(ISearchContext context) { - if (locators.Length == 0) + if (_locators.Length == 0) { return new List().AsReadOnly(); } IEnumerable elements = null; - foreach (var locator in locators) + foreach (var locator in _locators) { var nestedElements = new List(); diff --git a/src/Legerity.Core/ElementWrapper{TElement}.cs b/src/Legerity.Core/ElementWrapper{TElement}.cs index d03cbd6a..f65d3f80 100644 --- a/src/Legerity.Core/ElementWrapper{TElement}.cs +++ b/src/Legerity.Core/ElementWrapper{TElement}.cs @@ -1,9 +1,7 @@ namespace Legerity; using System; - using Exceptions; -using OpenQA.Selenium.Support.UI; /// /// Defines a base wrapper for elements to expose platform element logic. @@ -14,7 +12,7 @@ namespace Legerity; public abstract class ElementWrapper : IElementWrapper where TElement : WebElement { - private readonly WeakReference elementReference; + private readonly WeakReference _elementReference; /// /// Initializes a new instance of the class. @@ -24,13 +22,13 @@ public abstract class ElementWrapper : IElementWrapper /// protected ElementWrapper(TElement element) { - elementReference = new WeakReference(element); + _elementReference = new WeakReference(element); } /// Gets the original reference object. public TElement Element => - elementReference is { IsAlive: true } - ? elementReference.Target as TElement + _elementReference is { IsAlive: true } + ? _elementReference.Target as TElement : null; /// diff --git a/src/Legerity.Core/Exceptions/AppiumServerLoadFailedException.cs b/src/Legerity.Core/Exceptions/AppiumServerLoadFailedException.cs index 2b561b1b..0f5a599d 100644 --- a/src/Legerity.Core/Exceptions/AppiumServerLoadFailedException.cs +++ b/src/Legerity.Core/Exceptions/AppiumServerLoadFailedException.cs @@ -15,4 +15,4 @@ internal AppiumServerLoadFailedException(Exception innerException) : base("The Appium server could not be loaded", innerException) { } -} \ No newline at end of file +} diff --git a/src/Legerity.Core/Exceptions/DriverLoadFailedException.cs b/src/Legerity.Core/Exceptions/DriverLoadFailedException.cs index 1ecc57a4..0bf03c8a 100644 --- a/src/Legerity.Core/Exceptions/DriverLoadFailedException.cs +++ b/src/Legerity.Core/Exceptions/DriverLoadFailedException.cs @@ -26,7 +26,8 @@ internal DriverLoadFailedException(AppManagerOptions opts) /// /// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. internal DriverLoadFailedException(AppManagerOptions opts, Exception innerException) - : base($"The application driver could not be initialized with the specified app manager options: {opts}", innerException) + : base($"The application driver could not be initialized with the specified app manager options: {opts}", + innerException) { AppManagerOptions = opts; } @@ -35,4 +36,4 @@ internal DriverLoadFailedException(AppManagerOptions opts, Exception innerExcept /// Gets the app manager options used to initialize the driver. /// internal AppManagerOptions AppManagerOptions { get; } -} \ No newline at end of file +} diff --git a/src/Legerity.Core/Exceptions/DriverNotInitializedException.cs b/src/Legerity.Core/Exceptions/DriverNotInitializedException.cs index 338c8859..7da17d45 100644 --- a/src/Legerity.Core/Exceptions/DriverNotInitializedException.cs +++ b/src/Legerity.Core/Exceptions/DriverNotInitializedException.cs @@ -13,4 +13,4 @@ internal DriverNotInitializedException(string message) : base(message) { } -} \ No newline at end of file +} diff --git a/src/Legerity.Core/Exceptions/ElementNotShownException.cs b/src/Legerity.Core/Exceptions/ElementNotShownException.cs index 3f626048..923a5a5d 100644 --- a/src/Legerity.Core/Exceptions/ElementNotShownException.cs +++ b/src/Legerity.Core/Exceptions/ElementNotShownException.cs @@ -35,4 +35,4 @@ public ElementNotShownException(string locator, Exception innerException) /// Gets the locator used to locate the element. /// public string Locator { get; } -} \ No newline at end of file +} diff --git a/src/Legerity.Core/Exceptions/ElementShownException.cs b/src/Legerity.Core/Exceptions/ElementShownException.cs index 2e0ab000..f7cbaee2 100644 --- a/src/Legerity.Core/Exceptions/ElementShownException.cs +++ b/src/Legerity.Core/Exceptions/ElementShownException.cs @@ -35,4 +35,4 @@ public ElementShownException(string locator, Exception innerException) /// Gets the locator used to locate the element. /// public string Locator { get; } -} \ No newline at end of file +} diff --git a/src/Legerity.Core/Exceptions/ElementsNotShownException.cs b/src/Legerity.Core/Exceptions/ElementsNotShownException.cs index 0cd5d806..5f8057f7 100644 --- a/src/Legerity.Core/Exceptions/ElementsNotShownException.cs +++ b/src/Legerity.Core/Exceptions/ElementsNotShownException.cs @@ -35,4 +35,4 @@ public ElementsNotShownException(string locator, Exception innerException) /// Gets the locator used to locate the elements. /// public string Locator { get; } -} \ No newline at end of file +} diff --git a/src/Legerity.Core/Exceptions/LegerityException.cs b/src/Legerity.Core/Exceptions/LegerityException.cs index 34b4fa6a..1a924981 100644 --- a/src/Legerity.Core/Exceptions/LegerityException.cs +++ b/src/Legerity.Core/Exceptions/LegerityException.cs @@ -31,4 +31,4 @@ internal LegerityException(string message, Exception innerException) : base(message, innerException) { } -} \ No newline at end of file +} diff --git a/src/Legerity.Core/Exceptions/PageNotShownException.cs b/src/Legerity.Core/Exceptions/PageNotShownException.cs index 1e999081..d9eda188 100644 --- a/src/Legerity.Core/Exceptions/PageNotShownException.cs +++ b/src/Legerity.Core/Exceptions/PageNotShownException.cs @@ -21,4 +21,4 @@ internal PageNotShownException(string pageName) /// Gets the name of the page that was not shown. /// public string PageName { get; } -} \ No newline at end of file +} diff --git a/src/Legerity.Core/Extensions/AttributeExtensions.cs b/src/Legerity.Core/Extensions/AttributeExtensions.cs index c7df02fa..b2f33de9 100644 --- a/src/Legerity.Core/Extensions/AttributeExtensions.cs +++ b/src/Legerity.Core/Extensions/AttributeExtensions.cs @@ -30,4 +30,4 @@ public static string GetName(this IElementWrapper element) { return GetName(element.Element); } -} \ No newline at end of file +} diff --git a/src/Legerity.Core/Extensions/DriverExtensions.cs b/src/Legerity.Core/Extensions/DriverExtensions.cs index 395bc121..1eab2294 100644 --- a/src/Legerity.Core/Extensions/DriverExtensions.cs +++ b/src/Legerity.Core/Extensions/DriverExtensions.cs @@ -3,7 +3,6 @@ namespace Legerity.Extensions; using System; using System.Collections.ObjectModel; using System.Linq; -using OpenQA.Selenium.Support.UI; /// /// Defines a collection of extensions for a driver. @@ -181,4 +180,4 @@ public static WebElement FindElementByName(this WebDriver driver, string name) { return driver.FindElement(By.Name(name)) as WebElement; } -} \ No newline at end of file +} diff --git a/src/Legerity.Core/Extensions/ElementExtensions.cs b/src/Legerity.Core/Extensions/ElementExtensions.cs index a9ef406d..663e4e1c 100644 --- a/src/Legerity.Core/Extensions/ElementExtensions.cs +++ b/src/Legerity.Core/Extensions/ElementExtensions.cs @@ -4,7 +4,6 @@ namespace Legerity.Extensions; using System.Collections.ObjectModel; using System.Drawing; using System.Linq; -using OpenQA.Selenium.Support.UI; /// /// Defines a collection of extensions for elements. diff --git a/src/Legerity.Core/Extensions/ElementWrapperExtensions.cs b/src/Legerity.Core/Extensions/ElementWrapperExtensions.cs index 2ed6664b..5ad9cb94 100644 --- a/src/Legerity.Core/Extensions/ElementWrapperExtensions.cs +++ b/src/Legerity.Core/Extensions/ElementWrapperExtensions.cs @@ -3,7 +3,6 @@ namespace Legerity.Extensions; using System; using System.Collections.ObjectModel; using System.Drawing; -using OpenQA.Selenium.Support.UI; /// /// Defines a collection of extensions for objects. @@ -214,4 +213,4 @@ public static TResult WaitUntil( return WaitUntil(element, condition, timeout, retries - 1); } } -} \ No newline at end of file +} diff --git a/src/Legerity.Core/Extensions/InteractionExtensions.cs b/src/Legerity.Core/Extensions/InteractionExtensions.cs index 627964ef..0dbb0c3e 100644 --- a/src/Legerity.Core/Extensions/InteractionExtensions.cs +++ b/src/Legerity.Core/Extensions/InteractionExtensions.cs @@ -1,7 +1,5 @@ namespace Legerity.Extensions; -using OpenQA.Selenium.Interactions; - /// /// Defines a collection of extensions for performing interactions with elements. /// @@ -81,4 +79,4 @@ public static void ScrollTo(this IElementWrapper element) { ScrollTo(element.Element as WebElement); } -} \ No newline at end of file +} diff --git a/src/Legerity.Core/Extensions/StringExtensions.cs b/src/Legerity.Core/Extensions/StringExtensions.cs index 3f969f86..3d9f3db1 100644 --- a/src/Legerity.Core/Extensions/StringExtensions.cs +++ b/src/Legerity.Core/Extensions/StringExtensions.cs @@ -49,4 +49,4 @@ public static string RemoveUnicodeCharacters(this string value) { return value == null ? null : new string(value.Where(c => c < 128).ToArray()); } -} \ No newline at end of file +} diff --git a/src/Legerity.Core/GlobalUsings.cs b/src/Legerity.Core/GlobalUsings.cs index 62ca2f56..68467a92 100644 --- a/src/Legerity.Core/GlobalUsings.cs +++ b/src/Legerity.Core/GlobalUsings.cs @@ -1,4 +1,16 @@ // Global using directives global using OpenQA.Selenium; -global using OpenQA.Selenium.Remote; +global using OpenQA.Selenium.Appium; +global using OpenQA.Selenium.Appium.Android; +global using OpenQA.Selenium.Appium.Enums; +global using OpenQA.Selenium.Appium.iOS; +global using OpenQA.Selenium.Appium.Service; +global using OpenQA.Selenium.Appium.Windows; +global using OpenQA.Selenium.Chrome; +global using OpenQA.Selenium.Edge; +global using OpenQA.Selenium.Firefox; +global using OpenQA.Selenium.IE; +global using OpenQA.Selenium.Interactions; +global using OpenQA.Selenium.Safari; +global using OpenQA.Selenium.Support.UI; diff --git a/src/Legerity.Core/Helpers/AppiumServerHelper.cs b/src/Legerity.Core/Helpers/AppiumServerHelper.cs index b6c7e24e..3dc52a10 100644 --- a/src/Legerity.Core/Helpers/AppiumServerHelper.cs +++ b/src/Legerity.Core/Helpers/AppiumServerHelper.cs @@ -2,7 +2,6 @@ namespace Legerity.Helpers; using System; using Exceptions; -using OpenQA.Selenium.Appium.Service; /// /// Defines a helper class for launching a local Appium server. diff --git a/src/Legerity.Core/IElementWrapper{TElement}.cs b/src/Legerity.Core/IElementWrapper{TElement}.cs index 9d8debb3..72415a17 100644 --- a/src/Legerity.Core/IElementWrapper{TElement}.cs +++ b/src/Legerity.Core/IElementWrapper{TElement}.cs @@ -8,7 +8,7 @@ namespace Legerity; /// /// The type of . /// -public interface IElementWrapper +public interface IElementWrapper where TElement : IWebElement { /// Gets the original reference object. @@ -84,4 +84,4 @@ public interface IElementWrapper /// The amount of time the driver should wait when searching for the if it is not immediately present. /// void VerifyElementsShown(By locator, TimeSpan? timeout); -} \ No newline at end of file +} diff --git a/src/Legerity.Core/IOS/IOSAppManagerOptions.cs b/src/Legerity.Core/IOS/IOSAppManagerOptions.cs index 7d257c87..6a49aedc 100644 --- a/src/Legerity.Core/IOS/IOSAppManagerOptions.cs +++ b/src/Legerity.Core/IOS/IOSAppManagerOptions.cs @@ -1,8 +1,6 @@ namespace Legerity.IOS; using System.Collections.Generic; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Enums; /// /// Defines a specific for an iOS application. @@ -156,7 +154,7 @@ private string GetOptionDetails() if (AdditionalOptions != null) { - foreach ((var name, var value) in AdditionalOptions) + foreach (var (name, value) in AdditionalOptions) { options.Add($"{name} [{value}]"); } diff --git a/src/Legerity.Core/LegerityTestClass.cs b/src/Legerity.Core/LegerityTestClass.cs index 553adfcd..22636205 100644 --- a/src/Legerity.Core/LegerityTestClass.cs +++ b/src/Legerity.Core/LegerityTestClass.cs @@ -5,9 +5,6 @@ namespace Legerity; using Android; using Exceptions; using IOS; -using OpenQA.Selenium.Appium.Android; -using OpenQA.Selenium.Appium.iOS; -using OpenQA.Selenium.Appium.Windows; using Windows; /// diff --git a/src/Legerity.Core/Pages/BasePage.cs b/src/Legerity.Core/Pages/BasePage.cs index f290fcd5..fbb683f5 100644 --- a/src/Legerity.Core/Pages/BasePage.cs +++ b/src/Legerity.Core/Pages/BasePage.cs @@ -2,13 +2,8 @@ namespace Legerity.Pages; using System; using System.Collections.ObjectModel; -using System.Linq; using Exceptions; using Extensions; -using OpenQA.Selenium.Appium.Android; -using OpenQA.Selenium.Appium.iOS; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Support.UI; /// /// Defines a base page for creating tests following the page object pattern. diff --git a/src/Legerity.Core/Web/OperaChromiumOptions.cs b/src/Legerity.Core/Web/OperaChromiumOptions.cs new file mode 100644 index 00000000..0bdcb13f --- /dev/null +++ b/src/Legerity.Core/Web/OperaChromiumOptions.cs @@ -0,0 +1,48 @@ +using System; +using System.Runtime.InteropServices; + +namespace Legerity.Web; + +public class OperaChromiumOptions : ChromeOptions +{ + public OperaChromiumOptions(string binaryLocation = default) + { + BinaryLocation = DetermineBinaryLocation(binaryLocation); + } + + /// + public sealed override string BinaryLocation + { + get => base.BinaryLocation; + set => base.BinaryLocation = value; + } + + private string DetermineBinaryLocation(string binaryLocation) + { + if (!string.IsNullOrWhiteSpace(binaryLocation)) + { + return binaryLocation; + } + + var isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); + if (isWindows) + { + var userPath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); + return $@"{userPath}\AppData\Local\Programs\Opera\opera.exe"; + } + + var isLinux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux); + if (isLinux) + { + return "/usr/bin/opera"; + } + + var isMac = RuntimeInformation.IsOSPlatform(OSPlatform.OSX); + if (isMac) + { + return "/Applications/Opera.app/Contents/MacOS/Opera"; + } + + throw new PlatformNotSupportedException("The current operating system is not supported."); + } +} diff --git a/src/Legerity.Core/Web/WebAppDriverType.cs b/src/Legerity.Core/Web/WebAppDriverType.cs index a02240d5..8ac448ca 100644 --- a/src/Legerity.Core/Web/WebAppDriverType.cs +++ b/src/Legerity.Core/Web/WebAppDriverType.cs @@ -47,4 +47,4 @@ public enum WebAppDriverType /// [Obsolete("Use Edge instead. This will be removed in a future release.")] EdgeChromium, -} \ No newline at end of file +} diff --git a/src/Legerity.Core/Web/WebAppManagerOptions.cs b/src/Legerity.Core/Web/WebAppManagerOptions.cs index 21ed6ab6..f46e8899 100644 --- a/src/Legerity.Core/Web/WebAppManagerOptions.cs +++ b/src/Legerity.Core/Web/WebAppManagerOptions.cs @@ -70,4 +70,4 @@ private string GetOptionDetails() return string.Join(", ", options); } -} \ No newline at end of file +} diff --git a/src/Legerity.Core/Windows/Exceptions/WinAppDriverLoadFailedException.cs b/src/Legerity.Core/Windows/Exceptions/WinAppDriverLoadFailedException.cs index 0e60812a..c300b98b 100644 --- a/src/Legerity.Core/Windows/Exceptions/WinAppDriverLoadFailedException.cs +++ b/src/Legerity.Core/Windows/Exceptions/WinAppDriverLoadFailedException.cs @@ -22,4 +22,4 @@ internal WinAppDriverLoadFailedException(string path, Exception exception) /// Gets or sets the path where the WinAppDriver should have loaded from. /// public string Path { get; set; } -} \ No newline at end of file +} diff --git a/src/Legerity.Core/Windows/Exceptions/WinAppDriverNotFoundException.cs b/src/Legerity.Core/Windows/Exceptions/WinAppDriverNotFoundException.cs index 233e0104..b3e35e32 100644 --- a/src/Legerity.Core/Windows/Exceptions/WinAppDriverNotFoundException.cs +++ b/src/Legerity.Core/Windows/Exceptions/WinAppDriverNotFoundException.cs @@ -19,4 +19,4 @@ internal WinAppDriverNotFoundException(string path) /// Gets or sets the path where the WinAppDriver should be located. /// public string Path { get; set; } -} \ No newline at end of file +} diff --git a/src/Legerity.Core/Windows/WindowsAppManagerOptions.cs b/src/Legerity.Core/Windows/WindowsAppManagerOptions.cs index 6af8ae35..b7cad376 100644 --- a/src/Legerity.Core/Windows/WindowsAppManagerOptions.cs +++ b/src/Legerity.Core/Windows/WindowsAppManagerOptions.cs @@ -2,7 +2,6 @@ namespace Legerity.Windows; using System.Collections.Generic; using Helpers; -using OpenQA.Selenium.Appium; /// /// Defines a specific for a Windows application. @@ -102,12 +101,14 @@ private string GetOptionDetails() options.Add($"App ID [{AppId}]"); } - if (AdditionalOptions != null) + if (AdditionalOptions == null) { - foreach ((var name, var value) in AdditionalOptions) - { - options.Add($"{name} [{value}]"); - } + return string.Join(", ", options); + } + + foreach (var (name, value) in AdditionalOptions) + { + options.Add($"{name} [{value}]"); } return string.Join(", ", options); diff --git a/src/Legerity.IOS/Elements/Core/Slider.cs b/src/Legerity.IOS/Elements/Core/Slider.cs index 76c201fa..83efd9af 100644 --- a/src/Legerity.IOS/Elements/Core/Slider.cs +++ b/src/Legerity.IOS/Elements/Core/Slider.cs @@ -43,7 +43,7 @@ public static implicit operator Slider(WebElement element) { return new Slider(element); } - + /// /// Sets the value of the slider. /// diff --git a/src/Legerity.IOS/Elements/Core/Switch.cs b/src/Legerity.IOS/Elements/Core/Switch.cs index 8a33758f..22ad10d1 100644 --- a/src/Legerity.IOS/Elements/Core/Switch.cs +++ b/src/Legerity.IOS/Elements/Core/Switch.cs @@ -39,7 +39,7 @@ public static implicit operator Switch(WebElement element) { return new Switch(element); } - + /// /// Toggles the switch on. /// diff --git a/src/Legerity.IOS/Elements/Core/TextField.cs b/src/Legerity.IOS/Elements/Core/TextField.cs index 3cdf3237..a57777ef 100644 --- a/src/Legerity.IOS/Elements/Core/TextField.cs +++ b/src/Legerity.IOS/Elements/Core/TextField.cs @@ -42,7 +42,7 @@ public static implicit operator TextField(WebElement element) { return new TextField(element); } - + /// /// Sets the text of the text field to the specified text. /// diff --git a/src/Legerity.IOS/Elements/IOSElementWrapper.cs b/src/Legerity.IOS/Elements/IOSElementWrapper.cs index d1d5e556..a4e1915b 100644 --- a/src/Legerity.IOS/Elements/IOSElementWrapper.cs +++ b/src/Legerity.IOS/Elements/IOSElementWrapper.cs @@ -1,9 +1,7 @@ namespace Legerity.IOS.Elements; using System; - using Exceptions; -using OpenQA.Selenium.Support.UI; /// /// Defines an element wrapper for an iOS . diff --git a/src/Legerity.IOS/Extensions/AttributeExtensions.cs b/src/Legerity.IOS/Extensions/AttributeExtensions.cs index f4edd9a3..18ab3c8c 100644 --- a/src/Legerity.IOS/Extensions/AttributeExtensions.cs +++ b/src/Legerity.IOS/Extensions/AttributeExtensions.cs @@ -56,4 +56,4 @@ public static string GetValue(this IElementWrapper element) { return GetValue(element.Element); } -} \ No newline at end of file +} diff --git a/src/Legerity.IOS/Extensions/IOSElementWrapperExtensions.cs b/src/Legerity.IOS/Extensions/IOSElementWrapperExtensions.cs index 5d8cb7bd..a8b32a42 100644 --- a/src/Legerity.IOS/Extensions/IOSElementWrapperExtensions.cs +++ b/src/Legerity.IOS/Extensions/IOSElementWrapperExtensions.cs @@ -2,7 +2,6 @@ namespace Legerity.IOS.Extensions; using System; using Elements; -using OpenQA.Selenium.Support.UI; /// /// Defines a collection of extensions for objects. diff --git a/src/Legerity.IOS/Extensions/LegerityTestClassExtensions.cs b/src/Legerity.IOS/Extensions/LegerityTestClassExtensions.cs index 51300c4c..e6756177 100644 --- a/src/Legerity.IOS/Extensions/LegerityTestClassExtensions.cs +++ b/src/Legerity.IOS/Extensions/LegerityTestClassExtensions.cs @@ -75,4 +75,4 @@ public static IOSDriver StartIOSApp( return testClass.StartApp(options, waitUntil, waitUntilTimeout, waitUntilRetries) as IOSDriver; } -} \ No newline at end of file +} diff --git a/src/Legerity.IOS/GlobalUsings.cs b/src/Legerity.IOS/GlobalUsings.cs index 63d1b021..80fc043d 100644 --- a/src/Legerity.IOS/GlobalUsings.cs +++ b/src/Legerity.IOS/GlobalUsings.cs @@ -1,6 +1,5 @@ // Global using directives global using OpenQA.Selenium; -global using OpenQA.Selenium.Appium; global using OpenQA.Selenium.Appium.iOS; -global using OpenQA.Selenium.Remote; +global using OpenQA.Selenium.Support.UI; diff --git a/src/Legerity.IOS/IOSByExtras.cs b/src/Legerity.IOS/IOSByExtras.cs index 34c94c04..a6eb4f7a 100644 --- a/src/Legerity.IOS/IOSByExtras.cs +++ b/src/Legerity.IOS/IOSByExtras.cs @@ -44,4 +44,4 @@ public static By PartialValue(string value) { return By.XPath($".//*[contains(@value,'{value}')]"); } -} \ No newline at end of file +} diff --git a/src/Legerity.MADE/GlobalUsings.cs b/src/Legerity.MADE/GlobalUsings.cs index d33e0522..cb00424d 100644 --- a/src/Legerity.MADE/GlobalUsings.cs +++ b/src/Legerity.MADE/GlobalUsings.cs @@ -1,6 +1,3 @@ // Global using directives global using OpenQA.Selenium; -global using OpenQA.Selenium.Appium; -global using OpenQA.Selenium.Appium.Windows; -global using OpenQA.Selenium.Remote; diff --git a/src/Legerity.Telerik.Uwp/GlobalUsings.cs b/src/Legerity.Telerik.Uwp/GlobalUsings.cs index d33e0522..cb00424d 100644 --- a/src/Legerity.Telerik.Uwp/GlobalUsings.cs +++ b/src/Legerity.Telerik.Uwp/GlobalUsings.cs @@ -1,6 +1,3 @@ // Global using directives global using OpenQA.Selenium; -global using OpenQA.Selenium.Appium; -global using OpenQA.Selenium.Appium.Windows; -global using OpenQA.Selenium.Remote; diff --git a/src/Legerity.Telerik.Uwp/RadAutoCompleteBox.cs b/src/Legerity.Telerik.Uwp/RadAutoCompleteBox.cs index 01dac6e3..cceaa5e3 100644 --- a/src/Legerity.Telerik.Uwp/RadAutoCompleteBox.cs +++ b/src/Legerity.Telerik.Uwp/RadAutoCompleteBox.cs @@ -9,7 +9,7 @@ namespace Legerity.Windows.Elements.Telerik; /// public class RadAutoCompleteBox : WindowsElementWrapper { - private readonly By suggestionsControlLocator = WindowsByExtras.AutomationId("PART_SuggestionsControl"); + private readonly By _suggestionsControlLocator = WindowsByExtras.AutomationId("PART_SuggestionsControl"); /// /// Initializes a new instance of the class. @@ -78,9 +78,9 @@ public virtual void SelectSuggestion(string value, string suggestion) { SetText(value); - VerifyElementShown(suggestionsControlLocator, TimeSpan.FromSeconds(2)); + VerifyElementShown(_suggestionsControlLocator, TimeSpan.FromSeconds(2)); - ListBox suggestionList = FindElement(suggestionsControlLocator); + ListBox suggestionList = FindElement(_suggestionsControlLocator); suggestionList.ClickItem(suggestion); } @@ -99,9 +99,9 @@ public virtual void SelectSuggestionByPartialSuggestion(string value, string par { SetText(value); - VerifyElementShown(suggestionsControlLocator, TimeSpan.FromSeconds(2)); + VerifyElementShown(_suggestionsControlLocator, TimeSpan.FromSeconds(2)); - ListBox suggestionList = FindElement(suggestionsControlLocator); + ListBox suggestionList = FindElement(_suggestionsControlLocator); suggestionList.ClickItemByPartialName(partialSuggestion); } diff --git a/src/Legerity.Telerik.Uwp/RadBusyIndicator.cs b/src/Legerity.Telerik.Uwp/RadBusyIndicator.cs index 5c5074eb..8ba833ae 100644 --- a/src/Legerity.Telerik.Uwp/RadBusyIndicator.cs +++ b/src/Legerity.Telerik.Uwp/RadBusyIndicator.cs @@ -37,4 +37,4 @@ public static implicit operator RadBusyIndicator(WebElement element) { return new RadBusyIndicator(element); } -} \ No newline at end of file +} diff --git a/src/Legerity.WCT/BladeViewItem.cs b/src/Legerity.WCT/BladeViewItem.cs index 81c0d832..2ce8003f 100644 --- a/src/Legerity.WCT/BladeViewItem.cs +++ b/src/Legerity.WCT/BladeViewItem.cs @@ -8,7 +8,7 @@ namespace Legerity.Windows.Elements.WCT; /// public class BladeViewItem : WindowsElementWrapper { - private readonly WeakReference parentBladeViewReference; + private readonly WeakReference _parentBladeViewReference; /// /// Initializes a new instance of the class. @@ -37,14 +37,14 @@ public BladeViewItem( { if (parentBladeView != null) { - parentBladeViewReference = new WeakReference(parentBladeView); + _parentBladeViewReference = new WeakReference(parentBladeView); } } /// Gets the original parent reference object. public BladeView ParentMenuBar => - parentBladeViewReference is { IsAlive: true } - ? parentBladeViewReference.Target as BladeView + _parentBladeViewReference is { IsAlive: true } + ? _parentBladeViewReference.Target as BladeView : null; /// diff --git a/src/Legerity.WCT/Carousel.cs b/src/Legerity.WCT/Carousel.cs index e04bffdd..86d6c63a 100644 --- a/src/Legerity.WCT/Carousel.cs +++ b/src/Legerity.WCT/Carousel.cs @@ -12,7 +12,7 @@ namespace Legerity.Windows.Elements.WCT; /// public class Carousel : WindowsElementWrapper { - private readonly By carouselItemLocator = By.ClassName("CarouselItem"); + private readonly By _carouselItemLocator = By.ClassName("CarouselItem"); /// /// Initializes a new instance of the class. @@ -29,7 +29,7 @@ public Carousel(WebElement element) /// Gets the collection of items associated with the carousel. /// public virtual ReadOnlyCollection Items => - Element.FindElements(carouselItemLocator).Cast().ToList().AsReadOnly(); + Element.FindElements(_carouselItemLocator).Cast().ToList().AsReadOnly(); /// /// Gets the element associated with the currently selected item. @@ -69,7 +69,7 @@ public static implicit operator Carousel(WebElement element) /// Thrown when an element is not visible. public virtual void SelectItem(string name) { - VerifyElementsShown(carouselItemLocator, TimeSpan.FromSeconds(2)); + VerifyElementsShown(_carouselItemLocator, TimeSpan.FromSeconds(2)); var index = Items.IndexOf(Items.FirstOrDefault(element => element.VerifyNameOrAutomationIdEquals(name))); @@ -89,7 +89,7 @@ public virtual void SelectItem(string name) /// Thrown when an element is not visible. public virtual void SelectItemByPartialName(string partialName) { - VerifyElementsShown(carouselItemLocator, TimeSpan.FromSeconds(2)); + VerifyElementsShown(_carouselItemLocator, TimeSpan.FromSeconds(2)); var index = Items.IndexOf(Items.FirstOrDefault(element => element.VerifyNameOrAutomationIdContains(partialName))); @@ -110,7 +110,7 @@ public virtual void SelectItemByPartialName(string partialName) /// Thrown when an element is not visible. public virtual void SelectItem(int index) { - VerifyElementsShown(carouselItemLocator, TimeSpan.FromSeconds(2)); + VerifyElementsShown(_carouselItemLocator, TimeSpan.FromSeconds(2)); if (index > Items.Count - 1) { diff --git a/src/Legerity.WCT/GlobalUsings.cs b/src/Legerity.WCT/GlobalUsings.cs index d33e0522..cb00424d 100644 --- a/src/Legerity.WCT/GlobalUsings.cs +++ b/src/Legerity.WCT/GlobalUsings.cs @@ -1,6 +1,3 @@ // Global using directives global using OpenQA.Selenium; -global using OpenQA.Selenium.Appium; -global using OpenQA.Selenium.Appium.Windows; -global using OpenQA.Selenium.Remote; diff --git a/src/Legerity.Web.Authentication/GlobalUsings.cs b/src/Legerity.Web.Authentication/GlobalUsings.cs index 62ca2f56..cb00424d 100644 --- a/src/Legerity.Web.Authentication/GlobalUsings.cs +++ b/src/Legerity.Web.Authentication/GlobalUsings.cs @@ -1,4 +1,3 @@ // Global using directives global using OpenQA.Selenium; -global using OpenQA.Selenium.Remote; diff --git a/src/Legerity.Web.Authentication/Pages/AzureAdLoginPage.cs b/src/Legerity.Web.Authentication/Pages/AzureAdLoginPage.cs index fbaff70f..89b5672c 100644 --- a/src/Legerity.Web.Authentication/Pages/AzureAdLoginPage.cs +++ b/src/Legerity.Web.Authentication/Pages/AzureAdLoginPage.cs @@ -112,7 +112,7 @@ public AzureAdLoginPage(WebDriver app, TimeSpan? traitTimeout) /// Thrown when an element is not visible. public AzureAdLoginPage Login(string email, string password) { - (var hasEmailInput, var _) = + var (hasEmailInput, _) = this.TryWaitUntil(page => page.EmailInput.IsVisible, WaitTimeout); if (!hasEmailInput) { @@ -126,7 +126,7 @@ public AzureAdLoginPage Login(string email, string password) SignInButton.Click(); // Check to ensure that the user is not authenticating with password-less authentication. - (var isNotPasswordLogin, var _) = + var (isNotPasswordLogin, _) = this.TryWaitUntil(page => page.UsePasswordButton.IsVisible, WaitTimeout); if (isNotPasswordLogin) { diff --git a/src/Legerity.Web.Authentication/Pages/FacebookLoginPage.cs b/src/Legerity.Web.Authentication/Pages/FacebookLoginPage.cs index 573650b0..3f9d24e4 100644 --- a/src/Legerity.Web.Authentication/Pages/FacebookLoginPage.cs +++ b/src/Legerity.Web.Authentication/Pages/FacebookLoginPage.cs @@ -106,7 +106,7 @@ public FacebookLoginPage(WebDriver app, TimeSpan? traitTimeout) /// Thrown when an element is not visible. public FacebookLoginPage Login(string email, string password) { - (var hasEmailInput, var _) = + var (hasEmailInput, _) = this.TryWaitUntil(page => page.EmailInput.IsVisible, WaitTimeout); if (!hasEmailInput) { diff --git a/src/Legerity.Web.Authentication/Pages/GoogleLoginPage.cs b/src/Legerity.Web.Authentication/Pages/GoogleLoginPage.cs index 2f97842f..3bc4286e 100644 --- a/src/Legerity.Web.Authentication/Pages/GoogleLoginPage.cs +++ b/src/Legerity.Web.Authentication/Pages/GoogleLoginPage.cs @@ -112,7 +112,7 @@ public GoogleLoginPage(WebDriver app, TimeSpan? traitTimeout) /// Thrown when an element is not visible. public GoogleLoginPage Login(string email, string password) { - (var hasEmailInput, var _) = + var (hasEmailInput, _) = this.TryWaitUntil(page => page.EmailInput.IsVisible, WaitTimeout); if (!hasEmailInput) { @@ -125,7 +125,7 @@ public GoogleLoginPage Login(string email, string password) // Google login uses a 2-step process for email and password. NextButton.Click(); - (var isPasswordInputVisible, var _) = + var (isPasswordInputVisible, _) = this.TryWaitUntil(page => page.PasswordInput.IsVisible, WaitTimeout); if (!isPasswordInputVisible) { diff --git a/src/Legerity.Web/Elements/Core/DateInput.cs b/src/Legerity.Web/Elements/Core/DateInput.cs index 98c53be5..ed79f720 100644 --- a/src/Legerity.Web/Elements/Core/DateInput.cs +++ b/src/Legerity.Web/Elements/Core/DateInput.cs @@ -2,7 +2,6 @@ namespace Legerity.Web.Elements.Core; using System; using Extensions; -using OpenQA.Selenium.Support.Extensions; /// /// Defines a wrapper for the core web Input date control. diff --git a/src/Legerity.Web/Elements/Core/Form.cs b/src/Legerity.Web/Elements/Core/Form.cs index d28d4470..9d9c9377 100644 --- a/src/Legerity.Web/Elements/Core/Form.cs +++ b/src/Legerity.Web/Elements/Core/Form.cs @@ -40,4 +40,4 @@ public static implicit operator Form(WebElement element) { return new Form(element); } -} \ No newline at end of file +} diff --git a/src/Legerity.Web/Elements/Core/TextArea.cs b/src/Legerity.Web/Elements/Core/TextArea.cs index c1995bf0..52272890 100644 --- a/src/Legerity.Web/Elements/Core/TextArea.cs +++ b/src/Legerity.Web/Elements/Core/TextArea.cs @@ -52,4 +52,4 @@ public static implicit operator TextArea(WebElement element) { return new TextArea(element); } -} \ No newline at end of file +} diff --git a/src/Legerity.Web/Elements/WebElementWrapper.cs b/src/Legerity.Web/Elements/WebElementWrapper.cs index 885d2164..1f28ecb5 100644 --- a/src/Legerity.Web/Elements/WebElementWrapper.cs +++ b/src/Legerity.Web/Elements/WebElementWrapper.cs @@ -4,14 +4,13 @@ namespace Legerity.Web.Elements; using System.Collections.ObjectModel; using Exceptions; using Legerity.Extensions; -using OpenQA.Selenium.Support.UI; /// /// Defines an element wrapper for a . /// public class WebElementWrapper : IElementWrapper { - private readonly WeakReference elementReference; + private readonly WeakReference _elementReference; /// /// Initializes a new instance of the class. @@ -32,13 +31,13 @@ public WebElementWrapper(IWebElement element) /// public WebElementWrapper(WebElement element) { - elementReference = new WeakReference(element); + _elementReference = new WeakReference(element); } /// Gets the original reference object. public WebElement Element => - elementReference is { IsAlive: true } - ? elementReference.Target as WebElement + _elementReference is { IsAlive: true } + ? _elementReference.Target as WebElement : null; /// diff --git a/src/Legerity.Web/Extensions/AttributeExtensions.cs b/src/Legerity.Web/Extensions/AttributeExtensions.cs index 0a5340b0..a92ff3a0 100644 --- a/src/Legerity.Web/Extensions/AttributeExtensions.cs +++ b/src/Legerity.Web/Extensions/AttributeExtensions.cs @@ -186,4 +186,4 @@ public static double GetMaximum(this IElementWrapper element { return GetMaximum(element.Element); } -} \ No newline at end of file +} diff --git a/src/Legerity.Web/Extensions/IWebElementExtensions.cs b/src/Legerity.Web/Extensions/IWebElementExtensions.cs index 088f0db3..2bf52af5 100644 --- a/src/Legerity.Web/Extensions/IWebElementExtensions.cs +++ b/src/Legerity.Web/Extensions/IWebElementExtensions.cs @@ -62,4 +62,4 @@ public static bool HasClass(this IElementWrapper element, st { return HasClass(element.Element, className); } -} \ No newline at end of file +} diff --git a/src/Legerity.Web/Extensions/WebElementWrapperExtensions.cs b/src/Legerity.Web/Extensions/WebElementWrapperExtensions.cs index aac5ef54..7f07bf63 100644 --- a/src/Legerity.Web/Extensions/WebElementWrapperExtensions.cs +++ b/src/Legerity.Web/Extensions/WebElementWrapperExtensions.cs @@ -2,7 +2,6 @@ namespace Legerity.Web.Extensions; using System; using Elements; -using OpenQA.Selenium.Support.UI; /// /// Defines a collection of extensions for objects. diff --git a/src/Legerity.Web/GlobalUsings.cs b/src/Legerity.Web/GlobalUsings.cs index 62ca2f56..9bdbe875 100644 --- a/src/Legerity.Web/GlobalUsings.cs +++ b/src/Legerity.Web/GlobalUsings.cs @@ -1,4 +1,5 @@ // Global using directives global using OpenQA.Selenium; -global using OpenQA.Selenium.Remote; +global using OpenQA.Selenium.Support.Extensions; +global using OpenQA.Selenium.Support.UI; diff --git a/src/Legerity.Web/WebByExtras.cs b/src/Legerity.Web/WebByExtras.cs index f0e77abd..5964cc15 100644 --- a/src/Legerity.Web/WebByExtras.cs +++ b/src/Legerity.Web/WebByExtras.cs @@ -59,4 +59,4 @@ public static By TableDataRow() { return By.XPath("//tr[td]"); } -} \ No newline at end of file +} diff --git a/src/Legerity.WinUI/GlobalUsings.cs b/src/Legerity.WinUI/GlobalUsings.cs index d33e0522..cb00424d 100644 --- a/src/Legerity.WinUI/GlobalUsings.cs +++ b/src/Legerity.WinUI/GlobalUsings.cs @@ -1,6 +1,3 @@ // Global using directives global using OpenQA.Selenium; -global using OpenQA.Selenium.Appium; -global using OpenQA.Selenium.Appium.Windows; -global using OpenQA.Selenium.Remote; diff --git a/src/Legerity.WinUI/MenuBarItem.cs b/src/Legerity.WinUI/MenuBarItem.cs index 2bc73c37..789e3801 100644 --- a/src/Legerity.WinUI/MenuBarItem.cs +++ b/src/Legerity.WinUI/MenuBarItem.cs @@ -12,7 +12,7 @@ namespace Legerity.Windows.Elements.WinUI; /// public class MenuBarItem : WindowsElementWrapper { - private readonly WeakReference parentMenuBarReference; + private readonly WeakReference _parentMenuBarReference; /// /// Initializes a new instance of the class. @@ -41,14 +41,14 @@ public MenuBarItem( { if (parentMenuBar != null) { - parentMenuBarReference = new WeakReference(parentMenuBar); + _parentMenuBarReference = new WeakReference(parentMenuBar); } } /// Gets the original parent reference object. public virtual MenuBar ParentMenuBar => - parentMenuBarReference is { IsAlive: true } - ? parentMenuBarReference.Target as MenuBar + _parentMenuBarReference is { IsAlive: true } + ? _parentMenuBarReference.Target as MenuBar : null; /// diff --git a/src/Legerity.WinUI/NavigationView.cs b/src/Legerity.WinUI/NavigationView.cs index 03188544..79ed4725 100644 --- a/src/Legerity.WinUI/NavigationView.cs +++ b/src/Legerity.WinUI/NavigationView.cs @@ -214,6 +214,7 @@ public virtual void OpenSettings() /// The expected compact pane width when closed. /// True if the pane is open; otherwise, false. /// Thrown when no element matches the expected locator. + /// Thrown when an element is no longer valid in the document DOM. public virtual bool VerifyPaneOpen(int expectedCompactPaneWidth) { var pane = FindElement(WindowsByExtras.AutomationId("PaneRoot")); diff --git a/src/Legerity.WinUI/NavigationViewItem.cs b/src/Legerity.WinUI/NavigationViewItem.cs index db4bb8eb..427c0cb8 100644 --- a/src/Legerity.WinUI/NavigationViewItem.cs +++ b/src/Legerity.WinUI/NavigationViewItem.cs @@ -11,11 +11,11 @@ namespace Legerity.Windows.Elements.WinUI; /// public class NavigationViewItem : WindowsElementWrapper { - private readonly By navigationViewItemLocator = By.ClassName("Microsoft.UI.Xaml.Controls.NavigationViewItem"); + private readonly By _navigationViewItemLocator = By.ClassName("Microsoft.UI.Xaml.Controls.NavigationViewItem"); - private readonly WeakReference parentNavigationViewReference; + private readonly WeakReference _parentNavigationViewReference; - private readonly WeakReference parentItemReference; + private readonly WeakReference _parentItemReference; /// /// Initializes a new instance of the class. @@ -76,25 +76,25 @@ public NavigationViewItem( { if (parentNavigationView != null) { - parentNavigationViewReference = new WeakReference(parentNavigationView); + _parentNavigationViewReference = new WeakReference(parentNavigationView); } if (parentItem != null) { - parentItemReference = new WeakReference(parentItem); + _parentItemReference = new WeakReference(parentItem); } } /// Gets the original parent reference object. public NavigationView ParentNavigationView => - parentNavigationViewReference is { IsAlive: true } - ? parentNavigationViewReference.Target as NavigationView + _parentNavigationViewReference is { IsAlive: true } + ? _parentNavigationViewReference.Target as NavigationView : null; /// Gets the original parent reference object. public NavigationViewItem ParentItem => - parentItemReference is { IsAlive: true } - ? parentItemReference.Target as NavigationViewItem + _parentItemReference is { IsAlive: true } + ? _parentItemReference.Target as NavigationViewItem : null; /// @@ -178,12 +178,12 @@ private IEnumerable GetChildMenuItems() { if (ParentNavigationView == null || ParentNavigationView.IsPaneOpen) { - return Element.FindElements(navigationViewItemLocator).Select( + return Element.FindElements(_navigationViewItemLocator).Select( element => new NavigationViewItem(ParentNavigationView, this, element as WebElement)); } return Driver.FindElement(WindowsByExtras.AutomationId("ChildrenFlyout")) - .FindElements(navigationViewItemLocator).Select( + .FindElements(_navigationViewItemLocator).Select( element => new NavigationViewItem(ParentNavigationView, this, element)); } } diff --git a/src/Legerity.WinUI/TabView.cs b/src/Legerity.WinUI/TabView.cs index 29aed26a..f0745eb4 100644 --- a/src/Legerity.WinUI/TabView.cs +++ b/src/Legerity.WinUI/TabView.cs @@ -12,7 +12,7 @@ namespace Legerity.Windows.Elements.WinUI; /// public class TabView : WindowsElementWrapper { - private readonly By tabListViewLocator = WindowsByExtras.AutomationId("TabListView"); + private readonly By _tabListViewLocator = WindowsByExtras.AutomationId("TabListView"); /// /// Initializes a new instance of the class. @@ -45,7 +45,7 @@ public TabView(WebElement element) public virtual WebElement SelectedItem => TabsListView.SelectedItem; /// Thrown when no element matches the expected locator. - private ListView TabsListView => FindElement(tabListViewLocator); + private ListView TabsListView => FindElement(_tabListViewLocator); /// /// Allows conversion of a to the without direct casting. @@ -71,7 +71,7 @@ public static implicit operator TabView(WebElement element) /// Thrown when an element is no longer valid in the document DOM. public virtual void CreateTab() { - VerifyElementShown(tabListViewLocator, TimeSpan.FromSeconds(2)); + VerifyElementShown(_tabListViewLocator, TimeSpan.FromSeconds(2)); AddTabButton.Click(); } @@ -88,7 +88,7 @@ public virtual void CreateTab() /// Thrown when an element is no longer valid in the document DOM. public virtual void SelectTab(string name) { - VerifyElementShown(tabListViewLocator, TimeSpan.FromSeconds(2)); + VerifyElementShown(_tabListViewLocator, TimeSpan.FromSeconds(2)); var item = Tabs.FirstOrDefault(element => element.VerifyNameOrAutomationIdEquals(name)); if (item == null) @@ -112,7 +112,7 @@ public virtual void SelectTab(string name) /// Thrown when an element is not visible. public virtual void SelectTabByPartialName(string name) { - VerifyElementShown(tabListViewLocator, TimeSpan.FromSeconds(2)); + VerifyElementShown(_tabListViewLocator, TimeSpan.FromSeconds(2)); var item = Tabs.FirstOrDefault(element => element.VerifyNameOrAutomationIdContains(name)); if (item == null) @@ -134,7 +134,7 @@ public virtual void SelectTabByPartialName(string name) /// Thrown when an element is not visible. public virtual void CloseTab(string name) { - VerifyElementShown(tabListViewLocator, TimeSpan.FromSeconds(2)); + VerifyElementShown(_tabListViewLocator, TimeSpan.FromSeconds(2)); var item = Tabs.FirstOrDefault(element => element.VerifyNameOrAutomationIdEquals(name)); if (item == null) @@ -157,7 +157,7 @@ public virtual void CloseTab(string name) /// Thrown when an element is no longer valid in the document DOM. public virtual void CloseTabByPartialName(string name) { - VerifyElementShown(tabListViewLocator, TimeSpan.FromSeconds(2)); + VerifyElementShown(_tabListViewLocator, TimeSpan.FromSeconds(2)); var item = Tabs.FirstOrDefault(element => element.VerifyNameOrAutomationIdContains(name)); if (item == null) diff --git a/src/Legerity.Windows/Elements/Core/AppBarButton.cs b/src/Legerity.Windows/Elements/Core/AppBarButton.cs index 2258267a..2c1d02f1 100644 --- a/src/Legerity.Windows/Elements/Core/AppBarButton.cs +++ b/src/Legerity.Windows/Elements/Core/AppBarButton.cs @@ -29,4 +29,4 @@ public static implicit operator AppBarButton(WebElement element) { return new AppBarButton(element); } -} \ No newline at end of file +} diff --git a/src/Legerity.Windows/Elements/Core/AutoSuggestBox.cs b/src/Legerity.Windows/Elements/Core/AutoSuggestBox.cs index 5af0ffbb..754772cb 100644 --- a/src/Legerity.Windows/Elements/Core/AutoSuggestBox.cs +++ b/src/Legerity.Windows/Elements/Core/AutoSuggestBox.cs @@ -8,7 +8,7 @@ namespace Legerity.Windows.Elements.Core; /// public class AutoSuggestBox : WindowsElementWrapper { - private readonly By suggestionsPopupLocator = WindowsByExtras.AutomationId("SuggestionsPopup"); + private readonly By _suggestionsPopupLocator = WindowsByExtras.AutomationId("SuggestionsPopup"); /// /// Initializes a new instance of the class. @@ -25,7 +25,7 @@ public AutoSuggestBox(WebElement element) /// Gets the element associated with the suggestions popup. /// /// Thrown when no element matches the expected locator. - public virtual WebElement SuggestionsPopup => FindElement(suggestionsPopupLocator); + public virtual WebElement SuggestionsPopup => FindElement(_suggestionsPopupLocator); /// /// Gets the element associated with the suggestion list when the is shown. @@ -90,7 +90,7 @@ public virtual void SelectSuggestion(string value, string suggestion, int popupW { SetText(value); - VerifyElementShown(suggestionsPopupLocator, TimeSpan.FromMilliseconds(popupWaitTimeout)); + VerifyElementShown(_suggestionsPopupLocator, TimeSpan.FromMilliseconds(popupWaitTimeout)); SuggestionList.ClickItem(suggestion); } @@ -111,7 +111,7 @@ public virtual void SelectSuggestionByPartialSuggestion(string value, string par { SetText(value); - VerifyElementShown(suggestionsPopupLocator, TimeSpan.FromMilliseconds(popupWaitTimeout)); + VerifyElementShown(_suggestionsPopupLocator, TimeSpan.FromMilliseconds(popupWaitTimeout)); SuggestionList.ClickItemByPartialName(partialSuggestion); } @@ -128,4 +128,4 @@ public virtual void SetText(string value) { TextBox.SetText(value); } -} \ No newline at end of file +} diff --git a/src/Legerity.Windows/Elements/Core/Button.cs b/src/Legerity.Windows/Elements/Core/Button.cs index 7ff12b02..dde1278b 100644 --- a/src/Legerity.Windows/Elements/Core/Button.cs +++ b/src/Legerity.Windows/Elements/Core/Button.cs @@ -29,4 +29,4 @@ public static implicit operator Button(WebElement element) { return new Button(element); } -} \ No newline at end of file +} diff --git a/src/Legerity.Windows/Elements/Core/CalendarDatePicker.cs b/src/Legerity.Windows/Elements/Core/CalendarDatePicker.cs index 91b1a496..23d32252 100644 --- a/src/Legerity.Windows/Elements/Core/CalendarDatePicker.cs +++ b/src/Legerity.Windows/Elements/Core/CalendarDatePicker.cs @@ -10,7 +10,7 @@ namespace Legerity.Windows.Elements.Core; /// public class CalendarDatePicker : WindowsElementWrapper { - private readonly By calendarPopupLocator = By.XPath(".//*[@ClassName='Popup'][@Name='Popup']"); + private readonly By _calendarPopupLocator = By.XPath(".//*[@ClassName='Popup'][@Name='Popup']"); /// /// Initializes a new instance of the class. @@ -27,7 +27,7 @@ public CalendarDatePicker(WebElement element) /// Gets the element associated with the calendar flyout. /// /// Thrown when no element matches the expected locator. - public virtual CalendarView CalendarViewFlyout => Driver.FindElement(calendarPopupLocator) + public virtual CalendarView CalendarViewFlyout => Driver.FindElement(_calendarPopupLocator) .FindElement(WindowsByExtras.AutomationId("CalendarView")); /// @@ -68,7 +68,7 @@ public virtual void SetDate(DateTime date) { Click(); - VerifyDriverElementShown(calendarPopupLocator, TimeSpan.FromSeconds(2)); + VerifyDriverElementShown(_calendarPopupLocator, TimeSpan.FromSeconds(2)); CalendarViewFlyout.SetDate(date); } diff --git a/src/Legerity.Windows/Elements/Core/CalendarView.cs b/src/Legerity.Windows/Elements/Core/CalendarView.cs index e956ad64..cb33f83c 100644 --- a/src/Legerity.Windows/Elements/Core/CalendarView.cs +++ b/src/Legerity.Windows/Elements/Core/CalendarView.cs @@ -13,7 +13,7 @@ namespace Legerity.Windows.Elements.Core; /// public class CalendarView : WindowsElementWrapper { - private readonly Dictionary months = new() + private readonly Dictionary _months = new() { { "January", "01" }, { "February", "02" }, @@ -135,7 +135,7 @@ public void SetDate(DateTime date) private DateTime GetCurrentViewDate(string currentHeader) { - months.TryGetValue( + _months.TryGetValue( string.Join(string.Empty, currentHeader.Where(char.IsLetter)).Trim(), out var month); diff --git a/src/Legerity.Windows/Elements/Core/ComboBox.cs b/src/Legerity.Windows/Elements/Core/ComboBox.cs index 69202d1b..069256ab 100644 --- a/src/Legerity.Windows/Elements/Core/ComboBox.cs +++ b/src/Legerity.Windows/Elements/Core/ComboBox.cs @@ -2,7 +2,6 @@ namespace Legerity.Windows.Elements.Core; using System; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Globalization; using System.Linq; using Legerity.Exceptions; @@ -13,7 +12,7 @@ namespace Legerity.Windows.Elements.Core; /// public class ComboBox : WindowsElementWrapper { - private readonly By comboBoxItemLocator = By.ClassName("ComboBoxItem"); + private readonly By _comboBoxItemLocator = By.ClassName("ComboBoxItem"); /// /// Initializes a new instance of the class. @@ -101,7 +100,7 @@ public virtual void SelectItemByPartialName(string name) /// Thrown when an element is no longer valid in the document DOM. private string GetSelectedItem() { - var listElements = Element.FindElements(comboBoxItemLocator).Cast().ToList().AsReadOnly(); + var listElements = Element.FindElements(_comboBoxItemLocator).Cast().ToList().AsReadOnly(); return listElements.Count == 1 ? listElements.FirstOrDefault().GetName() : null; } @@ -112,8 +111,8 @@ private string GetSelectedItem() private IEnumerable GetItemsToSelect() { Click(); - VerifyElementsShown(comboBoxItemLocator, TimeSpan.FromSeconds(2)); - var listElements = Element.FindElements(comboBoxItemLocator).Cast().ToList().AsReadOnly(); + VerifyElementsShown(_comboBoxItemLocator, TimeSpan.FromSeconds(2)); + var listElements = Element.FindElements(_comboBoxItemLocator).Cast().ToList().AsReadOnly(); return listElements; } } diff --git a/src/Legerity.Windows/Elements/Core/CommandBar.cs b/src/Legerity.Windows/Elements/Core/CommandBar.cs index f576b1f0..5f1847f8 100644 --- a/src/Legerity.Windows/Elements/Core/CommandBar.cs +++ b/src/Legerity.Windows/Elements/Core/CommandBar.cs @@ -11,11 +11,11 @@ namespace Legerity.Windows.Elements.Core; /// public class CommandBar : WindowsElementWrapper { - private readonly By moreButtonLocator = WindowsByExtras.AutomationId("MoreButton"); + private readonly By _moreButtonLocator = WindowsByExtras.AutomationId("MoreButton"); - private readonly By overflowPopupLocator = WindowsByExtras.AutomationId("OverflowPopup"); + private readonly By _overflowPopupLocator = WindowsByExtras.AutomationId("OverflowPopup"); - private readonly By appBarButtonLocator = By.ClassName(nameof(AppBarButton)); + private readonly By _appBarButtonLocator = By.ClassName(nameof(AppBarButton)); /// /// Initializes a new instance of the class. @@ -32,14 +32,14 @@ public CommandBar(WebElement element) /// Gets the collection of primary buttons. /// public virtual IEnumerable PrimaryButtons => - Element.FindElements(appBarButtonLocator) + Element.FindElements(_appBarButtonLocator) .Select(element => element as WebElement); /// /// Gets the for opening the secondary button menu. /// /// Thrown when no element matches the expected locator. - public virtual AppBarButton SecondaryMenuButton => FindElement(moreButtonLocator); + public virtual AppBarButton SecondaryMenuButton => FindElement(_moreButtonLocator); /// /// Gets the collection of secondary buttons. @@ -49,7 +49,7 @@ public CommandBar(WebElement element) /// /// Thrown when no element matches the expected locator. public virtual IEnumerable SecondaryButtons => - Driver.FindElement(overflowPopupLocator).FindElements(appBarButtonLocator) + Driver.FindElement(_overflowPopupLocator).FindElements(_appBarButtonLocator) .Select(element => element); /// @@ -174,8 +174,8 @@ public virtual void ClickSecondaryButtonByPartialName(string partialName) /// Thrown when no element matches the expected locator. public virtual void OpenSecondaryButtonMenu() { - VerifyElementShown(moreButtonLocator, TimeSpan.FromSeconds(2)); + VerifyElementShown(_moreButtonLocator, TimeSpan.FromSeconds(2)); SecondaryMenuButton.Click(); - VerifyDriverElementShown(overflowPopupLocator, TimeSpan.FromSeconds(2)); + VerifyDriverElementShown(_overflowPopupLocator, TimeSpan.FromSeconds(2)); } } diff --git a/src/Legerity.Windows/Elements/Core/GridView.cs b/src/Legerity.Windows/Elements/Core/GridView.cs index 8db9b2ee..46b599a8 100644 --- a/src/Legerity.Windows/Elements/Core/GridView.cs +++ b/src/Legerity.Windows/Elements/Core/GridView.cs @@ -11,7 +11,7 @@ namespace Legerity.Windows.Elements.Core; /// public class GridView : WindowsElementWrapper { - private readonly By gridViewItemLocator = By.ClassName("GridViewItem"); + private readonly By _gridViewItemLocator = By.ClassName("GridViewItem"); /// /// Initializes a new instance of the class. @@ -28,7 +28,7 @@ public GridView(WebElement element) /// Gets the collection of items associated with the grid view. /// public virtual ReadOnlyCollection Items => - Element.FindElements(gridViewItemLocator).Cast().ToList().AsReadOnly(); + Element.FindElements(_gridViewItemLocator).Cast().ToList().AsReadOnly(); /// /// Gets the element associated with the currently selected item. @@ -67,7 +67,7 @@ public static implicit operator GridView(WebElement element) /// Thrown when an element is not visible. public virtual void ClickItem(string name) { - VerifyElementsShown(gridViewItemLocator, TimeSpan.FromSeconds(2)); + VerifyElementsShown(_gridViewItemLocator, TimeSpan.FromSeconds(2)); var item = Items.FirstOrDefault(element => element.VerifyNameOrAutomationIdEquals(name)); @@ -92,7 +92,7 @@ public virtual void ClickItem(string name) /// Thrown when an element is no longer valid in the document DOM. public virtual void ClickItemByPartialName(string partialName) { - VerifyElementsShown(gridViewItemLocator, TimeSpan.FromSeconds(2)); + VerifyElementsShown(_gridViewItemLocator, TimeSpan.FromSeconds(2)); var item = Items.FirstOrDefault(element => element.VerifyNameOrAutomationIdContains(partialName)); @@ -118,7 +118,7 @@ public virtual void ClickItemByPartialName(string partialName) /// Thrown when an element is no longer valid in the document DOM. public virtual void ClickItemByIndex(int index) { - VerifyElementsShown(gridViewItemLocator, TimeSpan.FromSeconds(2)); + VerifyElementsShown(_gridViewItemLocator, TimeSpan.FromSeconds(2)); var item = Items[index]; diff --git a/src/Legerity.Windows/Elements/Core/Hub.cs b/src/Legerity.Windows/Elements/Core/Hub.cs index 61d66cd4..8f5c3824 100644 --- a/src/Legerity.Windows/Elements/Core/Hub.cs +++ b/src/Legerity.Windows/Elements/Core/Hub.cs @@ -37,4 +37,4 @@ public static implicit operator Hub(WebElement element) { return new Hub(element); } -} \ No newline at end of file +} diff --git a/src/Legerity.Windows/Elements/Core/HyperlinkButton.cs b/src/Legerity.Windows/Elements/Core/HyperlinkButton.cs index bff0308f..f142023d 100644 --- a/src/Legerity.Windows/Elements/Core/HyperlinkButton.cs +++ b/src/Legerity.Windows/Elements/Core/HyperlinkButton.cs @@ -29,4 +29,4 @@ public static implicit operator HyperlinkButton(WebElement element) { return new HyperlinkButton(element); } -} \ No newline at end of file +} diff --git a/src/Legerity.Windows/Elements/Core/InkToolbar.BallpointPenFlyout.cs b/src/Legerity.Windows/Elements/Core/InkToolbar.BallpointPenFlyout.cs index b08eaf75..c33142dd 100644 --- a/src/Legerity.Windows/Elements/Core/InkToolbar.BallpointPenFlyout.cs +++ b/src/Legerity.Windows/Elements/Core/InkToolbar.BallpointPenFlyout.cs @@ -11,7 +11,7 @@ public partial class InkToolbar public class InkToolbarBallpointPenFlyout : InkToolbarColorFlyoutBase { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// The reference. @@ -35,4 +35,4 @@ public static implicit operator InkToolbarBallpointPenFlyout(WebElement element) return new InkToolbarBallpointPenFlyout(element); } } -} \ No newline at end of file +} diff --git a/src/Legerity.Windows/Elements/Core/InkToolbar.ColorFlyoutBase.cs b/src/Legerity.Windows/Elements/Core/InkToolbar.ColorFlyoutBase.cs index eb1103a0..7b47b0cb 100644 --- a/src/Legerity.Windows/Elements/Core/InkToolbar.ColorFlyoutBase.cs +++ b/src/Legerity.Windows/Elements/Core/InkToolbar.ColorFlyoutBase.cs @@ -16,7 +16,7 @@ public partial class InkToolbar /// public abstract class InkToolbarColorFlyoutBase : WindowsElementWrapper { - private readonly By penColorPaletteLocator = WindowsByExtras.AutomationId("PenColorPalette"); + private readonly By _penColorPaletteLocator = WindowsByExtras.AutomationId("PenColorPalette"); /// /// Initializes a new instance of the class. @@ -33,7 +33,7 @@ protected InkToolbarColorFlyoutBase(WebElement element) /// Gets the element associated with the color grid. /// /// Thrown when no element matches the expected locator. - public virtual GridView ColorGridView => Driver.FindElement(penColorPaletteLocator); + public virtual GridView ColorGridView => Driver.FindElement(_penColorPaletteLocator); /// /// Gets the element associated with the size of the ink. @@ -88,7 +88,7 @@ public virtual void SetColorByPartialName(string partialColor) /// Thrown when an element is no longer valid in the document DOM. private WebElement GetSelectedColor() { - VerifyElementShown(penColorPaletteLocator, TimeSpan.FromSeconds(2)); + VerifyElementShown(_penColorPaletteLocator, TimeSpan.FromSeconds(2)); return ColorGridView.Items.FirstOrDefault(i => i.IsSelected()); } diff --git a/src/Legerity.Windows/Elements/Core/InkToolbar.HighlighterFlyout.cs b/src/Legerity.Windows/Elements/Core/InkToolbar.HighlighterFlyout.cs index b7ef5c80..dc02b97f 100644 --- a/src/Legerity.Windows/Elements/Core/InkToolbar.HighlighterFlyout.cs +++ b/src/Legerity.Windows/Elements/Core/InkToolbar.HighlighterFlyout.cs @@ -11,7 +11,7 @@ public partial class InkToolbar public class InkToolbarHighlighterFlyout : InkToolbarColorFlyoutBase { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// The reference. @@ -35,4 +35,4 @@ public static implicit operator InkToolbarHighlighterFlyout(WebElement element) return new InkToolbarHighlighterFlyout(element); } } -} \ No newline at end of file +} diff --git a/src/Legerity.Windows/Elements/Core/InkToolbar.PencilFlyout.cs b/src/Legerity.Windows/Elements/Core/InkToolbar.PencilFlyout.cs index bc69630e..c8bf5d8c 100644 --- a/src/Legerity.Windows/Elements/Core/InkToolbar.PencilFlyout.cs +++ b/src/Legerity.Windows/Elements/Core/InkToolbar.PencilFlyout.cs @@ -11,7 +11,7 @@ public partial class InkToolbar public class InkToolbarPencilFlyout : InkToolbarColorFlyoutBase { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// The reference. @@ -35,4 +35,4 @@ public static implicit operator InkToolbarPencilFlyout(WebElement element) return new InkToolbarPencilFlyout(element); } } -} \ No newline at end of file +} diff --git a/src/Legerity.Windows/Elements/Core/InkToolbar.cs b/src/Legerity.Windows/Elements/Core/InkToolbar.cs index 925dc3af..1ad67f64 100644 --- a/src/Legerity.Windows/Elements/Core/InkToolbar.cs +++ b/src/Legerity.Windows/Elements/Core/InkToolbar.cs @@ -9,11 +9,11 @@ namespace Legerity.Windows.Elements.Core; /// public partial class InkToolbar : WindowsElementWrapper { - private readonly By ballpointPenFlyoutLocator = By.Name("Ballpoint pen flyout"); + private readonly By _ballpointPenFlyoutLocator = By.Name("Ballpoint pen flyout"); - private readonly By pencilFlyoutLocator = By.Name("Pencil flyout"); + private readonly By _pencilFlyoutLocator = By.Name("Pencil flyout"); - private readonly By highlighterFlyoutLocator = By.Name("Highlighter flyout"); + private readonly By _highlighterFlyoutLocator = By.Name("Highlighter flyout"); /// /// Initializes a new instance of the class. @@ -83,7 +83,7 @@ public InkToolbar(WebElement element) /// /// Thrown when no element matches the expected locator. public virtual InkToolbarBallpointPenFlyout BallpointPenFlyout => - Driver.FindElement(ballpointPenFlyoutLocator); + Driver.FindElement(_ballpointPenFlyoutLocator); /// /// Gets the element associated with the pencil flyout. @@ -92,7 +92,7 @@ public InkToolbar(WebElement element) /// This is only available when the pencil button is selected. /// /// Thrown when no element matches the expected locator. - public virtual InkToolbarPencilFlyout PencilFlyout => Driver.FindElement(pencilFlyoutLocator); + public virtual InkToolbarPencilFlyout PencilFlyout => Driver.FindElement(_pencilFlyoutLocator); /// /// Gets the element associated with the highlighter flyout. @@ -102,7 +102,7 @@ public InkToolbar(WebElement element) /// /// Thrown when no element matches the expected locator. public virtual InkToolbarHighlighterFlyout HighlighterFlyout => - Driver.FindElement(highlighterFlyoutLocator); + Driver.FindElement(_highlighterFlyoutLocator); /// /// Allows conversion of a to the without direct casting. @@ -146,7 +146,7 @@ public virtual void OpenBallpointPenFlyout() SelectBallpointPen(); BallpointPenButton.Click(); - VerifyDriverElementShown(ballpointPenFlyoutLocator, TimeSpan.FromSeconds(2)); + VerifyDriverElementShown(_ballpointPenFlyoutLocator, TimeSpan.FromSeconds(2)); } /// @@ -213,7 +213,7 @@ public virtual void OpenPencilFlyout() SelectPencil(); PencilButton.Click(); - VerifyDriverElementShown(pencilFlyoutLocator, TimeSpan.FromSeconds(2)); + VerifyDriverElementShown(_pencilFlyoutLocator, TimeSpan.FromSeconds(2)); } /// @@ -280,7 +280,7 @@ public virtual void OpenHighlighterFlyout() SelectHighlighter(); HighlighterButton.Click(); - VerifyDriverElementShown(highlighterFlyoutLocator, TimeSpan.FromSeconds(2)); + VerifyDriverElementShown(_highlighterFlyoutLocator, TimeSpan.FromSeconds(2)); } /// @@ -318,4 +318,4 @@ public virtual void SetHighlighterColorByPartialName(string color) OpenHighlighterFlyout(); HighlighterFlyout.SetColorByPartialName(color); } -} \ No newline at end of file +} diff --git a/src/Legerity.Windows/Elements/Core/ListBox.cs b/src/Legerity.Windows/Elements/Core/ListBox.cs index 19ff1afe..2a833084 100644 --- a/src/Legerity.Windows/Elements/Core/ListBox.cs +++ b/src/Legerity.Windows/Elements/Core/ListBox.cs @@ -11,7 +11,7 @@ namespace Legerity.Windows.Elements.Core; /// public class ListBox : WindowsElementWrapper { - private readonly By listBoxItemLocator = By.ClassName("ListBoxItem"); + private readonly By _listBoxItemLocator = By.ClassName("ListBoxItem"); /// /// Initializes a new instance of the class. @@ -27,7 +27,7 @@ public ListBox(WebElement element) /// /// Gets the collection of items associated with the list box. /// - public virtual ReadOnlyCollection Items => Element.FindElements(listBoxItemLocator).Cast().ToList().AsReadOnly(); + public virtual ReadOnlyCollection Items => Element.FindElements(_listBoxItemLocator).Cast().ToList().AsReadOnly(); /// /// Gets the element associated with the currently selected item. @@ -62,7 +62,7 @@ public static implicit operator ListBox(WebElement element) /// Thrown when an element is no longer valid in the document DOM. public virtual void ClickItem(string name) { - VerifyElementsShown(listBoxItemLocator, TimeSpan.FromSeconds(2)); + VerifyElementsShown(_listBoxItemLocator, TimeSpan.FromSeconds(2)); var item = Items.FirstOrDefault(element => element.VerifyNameOrAutomationIdEquals(name)); if (item == null) @@ -84,7 +84,7 @@ public virtual void ClickItem(string name) /// Thrown when an element is not visible. public virtual void ClickItemByPartialName(string partialName) { - VerifyElementsShown(listBoxItemLocator, TimeSpan.FromSeconds(2)); + VerifyElementsShown(_listBoxItemLocator, TimeSpan.FromSeconds(2)); var item = Items.FirstOrDefault(element => element.VerifyNameOrAutomationIdContains(partialName)); diff --git a/src/Legerity.Windows/Elements/Core/ListView.cs b/src/Legerity.Windows/Elements/Core/ListView.cs index ff4d08ab..9d8b5d82 100644 --- a/src/Legerity.Windows/Elements/Core/ListView.cs +++ b/src/Legerity.Windows/Elements/Core/ListView.cs @@ -11,7 +11,7 @@ namespace Legerity.Windows.Elements.Core; /// public class ListView : WindowsElementWrapper { - private readonly By listViewItemLocator = By.ClassName("ListViewItem"); + private readonly By _listViewItemLocator = By.ClassName("ListViewItem"); /// /// Initializes a new instance of the class. @@ -27,7 +27,7 @@ public ListView(WebElement element) /// /// Gets the collection of items associated with the list view. /// - public virtual ReadOnlyCollection Items => Element.FindElements(listViewItemLocator).Cast().ToList().AsReadOnly(); + public virtual ReadOnlyCollection Items => Element.FindElements(_listViewItemLocator).Cast().ToList().AsReadOnly(); /// /// Gets the element associated with the currently selected item. @@ -62,7 +62,7 @@ public static implicit operator ListView(WebElement element) /// Thrown when an element is no longer valid in the document DOM. public virtual void ClickItem(string name) { - VerifyElementsShown(listViewItemLocator, TimeSpan.FromSeconds(2)); + VerifyElementsShown(_listViewItemLocator, TimeSpan.FromSeconds(2)); var item = Items.FirstOrDefault(element => element.VerifyNameOrAutomationIdEquals(name)); if (item == null) @@ -84,7 +84,7 @@ public virtual void ClickItem(string name) /// Thrown when an element is no longer valid in the document DOM. public virtual void ClickItemByPartialName(string partialName) { - VerifyElementsShown(listViewItemLocator, TimeSpan.FromSeconds(2)); + VerifyElementsShown(_listViewItemLocator, TimeSpan.FromSeconds(2)); var item = Items.FirstOrDefault(element => element.VerifyNameOrAutomationIdContains(partialName)); diff --git a/src/Legerity.Windows/Elements/Core/MenuFlyoutItem.cs b/src/Legerity.Windows/Elements/Core/MenuFlyoutItem.cs index b6b9718d..ecef09ed 100644 --- a/src/Legerity.Windows/Elements/Core/MenuFlyoutItem.cs +++ b/src/Legerity.Windows/Elements/Core/MenuFlyoutItem.cs @@ -29,4 +29,4 @@ public static implicit operator MenuFlyoutItem(WebElement element) { return new MenuFlyoutItem(element); } -} \ No newline at end of file +} diff --git a/src/Legerity.Windows/Elements/Core/PasswordBox.cs b/src/Legerity.Windows/Elements/Core/PasswordBox.cs index 4f1989c8..fbece61c 100644 --- a/src/Legerity.Windows/Elements/Core/PasswordBox.cs +++ b/src/Legerity.Windows/Elements/Core/PasswordBox.cs @@ -64,4 +64,4 @@ public virtual void HidePassword() { RevealButton.ReleaseHold(); } -} \ No newline at end of file +} diff --git a/src/Legerity.Windows/Elements/Core/Pivot.cs b/src/Legerity.Windows/Elements/Core/Pivot.cs index dc143337..5d1d9f03 100644 --- a/src/Legerity.Windows/Elements/Core/Pivot.cs +++ b/src/Legerity.Windows/Elements/Core/Pivot.cs @@ -11,7 +11,7 @@ namespace Legerity.Windows.Elements.Core; /// public class Pivot : WindowsElementWrapper { - private readonly By pivotItemLocator = By.ClassName("PivotItem"); + private readonly By _pivotItemLocator = By.ClassName("PivotItem"); /// /// Initializes a new instance of the class. @@ -27,7 +27,7 @@ public Pivot(WebElement element) /// /// Gets the collection of items associated with the pivot. /// - public virtual ReadOnlyCollection Items => Element.FindElements(pivotItemLocator).Cast().ToList().AsReadOnly(); + public virtual ReadOnlyCollection Items => Element.FindElements(_pivotItemLocator).Cast().ToList().AsReadOnly(); /// /// Gets the currently selected item. @@ -62,7 +62,7 @@ public static implicit operator Pivot(WebElement element) /// Thrown when an element is no longer valid in the document DOM. public virtual void ClickItem(string name) { - VerifyElementsShown(pivotItemLocator, TimeSpan.FromSeconds(2)); + VerifyElementsShown(_pivotItemLocator, TimeSpan.FromSeconds(2)); var item = Items.FirstOrDefault(element => element.VerifyNameOrAutomationIdEquals(name)); @@ -87,7 +87,7 @@ public virtual void ClickItem(string name) /// Thrown when an element is not visible. public virtual void ClickItemByPartialName(string name) { - VerifyElementsShown(pivotItemLocator, TimeSpan.FromSeconds(2)); + VerifyElementsShown(_pivotItemLocator, TimeSpan.FromSeconds(2)); var item = Items.FirstOrDefault(element => element.VerifyNameOrAutomationIdContains(name)); diff --git a/src/Legerity.Windows/Elements/Core/ScrollViewer.cs b/src/Legerity.Windows/Elements/Core/ScrollViewer.cs index 56423fa3..0cb25f6a 100644 --- a/src/Legerity.Windows/Elements/Core/ScrollViewer.cs +++ b/src/Legerity.Windows/Elements/Core/ScrollViewer.cs @@ -51,4 +51,4 @@ public virtual void ScrollToBottom() { Element.SendKeys(Keys.End); } -} \ No newline at end of file +} diff --git a/src/Legerity.Windows/Elements/Core/TextBlock.cs b/src/Legerity.Windows/Elements/Core/TextBlock.cs index 213e2976..30692975 100644 --- a/src/Legerity.Windows/Elements/Core/TextBlock.cs +++ b/src/Legerity.Windows/Elements/Core/TextBlock.cs @@ -35,4 +35,4 @@ public static implicit operator TextBlock(WebElement element) { return new TextBlock(element); } -} \ No newline at end of file +} diff --git a/src/Legerity.Windows/Elements/Core/TimePicker.cs b/src/Legerity.Windows/Elements/Core/TimePicker.cs index e5dd2436..614cdb95 100644 --- a/src/Legerity.Windows/Elements/Core/TimePicker.cs +++ b/src/Legerity.Windows/Elements/Core/TimePicker.cs @@ -49,9 +49,9 @@ public virtual void SetTime(TimeSpan time) Click(); // Finds the popup and changes the time. - WebElement popup = Driver.FindElement(WindowsByExtras.AutomationId("TimePickerFlyoutPresenter")); + var popup = Driver.FindElement(WindowsByExtras.AutomationId("TimePickerFlyoutPresenter")); popup.FindElement(WindowsByExtras.AutomationId("HourLoopingSelector")).FindElementByName(time.ToString("%h")).Click(); popup.FindElement(WindowsByExtras.AutomationId("MinuteLoopingSelector")).FindElementByName(time.ToString("mm")).Click(); popup.FindElement(WindowsByExtras.AutomationId("AcceptButton")).Click(); } -} \ No newline at end of file +} diff --git a/src/Legerity.Windows/Elements/Core/ToggleState.cs b/src/Legerity.Windows/Elements/Core/ToggleState.cs index 76395d52..6010e772 100644 --- a/src/Legerity.Windows/Elements/Core/ToggleState.cs +++ b/src/Legerity.Windows/Elements/Core/ToggleState.cs @@ -19,4 +19,4 @@ public enum ToggleState /// The toggle is indeterminate. /// Indeterminate = 2, -} \ No newline at end of file +} diff --git a/src/Legerity.Windows/Elements/WindowsElementWrapper.cs b/src/Legerity.Windows/Elements/WindowsElementWrapper.cs index c9dd83f3..54d2be2b 100644 --- a/src/Legerity.Windows/Elements/WindowsElementWrapper.cs +++ b/src/Legerity.Windows/Elements/WindowsElementWrapper.cs @@ -2,7 +2,6 @@ namespace Legerity.Windows.Elements; using System; using Legerity.Exceptions; -using OpenQA.Selenium.Support.UI; /// /// Defines an element wrapper for a Windows . @@ -96,4 +95,4 @@ protected void VerifyDriverElementsShown(By locator, TimeSpan? timeout) wait.Until(driver => driver.FindElements(locator).Count != 0); } } -} \ No newline at end of file +} diff --git a/src/Legerity.Windows/Extensions/ElementExtensions.cs b/src/Legerity.Windows/Extensions/ElementExtensions.cs index 3144640a..53fe7d71 100644 --- a/src/Legerity.Windows/Extensions/ElementExtensions.cs +++ b/src/Legerity.Windows/Extensions/ElementExtensions.cs @@ -15,4 +15,4 @@ public static IEnumerable FindElementsByClassName(this IWebElement e { return element.FindElements(By.ClassName(className)).Cast(); } -} \ No newline at end of file +} diff --git a/src/Legerity.Windows/Extensions/LegerityTestClassExtensions.cs b/src/Legerity.Windows/Extensions/LegerityTestClassExtensions.cs index c780604a..e75c5cd4 100644 --- a/src/Legerity.Windows/Extensions/LegerityTestClassExtensions.cs +++ b/src/Legerity.Windows/Extensions/LegerityTestClassExtensions.cs @@ -76,4 +76,4 @@ public static WindowsDriver StartWindowsApp( return testClass.StartApp(options, waitUntil, waitUntilTimeout, waitUntilRetries) as WindowsDriver; } -} \ No newline at end of file +} diff --git a/src/Legerity.Windows/Extensions/WindowsElementWrapperExtensions.cs b/src/Legerity.Windows/Extensions/WindowsElementWrapperExtensions.cs index 14da0fa2..3d3244c0 100644 --- a/src/Legerity.Windows/Extensions/WindowsElementWrapperExtensions.cs +++ b/src/Legerity.Windows/Extensions/WindowsElementWrapperExtensions.cs @@ -2,7 +2,6 @@ namespace Legerity.Windows.Extensions; using System; using Elements; -using OpenQA.Selenium.Support.UI; /// /// Defines a collection of extensions for objects. diff --git a/src/Legerity.Windows/GlobalUsings.cs b/src/Legerity.Windows/GlobalUsings.cs index d33e0522..9f175fce 100644 --- a/src/Legerity.Windows/GlobalUsings.cs +++ b/src/Legerity.Windows/GlobalUsings.cs @@ -3,4 +3,4 @@ global using OpenQA.Selenium; global using OpenQA.Selenium.Appium; global using OpenQA.Selenium.Appium.Windows; -global using OpenQA.Selenium.Remote; +global using OpenQA.Selenium.Support.UI; diff --git a/src/Legerity.Windows/WindowsByExtras.cs b/src/Legerity.Windows/WindowsByExtras.cs index 5459e74e..5e52bdf8 100644 --- a/src/Legerity.Windows/WindowsByExtras.cs +++ b/src/Legerity.Windows/WindowsByExtras.cs @@ -26,4 +26,4 @@ public static By AutomationId(string automationId) return By.XPath($".//*[@AutomationId='{automationId}']"); } -} \ No newline at end of file +} diff --git a/tests/Legerity.Core.Tests/GlobalUsings.cs b/tests/Legerity.Core.Tests/GlobalUsings.cs index 0d499602..45803334 100644 --- a/tests/Legerity.Core.Tests/GlobalUsings.cs +++ b/tests/Legerity.Core.Tests/GlobalUsings.cs @@ -1,8 +1,3 @@ // Global using directives -global using Legerity; -global using Legerity.Pages; -global using Legerity.Web; global using NUnit.Framework; -global using OpenQA.Selenium; -global using OpenQA.Selenium.Remote; \ No newline at end of file diff --git a/tests/Legerity.Core.Tests/Pages/W3SchoolsPage.cs b/tests/Legerity.Core.Tests/Pages/W3SchoolsPage.cs index 6382ec95..e7bbac7f 100644 --- a/tests/Legerity.Core.Tests/Pages/W3SchoolsPage.cs +++ b/tests/Legerity.Core.Tests/Pages/W3SchoolsPage.cs @@ -1,26 +1,27 @@ -namespace Legerity.Core.Tests.Pages; - -using Extensions; +using Legerity.Core.Tests.Tests; +using Legerity.Extensions; +using Legerity.Pages; using Legerity.Web.Elements.Core; using OpenQA.Selenium; -using OpenQA.Selenium.Remote; -using Tests; + +namespace Legerity.Core.Tests.Pages; + internal class W3SchoolsPage : BasePage { - private readonly By contentFrameLocator = By.Id("iframeResult"); - private readonly By acceptCookiesButtonLocator = By.Id("accept-choices"); + private readonly By _contentFrameLocator = By.Id("iframeResult"); + private readonly By _acceptCookiesButtonLocator = By.Id("accept-choices"); public W3SchoolsPage(WebDriver app) : base(app, BaseTestClass.ImplicitWait) { } - protected override By Trait => contentFrameLocator; + protected override By Trait => _contentFrameLocator; - public Button AcceptCookiesButton => FindElement(acceptCookiesButtonLocator); + public Button AcceptCookiesButton => FindElement(_acceptCookiesButtonLocator); - public WebElement ContentFrame => FindElement(contentFrameLocator); + public WebElement ContentFrame => FindElement(_contentFrameLocator); public T AcceptCookies() where T : W3SchoolsPage { diff --git a/tests/Legerity.Core.Tests/Tests/BaseTestClass.cs b/tests/Legerity.Core.Tests/Tests/BaseTestClass.cs index 838712f4..9b4e3c21 100644 --- a/tests/Legerity.Core.Tests/Tests/BaseTestClass.cs +++ b/tests/Legerity.Core.Tests/Tests/BaseTestClass.cs @@ -1,3 +1,4 @@ +using System; using System.Diagnostics.CodeAnalysis; [assembly: LevelOfParallelism(5)] @@ -5,9 +6,6 @@ namespace Legerity.Core.Tests.Tests; -using System; -using Legerity; - /// /// Defines the base test class for setting up and running UI tests. /// @@ -59,4 +57,4 @@ public virtual void FinalCleanup() // Ensures that any running app driver instances being tracked are stopped. StopApps(); } -} \ No newline at end of file +} diff --git a/tests/Legerity.Core.Tests/Tests/ByAllTests.cs b/tests/Legerity.Core.Tests/Tests/ByAllTests.cs index e3233e5e..b4ac9931 100644 --- a/tests/Legerity.Core.Tests/Tests/ByAllTests.cs +++ b/tests/Legerity.Core.Tests/Tests/ByAllTests.cs @@ -1,14 +1,13 @@ -namespace Legerity.Core.Tests.Tests; - using System; -using System.Collections.ObjectModel; using System.IO; +using Legerity.Core.Tests.Pages; +using Legerity.Web; using OpenQA.Selenium; using OpenQA.Selenium.Chrome; -using OpenQA.Selenium.Remote; -using Pages; using Shouldly; +namespace Legerity.Core.Tests.Tests; + [TestFixture] [Parallelizable(ParallelScope.All)] internal class ByAllTests : BaseTestClass diff --git a/tests/Legerity.Core.Tests/Tests/ByNestedTests.cs b/tests/Legerity.Core.Tests/Tests/ByNestedTests.cs index 0cf86af4..a133ff82 100644 --- a/tests/Legerity.Core.Tests/Tests/ByNestedTests.cs +++ b/tests/Legerity.Core.Tests/Tests/ByNestedTests.cs @@ -1,14 +1,13 @@ -namespace Legerity.Core.Tests.Tests; - using System; -using System.Collections.ObjectModel; using System.IO; -using Pages; +using Legerity.Core.Tests.Pages; +using Legerity.Web; +using Legerity.Web.Extensions; using OpenQA.Selenium; using OpenQA.Selenium.Chrome; -using OpenQA.Selenium.Remote; using Shouldly; -using Web.Extensions; + +namespace Legerity.Core.Tests.Tests; [TestFixture] [Parallelizable(ParallelScope.All)] diff --git a/tests/Legerity.Core.Tests/Tests/WaitUntilElementIsNotVisibleTests.cs b/tests/Legerity.Core.Tests/Tests/WaitUntilElementIsNotVisibleTests.cs index 25e1e739..32621b83 100644 --- a/tests/Legerity.Core.Tests/Tests/WaitUntilElementIsNotVisibleTests.cs +++ b/tests/Legerity.Core.Tests/Tests/WaitUntilElementIsNotVisibleTests.cs @@ -1,14 +1,14 @@ -namespace Legerity.Core.Tests.Tests; - using System; using System.IO; -using Extensions; -using Helpers; +using Legerity.Core.Tests.Pages; +using Legerity.Extensions; +using Legerity.Helpers; +using Legerity.Web; +using Legerity.Web.Elements.Core; using OpenQA.Selenium; using OpenQA.Selenium.Chrome; -using OpenQA.Selenium.Remote; -using Pages; -using Web.Elements.Core; + +namespace Legerity.Core.Tests.Tests; [TestFixture] [Parallelizable(ParallelScope.All)] diff --git a/tests/Legerity.Core.Tests/Tests/WaitUntilElementIsVisibleTests.cs b/tests/Legerity.Core.Tests/Tests/WaitUntilElementIsVisibleTests.cs index a44c8cfd..6d55f941 100644 --- a/tests/Legerity.Core.Tests/Tests/WaitUntilElementIsVisibleTests.cs +++ b/tests/Legerity.Core.Tests/Tests/WaitUntilElementIsVisibleTests.cs @@ -1,14 +1,14 @@ -namespace Legerity.Core.Tests.Tests; - using System; using System.IO; -using Extensions; -using Helpers; +using Legerity.Core.Tests.Pages; +using Legerity.Extensions; +using Legerity.Helpers; +using Legerity.Web; +using Legerity.Web.Elements.Core; using OpenQA.Selenium; using OpenQA.Selenium.Chrome; -using OpenQA.Selenium.Remote; -using Pages; -using Web.Elements.Core; + +namespace Legerity.Core.Tests.Tests; [TestFixture] [Parallelizable(ParallelScope.All)] diff --git a/tests/Legerity.Core.Tests/Tests/WebAppManagerOptionsTests.cs b/tests/Legerity.Core.Tests/Tests/WebAppManagerOptionsTests.cs index 23823e56..9dd057b3 100644 --- a/tests/Legerity.Core.Tests/Tests/WebAppManagerOptionsTests.cs +++ b/tests/Legerity.Core.Tests/Tests/WebAppManagerOptionsTests.cs @@ -1,13 +1,12 @@ -namespace Legerity.Core.Tests.Tests; - using System; using System.Drawing; using System.IO; -using OpenQA.Selenium; +using Legerity.Web; using OpenQA.Selenium.Chrome; -using OpenQA.Selenium.Remote; using Shouldly; +namespace Legerity.Core.Tests.Tests; + [TestFixture] [Parallelizable(ParallelScope.All)] internal class WebAppManagerOptionsTests : BaseTestClass @@ -25,7 +24,7 @@ public void ShouldLaunchBrowserAtDesiredSize() ImplicitWait = ImplicitWait, DriverOptions = new ChromeOptions() }; - + // Act var app = StartApp(options); diff --git a/tests/Legerity.Telerik.Uwp.Tests/GlobalUsings.cs b/tests/Legerity.Telerik.Uwp.Tests/GlobalUsings.cs index 0eadd8a0..45803334 100644 --- a/tests/Legerity.Telerik.Uwp.Tests/GlobalUsings.cs +++ b/tests/Legerity.Telerik.Uwp.Tests/GlobalUsings.cs @@ -1,8 +1,3 @@ // Global using directives -global using Legerity; -global using Legerity.Pages; -global using Legerity.Windows; global using NUnit.Framework; -global using OpenQA.Selenium; -global using OpenQA.Selenium.Remote; \ No newline at end of file diff --git a/tests/Legerity.Telerik.Uwp.Tests/Pages/BaseNavigationPage.cs b/tests/Legerity.Telerik.Uwp.Tests/Pages/BaseNavigationPage.cs index f9014775..11c49720 100644 --- a/tests/Legerity.Telerik.Uwp.Tests/Pages/BaseNavigationPage.cs +++ b/tests/Legerity.Telerik.Uwp.Tests/Pages/BaseNavigationPage.cs @@ -1,22 +1,22 @@ -namespace Legerity.Telerik.Uwp.Tests.Pages; - using System; -using Windows.Elements.Core; +using Legerity.Pages; +using Legerity.Windows.Elements.Core; using OpenQA.Selenium; -using OpenQA.Selenium.Remote; + +namespace Legerity.Telerik.Uwp.Tests.Pages; internal class BaseNavigationPage : BasePage { - private readonly By searchBoxLocator = By.Name("Search"); + private readonly By _searchBoxLocator = By.Name("Search"); public BaseNavigationPage(WebDriver app) : base(app) { } - public TextBox SearchBox => FindElement(searchBoxLocator); + public TextBox SearchBox => FindElement(_searchBoxLocator); - protected override By Trait => searchBoxLocator; + protected override By Trait => _searchBoxLocator; public TPage NavigateTo(string controlName, string sampleName) where TPage : BasePage diff --git a/tests/Legerity.Telerik.Uwp.Tests/Pages/HomePage.cs b/tests/Legerity.Telerik.Uwp.Tests/Pages/HomePage.cs index 696e4501..ed819ab4 100644 --- a/tests/Legerity.Telerik.Uwp.Tests/Pages/HomePage.cs +++ b/tests/Legerity.Telerik.Uwp.Tests/Pages/HomePage.cs @@ -1,11 +1,10 @@ -namespace Legerity.Telerik.Uwp.Tests.Pages; - using OpenQA.Selenium; -using OpenQA.Selenium.Remote; + +namespace Legerity.Telerik.Uwp.Tests.Pages; internal class HomePage : BaseNavigationPage { public HomePage(WebDriver app) : base(app) { } -} \ No newline at end of file +} diff --git a/tests/Legerity.Telerik.Uwp.Tests/Tests/BaseTestClass.cs b/tests/Legerity.Telerik.Uwp.Tests/Tests/BaseTestClass.cs index e1cc6c83..f29b7719 100644 --- a/tests/Legerity.Telerik.Uwp.Tests/Tests/BaseTestClass.cs +++ b/tests/Legerity.Telerik.Uwp.Tests/Tests/BaseTestClass.cs @@ -1,14 +1,12 @@ +using System; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; +using Legerity.Windows; [assembly: ExcludeFromCodeCoverage] namespace Legerity.Telerik.Uwp.Tests.Tests; -using System; -using System.Collections.Generic; -using Legerity; -using Windows; - /// /// Defines the base test class for setting up and running UI tests. /// diff --git a/tests/Legerity.WCT.Tests/GlobalUsings.cs b/tests/Legerity.WCT.Tests/GlobalUsings.cs index 0eadd8a0..45803334 100644 --- a/tests/Legerity.WCT.Tests/GlobalUsings.cs +++ b/tests/Legerity.WCT.Tests/GlobalUsings.cs @@ -1,8 +1,3 @@ // Global using directives -global using Legerity; -global using Legerity.Pages; -global using Legerity.Windows; global using NUnit.Framework; -global using OpenQA.Selenium; -global using OpenQA.Selenium.Remote; \ No newline at end of file diff --git a/tests/Legerity.WCT.Tests/Pages/BaseNavigationPage.cs b/tests/Legerity.WCT.Tests/Pages/BaseNavigationPage.cs index 27f01a7c..04db60a9 100644 --- a/tests/Legerity.WCT.Tests/Pages/BaseNavigationPage.cs +++ b/tests/Legerity.WCT.Tests/Pages/BaseNavigationPage.cs @@ -1,30 +1,30 @@ -namespace Legerity.WCT.Tests.Pages; - using System; using System.Linq; -using Extensions; -using Windows.Elements.Core; -using Windows.Elements.WinUI; +using Legerity.Extensions; +using Legerity.Pages; +using Legerity.Windows; +using Legerity.Windows.Elements.Core; +using Legerity.Windows.Elements.WinUI; using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Remote; + +namespace Legerity.WCT.Tests.Pages; internal class BaseNavigationPage : BasePage { - private readonly By navigationViewLocator = WindowsByExtras.AutomationId("NavView"); + private readonly By _navigationViewLocator = WindowsByExtras.AutomationId("NavView"); public BaseNavigationPage(WebDriver app) : base(app) { } - public NavigationView NavigationView => FindElement(navigationViewLocator); + public NavigationView NavigationView => FindElement(_navigationViewLocator); public AutoSuggestBox SampleSearchBox => NavigationView.FindElement(WindowsByExtras.AutomationId("SearchBox")); public GridView SamplePicker => FindElement(WindowsByExtras.AutomationId("SamplePickerGridView")); - protected override By Trait => navigationViewLocator; + protected override By Trait => _navigationViewLocator; public TPage NavigateTo(string sampleName) where TPage : BasePage diff --git a/tests/Legerity.WCT.Tests/Pages/HomePage.cs b/tests/Legerity.WCT.Tests/Pages/HomePage.cs index 17c764b4..02baee58 100644 --- a/tests/Legerity.WCT.Tests/Pages/HomePage.cs +++ b/tests/Legerity.WCT.Tests/Pages/HomePage.cs @@ -1,11 +1,10 @@ -namespace Legerity.WCT.Tests.Pages; - using OpenQA.Selenium; -using OpenQA.Selenium.Remote; + +namespace Legerity.WCT.Tests.Pages; internal class HomePage : BaseNavigationPage { public HomePage(WebDriver app) : base(app) { } -} \ No newline at end of file +} diff --git a/tests/Legerity.WCT.Tests/Tests/BaseTestClass.cs b/tests/Legerity.WCT.Tests/Tests/BaseTestClass.cs index cdd55ffc..24ef1b2e 100644 --- a/tests/Legerity.WCT.Tests/Tests/BaseTestClass.cs +++ b/tests/Legerity.WCT.Tests/Tests/BaseTestClass.cs @@ -1,14 +1,12 @@ +using System; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; +using Legerity.Windows; [assembly: ExcludeFromCodeCoverage] namespace Legerity.WCT.Tests.Tests; -using System; -using System.Collections.Generic; -using Legerity; -using Windows; - /// /// Defines the base test class for setting up and running UI tests. /// diff --git a/tests/Legerity.Web.Tests/GlobalUsings.cs b/tests/Legerity.Web.Tests/GlobalUsings.cs index 0d499602..45803334 100644 --- a/tests/Legerity.Web.Tests/GlobalUsings.cs +++ b/tests/Legerity.Web.Tests/GlobalUsings.cs @@ -1,8 +1,3 @@ // Global using directives -global using Legerity; -global using Legerity.Pages; -global using Legerity.Web; global using NUnit.Framework; -global using OpenQA.Selenium; -global using OpenQA.Selenium.Remote; \ No newline at end of file diff --git a/tests/Legerity.Web.Tests/Legerity.Web.Tests.csproj b/tests/Legerity.Web.Tests/Legerity.Web.Tests.csproj index 9d1517c0..c8c6d293 100644 --- a/tests/Legerity.Web.Tests/Legerity.Web.Tests.csproj +++ b/tests/Legerity.Web.Tests/Legerity.Web.Tests.csproj @@ -10,7 +10,10 @@ + + + diff --git a/tests/Legerity.Web.Tests/Pages/ButtonPage.cs b/tests/Legerity.Web.Tests/Pages/ButtonPage.cs index e8d0a037..4ffe130c 100644 --- a/tests/Legerity.Web.Tests/Pages/ButtonPage.cs +++ b/tests/Legerity.Web.Tests/Pages/ButtonPage.cs @@ -1,23 +1,22 @@ -namespace Legerity.Web.Tests.Pages; - -using Elements.Core; +using Legerity.Web.Elements.Core; using OpenQA.Selenium; -using OpenQA.Selenium.Remote; + +namespace Legerity.Web.Tests.Pages; internal class ButtonPage : W3SchoolsBasePage { - private readonly By buttonLocator = By.TagName("button"); + private readonly By _buttonLocator = By.TagName("button"); public ButtonPage(WebDriver app) : base(app) { } - public Button Button => FindElement(buttonLocator); + public Button Button => FindElement(_buttonLocator); public ButtonPage ClickButton() { Button.Click(); return this; } -} \ No newline at end of file +} diff --git a/tests/Legerity.Web.Tests/Pages/CheckBoxPage.cs b/tests/Legerity.Web.Tests/Pages/CheckBoxPage.cs index a98760f1..83755c63 100644 --- a/tests/Legerity.Web.Tests/Pages/CheckBoxPage.cs +++ b/tests/Legerity.Web.Tests/Pages/CheckBoxPage.cs @@ -1,18 +1,17 @@ -namespace Legerity.Web.Tests.Pages; - -using Elements.Core; +using Legerity.Web.Elements.Core; using OpenQA.Selenium; -using OpenQA.Selenium.Remote; + +namespace Legerity.Web.Tests.Pages; internal class CheckBoxPage : W3SchoolsBasePage { - private readonly By bikeCheckBoxLocator = By.Id("vehicle1"); + private readonly By _bikeCheckBoxLocator = By.Id("vehicle1"); public CheckBoxPage(WebDriver app) : base(app) { } - public CheckBox BikeCheckBox => FindElement(bikeCheckBoxLocator); + public CheckBox BikeCheckBox => FindElement(_bikeCheckBoxLocator); public CheckBoxPage CheckBikeOn() { @@ -25,4 +24,4 @@ public CheckBoxPage CheckBikeOff() BikeCheckBox.CheckOff(); return this; } -} \ No newline at end of file +} diff --git a/tests/Legerity.Web.Tests/Pages/DateInputPage.cs b/tests/Legerity.Web.Tests/Pages/DateInputPage.cs index ffbb30f7..20c3eb99 100644 --- a/tests/Legerity.Web.Tests/Pages/DateInputPage.cs +++ b/tests/Legerity.Web.Tests/Pages/DateInputPage.cs @@ -1,9 +1,8 @@ -namespace Legerity.Web.Tests.Pages; - using System; -using Elements.Core; +using Legerity.Web.Elements.Core; using OpenQA.Selenium; -using OpenQA.Selenium.Remote; + +namespace Legerity.Web.Tests.Pages; internal class DateInputPage : W3SchoolsBasePage { @@ -18,4 +17,4 @@ public DateInputPage SetBirthdayDate(DateTime date) DateInput.SetDate(date); return this; } -} \ No newline at end of file +} diff --git a/tests/Legerity.Web.Tests/Pages/FileInputPage.cs b/tests/Legerity.Web.Tests/Pages/FileInputPage.cs index c96b2802..aa5c7881 100644 --- a/tests/Legerity.Web.Tests/Pages/FileInputPage.cs +++ b/tests/Legerity.Web.Tests/Pages/FileInputPage.cs @@ -1,18 +1,17 @@ -namespace Legerity.Web.Tests.Pages; - -using Elements.Core; +using Legerity.Web.Elements.Core; using OpenQA.Selenium; -using OpenQA.Selenium.Remote; + +namespace Legerity.Web.Tests.Pages; internal class FileInputPage : W3SchoolsBasePage { - private readonly By fileInputLocator = By.Id("myfile"); + private readonly By _fileInputLocator = By.Id("myfile"); public FileInputPage(WebDriver app) : base(app) { } - public FileInput FileInput => FindElement(fileInputLocator); + public FileInput FileInput => FindElement(_fileInputLocator); public FileInputPage SetFileInputFilePath(string filePath) { @@ -25,4 +24,4 @@ public FileInputPage ClearFileInput() FileInput.ClearFile(); return this; } -} \ No newline at end of file +} diff --git a/tests/Legerity.Web.Tests/Pages/ImagePage.cs b/tests/Legerity.Web.Tests/Pages/ImagePage.cs index 4d8a107f..4c144e87 100644 --- a/tests/Legerity.Web.Tests/Pages/ImagePage.cs +++ b/tests/Legerity.Web.Tests/Pages/ImagePage.cs @@ -1,16 +1,15 @@ -namespace Legerity.Web.Tests.Pages; - -using Elements.Core; +using Legerity.Web.Elements.Core; using OpenQA.Selenium; -using OpenQA.Selenium.Remote; + +namespace Legerity.Web.Tests.Pages; internal class ImagePage : W3SchoolsBasePage { - private readonly By imageLocator = By.TagName("img"); + private readonly By _imageLocator = By.TagName("img"); public ImagePage(WebDriver app) : base(app) { } - public Image Image => FindElement(imageLocator); -} \ No newline at end of file + public Image Image => FindElement(_imageLocator); +} diff --git a/tests/Legerity.Web.Tests/Pages/ListPage.cs b/tests/Legerity.Web.Tests/Pages/ListPage.cs index 766507a9..41d528be 100644 --- a/tests/Legerity.Web.Tests/Pages/ListPage.cs +++ b/tests/Legerity.Web.Tests/Pages/ListPage.cs @@ -1,17 +1,16 @@ -namespace Legerity.Web.Tests.Pages; - -using Elements.Core; using System.Linq; +using Legerity.Web.Elements.Core; using OpenQA.Selenium; -using OpenQA.Selenium.Remote; + +namespace Legerity.Web.Tests.Pages; internal class ListPage : W3SchoolsBasePage { - private readonly By orderedListLocator = By.TagName("ol"); + private readonly By _orderedListLocator = By.TagName("ol"); public ListPage(WebDriver app) : base(app) { } - public List OrderedList => FindElements(orderedListLocator).FirstOrDefault(); -} \ No newline at end of file + public List OrderedList => FindElements(_orderedListLocator).FirstOrDefault(); +} diff --git a/tests/Legerity.Web.Tests/Pages/NumberInputPage.cs b/tests/Legerity.Web.Tests/Pages/NumberInputPage.cs index 4d084ce0..0de6955a 100644 --- a/tests/Legerity.Web.Tests/Pages/NumberInputPage.cs +++ b/tests/Legerity.Web.Tests/Pages/NumberInputPage.cs @@ -1,18 +1,17 @@ -namespace Legerity.Web.Tests.Pages; - -using Elements.Core; +using Legerity.Web.Elements.Core; using OpenQA.Selenium; -using OpenQA.Selenium.Remote; + +namespace Legerity.Web.Tests.Pages; internal class NumberInputPage : W3SchoolsBasePage { - private readonly By quantityNumberInputLocator = By.Id("quantity"); + private readonly By _quantityNumberInputLocator = By.Id("quantity"); public NumberInputPage(WebDriver app) : base(app) { } - public NumberInput QuantityNumberInput => FindElement(quantityNumberInputLocator); + public NumberInput QuantityNumberInput => FindElement(_quantityNumberInputLocator); public NumberInputPage SetQuantity(int quantity) { @@ -31,4 +30,4 @@ public NumberInputPage DecrementQuantity() QuantityNumberInput.Decrement(); return this; } -} \ No newline at end of file +} diff --git a/tests/Legerity.Web.Tests/Pages/OptionPage.cs b/tests/Legerity.Web.Tests/Pages/OptionPage.cs index 1b9262de..d5fde05f 100644 --- a/tests/Legerity.Web.Tests/Pages/OptionPage.cs +++ b/tests/Legerity.Web.Tests/Pages/OptionPage.cs @@ -1,20 +1,19 @@ -namespace Legerity.Web.Tests.Pages; - using System.Collections.Generic; using System.Linq; -using Elements.Core; +using Legerity.Web.Elements.Core; using OpenQA.Selenium; -using OpenQA.Selenium.Remote; + +namespace Legerity.Web.Tests.Pages; internal class OptionPage : W3SchoolsBasePage { - private readonly By carOptionLocator = By.TagName("option"); + private readonly By _carOptionLocator = By.TagName("option"); public OptionPage(WebDriver app) : base(app) { } - public IEnumerable