From a1a07a91731b1f91af8a226988764951e863cdcf Mon Sep 17 00:00:00 2001 From: James Croft Date: Mon, 4 Mar 2024 08:23:06 +0000 Subject: [PATCH 01/21] Upgrade NuGet packages for Selenium 4 --- samples/AndroidCoreSamples/AndroidCoreSamples.csproj | 4 ++-- samples/MADESampleApp/MADESampleApp.csproj | 4 ++-- samples/TelerikUwpSdkSample/TelerikUwpSdkSample.csproj | 4 ++-- .../WindowsCommunityToolkitSampleApp.csproj | 4 ++-- src/Legerity.Android/Legerity.Android.csproj | 4 ++-- src/Legerity.Core/Legerity.Core.csproj | 6 +++--- src/Legerity.IOS/Legerity.IOS.csproj | 4 ++-- src/Legerity.MADE/Legerity.MADE.csproj | 4 ++-- src/Legerity.Telerik.Uwp/Legerity.Telerik.Uwp.csproj | 4 ++-- src/Legerity.WCT/Legerity.WCT.csproj | 4 ++-- .../Legerity.Web.Authentication.csproj | 4 ++-- src/Legerity.Web/Legerity.Web.csproj | 4 ++-- src/Legerity.WinUI/Legerity.WinUI.csproj | 4 ++-- src/Legerity.Windows/Legerity.Windows.csproj | 4 ++-- src/Legerity/Legerity.csproj | 4 ++-- tests/Legerity.Core.Tests/Legerity.Core.Tests.csproj | 4 ++-- .../Legerity.Telerik.Uwp.Tests.csproj | 4 ++-- tests/Legerity.WCT.Tests/Legerity.WCT.Tests.csproj | 4 ++-- tests/Legerity.Web.Tests/Legerity.Web.Tests.csproj | 4 ++-- tests/Legerity.WinUI.Tests/Legerity.WinUI.Tests.csproj | 4 ++-- tests/Legerity.Windows.Tests/Legerity.Windows.Tests.csproj | 4 ++-- .../Legerity.PageObjectGenerator.csproj | 2 +- tools/Legerity.Templates/Legerity.Templates.csproj | 2 +- .../Legerity.Templates.Android.NUnit.csproj | 4 ++-- .../Legerity.Templates.CrossPlatform.NUnit.csproj | 4 ++-- .../Legerity.Templates.IOS.NUnit.csproj | 4 ++-- .../Legerity.Templates.Web.NUnit.csproj | 4 ++-- .../Legerity.Templates.Windows.NUnit.csproj | 4 ++-- 28 files changed, 55 insertions(+), 55 deletions(-) diff --git a/samples/AndroidCoreSamples/AndroidCoreSamples.csproj b/samples/AndroidCoreSamples/AndroidCoreSamples.csproj index 1cde6b97..1849fad8 100644 --- a/samples/AndroidCoreSamples/AndroidCoreSamples.csproj +++ b/samples/AndroidCoreSamples/AndroidCoreSamples.csproj @@ -1,13 +1,13 @@ - net6.0 + net6.0;net7.0;net8.0 false - + diff --git a/samples/MADESampleApp/MADESampleApp.csproj b/samples/MADESampleApp/MADESampleApp.csproj index 036ca2c6..3b75f0e0 100644 --- a/samples/MADESampleApp/MADESampleApp.csproj +++ b/samples/MADESampleApp/MADESampleApp.csproj @@ -1,13 +1,13 @@ - net6.0 + net6.0;net7.0;net8.0 false - + diff --git a/samples/TelerikUwpSdkSample/TelerikUwpSdkSample.csproj b/samples/TelerikUwpSdkSample/TelerikUwpSdkSample.csproj index 9e241614..d592207f 100644 --- a/samples/TelerikUwpSdkSample/TelerikUwpSdkSample.csproj +++ b/samples/TelerikUwpSdkSample/TelerikUwpSdkSample.csproj @@ -1,13 +1,13 @@ - net6.0 + net6.0;net7.0;net8.0 false - + diff --git a/samples/WindowsCommunityToolkitSampleApp/WindowsCommunityToolkitSampleApp.csproj b/samples/WindowsCommunityToolkitSampleApp/WindowsCommunityToolkitSampleApp.csproj index 4b9ef814..73fb15f2 100644 --- a/samples/WindowsCommunityToolkitSampleApp/WindowsCommunityToolkitSampleApp.csproj +++ b/samples/WindowsCommunityToolkitSampleApp/WindowsCommunityToolkitSampleApp.csproj @@ -1,13 +1,13 @@ - net6.0 + net6.0;net7.0;net8.0 false - + diff --git a/src/Legerity.Android/Legerity.Android.csproj b/src/Legerity.Android/Legerity.Android.csproj index ea829332..fade1d98 100644 --- a/src/Legerity.Android/Legerity.Android.csproj +++ b/src/Legerity.Android/Legerity.Android.csproj @@ -1,7 +1,7 @@ - netstandard2.0 + net6.0;net7.0;net8.0 true Legerity for Android - Framework for UI testing with Selenium/Appium @@ -22,7 +22,7 @@ - + diff --git a/src/Legerity.Core/Legerity.Core.csproj b/src/Legerity.Core/Legerity.Core.csproj index 58c7bc83..ede6f67e 100644 --- a/src/Legerity.Core/Legerity.Core.csproj +++ b/src/Legerity.Core/Legerity.Core.csproj @@ -1,7 +1,7 @@ - netstandard2.0 + net6.0;net7.0;net8.0 true Legerity Core - Framework for UI testing with Selenium/Appium @@ -16,8 +16,8 @@ - - + + diff --git a/src/Legerity.IOS/Legerity.IOS.csproj b/src/Legerity.IOS/Legerity.IOS.csproj index a3c82821..e0d8a757 100644 --- a/src/Legerity.IOS/Legerity.IOS.csproj +++ b/src/Legerity.IOS/Legerity.IOS.csproj @@ -1,7 +1,7 @@ - netstandard2.0 + net6.0;net7.0;net8.0 true Legerity for iOS - Framework for UI testing with Selenium/Appium @@ -12,7 +12,7 @@ - + diff --git a/src/Legerity.MADE/Legerity.MADE.csproj b/src/Legerity.MADE/Legerity.MADE.csproj index e9e078b0..da670834 100644 --- a/src/Legerity.MADE/Legerity.MADE.csproj +++ b/src/Legerity.MADE/Legerity.MADE.csproj @@ -1,7 +1,7 @@ - netstandard2.0 + net6.0;net7.0;net8.0 true Legerity for MADE.NET - Framework for UI tests with Selenium/Appium @@ -14,7 +14,7 @@ - + diff --git a/src/Legerity.Telerik.Uwp/Legerity.Telerik.Uwp.csproj b/src/Legerity.Telerik.Uwp/Legerity.Telerik.Uwp.csproj index 2383448a..c763d0e3 100644 --- a/src/Legerity.Telerik.Uwp/Legerity.Telerik.Uwp.csproj +++ b/src/Legerity.Telerik.Uwp/Legerity.Telerik.Uwp.csproj @@ -1,7 +1,7 @@ - netstandard2.0 + net6.0;net7.0;net8.0 true Legerity for Telerik for UWP - Framework for UI tests with Selenium/Appium @@ -16,7 +16,7 @@ - + diff --git a/src/Legerity.WCT/Legerity.WCT.csproj b/src/Legerity.WCT/Legerity.WCT.csproj index 7c194588..1f6e1d09 100644 --- a/src/Legerity.WCT/Legerity.WCT.csproj +++ b/src/Legerity.WCT/Legerity.WCT.csproj @@ -1,7 +1,7 @@ - netstandard2.0 + net6.0;net7.0;net8.0 true Legerity for Windows Community Toolkit - Framework for UI tests with Selenium/Appium @@ -15,7 +15,7 @@ - + diff --git a/src/Legerity.Web.Authentication/Legerity.Web.Authentication.csproj b/src/Legerity.Web.Authentication/Legerity.Web.Authentication.csproj index 6419ba18..b5927232 100644 --- a/src/Legerity.Web.Authentication/Legerity.Web.Authentication.csproj +++ b/src/Legerity.Web.Authentication/Legerity.Web.Authentication.csproj @@ -1,7 +1,7 @@ - netstandard2.0 + net6.0;net7.0;net8.0 true Legerity for Web Authentication - Framework for UI testing with Selenium/Appium @@ -11,7 +11,7 @@ - + diff --git a/src/Legerity.Web/Legerity.Web.csproj b/src/Legerity.Web/Legerity.Web.csproj index e405f378..88abe8ee 100644 --- a/src/Legerity.Web/Legerity.Web.csproj +++ b/src/Legerity.Web/Legerity.Web.csproj @@ -1,7 +1,7 @@ - netstandard2.0 + net6.0;net7.0;net8.0 true Legerity for Web - Framework for UI testing with Selenium/Appium @@ -24,7 +24,7 @@ - + diff --git a/src/Legerity.WinUI/Legerity.WinUI.csproj b/src/Legerity.WinUI/Legerity.WinUI.csproj index a2c9aab2..9d7c2b89 100644 --- a/src/Legerity.WinUI/Legerity.WinUI.csproj +++ b/src/Legerity.WinUI/Legerity.WinUI.csproj @@ -1,7 +1,7 @@ - netstandard2.0 + net6.0;net7.0;net8.0 true Legerity for WinUI - Framework for UI tests with Selenium/Appium @@ -18,7 +18,7 @@ - + diff --git a/src/Legerity.Windows/Legerity.Windows.csproj b/src/Legerity.Windows/Legerity.Windows.csproj index 003bec6b..7f5de98d 100644 --- a/src/Legerity.Windows/Legerity.Windows.csproj +++ b/src/Legerity.Windows/Legerity.Windows.csproj @@ -1,7 +1,7 @@ - netstandard2.0 + net6.0;net7.0;net8.0 true Legerity for Windows - Framework for UI testing with Selenium/Appium @@ -42,7 +42,7 @@ - + diff --git a/src/Legerity/Legerity.csproj b/src/Legerity/Legerity.csproj index b16af06e..df23df5e 100644 --- a/src/Legerity/Legerity.csproj +++ b/src/Legerity/Legerity.csproj @@ -1,7 +1,7 @@ - netstandard2.0 + net6.0;net7.0;net8.0 true Legerity - Framework for UI testing with Selenium/Appium @@ -16,7 +16,7 @@ - + diff --git a/tests/Legerity.Core.Tests/Legerity.Core.Tests.csproj b/tests/Legerity.Core.Tests/Legerity.Core.Tests.csproj index a1534071..5d1785f6 100644 --- a/tests/Legerity.Core.Tests/Legerity.Core.Tests.csproj +++ b/tests/Legerity.Core.Tests/Legerity.Core.Tests.csproj @@ -1,12 +1,12 @@ - net6.0 + net6.0;net7.0;net8.0 false - + diff --git a/tests/Legerity.Telerik.Uwp.Tests/Legerity.Telerik.Uwp.Tests.csproj b/tests/Legerity.Telerik.Uwp.Tests/Legerity.Telerik.Uwp.Tests.csproj index 1e486107..63451261 100644 --- a/tests/Legerity.Telerik.Uwp.Tests/Legerity.Telerik.Uwp.Tests.csproj +++ b/tests/Legerity.Telerik.Uwp.Tests/Legerity.Telerik.Uwp.Tests.csproj @@ -1,12 +1,12 @@ - net6.0 + net6.0;net7.0;net8.0 false - + diff --git a/tests/Legerity.WCT.Tests/Legerity.WCT.Tests.csproj b/tests/Legerity.WCT.Tests/Legerity.WCT.Tests.csproj index dcd3103e..7b78018a 100644 --- a/tests/Legerity.WCT.Tests/Legerity.WCT.Tests.csproj +++ b/tests/Legerity.WCT.Tests/Legerity.WCT.Tests.csproj @@ -1,12 +1,12 @@ - net6.0 + net6.0;net7.0;net8.0 false - + diff --git a/tests/Legerity.Web.Tests/Legerity.Web.Tests.csproj b/tests/Legerity.Web.Tests/Legerity.Web.Tests.csproj index a1534071..5d1785f6 100644 --- a/tests/Legerity.Web.Tests/Legerity.Web.Tests.csproj +++ b/tests/Legerity.Web.Tests/Legerity.Web.Tests.csproj @@ -1,12 +1,12 @@ - net6.0 + net6.0;net7.0;net8.0 false - + diff --git a/tests/Legerity.WinUI.Tests/Legerity.WinUI.Tests.csproj b/tests/Legerity.WinUI.Tests/Legerity.WinUI.Tests.csproj index 10186d62..844e386f 100644 --- a/tests/Legerity.WinUI.Tests/Legerity.WinUI.Tests.csproj +++ b/tests/Legerity.WinUI.Tests/Legerity.WinUI.Tests.csproj @@ -1,12 +1,12 @@ - net6.0 + net6.0;net7.0;net8.0 false - + diff --git a/tests/Legerity.Windows.Tests/Legerity.Windows.Tests.csproj b/tests/Legerity.Windows.Tests/Legerity.Windows.Tests.csproj index 10186d62..844e386f 100644 --- a/tests/Legerity.Windows.Tests/Legerity.Windows.Tests.csproj +++ b/tests/Legerity.Windows.Tests/Legerity.Windows.Tests.csproj @@ -1,12 +1,12 @@ - net6.0 + net6.0;net7.0;net8.0 false - + diff --git a/tools/Legerity.PageObjectGenerator/Legerity.PageObjectGenerator.csproj b/tools/Legerity.PageObjectGenerator/Legerity.PageObjectGenerator.csproj index 0299ab26..077f1eaa 100644 --- a/tools/Legerity.PageObjectGenerator/Legerity.PageObjectGenerator.csproj +++ b/tools/Legerity.PageObjectGenerator/Legerity.PageObjectGenerator.csproj @@ -3,7 +3,7 @@ true Exe - net6.0 + net6.0;net7.0;net8.0 enable enable true diff --git a/tools/Legerity.Templates/Legerity.Templates.csproj b/tools/Legerity.Templates/Legerity.Templates.csproj index c8a4e727..520cfc98 100644 --- a/tools/Legerity.Templates/Legerity.Templates.csproj +++ b/tools/Legerity.Templates/Legerity.Templates.csproj @@ -2,7 +2,7 @@ Template - netstandard2.0 + net6.0;net7.0;net8.0 true Legerity Test Project Templates - Framework for UI testing with Selenium/Appium diff --git a/tools/Legerity.Templates/templates/Legerity.Templates.Android.NUnit/Legerity.Templates.Android.NUnit.csproj b/tools/Legerity.Templates/templates/Legerity.Templates.Android.NUnit/Legerity.Templates.Android.NUnit.csproj index 4c8f8dfb..efa8cc8a 100644 --- a/tools/Legerity.Templates/templates/Legerity.Templates.Android.NUnit/Legerity.Templates.Android.NUnit.csproj +++ b/tools/Legerity.Templates/templates/Legerity.Templates.Android.NUnit/Legerity.Templates.Android.NUnit.csproj @@ -1,12 +1,12 @@ - net6.0 + net6.0;net7.0;net8.0 false - + diff --git a/tools/Legerity.Templates/templates/Legerity.Templates.CrossPlatform.NUnit/Legerity.Templates.CrossPlatform.NUnit.csproj b/tools/Legerity.Templates/templates/Legerity.Templates.CrossPlatform.NUnit/Legerity.Templates.CrossPlatform.NUnit.csproj index e8f03c9f..baa1bcbd 100644 --- a/tools/Legerity.Templates/templates/Legerity.Templates.CrossPlatform.NUnit/Legerity.Templates.CrossPlatform.NUnit.csproj +++ b/tools/Legerity.Templates/templates/Legerity.Templates.CrossPlatform.NUnit/Legerity.Templates.CrossPlatform.NUnit.csproj @@ -1,12 +1,12 @@ - net6.0 + net6.0;net7.0;net8.0 false - + diff --git a/tools/Legerity.Templates/templates/Legerity.Templates.IOS.NUnit/Legerity.Templates.IOS.NUnit.csproj b/tools/Legerity.Templates/templates/Legerity.Templates.IOS.NUnit/Legerity.Templates.IOS.NUnit.csproj index 486082e2..99d2cae5 100644 --- a/tools/Legerity.Templates/templates/Legerity.Templates.IOS.NUnit/Legerity.Templates.IOS.NUnit.csproj +++ b/tools/Legerity.Templates/templates/Legerity.Templates.IOS.NUnit/Legerity.Templates.IOS.NUnit.csproj @@ -1,12 +1,12 @@ - net6.0 + net6.0;net7.0;net8.0 false - + diff --git a/tools/Legerity.Templates/templates/Legerity.Templates.Web.NUnit/Legerity.Templates.Web.NUnit.csproj b/tools/Legerity.Templates/templates/Legerity.Templates.Web.NUnit/Legerity.Templates.Web.NUnit.csproj index 003f0d6f..7c56cc4c 100644 --- a/tools/Legerity.Templates/templates/Legerity.Templates.Web.NUnit/Legerity.Templates.Web.NUnit.csproj +++ b/tools/Legerity.Templates/templates/Legerity.Templates.Web.NUnit/Legerity.Templates.Web.NUnit.csproj @@ -1,12 +1,12 @@  - net6.0 + net6.0;net7.0;net8.0 false - + diff --git a/tools/Legerity.Templates/templates/Legerity.Templates.Windows.NUnit/Legerity.Templates.Windows.NUnit.csproj b/tools/Legerity.Templates/templates/Legerity.Templates.Windows.NUnit/Legerity.Templates.Windows.NUnit.csproj index f45c3680..ac494b0c 100644 --- a/tools/Legerity.Templates/templates/Legerity.Templates.Windows.NUnit/Legerity.Templates.Windows.NUnit.csproj +++ b/tools/Legerity.Templates/templates/Legerity.Templates.Windows.NUnit/Legerity.Templates.Windows.NUnit.csproj @@ -1,12 +1,12 @@  - net6.0 + net6.0;net7.0;net8.0 false - + From 1e2291c5d95d9e26db48f5003bc78484f51b1ec9 Mon Sep 17 00:00:00 2001 From: James Croft Date: Mon, 4 Mar 2024 20:14:41 +0000 Subject: [PATCH 02/21] Fix Opera references to Chromium --- src/Legerity.Core/AppManager.cs | 10 ++++------ src/Legerity.Core/GlobalUsings.cs | 4 ++++ src/Legerity.Core/Web/WebAppDriverType.cs | 3 +++ 3 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 src/Legerity.Core/GlobalUsings.cs diff --git a/src/Legerity.Core/AppManager.cs b/src/Legerity.Core/AppManager.cs index 98ca141d..95a6516e 100644 --- a/src/Legerity.Core/AppManager.cs +++ b/src/Legerity.Core/AppManager.cs @@ -18,7 +18,6 @@ namespace Legerity; using OpenQA.Selenium.Edge; using OpenQA.Selenium.Firefox; using OpenQA.Selenium.IE; -using OpenQA.Selenium.Opera; using OpenQA.Selenium.Remote; using OpenQA.Selenium.Safari; @@ -130,9 +129,9 @@ public static RemoteWebDriver StartApp( WebAppDriverType.Firefox => new FirefoxDriver( webOpts.DriverUri, webOpts.DriverOptions as FirefoxOptions ?? new FirefoxOptions()), - WebAppDriverType.Opera => new OperaDriver( + WebAppDriverType.Opera => new ChromeDriver( webOpts.DriverUri, - webOpts.DriverOptions as OperaOptions ?? new OperaOptions()), + webOpts.DriverOptions as ChromeOptions ?? new ChromeOptions()), WebAppDriverType.Safari => new SafariDriver( webOpts.DriverUri, webOpts.DriverOptions as SafariOptions ?? new SafariOptions()), @@ -142,10 +141,9 @@ public static RemoteWebDriver StartApp( WebAppDriverType.InternetExplorer => new InternetExplorerDriver( webOpts.DriverUri, webOpts.DriverOptions as InternetExplorerOptions ?? new InternetExplorerOptions()), - WebAppDriverType.EdgeChromium => new Microsoft.Edge.SeleniumTools.EdgeDriver( + WebAppDriverType.EdgeChromium => new EdgeDriver( webOpts.DriverUri, - webOpts.DriverOptions as Microsoft.Edge.SeleniumTools.EdgeOptions ?? - new Microsoft.Edge.SeleniumTools.EdgeOptions { UseChromium = true }), + webOpts.DriverOptions as EdgeOptions ?? new EdgeOptions()), _ => null }; diff --git a/src/Legerity.Core/GlobalUsings.cs b/src/Legerity.Core/GlobalUsings.cs new file mode 100644 index 00000000..62ca2f56 --- /dev/null +++ b/src/Legerity.Core/GlobalUsings.cs @@ -0,0 +1,4 @@ +// Global using directives + +global using OpenQA.Selenium; +global using OpenQA.Selenium.Remote; diff --git a/src/Legerity.Core/Web/WebAppDriverType.cs b/src/Legerity.Core/Web/WebAppDriverType.cs index 3a118e7f..a02240d5 100644 --- a/src/Legerity.Core/Web/WebAppDriverType.cs +++ b/src/Legerity.Core/Web/WebAppDriverType.cs @@ -1,5 +1,7 @@ namespace Legerity.Web; +using System; + /// /// Defines the values associated with the web app driver type. /// @@ -43,5 +45,6 @@ public enum WebAppDriverType /// /// Edge Chromium. Setting this will cause the application driver to launch for Microsoft's Chromium Edge. /// + [Obsolete("Use Edge instead. This will be removed in a future release.")] EdgeChromium, } \ No newline at end of file From 7103de60ae25cf2acf3d368a6d2ab84babab31da Mon Sep 17 00:00:00 2001 From: James Croft Date: Mon, 4 Mar 2024 21:04:00 +0000 Subject: [PATCH 03/21] Fix Core project --- .../Android/AndroidAppManagerOptions.cs | 15 +++--- src/Legerity.Core/AppManager.cs | 32 ++++++----- src/Legerity.Core/AppManagerOptions.cs | 1 - src/Legerity.Core/AppiumManagerOptions.cs | 2 +- src/Legerity.Core/ByAll.cs | 1 - src/Legerity.Core/ByExtras.cs | 2 - src/Legerity.Core/ByNested.cs | 1 - ...apper`1.cs => ElementWrapper{TElement}.cs} | 11 ++-- .../Exceptions/ElementNotShownException.cs | 7 --- .../Exceptions/ElementShownException.cs | 7 --- .../Extensions/AttributeExtensions.cs | 5 +- .../Extensions/DriverExtensions.cs | 46 +++++++++++----- .../Extensions/ElementExtensions.cs | 22 ++++---- .../Extensions/ElementWrapperExtensions.cs | 10 ++-- .../Extensions/InteractionExtensions.cs | 14 +++-- .../Extensions/PageExtensions.cs | 1 - .../Helpers/WaitUntilConditions.cs | 1 - ...rapper.cs => IElementWrapper{TElement}.cs} | 1 - src/Legerity.Core/IOS/IOSAppManagerOptions.cs | 12 ++--- src/Legerity.Core/LegerityTestClass.cs | 20 ++++--- src/Legerity.Core/Pages/BasePage.cs | 54 +++++++++---------- .../Windows/WindowsAppManagerOptions.cs | 2 +- 22 files changed, 122 insertions(+), 145 deletions(-) rename src/Legerity.Core/{ElementWrapper`1.cs => ElementWrapper{TElement}.cs} (96%) rename src/Legerity.Core/{IElementWrapper.cs => IElementWrapper{TElement}.cs} (99%) diff --git a/src/Legerity.Core/Android/AndroidAppManagerOptions.cs b/src/Legerity.Core/Android/AndroidAppManagerOptions.cs index 29d2d5fc..dafc1501 100644 --- a/src/Legerity.Core/Android/AndroidAppManagerOptions.cs +++ b/src/Legerity.Core/Android/AndroidAppManagerOptions.cs @@ -1,6 +1,5 @@ namespace Legerity.Android; -using System; using System.Collections.Generic; using OpenQA.Selenium.Appium; using OpenQA.Selenium.Appium.Enums; @@ -164,36 +163,36 @@ public override void Configure() { base.Configure(); - this.AppiumOptions.AddAdditionalCapability(MobileCapabilityType.PlatformName, "Android"); + this.AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.PlatformName, "Android"); if (!string.IsNullOrWhiteSpace(this.OSVersion)) { - this.AppiumOptions.AddAdditionalCapability(MobileCapabilityType.PlatformVersion, this.OSVersion); + this.AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.PlatformVersion, this.OSVersion); } if (!string.IsNullOrWhiteSpace(this.DeviceName)) { - this.AppiumOptions.AddAdditionalCapability(MobileCapabilityType.DeviceName, this.DeviceName); + this.AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.DeviceName, this.DeviceName); } if (!string.IsNullOrWhiteSpace(this.DeviceId)) { - this.AppiumOptions.AddAdditionalCapability(MobileCapabilityType.Udid, this.DeviceId); + this.AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.Udid, this.DeviceId); } if (!string.IsNullOrWhiteSpace(this.AppId)) { - this.AppiumOptions.AddAdditionalCapability("appPackage", this.AppId); + this.AppiumOptions.AddAdditionalAppiumOption("appPackage", this.AppId); } if (!string.IsNullOrWhiteSpace(this.AppActivity)) { - this.AppiumOptions.AddAdditionalCapability("appActivity", this.AppActivity); + this.AppiumOptions.AddAdditionalAppiumOption("appActivity", this.AppActivity); } if (!string.IsNullOrWhiteSpace(this.AppPath)) { - this.AppiumOptions.AddAdditionalCapability("app", this.AppPath); + this.AppiumOptions.AddAdditionalAppiumOption("app", this.AppPath); } } diff --git a/src/Legerity.Core/AppManager.cs b/src/Legerity.Core/AppManager.cs index 95a6516e..0f465eef 100644 --- a/src/Legerity.Core/AppManager.cs +++ b/src/Legerity.Core/AppManager.cs @@ -10,7 +10,6 @@ namespace Legerity; using Legerity.Web; using Legerity.Windows; using Legerity.Windows.Helpers; -using OpenQA.Selenium; using OpenQA.Selenium.Appium.Android; using OpenQA.Selenium.Appium.iOS; using OpenQA.Selenium.Appium.Windows; @@ -18,7 +17,6 @@ namespace Legerity; using OpenQA.Selenium.Edge; using OpenQA.Selenium.Firefox; using OpenQA.Selenium.IE; -using OpenQA.Selenium.Remote; using OpenQA.Selenium.Safari; /// @@ -26,7 +24,7 @@ namespace Legerity; /// public static class AppManager { - private static readonly List StartedApps = new(); + private static readonly List StartedApps = new(); /// /// Gets the instance of the started Windows application. @@ -34,7 +32,7 @@ public static class AppManager /// /// This instance should not be used in parallelized test runs. Instead, use the instance returned by the method. /// - public static WindowsDriver WindowsApp => App as WindowsDriver; + public static WindowsDriver WindowsApp => App as WindowsDriver; /// /// Gets the instance of the started Android application. @@ -42,7 +40,7 @@ public static class AppManager /// /// This instance should not be used in parallelized test runs. Instead, use the instance returned by the method. /// - public static AndroidDriver AndroidApp => App as AndroidDriver; + public static AndroidDriver AndroidApp => App as AndroidDriver; /// /// Gets the instance of the started iOS application. @@ -50,7 +48,7 @@ public static class AppManager /// /// This instance should not be used in parallelized test runs. Instead, use the instance returned by the method. /// - public static IOSDriver IOSApp => App as IOSDriver; + public static IOSDriver IOSApp => App as IOSDriver; /// /// Gets the instance of the started web application. @@ -58,23 +56,23 @@ public static class AppManager /// /// This instance should not be used in parallelized test runs. Instead, use the instance returned by the method. /// - public static RemoteWebDriver WebApp => App; + public static WebDriver WebApp => App; /// /// Gets or sets the instance of the started application. /// - /// This could be a , , , or web driver. + /// This could be a , , , or web driver. /// /// /// /// This instance should not be used in parallelized test runs. Instead, use the instance returned by the method. /// - public static RemoteWebDriver App { get; set; } + public static WebDriver App { get; set; } /// /// Gets the instances of started applications. /// - public static IReadOnlyCollection Apps => StartedApps; + public static IReadOnlyCollection Apps => StartedApps; /// /// Starts the application ready for testing. @@ -102,13 +100,13 @@ public static class AppManager /// - The WinAppDriver could not be found when running with true. /// - The WinAppDriver failed to load when running with true. /// - public static RemoteWebDriver StartApp( + public static WebDriver StartApp( AppManagerOptions opts, Func waitUntil = default, TimeSpan? waitUntilTimeout = default, int waitUntilRetries = 0) { - RemoteWebDriver app = null; + WebDriver app = null; if (opts is AppiumManagerOptions appiumOpts) { @@ -169,7 +167,7 @@ public static RemoteWebDriver StartApp( WinAppDriverHelper.Run(); } - app = new WindowsDriver( + app = new WindowsDriver( new Uri(winOpts.DriverUri), winOpts.AppiumOptions); @@ -190,7 +188,7 @@ public static RemoteWebDriver StartApp( AppiumServerHelper.Run(); } - app = new AndroidDriver( + app = new AndroidDriver( new Uri(androidOpts.DriverUri), androidOpts.AppiumOptions); @@ -205,7 +203,7 @@ public static RemoteWebDriver StartApp( AppiumServerHelper.Run(); } - app = new IOSDriver(new Uri(iosOpts.DriverUri), iosOpts.AppiumOptions); + app = new IOSDriver(new Uri(iosOpts.DriverUri), iosOpts.AppiumOptions); VerifyAppDriver(app, iosOpts); break; @@ -259,7 +257,7 @@ public static void StopApp(bool stopServer = true) /// /// An optional value indicating whether to stop the running Appium or WinAppDriver server. Default, false. /// - public static void StopApp(RemoteWebDriver app, bool stopServer = false) + public static void StopApp(WebDriver app, bool stopServer = false) { app?.Quit(); StartedApps.Remove(app); @@ -283,7 +281,7 @@ public static void StopApps() } /// Thrown when the driver could not be verified. - private static void VerifyAppDriver(RemoteWebDriver app, AppManagerOptions opts) + private static void VerifyAppDriver(WebDriver app, AppManagerOptions opts) { if (app?.SessionId == null) { diff --git a/src/Legerity.Core/AppManagerOptions.cs b/src/Legerity.Core/AppManagerOptions.cs index 9659f3aa..bb883cdf 100644 --- a/src/Legerity.Core/AppManagerOptions.cs +++ b/src/Legerity.Core/AppManagerOptions.cs @@ -1,7 +1,6 @@ namespace Legerity; using System; -using OpenQA.Selenium; /// /// Defines a base model that represents configuration options for the . diff --git a/src/Legerity.Core/AppiumManagerOptions.cs b/src/Legerity.Core/AppiumManagerOptions.cs index 5da86e58..d7d14df5 100644 --- a/src/Legerity.Core/AppiumManagerOptions.cs +++ b/src/Legerity.Core/AppiumManagerOptions.cs @@ -39,7 +39,7 @@ public virtual void Configure() foreach ((string capabilityName, object capabilityValue) in this.AdditionalOptions) { - this.AppiumOptions.AddAdditionalCapability(capabilityName, capabilityValue); + this.AppiumOptions.AddAdditionalAppiumOption(capabilityName, capabilityValue); } } } \ No newline at end of file diff --git a/src/Legerity.Core/ByAll.cs b/src/Legerity.Core/ByAll.cs index 6dc54a09..df79708f 100644 --- a/src/Legerity.Core/ByAll.cs +++ b/src/Legerity.Core/ByAll.cs @@ -3,7 +3,6 @@ namespace Legerity; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; -using OpenQA.Selenium; /// /// Defines a locator that can be used to find all elements that match all locators in sequence. diff --git a/src/Legerity.Core/ByExtras.cs b/src/Legerity.Core/ByExtras.cs index 6c5dfd60..aaa46601 100644 --- a/src/Legerity.Core/ByExtras.cs +++ b/src/Legerity.Core/ByExtras.cs @@ -1,7 +1,5 @@ namespace Legerity; -using OpenQA.Selenium; - /// /// Defines a collection of extra locator constraints for . /// diff --git a/src/Legerity.Core/ByNested.cs b/src/Legerity.Core/ByNested.cs index dbe0ad4c..49704489 100644 --- a/src/Legerity.Core/ByNested.cs +++ b/src/Legerity.Core/ByNested.cs @@ -3,7 +3,6 @@ namespace Legerity; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; -using OpenQA.Selenium; /// /// Defines a locator that can be used to find elements using a sequence of locators that are continuously nested until the final locator is run. diff --git a/src/Legerity.Core/ElementWrapper`1.cs b/src/Legerity.Core/ElementWrapper{TElement}.cs similarity index 96% rename from src/Legerity.Core/ElementWrapper`1.cs rename to src/Legerity.Core/ElementWrapper{TElement}.cs index e86c5d1b..e66a5d7b 100644 --- a/src/Legerity.Core/ElementWrapper`1.cs +++ b/src/Legerity.Core/ElementWrapper{TElement}.cs @@ -3,19 +3,16 @@ namespace Legerity; using System; using Legerity.Exceptions; - -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; using OpenQA.Selenium.Support.UI; /// /// Defines a base wrapper for elements to expose platform element logic. /// /// -/// The type of . +/// The type of . /// public abstract class ElementWrapper : IElementWrapper - where TElement : AppiumWebElement + where TElement : WebElement { private readonly WeakReference elementReference; @@ -81,9 +78,9 @@ public string GetAttribute(string attributeName) /// The locator to find a child element by. /// The . /// Thrown when no element matches the expected locator. - public AppiumWebElement FindElement(By locator) + public WebElement FindElement(By locator) { - return this.Element.FindElement(locator); + return this.Element.FindElement(locator) as WebElement; } /// diff --git a/src/Legerity.Core/Exceptions/ElementNotShownException.cs b/src/Legerity.Core/Exceptions/ElementNotShownException.cs index f4552a01..c233efe4 100644 --- a/src/Legerity.Core/Exceptions/ElementNotShownException.cs +++ b/src/Legerity.Core/Exceptions/ElementNotShownException.cs @@ -28,7 +28,6 @@ public ElementNotShownException(string locator) public ElementNotShownException(string locator, Exception innerException) : base($"No element could be located using locator: {locator}", innerException) { - this.ElementName = locator; this.Locator = locator; } @@ -36,10 +35,4 @@ public ElementNotShownException(string locator, Exception innerException) /// Gets the locator used to locate the element. /// public string Locator { get; } - - /// - /// Gets the name of the element that was not shown. - /// - [Obsolete("ElementName will be removed in a future major release. Please use the Locator instead.")] - public string ElementName { get; } } \ No newline at end of file diff --git a/src/Legerity.Core/Exceptions/ElementShownException.cs b/src/Legerity.Core/Exceptions/ElementShownException.cs index bd1fcec3..bdb44c2a 100644 --- a/src/Legerity.Core/Exceptions/ElementShownException.cs +++ b/src/Legerity.Core/Exceptions/ElementShownException.cs @@ -28,7 +28,6 @@ public ElementShownException(string locator) public ElementShownException(string locator, Exception innerException) : base($"An element was located using locator: {locator}", innerException) { - this.ElementName = locator; this.Locator = locator; } @@ -36,10 +35,4 @@ public ElementShownException(string locator, Exception innerException) /// Gets the locator used to locate the element. /// public string Locator { get; } - - /// - /// Gets the name of the element that was shown. - /// - [Obsolete("ElementName will be removed in a future major release. Please use the Locator instead.")] - public string ElementName { get; } } \ No newline at end of file diff --git a/src/Legerity.Core/Extensions/AttributeExtensions.cs b/src/Legerity.Core/Extensions/AttributeExtensions.cs index bba328dd..c7df02fa 100644 --- a/src/Legerity.Core/Extensions/AttributeExtensions.cs +++ b/src/Legerity.Core/Extensions/AttributeExtensions.cs @@ -1,8 +1,5 @@ namespace Legerity.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; - /// /// Defines a collection of extensions for retrieving element attributes. /// @@ -23,7 +20,7 @@ public static string GetName(this IWebElement element) /// Retrieves the Name attribute from the specified element. /// /// - /// The type of . + /// The type of . /// /// The to retrieve a Name from. /// The Name of the element. diff --git a/src/Legerity.Core/Extensions/DriverExtensions.cs b/src/Legerity.Core/Extensions/DriverExtensions.cs index 404d32a4..395bc121 100644 --- a/src/Legerity.Core/Extensions/DriverExtensions.cs +++ b/src/Legerity.Core/Extensions/DriverExtensions.cs @@ -3,8 +3,6 @@ namespace Legerity.Extensions; using System; using System.Collections.ObjectModel; using System.Linq; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; using OpenQA.Selenium.Support.UI; /// @@ -17,11 +15,11 @@ public static class DriverExtensions /// /// The remote web driver. /// The locator to find the element. - /// A . + /// A . /// Thrown when no element matches the expected locator. - public static RemoteWebElement FindWebElement(this RemoteWebDriver driver, By locator) + public static WebElement FindWebElement(this WebDriver driver, By locator) { - return driver.FindElement(locator) as RemoteWebElement; + return driver.FindElement(locator) as WebElement; } /// @@ -29,10 +27,10 @@ public static RemoteWebElement FindWebElement(this RemoteWebDriver driver, By lo /// /// The remote web driver. /// The locator to find the elements. - /// A readonly collection of . - public static ReadOnlyCollection FindWebElements(this RemoteWebDriver driver, By locator) + /// A readonly collection of . + public static ReadOnlyCollection FindWebElements(this WebDriver driver, By locator) { - return driver.FindElements(locator).Cast().ToList().AsReadOnly(); + return driver.FindElements(locator).Cast().ToList().AsReadOnly(); } /// @@ -42,7 +40,7 @@ public static ReadOnlyCollection FindWebElements(this RemoteWe /// The text to find. /// A . /// Thrown when no element matches the expected locator. - public static IWebElement FindElementByText(this RemoteWebDriver driver, string text) + public static IWebElement FindElementByText(this WebDriver driver, string text) { return driver.FindElement(ByExtras.Text(text)); } @@ -53,7 +51,7 @@ public static IWebElement FindElementByText(this RemoteWebDriver driver, string /// The remote web driver. /// The text to find. /// A readonly collection of . - public static ReadOnlyCollection FindElementsByText(this RemoteWebDriver driver, string text) + public static ReadOnlyCollection FindElementsByText(this WebDriver driver, string text) { return driver.FindElements(ByExtras.Text(text)); } @@ -65,7 +63,7 @@ public static ReadOnlyCollection FindElementsByText(this RemoteWebD /// The partial text to find. /// A . /// Thrown when no element matches the expected locator. - public static IWebElement FindElementByPartialText(this RemoteWebDriver driver, string text) + public static IWebElement FindElementByPartialText(this WebDriver driver, string text) { return driver.FindElement(ByExtras.PartialText(text)); } @@ -77,7 +75,7 @@ public static IWebElement FindElementByPartialText(this RemoteWebDriver driver, /// The partial text to find. /// A readonly collection of . public static ReadOnlyCollection FindElementsByPartialText( - this RemoteWebDriver driver, + this WebDriver driver, string text) { return driver.FindElements(ByExtras.PartialText(text)); @@ -88,7 +86,7 @@ public static ReadOnlyCollection FindElementsByPartialText( /// /// The remote web driver. /// A readonly collection of . - public static ReadOnlyCollection GetAllElements(this RemoteWebDriver driver) + public static ReadOnlyCollection GetAllElements(this WebDriver driver) { return driver.FindElements(By.XPath("//*")); } @@ -98,7 +96,7 @@ public static ReadOnlyCollection GetAllElements(this RemoteWebDrive /// /// The remote web driver. /// A readonly collection of . - public static ReadOnlyCollection GetAllChildElements(this RemoteWebDriver driver) + public static ReadOnlyCollection GetAllChildElements(this WebDriver driver) { return driver.FindElements(By.XPath(".//*")); } @@ -163,4 +161,24 @@ public static TResult WaitUntil( return WaitUntil(appDriver, condition, timeout, retries - 1); } } + + public static WebElement FindElementByXPath(this WebDriver driver, string xpath) + { + return driver.FindElement(By.XPath(xpath)) as WebElement; + } + + public static ReadOnlyCollection FindElementsByXPath(this WebDriver driver, string xpath) + { + return driver.FindElements(By.XPath(xpath)).Cast().ToList().AsReadOnly(); + } + + public static WebElement FindElementById(this WebDriver driver, string id) + { + return driver.FindElement(By.Id(id)) as WebElement; + } + + 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 a547237b..d8a06b96 100644 --- a/src/Legerity.Core/Extensions/ElementExtensions.cs +++ b/src/Legerity.Core/Extensions/ElementExtensions.cs @@ -4,8 +4,6 @@ namespace Legerity.Extensions; using System.Collections.ObjectModel; using System.Drawing; using System.Linq; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; using OpenQA.Selenium.Support.UI; /// @@ -31,11 +29,11 @@ public static Rectangle GetBoundingRect(this IWebElement element) /// /// The remote web element. /// The locator to find the element. - /// A . + /// A . /// Thrown when no element matches the expected locator. - public static RemoteWebElement FindWebElement(this IWebElement element, By locator) + public static WebElement FindWebElement(this IWebElement element, By locator) { - return element.FindElement(locator) as RemoteWebElement; + return element.FindElement(locator) as WebElement; } /// @@ -43,10 +41,10 @@ public static RemoteWebElement FindWebElement(this IWebElement element, By locat /// /// The remote web element. /// The locator to find the elements. - /// A readonly collection of . - public static ReadOnlyCollection FindWebElements(this IWebElement element, By locator) + /// A readonly collection of . + public static ReadOnlyCollection FindWebElements(this IWebElement element, By locator) { - return element.FindElements(locator).Cast().ToList().AsReadOnly(); + return element.FindElements(locator).Cast().ToList().AsReadOnly(); } /// @@ -116,8 +114,8 @@ public static ReadOnlyCollection GetAllChildElements(this IWebEleme /// Whether the wait was a success. /// Thrown when the callback throws an exception. public static bool TryWaitUntil( - this RemoteWebElement element, - Func condition, + this WebElement element, + Func condition, TimeSpan? timeout = default, int retries = 0, Action exceptionHandler = null) @@ -147,8 +145,8 @@ public static bool TryWaitUntil( /// Thrown when the condition is not met in the allocated timeout period. /// Thrown when the callback throws an exception. public static TResult WaitUntil( - this RemoteWebElement element, - Func condition, + this WebElement element, + Func condition, TimeSpan? timeout = default, int retries = 0) { diff --git a/src/Legerity.Core/Extensions/ElementWrapperExtensions.cs b/src/Legerity.Core/Extensions/ElementWrapperExtensions.cs index 8c9b68dd..2ed6664b 100644 --- a/src/Legerity.Core/Extensions/ElementWrapperExtensions.cs +++ b/src/Legerity.Core/Extensions/ElementWrapperExtensions.cs @@ -3,8 +3,6 @@ namespace Legerity.Extensions; using System; using System.Collections.ObjectModel; using System.Drawing; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; using OpenQA.Selenium.Support.UI; /// @@ -35,9 +33,9 @@ public static Rectangle GetBoundingRect(this IElementWrapper /// /// The remote web element. /// The locator to find the element. - /// A . + /// A . /// Thrown when no element matches the expected locator. - public static RemoteWebElement FindWebElement(this IElementWrapper element, By locator) + public static WebElement FindWebElement(this IElementWrapper element, By locator) where TElement : IWebElement { return element.Element.FindWebElement(locator); @@ -51,8 +49,8 @@ public static RemoteWebElement FindWebElement(this IElementWrapper /// The remote web element. /// The locator to find the elements. - /// A readonly collection of . - public static ReadOnlyCollection FindWebElements( + /// A readonly collection of . + public static ReadOnlyCollection FindWebElements( this IElementWrapper element, By locator) where TElement : IWebElement { diff --git a/src/Legerity.Core/Extensions/InteractionExtensions.cs b/src/Legerity.Core/Extensions/InteractionExtensions.cs index fa8a3d14..627964ef 100644 --- a/src/Legerity.Core/Extensions/InteractionExtensions.cs +++ b/src/Legerity.Core/Extensions/InteractionExtensions.cs @@ -1,8 +1,6 @@ namespace Legerity.Extensions; -using OpenQA.Selenium; using OpenQA.Selenium.Interactions; -using OpenQA.Selenium.Remote; /// /// Defines a collection of extensions for performing interactions with elements. @@ -16,7 +14,7 @@ public static class InteractionExtensions /// The element hold can be released by calling . /// /// The element to click and hold. - public static void ClickAndHold(this RemoteWebElement element) + public static void ClickAndHold(this WebElement element) { var action = new Actions(element.WrappedDriver); action.ClickAndHold(element).Perform(); @@ -35,14 +33,14 @@ public static void ClickAndHold(this RemoteWebElement element) public static void ClickAndHold(this IElementWrapper element) where TElement : IWebElement { - ClickAndHold(element.Element as RemoteWebElement); + ClickAndHold(element.Element as WebElement); } /// /// Releases the hold click from the element. /// /// The element to release the hold from. - public static void ReleaseHold(this RemoteWebElement element) + public static void ReleaseHold(this WebElement element) { var action = new Actions(element.WrappedDriver); action.Release(element).Perform(); @@ -58,14 +56,14 @@ public static void ReleaseHold(this RemoteWebElement element) public static void ReleaseHold(this IElementWrapper element) where TElement : IWebElement { - ReleaseHold(element.Element as RemoteWebElement); + ReleaseHold(element.Element as WebElement); } /// /// Scrolls to the element. /// /// The element to scroll to. - public static void ScrollTo(this RemoteWebElement element) + public static void ScrollTo(this WebElement element) { var action = new Actions(element.WrappedDriver); action.MoveToElement(element).Perform(); @@ -81,6 +79,6 @@ public static void ScrollTo(this RemoteWebElement element) public static void ScrollTo(this IElementWrapper element) where TElement : IWebElement { - ScrollTo(element.Element as RemoteWebElement); + ScrollTo(element.Element as WebElement); } } \ No newline at end of file diff --git a/src/Legerity.Core/Extensions/PageExtensions.cs b/src/Legerity.Core/Extensions/PageExtensions.cs index 306c0994..f4ad2684 100644 --- a/src/Legerity.Core/Extensions/PageExtensions.cs +++ b/src/Legerity.Core/Extensions/PageExtensions.cs @@ -2,7 +2,6 @@ namespace Legerity.Extensions; using System; using Legerity.Pages; -using OpenQA.Selenium; using OpenQA.Selenium.Support.UI; /// diff --git a/src/Legerity.Core/Helpers/WaitUntilConditions.cs b/src/Legerity.Core/Helpers/WaitUntilConditions.cs index f6719c49..5f548173 100644 --- a/src/Legerity.Core/Helpers/WaitUntilConditions.cs +++ b/src/Legerity.Core/Helpers/WaitUntilConditions.cs @@ -2,7 +2,6 @@ namespace Legerity.Helpers; using System; using Legerity.Pages; -using OpenQA.Selenium; /// /// Defines a set of conditions that can be used with the WaitUntil methods of elements and pages. diff --git a/src/Legerity.Core/IElementWrapper.cs b/src/Legerity.Core/IElementWrapper{TElement}.cs similarity index 99% rename from src/Legerity.Core/IElementWrapper.cs rename to src/Legerity.Core/IElementWrapper{TElement}.cs index 0d0a03ef..9d8debb3 100644 --- a/src/Legerity.Core/IElementWrapper.cs +++ b/src/Legerity.Core/IElementWrapper{TElement}.cs @@ -1,7 +1,6 @@ namespace Legerity; using System; -using OpenQA.Selenium; /// /// Defines an interface for a Selenium/Appium element wrapper. diff --git a/src/Legerity.Core/IOS/IOSAppManagerOptions.cs b/src/Legerity.Core/IOS/IOSAppManagerOptions.cs index d002e4e3..a2fab020 100644 --- a/src/Legerity.Core/IOS/IOSAppManagerOptions.cs +++ b/src/Legerity.Core/IOS/IOSAppManagerOptions.cs @@ -108,12 +108,12 @@ public override void Configure() { base.Configure(); - this.AppiumOptions.AddAdditionalCapability(MobileCapabilityType.PlatformName, "iOS"); - this.AppiumOptions.AddAdditionalCapability(MobileCapabilityType.PlatformVersion, this.OSVersion); - this.AppiumOptions.AddAdditionalCapability(MobileCapabilityType.DeviceName, this.DeviceName); - this.AppiumOptions.AddAdditionalCapability(MobileCapabilityType.Udid, this.DeviceId); - this.AppiumOptions.AddAdditionalCapability(MobileCapabilityType.App, this.AppId); - this.AppiumOptions.AddAdditionalCapability(MobileCapabilityType.AutomationName, this.AutomationName); + this.AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.PlatformName, "iOS"); + this.AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.PlatformVersion, this.OSVersion); + this.AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.DeviceName, this.DeviceName); + this.AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.Udid, this.DeviceId); + this.AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.App, this.AppId); + this.AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.AutomationName, this.AutomationName); } /// diff --git a/src/Legerity.Core/LegerityTestClass.cs b/src/Legerity.Core/LegerityTestClass.cs index d5425379..4a807c7b 100644 --- a/src/Legerity.Core/LegerityTestClass.cs +++ b/src/Legerity.Core/LegerityTestClass.cs @@ -5,11 +5,9 @@ namespace Legerity; using Android; using Exceptions; using IOS; -using OpenQA.Selenium; using OpenQA.Selenium.Appium.Android; using OpenQA.Selenium.Appium.iOS; using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; using Windows; /// @@ -17,7 +15,7 @@ namespace Legerity; /// public abstract class LegerityTestClass { - private readonly List apps = new(); + private readonly List apps = new(); /// /// Initializes a new instance of the class. @@ -41,13 +39,13 @@ protected LegerityTestClass(AppManagerOptions options) /// /// Gets the instance of the started application. /// - /// This could be a , , , or web driver. + /// This could be a , , , or web driver. /// /// /// /// This instance should not be used in parallelized test runs. Instead, use the instance returned by the or method. /// - protected RemoteWebDriver App { get; private set; } + protected WebDriver App { get; private set; } /// /// Gets or sets the instances of started applications. @@ -55,7 +53,7 @@ protected LegerityTestClass(AppManagerOptions options) /// /// This is useful for accessing drivers in parallelized tests. /// - protected IReadOnlyCollection Apps => this.apps; + protected IReadOnlyCollection Apps => this.apps; /// /// Gets or sets the model that represents the configuration options for the . @@ -82,7 +80,7 @@ protected LegerityTestClass(AppManagerOptions options) /// - The WinAppDriver could not be found when running with true. /// - The WinAppDriver failed to load when running with true. /// - public virtual RemoteWebDriver StartApp( + public virtual WebDriver StartApp( Func waitUntil = default, TimeSpan? waitUntilTimeout = default, int waitUntilRetries = 0) @@ -116,7 +114,7 @@ public virtual RemoteWebDriver StartApp( /// - The WinAppDriver failed to load when running with true. /// /// Thrown when the wait until condition is not met in the allocated timeout period if provided. - public virtual RemoteWebDriver StartApp( + public virtual WebDriver StartApp( AppManagerOptions options, Func waitUntil = default, TimeSpan? waitUntilTimeout = default, @@ -127,7 +125,7 @@ public virtual RemoteWebDriver StartApp( this.Options = options; } - RemoteWebDriver app = AppManager.StartApp(this.Options, waitUntil, waitUntilTimeout, waitUntilRetries); + WebDriver app = AppManager.StartApp(this.Options, waitUntil, waitUntilTimeout, waitUntilRetries); this.App = app; this.apps.Add(app); return app; @@ -161,7 +159,7 @@ public virtual void StopApp(bool stopServer) /// /// An optional value indicating whether to stop the running Appium or WinAppDriver server. Default, false. /// - public virtual void StopApp(RemoteWebDriver app, bool stopServer = false) + public virtual void StopApp(WebDriver app, bool stopServer = false) { this.StopAppManagerApp(app, stopServer, true); } @@ -178,7 +176,7 @@ public virtual void StopApps(bool stopServer = true) this.apps.Clear(); } - private void StopAppManagerApp(RemoteWebDriver app, bool stopServer, bool removeApp) + private void StopAppManagerApp(WebDriver app, bool stopServer, bool removeApp) { if (removeApp) { diff --git a/src/Legerity.Core/Pages/BasePage.cs b/src/Legerity.Core/Pages/BasePage.cs index 296f18df..47be0ead 100644 --- a/src/Legerity.Core/Pages/BasePage.cs +++ b/src/Legerity.Core/Pages/BasePage.cs @@ -5,11 +5,9 @@ namespace Legerity.Pages; using System.Linq; using Legerity.Exceptions; using Legerity.Extensions; -using OpenQA.Selenium; using OpenQA.Selenium.Appium.Android; using OpenQA.Selenium.Appium.iOS; using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; using OpenQA.Selenium.Support.UI; /// @@ -29,7 +27,7 @@ protected BasePage() } /// - /// Initializes a new instance of the class using a instance that verifies the page has loaded within 2 seconds. + /// Initializes a new instance of the class using a instance that verifies the page has loaded within 2 seconds. /// /// /// The instance of the started application driver that will be used to drive the page interaction. @@ -37,7 +35,7 @@ protected BasePage() /// Thrown when AppManager.StartApp() has not been called. /// Thrown when the page is not shown in 2 seconds. /// Thrown when no element matches the expected locator. - protected BasePage(RemoteWebDriver app) + protected BasePage(WebDriver app) : this(app, TimeSpan.FromSeconds(2)) { } @@ -57,7 +55,7 @@ protected BasePage(TimeSpan? traitTimeout) } /// - /// Initializes a new instance of the class using a instance that verifies the page has loaded within the given timeout. + /// Initializes a new instance of the class using a instance that verifies the page has loaded within the given timeout. /// /// /// The instance of the started application driver that will be used to drive the page interaction. @@ -68,7 +66,7 @@ protected BasePage(TimeSpan? traitTimeout) /// Thrown when AppManager.StartApp() has not been called. /// Thrown when the page is not shown in the given timeout. /// Thrown when no element matches the expected locator. - protected BasePage(RemoteWebDriver app, TimeSpan? traitTimeout) + protected BasePage(WebDriver app, TimeSpan? traitTimeout) { this.App = app; this.WaitTimeout = traitTimeout ?? TimeSpan.FromSeconds(2); @@ -81,10 +79,10 @@ protected BasePage(RemoteWebDriver app, TimeSpan? traitTimeout) /// The instance serves as base for the drivers and can be referenced for basic Selenium functions. /// /// - /// This could be a , , , or web driver. + /// This could be a , , , or web driver. /// /// - public RemoteWebDriver App { get; } + public WebDriver App { get; } /// /// Gets or sets the amount of time the driver should wait when searching for elements if they are not immediately present. @@ -94,22 +92,22 @@ protected BasePage(RemoteWebDriver app, TimeSpan? traitTimeout) /// /// Gets the instance of the started Windows application. /// - protected WindowsDriver WindowsApp => this.App as WindowsDriver; + protected WindowsDriver WindowsApp => this.App as WindowsDriver; /// /// Gets the instance of the started Android application. /// - protected AndroidDriver AndroidApp => this.App as AndroidDriver; + protected AndroidDriver AndroidApp => this.App as AndroidDriver; /// /// Gets the instance of the started iOS application. /// - protected IOSDriver IOSApp => this.App as IOSDriver; + protected IOSDriver IOSApp => this.App as IOSDriver; /// /// Gets the instance of the started web application. /// - protected RemoteWebDriver WebApp => this.App; + protected WebDriver WebApp => this.App; /// /// Gets a given trait of the page to verify that the page is in view. @@ -120,9 +118,9 @@ protected BasePage(RemoteWebDriver app, TimeSpan? traitTimeout) /// Finds the first element in the page that matches the locator. /// /// The locator to find the element. - /// A . + /// A . /// Thrown when no element matches the expected locator. - public RemoteWebElement FindElement(By locator) + public WebElement FindElement(By locator) { return this.App.FindWebElement(locator); } @@ -131,8 +129,8 @@ public RemoteWebElement FindElement(By locator) /// Finds all the elements in the page that matches the locator. /// /// The locator to find the elements. - /// A readonly collection of . - public ReadOnlyCollection FindElements(By locator) + /// A readonly collection of . + public ReadOnlyCollection FindElements(By locator) { return this.App.FindWebElements(locator); } @@ -141,43 +139,43 @@ public ReadOnlyCollection FindElements(By locator) /// Finds the first element in the page that matches the specified XPath. /// /// The XPath to find the element. - /// A . + /// A . /// Thrown when no element matches the expected locator. - public RemoteWebElement FindElementByXPath(string xpath) + public WebElement FindElementByXPath(string xpath) { - return this.App.FindElementByXPath(xpath) as RemoteWebElement; + return this.App.FindElementByXPath(xpath); } /// /// Finds all the elements in the page that matches the specified XPath. /// /// The XPath to find the elements. - /// A readonly collection of . - public ReadOnlyCollection FindElementsByXPath(string xpath) + /// A readonly collection of . + public ReadOnlyCollection FindElementsByXPath(string xpath) { - return this.App.FindElementsByXPath(xpath).Cast().ToList().AsReadOnly(); + return this.App.FindElementsByXPath(xpath); } /// /// Finds the first element in the page that matches the specified ID. /// /// The ID of the element. - /// A . + /// A . /// Thrown when no element matches the expected locator. - public RemoteWebElement FindElementById(string id) + public WebElement FindElementById(string id) { - return this.App.FindElementById(id) as RemoteWebElement; + return this.App.FindElementById(id); } /// /// Finds the first of element in the page that matches the specified name. /// /// The name of the element. - /// A . + /// A . /// Thrown when no element matches the expected locator. - public RemoteWebElement FindElementByName(string name) + public WebElement FindElementByName(string name) { - return this.App.FindElementByName(name) as RemoteWebElement; + return this.App.FindElementByName(name); } /// diff --git a/src/Legerity.Core/Windows/WindowsAppManagerOptions.cs b/src/Legerity.Core/Windows/WindowsAppManagerOptions.cs index ecba6b4c..9eb6ca41 100644 --- a/src/Legerity.Core/Windows/WindowsAppManagerOptions.cs +++ b/src/Legerity.Core/Windows/WindowsAppManagerOptions.cs @@ -71,7 +71,7 @@ public WindowsAppManagerOptions(string appId, params (string, object)[] addition public override void Configure() { base.Configure(); - this.AppiumOptions.AddAdditionalCapability("app", this.AppId); + this.AppiumOptions.AddAdditionalAppiumOption("app", this.AppId); } /// From 7b97371756a1d9b9e05daf43a0a3b6e14dfd0c95 Mon Sep 17 00:00:00 2001 From: James Croft Date: Tue, 5 Mar 2024 19:43:40 +0000 Subject: [PATCH 04/21] Fix upgrades for Android lib --- src/Legerity.Android/AndroidByExtras.cs | 2 - .../Elements/AndroidElementWrapper.cs | 49 +++--------------- src/Legerity.Android/Elements/Core/Button.cs | 43 +++------------- .../Elements/Core/CheckBox.cs | 44 +++------------- .../Elements/Core/DatePicker.cs | 45 +++------------- .../Elements/Core/EditText.cs | 45 +++------------- .../Elements/Core/RadioButton.cs | 44 +++------------- src/Legerity.Android/Elements/Core/Spinner.cs | 51 ++++--------------- src/Legerity.Android/Elements/Core/Switch.cs | 46 +++-------------- .../Elements/Core/TextView.cs | 45 +++------------- .../Elements/Core/ToggleButton.cs | 44 +++------------- src/Legerity.Android/Elements/Core/View.cs | 43 +++------------- .../AndroidElementWrapperExtensions.cs | 1 - .../Extensions/AttributeExtensions.cs | 1 - .../Extensions/ElementExtensions.cs | 10 ++++ .../Extensions/LegerityTestClassExtensions.cs | 10 ++-- src/Legerity.Android/GlobalUsings.cs | 6 +++ 17 files changed, 93 insertions(+), 436 deletions(-) create mode 100644 src/Legerity.Android/Extensions/ElementExtensions.cs create mode 100644 src/Legerity.Android/GlobalUsings.cs diff --git a/src/Legerity.Android/AndroidByExtras.cs b/src/Legerity.Android/AndroidByExtras.cs index 85c2e8e0..3847c980 100644 --- a/src/Legerity.Android/AndroidByExtras.cs +++ b/src/Legerity.Android/AndroidByExtras.cs @@ -1,7 +1,5 @@ namespace Legerity.Android; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; using OpenQA.Selenium.Appium.Android.UiAutomator; /// diff --git a/src/Legerity.Android/Elements/AndroidElementWrapper.cs b/src/Legerity.Android/Elements/AndroidElementWrapper.cs index 51eef248..e17e1e23 100644 --- a/src/Legerity.Android/Elements/AndroidElementWrapper.cs +++ b/src/Legerity.Android/Elements/AndroidElementWrapper.cs @@ -3,25 +3,20 @@ namespace Legerity.Android.Elements; using System; using Legerity.Exceptions; - -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Android; -using OpenQA.Selenium.Remote; using OpenQA.Selenium.Support.UI; /// -/// Defines an element wrapper for a . +/// Defines an element wrapper for an Android . /// -public class AndroidElementWrapper : ElementWrapper +public class AndroidElementWrapper : ElementWrapper { /// /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public AndroidElementWrapper(AndroidElement element) + public AndroidElementWrapper(WebElement element) : base(element) { } @@ -29,50 +24,22 @@ public AndroidElementWrapper(AndroidElement element) /// /// Gets the instance of the Appium driver for the Android application. /// - public AndroidDriver Driver => this.ElementDriver as AndroidDriver; + public AndroidDriver Driver => this.ElementDriver as AndroidDriver; /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator AndroidElementWrapper(AndroidElement element) + public static implicit operator AndroidElementWrapper(WebElement element) { return new AndroidElementWrapper(element); } - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator AndroidElementWrapper(AppiumWebElement element) - { - return new AndroidElementWrapper(element as AndroidElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator AndroidElementWrapper(RemoteWebElement element) - { - return new AndroidElementWrapper(element as AndroidElement); - } - /// /// Determines whether the specified element is shown with the specified timeout. /// diff --git a/src/Legerity.Android/Elements/Core/Button.cs b/src/Legerity.Android/Elements/Core/Button.cs index 6f8a4fab..9b00b477 100644 --- a/src/Legerity.Android/Elements/Core/Button.cs +++ b/src/Legerity.Android/Elements/Core/Button.cs @@ -1,12 +1,9 @@ namespace Legerity.Android.Elements.Core; using Legerity.Android.Elements; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Android; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core Android Button control. +/// Defines a wrapper for the core Android Button control. /// public class Button : AndroidElementWrapper { @@ -14,52 +11,24 @@ public class Button : AndroidElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public Button(AndroidElement element) + public Button(WebElement element) : base(element) { } /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator Button(AndroidElement element) + public static implicit operator Button(WebElement element) { return new Button(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator Button(AppiumWebElement element) - { - return new Button(element as AndroidElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator Button(RemoteWebElement element) - { - return new Button(element as AndroidElement); - } } \ No newline at end of file diff --git a/src/Legerity.Android/Elements/Core/CheckBox.cs b/src/Legerity.Android/Elements/Core/CheckBox.cs index 978c5456..38fe6072 100644 --- a/src/Legerity.Android/Elements/Core/CheckBox.cs +++ b/src/Legerity.Android/Elements/Core/CheckBox.cs @@ -1,13 +1,9 @@ namespace Legerity.Android.Elements.Core; using Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Android; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core Android CheckBox control. +/// Defines a wrapper for the core Android CheckBox control. /// public class CheckBox : AndroidElementWrapper { @@ -15,9 +11,9 @@ public class CheckBox : AndroidElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public CheckBox(AndroidElement element) + public CheckBox(WebElement element) : base(element) { } @@ -29,47 +25,19 @@ public CheckBox(AndroidElement element) public virtual bool IsChecked => this.GetCheckedState(); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator CheckBox(AndroidElement element) + public static implicit operator CheckBox(WebElement element) { return new CheckBox(element); } - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator CheckBox(AppiumWebElement element) - { - return new CheckBox(element as AndroidElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator CheckBox(RemoteWebElement element) - { - return new CheckBox(element as AndroidElement); - } - /// /// Checks the check box on. /// diff --git a/src/Legerity.Android/Elements/Core/DatePicker.cs b/src/Legerity.Android/Elements/Core/DatePicker.cs index e7f0d06d..c1ff80ac 100644 --- a/src/Legerity.Android/Elements/Core/DatePicker.cs +++ b/src/Legerity.Android/Elements/Core/DatePicker.cs @@ -3,13 +3,10 @@ namespace Legerity.Android.Elements.Core; using System; using System.Collections.Generic; using System.Linq; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Android; -using OpenQA.Selenium.Remote; +using Extensions; /// -/// Defines a wrapper for the core Android DatePicker control. +/// Defines a wrapper for the core Android DatePicker control. /// public class DatePicker : AndroidElementWrapper { @@ -33,9 +30,9 @@ public class DatePicker : AndroidElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public DatePicker(AndroidElement element) + public DatePicker(WebElement element) : base(element) { } @@ -84,47 +81,19 @@ public DatePicker(AndroidElement element) public virtual DateTime SelectedDate => this.GetCurrentViewDate(); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator DatePicker(AndroidElement element) + public static implicit operator DatePicker(WebElement element) { return new DatePicker(element); } - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator DatePicker(AppiumWebElement element) - { - return new DatePicker(element as AndroidElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator DatePicker(RemoteWebElement element) - { - return new DatePicker(element as AndroidElement); - } - /// /// Sets the selected date of the date picker. /// diff --git a/src/Legerity.Android/Elements/Core/EditText.cs b/src/Legerity.Android/Elements/Core/EditText.cs index 7a837e00..af00881d 100644 --- a/src/Legerity.Android/Elements/Core/EditText.cs +++ b/src/Legerity.Android/Elements/Core/EditText.cs @@ -1,20 +1,15 @@ namespace Legerity.Android.Elements.Core; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Android; -using OpenQA.Selenium.Remote; - /// -/// Defines a wrapper for the core Android EditText control. +/// Defines a wrapper for the core Android EditText control. /// public class EditText : AndroidElementWrapper { /// /// Initializes a new instance of the class. /// - /// The representing the element. - public EditText(AndroidElement element) + /// The representing the element. + public EditText(WebElement element) : base(element) { } @@ -25,47 +20,19 @@ public EditText(AndroidElement element) public virtual string Text => this.Element.Text; /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator EditText(AndroidElement element) + public static implicit operator EditText(WebElement element) { return new EditText(element); } - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator EditText(AppiumWebElement element) - { - return new EditText(element as AndroidElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator EditText(RemoteWebElement element) - { - return new EditText(element as AndroidElement); - } - /// /// Sets the text of the text box to the specified text. /// diff --git a/src/Legerity.Android/Elements/Core/RadioButton.cs b/src/Legerity.Android/Elements/Core/RadioButton.cs index d3935645..ad598ed8 100644 --- a/src/Legerity.Android/Elements/Core/RadioButton.cs +++ b/src/Legerity.Android/Elements/Core/RadioButton.cs @@ -1,13 +1,9 @@ namespace Legerity.Android.Elements.Core; using Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Android; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core Android RadioButton control. +/// Defines a wrapper for the core Android RadioButton control. /// public class RadioButton : Button { @@ -15,9 +11,9 @@ public class RadioButton : Button /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public RadioButton(AndroidElement element) + public RadioButton(WebElement element) : base(element) { } @@ -29,44 +25,16 @@ public RadioButton(AndroidElement element) public virtual bool IsSelected => this.GetCheckedState(); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator RadioButton(AndroidElement element) + public static implicit operator RadioButton(WebElement element) { return new RadioButton(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator RadioButton(AppiumWebElement element) - { - return new RadioButton(element as AndroidElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator RadioButton(RemoteWebElement element) - { - return new RadioButton(element as AndroidElement); - } } \ 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 590ddfe0..95aafe09 100644 --- a/src/Legerity.Android/Elements/Core/Spinner.cs +++ b/src/Legerity.Android/Elements/Core/Spinner.cs @@ -1,12 +1,7 @@ namespace Legerity.Android.Elements.Core; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Android; -using OpenQA.Selenium.Remote; - /// -/// Defines a wrapper for the core Android Spinner control. +/// Defines a wrapper for the core Android Spinner control. /// public class Spinner : AndroidElementWrapper { @@ -14,9 +9,9 @@ public class Spinner : AndroidElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public Spinner(AndroidElement element) + public Spinner(WebElement element) : base(element) { } @@ -28,47 +23,19 @@ public Spinner(AndroidElement element) public virtual string SelectedItem => this.GetSelectedItem(); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator Spinner(AndroidElement element) + public static implicit operator Spinner(WebElement element) { return new Spinner(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator Spinner(AppiumWebElement element) - { - return new Spinner(element as AndroidElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator Spinner(RemoteWebElement element) - { - return new Spinner(element as AndroidElement); - } - + /// /// Selects an item in the combo-box with the specified item name. /// @@ -86,7 +53,7 @@ public virtual void SelectItem(string name) var locator = new ByAndroidUIAutomator( $"new UiScrollable(new UiSelector()).scrollIntoView(new UiSelector().text(\"{name}\"));"); - AndroidElement item = this.Driver.FindElement(locator); + WebElement item = this.Driver.FindElement(locator); item.Click(); } @@ -106,7 +73,7 @@ public virtual void SelectItemByPartialName(string partialName) var locator = new ByAndroidUIAutomator( $"new UiScrollable(new UiSelector()).scrollIntoView(new UiSelector().textContains(\"{partialName}\"));"); - AndroidElement item = this.Driver.FindElement(locator); + WebElement item = this.Driver.FindElement(locator); item.Click(); } diff --git a/src/Legerity.Android/Elements/Core/Switch.cs b/src/Legerity.Android/Elements/Core/Switch.cs index 66e592ae..753d0264 100644 --- a/src/Legerity.Android/Elements/Core/Switch.cs +++ b/src/Legerity.Android/Elements/Core/Switch.cs @@ -1,13 +1,9 @@ namespace Legerity.Android.Elements.Core; using Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Android; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core Android Switch control. +/// Defines a wrapper for the core Android Switch control. /// public class Switch : AndroidElementWrapper { @@ -15,9 +11,9 @@ public class Switch : AndroidElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public Switch(AndroidElement element) + public Switch(WebElement element) : base(element) { } @@ -29,47 +25,19 @@ public Switch(AndroidElement element) public virtual bool IsOn => this.GetCheckedState(); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator Switch(AndroidElement element) + public static implicit operator Switch(WebElement element) { return new Switch(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator Switch(AppiumWebElement element) - { - return new Switch(element as AndroidElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator Switch(RemoteWebElement element) - { - return new Switch(element as AndroidElement); - } - + /// /// Toggles the switch on. /// diff --git a/src/Legerity.Android/Elements/Core/TextView.cs b/src/Legerity.Android/Elements/Core/TextView.cs index e3ff3850..71b11484 100644 --- a/src/Legerity.Android/Elements/Core/TextView.cs +++ b/src/Legerity.Android/Elements/Core/TextView.cs @@ -1,12 +1,7 @@ namespace Legerity.Android.Elements.Core; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Android; -using OpenQA.Selenium.Remote; - /// -/// Defines a wrapper for the core Android TextView control. +/// Defines a wrapper for the core Android TextView control. /// public class TextView : AndroidElementWrapper { @@ -14,9 +9,9 @@ public class TextView : AndroidElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public TextView(AndroidElement element) + public TextView(WebElement element) : base(element) { } @@ -28,44 +23,16 @@ public TextView(AndroidElement element) public virtual string Text => this.Element.Text; /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator TextView(AndroidElement element) + public static implicit operator TextView(WebElement element) { return new TextView(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator TextView(AppiumWebElement element) - { - return new TextView(element as AndroidElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator TextView(RemoteWebElement element) - { - return new TextView(element as AndroidElement); - } } \ 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 044325e2..65f4734e 100644 --- a/src/Legerity.Android/Elements/Core/ToggleButton.cs +++ b/src/Legerity.Android/Elements/Core/ToggleButton.cs @@ -1,13 +1,9 @@ namespace Legerity.Android.Elements.Core; using Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Android; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core Android ToggleButton control. +/// Defines a wrapper for the core Android ToggleButton control. /// public class ToggleButton : Button { @@ -15,9 +11,9 @@ public class ToggleButton : Button /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public ToggleButton(AndroidElement element) + public ToggleButton(WebElement element) : base(element) { } @@ -29,47 +25,19 @@ public ToggleButton(AndroidElement element) public virtual bool IsOn => this.GetCheckedState(); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator ToggleButton(AndroidElement element) + public static implicit operator ToggleButton(WebElement element) { return new ToggleButton(element); } - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator ToggleButton(AppiumWebElement element) - { - return new ToggleButton(element as AndroidElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator ToggleButton(RemoteWebElement element) - { - return new ToggleButton(element as AndroidElement); - } - /// /// Toggles the button on. /// diff --git a/src/Legerity.Android/Elements/Core/View.cs b/src/Legerity.Android/Elements/Core/View.cs index 856c85cd..12bd15cc 100644 --- a/src/Legerity.Android/Elements/Core/View.cs +++ b/src/Legerity.Android/Elements/Core/View.cs @@ -1,12 +1,9 @@ namespace Legerity.Android.Elements.Core; using Legerity.Android.Elements; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Android; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core Android View base control. +/// Defines a wrapper for the core Android View base control. /// public class View : AndroidElementWrapper { @@ -14,52 +11,24 @@ public class View : AndroidElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public View(AndroidElement element) + public View(WebElement element) : base(element) { } /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator View(AndroidElement element) + public static implicit operator View(WebElement element) { return new View(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator View(AppiumWebElement element) - { - return new View(element as AndroidElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator View(RemoteWebElement element) - { - return new View(element as AndroidElement); - } } \ No newline at end of file diff --git a/src/Legerity.Android/Extensions/AndroidElementWrapperExtensions.cs b/src/Legerity.Android/Extensions/AndroidElementWrapperExtensions.cs index 7e1bc936..29ff5080 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 Legerity.Android.Elements; -using OpenQA.Selenium; using OpenQA.Selenium.Support.UI; /// diff --git a/src/Legerity.Android/Extensions/AttributeExtensions.cs b/src/Legerity.Android/Extensions/AttributeExtensions.cs index 2bee18ff..d3cfbf5f 100644 --- a/src/Legerity.Android/Extensions/AttributeExtensions.cs +++ b/src/Legerity.Android/Extensions/AttributeExtensions.cs @@ -1,7 +1,6 @@ namespace Legerity.Android.Extensions; using System; -using OpenQA.Selenium; /// /// Defines a collection of extensions for retrieving element attributes. diff --git a/src/Legerity.Android/Extensions/ElementExtensions.cs b/src/Legerity.Android/Extensions/ElementExtensions.cs new file mode 100644 index 00000000..7281f913 --- /dev/null +++ b/src/Legerity.Android/Extensions/ElementExtensions.cs @@ -0,0 +1,10 @@ +namespace Legerity.Android.Extensions; + +public static class ElementExtensions +{ + /// Thrown when no element matches the expected locator. + public static WebElement FindElementByAndroidUIAutomator(this WebElement element, string selector) + { + 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 6c87eed6..9a25c4f1 100644 --- a/src/Legerity.Android/Extensions/LegerityTestClassExtensions.cs +++ b/src/Legerity.Android/Extensions/LegerityTestClassExtensions.cs @@ -2,8 +2,6 @@ namespace Legerity.Android.Extensions; using System; using Exceptions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium.Android; /// /// Defines a collection of extensions for instances. @@ -31,13 +29,13 @@ public static class LegerityTestClassExtensions /// Thrown when: /// - The Appium server could not be found when running with true. /// - public static AndroidDriver StartAndroidApp( + public static AndroidDriver StartAndroidApp( this LegerityTestClass testClass, Func waitUntil = default, TimeSpan? waitUntilTimeout = default, int waitUntilRetries = 0) { - return testClass.StartApp(waitUntil, waitUntilTimeout, waitUntilRetries) as AndroidDriver; + return testClass.StartApp(waitUntil, waitUntilTimeout, waitUntilRetries) as AndroidDriver; } /// @@ -67,7 +65,7 @@ public static AndroidDriver StartAndroidApp( /// Thrown when: /// - The Appium server could not be found when running with true. /// - public static AndroidDriver StartAndroidApp( + public static AndroidDriver StartAndroidApp( this LegerityTestClass testClass, AndroidAppManagerOptions options, Func waitUntil = default, @@ -75,6 +73,6 @@ public static AndroidDriver StartAndroidApp( int waitUntilRetries = 0) { return testClass.StartApp(options, waitUntil, waitUntilTimeout, waitUntilRetries) as - AndroidDriver; + AndroidDriver; } } \ No newline at end of file diff --git a/src/Legerity.Android/GlobalUsings.cs b/src/Legerity.Android/GlobalUsings.cs new file mode 100644 index 00000000..0f3218a6 --- /dev/null +++ b/src/Legerity.Android/GlobalUsings.cs @@ -0,0 +1,6 @@ +// Global using directives + +global using OpenQA.Selenium; +global using OpenQA.Selenium.Appium; +global using OpenQA.Selenium.Appium.Android; +global using OpenQA.Selenium.Remote; From d0cd9ed923ddac3d12fd94e5a99cf69a991bbac4 Mon Sep 17 00:00:00 2001 From: James Croft Date: Tue, 5 Mar 2024 19:50:58 +0000 Subject: [PATCH 05/21] Fix iOS upgrade --- src/Legerity.IOS/Elements/Core/Button.cs | 44 +++-------------- src/Legerity.IOS/Elements/Core/Label.cs | 44 +++-------------- .../Elements/Core/ProgressView.cs | 44 +++-------------- src/Legerity.IOS/Elements/Core/Slider.cs | 46 +++-------------- src/Legerity.IOS/Elements/Core/Switch.cs | 46 +++-------------- src/Legerity.IOS/Elements/Core/TextField.cs | 46 +++-------------- .../Elements/IOSElementWrapper.cs | 49 +++---------------- .../Extensions/AttributeExtensions.cs | 7 +-- .../Extensions/IOSElementWrapperExtensions.cs | 1 - .../Extensions/LegerityTestClassExtensions.cs | 10 ++-- src/Legerity.IOS/GlobalUsings.cs | 6 +++ src/Legerity.IOS/IOSByExtras.cs | 2 - 12 files changed, 59 insertions(+), 286 deletions(-) create mode 100644 src/Legerity.IOS/GlobalUsings.cs diff --git a/src/Legerity.IOS/Elements/Core/Button.cs b/src/Legerity.IOS/Elements/Core/Button.cs index ff7de2f4..d415e6cc 100644 --- a/src/Legerity.IOS/Elements/Core/Button.cs +++ b/src/Legerity.IOS/Elements/Core/Button.cs @@ -1,13 +1,9 @@ namespace Legerity.IOS.Elements.Core; using Legerity.IOS.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.iOS; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core iOS Button control. +/// Defines a wrapper for the core iOS Button control. /// public class Button : IOSElementWrapper { @@ -15,9 +11,9 @@ public class Button : IOSElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public Button(IOSElement element) + public Button(WebElement element) : base(element) { } @@ -29,44 +25,16 @@ public Button(IOSElement element) public virtual string Label => this.GetLabel(); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator Button(IOSElement element) + public static implicit operator Button(WebElement element) { return new Button(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator Button(AppiumWebElement element) - { - return new Button(element as IOSElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator Button(RemoteWebElement element) - { - return new Button(element as IOSElement); - } } \ No newline at end of file diff --git a/src/Legerity.IOS/Elements/Core/Label.cs b/src/Legerity.IOS/Elements/Core/Label.cs index c1eebf18..c8f32eb7 100644 --- a/src/Legerity.IOS/Elements/Core/Label.cs +++ b/src/Legerity.IOS/Elements/Core/Label.cs @@ -1,13 +1,9 @@ namespace Legerity.IOS.Elements.Core; using Legerity.IOS.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.iOS; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core iOS Label control. +/// Defines a wrapper for the core iOS Label control. /// public class Label : IOSElementWrapper { @@ -15,9 +11,9 @@ public class Label : IOSElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public Label(IOSElement element) + public Label(WebElement element) : base(element) { } @@ -29,44 +25,16 @@ public Label(IOSElement element) public virtual string Text => this.GetLabel(); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator Label(IOSElement element) + public static implicit operator Label(WebElement element) { return new Label(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator Label(AppiumWebElement element) - { - return new Label(element as IOSElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator Label(RemoteWebElement element) - { - return new Label(element as IOSElement); - } } \ No newline at end of file diff --git a/src/Legerity.IOS/Elements/Core/ProgressView.cs b/src/Legerity.IOS/Elements/Core/ProgressView.cs index b343c163..2775e6ca 100644 --- a/src/Legerity.IOS/Elements/Core/ProgressView.cs +++ b/src/Legerity.IOS/Elements/Core/ProgressView.cs @@ -1,13 +1,9 @@ namespace Legerity.IOS.Elements.Core; using Legerity.IOS.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.iOS; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core iOS ProgressView control. +/// Defines a wrapper for the core iOS ProgressView control. /// public class ProgressView : IOSElementWrapper { @@ -15,9 +11,9 @@ public class ProgressView : IOSElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public ProgressView(IOSElement element) + public ProgressView(WebElement element) : base(element) { } @@ -29,44 +25,16 @@ public ProgressView(IOSElement element) public virtual double Percentage => double.Parse(this.GetValue().TrimEnd('%')); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator ProgressView(IOSElement element) + public static implicit operator ProgressView(WebElement element) { return new ProgressView(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator ProgressView(AppiumWebElement element) - { - return new ProgressView(element as IOSElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator ProgressView(RemoteWebElement element) - { - return new ProgressView(element as IOSElement); - } } \ No newline at end of file diff --git a/src/Legerity.IOS/Elements/Core/Slider.cs b/src/Legerity.IOS/Elements/Core/Slider.cs index 9860eeaf..cf9b346c 100644 --- a/src/Legerity.IOS/Elements/Core/Slider.cs +++ b/src/Legerity.IOS/Elements/Core/Slider.cs @@ -2,13 +2,9 @@ namespace Legerity.IOS.Elements.Core; using System; using Legerity.IOS.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.iOS; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core iOS Slider control. +/// Defines a wrapper for the core iOS Slider control. /// public class Slider : IOSElementWrapper { @@ -16,9 +12,9 @@ public class Slider : IOSElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public Slider(IOSElement element) + public Slider(WebElement element) : base(element) { } @@ -35,47 +31,19 @@ public Slider(IOSElement element) public virtual bool IsReadonly => !this.IsEnabled; /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator Slider(IOSElement element) + public static implicit operator Slider(WebElement element) { return new Slider(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator Slider(AppiumWebElement element) - { - return new Slider(element as IOSElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator Slider(RemoteWebElement element) - { - return new Slider(element as IOSElement); - } - + /// /// 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 b6f851e8..5c486e3b 100644 --- a/src/Legerity.IOS/Elements/Core/Switch.cs +++ b/src/Legerity.IOS/Elements/Core/Switch.cs @@ -1,13 +1,9 @@ namespace Legerity.IOS.Elements.Core; using Legerity.IOS.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.iOS; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core iOS Switch control. +/// Defines a wrapper for the core iOS Switch control. /// public class Switch : IOSElementWrapper { @@ -17,9 +13,9 @@ public class Switch : IOSElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public Switch(IOSElement element) + public Switch(WebElement element) : base(element) { } @@ -31,47 +27,19 @@ public Switch(IOSElement element) public virtual bool IsOn => this.GetValue() == ToggleOnValue; /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator Switch(IOSElement element) + public static implicit operator Switch(WebElement element) { return new Switch(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator Switch(AppiumWebElement element) - { - return new Switch(element as IOSElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator Switch(RemoteWebElement element) - { - return new Switch(element as IOSElement); - } - + /// /// Toggles the switch on. /// diff --git a/src/Legerity.IOS/Elements/Core/TextField.cs b/src/Legerity.IOS/Elements/Core/TextField.cs index f2974485..c4e3c754 100644 --- a/src/Legerity.IOS/Elements/Core/TextField.cs +++ b/src/Legerity.IOS/Elements/Core/TextField.cs @@ -2,21 +2,17 @@ namespace Legerity.IOS.Elements.Core; using Legerity.IOS.Elements; using Legerity.IOS.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.iOS; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core iOS TextField control. +/// Defines a wrapper for the core iOS TextField control. /// public class TextField : IOSElementWrapper { /// /// Initializes a new instance of the class. /// - /// The representing the element. - public TextField(IOSElement element) + /// The representing the element. + public TextField(WebElement element) : base(element) { } @@ -34,47 +30,19 @@ public TextField(IOSElement element) public virtual Button ClearTextButton => this.FindElement(IOSByExtras.Label("Clear text")); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator TextField(IOSElement element) + public static implicit operator TextField(WebElement element) { return new TextField(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator TextField(AppiumWebElement element) - { - return new TextField(element as IOSElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator TextField(RemoteWebElement element) - { - return new TextField(element as IOSElement); - } - + /// /// 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 992cf130..567e8a81 100644 --- a/src/Legerity.IOS/Elements/IOSElementWrapper.cs +++ b/src/Legerity.IOS/Elements/IOSElementWrapper.cs @@ -3,25 +3,20 @@ namespace Legerity.IOS.Elements; using System; using Legerity.Exceptions; - -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.iOS; -using OpenQA.Selenium.Remote; using OpenQA.Selenium.Support.UI; /// -/// Defines an element wrapper for a . +/// Defines an element wrapper for an iOS . /// -public class IOSElementWrapper : ElementWrapper +public class IOSElementWrapper : ElementWrapper { /// /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public IOSElementWrapper(IOSElement element) + public IOSElementWrapper(WebElement element) : base(element) { } @@ -29,50 +24,22 @@ public IOSElementWrapper(IOSElement element) /// /// Gets the instance of the Appium driver for the iOS application. /// - public IOSDriver Driver => this.ElementDriver as IOSDriver; + public IOSDriver Driver => this.ElementDriver as IOSDriver; /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator IOSElementWrapper(IOSElement element) + public static implicit operator IOSElementWrapper(WebElement element) { return new IOSElementWrapper(element); } - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator IOSElementWrapper(AppiumWebElement element) - { - return new IOSElementWrapper(element as IOSElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator IOSElementWrapper(RemoteWebElement element) - { - return new IOSElementWrapper(element as IOSElement); - } - /// /// Determines whether the specified element is shown with the specified timeout. /// diff --git a/src/Legerity.IOS/Extensions/AttributeExtensions.cs b/src/Legerity.IOS/Extensions/AttributeExtensions.cs index 2eb88629..f4edd9a3 100644 --- a/src/Legerity.IOS/Extensions/AttributeExtensions.cs +++ b/src/Legerity.IOS/Extensions/AttributeExtensions.cs @@ -1,8 +1,5 @@ namespace Legerity.IOS.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; - /// /// Defines a collection of extensions for retrieving element attributes. /// @@ -23,7 +20,7 @@ public static string GetLabel(this IWebElement element) /// Retrieves the label attribute from the specified element. /// /// - /// The type of . + /// The type of . /// /// The to retrieve a label from. /// The label of the element. @@ -49,7 +46,7 @@ public static string GetValue(this IWebElement element) /// Retrieves the value attribute from the specified element. /// /// - /// The type of . + /// The type of . /// /// The to retrieve a value from. /// The value of the element. diff --git a/src/Legerity.IOS/Extensions/IOSElementWrapperExtensions.cs b/src/Legerity.IOS/Extensions/IOSElementWrapperExtensions.cs index fc37ff6c..cd463813 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 Legerity.IOS.Elements; -using OpenQA.Selenium; using OpenQA.Selenium.Support.UI; /// diff --git a/src/Legerity.IOS/Extensions/LegerityTestClassExtensions.cs b/src/Legerity.IOS/Extensions/LegerityTestClassExtensions.cs index fcc5fb00..51300c4c 100644 --- a/src/Legerity.IOS/Extensions/LegerityTestClassExtensions.cs +++ b/src/Legerity.IOS/Extensions/LegerityTestClassExtensions.cs @@ -2,8 +2,6 @@ namespace Legerity.IOS.Extensions; using System; using Exceptions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium.iOS; /// /// Defines a collection of extensions for instances. @@ -31,13 +29,13 @@ public static class LegerityTestClassExtensions /// Thrown when: /// - The Appium server could not be found when running with true. /// - public static IOSDriver StartIOSApp( + public static IOSDriver StartIOSApp( this LegerityTestClass testClass, Func waitUntil = default, TimeSpan? waitUntilTimeout = default, int waitUntilRetries = 0) { - return testClass.StartApp(waitUntil, waitUntilTimeout, waitUntilRetries) as IOSDriver; + return testClass.StartApp(waitUntil, waitUntilTimeout, waitUntilRetries) as IOSDriver; } /// @@ -67,7 +65,7 @@ public static IOSDriver StartIOSApp( /// Thrown when: /// - The Appium server could not be found when running with true. /// - public static IOSDriver StartIOSApp( + public static IOSDriver StartIOSApp( this LegerityTestClass testClass, IOSAppManagerOptions options, Func waitUntil = default, @@ -75,6 +73,6 @@ public static IOSDriver StartIOSApp( int waitUntilRetries = 0) { return testClass.StartApp(options, waitUntil, waitUntilTimeout, waitUntilRetries) as - IOSDriver; + IOSDriver; } } \ No newline at end of file diff --git a/src/Legerity.IOS/GlobalUsings.cs b/src/Legerity.IOS/GlobalUsings.cs new file mode 100644 index 00000000..63d1b021 --- /dev/null +++ b/src/Legerity.IOS/GlobalUsings.cs @@ -0,0 +1,6 @@ +// Global using directives + +global using OpenQA.Selenium; +global using OpenQA.Selenium.Appium; +global using OpenQA.Selenium.Appium.iOS; +global using OpenQA.Selenium.Remote; diff --git a/src/Legerity.IOS/IOSByExtras.cs b/src/Legerity.IOS/IOSByExtras.cs index 44805473..34c94c04 100644 --- a/src/Legerity.IOS/IOSByExtras.cs +++ b/src/Legerity.IOS/IOSByExtras.cs @@ -1,7 +1,5 @@ namespace Legerity.IOS; -using OpenQA.Selenium; - /// /// Defines a collection of extra locator constraints for . /// From dbc69e85e48d3c82252269cc878a8cfd574ecc14 Mon Sep 17 00:00:00 2001 From: James Croft Date: Tue, 5 Mar 2024 19:55:56 +0000 Subject: [PATCH 06/21] Fix web upgrade --- src/Legerity.Web/Elements/Core/Button.cs | 14 ++++---- src/Legerity.Web/Elements/Core/CheckBox.cs | 14 ++++---- src/Legerity.Web/Elements/Core/DateInput.cs | 14 ++++---- src/Legerity.Web/Elements/Core/FileInput.cs | 10 +++--- src/Legerity.Web/Elements/Core/Form.cs | 9 ++--- src/Legerity.Web/Elements/Core/Image.cs | 10 +++--- src/Legerity.Web/Elements/Core/List.cs | 14 ++++---- src/Legerity.Web/Elements/Core/NumberInput.cs | 14 ++++---- src/Legerity.Web/Elements/Core/Option.cs | 10 +++--- src/Legerity.Web/Elements/Core/RadioButton.cs | 14 ++++---- src/Legerity.Web/Elements/Core/RangeInput.cs | 14 ++++---- src/Legerity.Web/Elements/Core/Select.cs | 10 +++--- src/Legerity.Web/Elements/Core/Table.cs | 10 +++--- src/Legerity.Web/Elements/Core/TableRow.cs | 8 ++--- src/Legerity.Web/Elements/Core/TextArea.cs | 13 +++---- src/Legerity.Web/Elements/Core/TextInput.cs | 10 +++--- .../Elements/WebElementWrapper.cs | 34 +++++++++---------- .../Extensions/AttributeExtensions.cs | 17 ++++------ .../Extensions/IWebElementExtensions.cs | 6 ++-- .../Extensions/WebElementWrapperExtensions.cs | 1 - src/Legerity.Web/GlobalUsings.cs | 4 +++ src/Legerity.Web/Legerity.Web.csproj | 2 +- src/Legerity.Web/WebByExtras.cs | 2 -- 23 files changed, 107 insertions(+), 147 deletions(-) create mode 100644 src/Legerity.Web/GlobalUsings.cs diff --git a/src/Legerity.Web/Elements/Core/Button.cs b/src/Legerity.Web/Elements/Core/Button.cs index 2fe764e8..2ca9e212 100644 --- a/src/Legerity.Web/Elements/Core/Button.cs +++ b/src/Legerity.Web/Elements/Core/Button.cs @@ -1,8 +1,6 @@ namespace Legerity.Web.Elements.Core; using Legerity.Web.Elements; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; /// /// Defines a wrapper for the core web Button control. @@ -16,7 +14,7 @@ public class Button : WebElementWrapper /// The reference. /// public Button(IWebElement element) - : this(element as RemoteWebElement) + : this(element as WebElement) { } @@ -24,23 +22,23 @@ public Button(IWebElement element) /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public Button(RemoteWebElement element) + public Button(WebElement element) : base(element) { } /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator Button(RemoteWebElement element) + public static implicit operator Button(WebElement element) { return new Button(element); } diff --git a/src/Legerity.Web/Elements/Core/CheckBox.cs b/src/Legerity.Web/Elements/Core/CheckBox.cs index 38d1cc6e..0ba719ca 100644 --- a/src/Legerity.Web/Elements/Core/CheckBox.cs +++ b/src/Legerity.Web/Elements/Core/CheckBox.cs @@ -1,8 +1,6 @@ namespace Legerity.Web.Elements.Core; using Legerity.Web.Elements; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; /// /// Defines a wrapper for the core web Input checkbox control. @@ -16,7 +14,7 @@ public class CheckBox : WebElementWrapper /// The reference. /// public CheckBox(IWebElement element) - : this(element as RemoteWebElement) + : this(element as WebElement) { } @@ -24,9 +22,9 @@ public CheckBox(IWebElement element) /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public CheckBox(RemoteWebElement element) + public CheckBox(WebElement element) : base(element) { } @@ -38,15 +36,15 @@ public CheckBox(RemoteWebElement element) public virtual bool IsChecked => this.Element.Selected; /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator CheckBox(RemoteWebElement element) + public static implicit operator CheckBox(WebElement element) { return new CheckBox(element); } diff --git a/src/Legerity.Web/Elements/Core/DateInput.cs b/src/Legerity.Web/Elements/Core/DateInput.cs index 97675523..6eeb1731 100644 --- a/src/Legerity.Web/Elements/Core/DateInput.cs +++ b/src/Legerity.Web/Elements/Core/DateInput.cs @@ -2,8 +2,6 @@ namespace Legerity.Web.Elements.Core; using System; using Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; using OpenQA.Selenium.Support.Extensions; /// @@ -18,7 +16,7 @@ public class DateInput : TextInput /// The reference. /// public DateInput(IWebElement element) - : this(element as RemoteWebElement) + : this(element as WebElement) { } @@ -26,9 +24,9 @@ public DateInput(IWebElement element) /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public DateInput(RemoteWebElement element) + public DateInput(WebElement element) : base(element) { } @@ -45,15 +43,15 @@ public DateInput(RemoteWebElement element) public virtual DateTime? SelectedDate => this.GetSelectedDate(); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator DateInput(RemoteWebElement element) + public static implicit operator DateInput(WebElement element) { return new DateInput(element); } diff --git a/src/Legerity.Web/Elements/Core/FileInput.cs b/src/Legerity.Web/Elements/Core/FileInput.cs index 8f3dbdd3..c8dcb1cc 100644 --- a/src/Legerity.Web/Elements/Core/FileInput.cs +++ b/src/Legerity.Web/Elements/Core/FileInput.cs @@ -2,8 +2,6 @@ namespace Legerity.Web.Elements.Core; using Legerity.Web.Elements; using Legerity.Web.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; /// /// Defines a wrapper for the core web Input file control. @@ -17,7 +15,7 @@ public class FileInput : WebElementWrapper /// The reference. /// public FileInput(IWebElement element) - : this(element as RemoteWebElement) + : this(element as WebElement) { } @@ -25,9 +23,9 @@ public FileInput(IWebElement element) /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public FileInput(RemoteWebElement element) + public FileInput(WebElement element) : base(element) { } @@ -47,7 +45,7 @@ public FileInput(RemoteWebElement element) /// /// The . /// - public static implicit operator FileInput(RemoteWebElement element) + public static implicit operator FileInput(WebElement element) { return new FileInput(element); } diff --git a/src/Legerity.Web/Elements/Core/Form.cs b/src/Legerity.Web/Elements/Core/Form.cs index 10ac7b1c..d28d4470 100644 --- a/src/Legerity.Web/Elements/Core/Form.cs +++ b/src/Legerity.Web/Elements/Core/Form.cs @@ -1,8 +1,5 @@ namespace Legerity.Web.Elements.Core; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; - /// /// Defines a wrapper for the core web Form control. /// @@ -23,9 +20,9 @@ public Form(IWebElement element) /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public Form(RemoteWebElement element) + public Form(WebElement element) : base(element) { } @@ -39,7 +36,7 @@ public Form(RemoteWebElement element) /// /// The . /// - public static implicit operator Form(RemoteWebElement element) + public static implicit operator Form(WebElement element) { return new Form(element); } diff --git a/src/Legerity.Web/Elements/Core/Image.cs b/src/Legerity.Web/Elements/Core/Image.cs index d46344a6..cde827fd 100644 --- a/src/Legerity.Web/Elements/Core/Image.cs +++ b/src/Legerity.Web/Elements/Core/Image.cs @@ -2,8 +2,6 @@ namespace Legerity.Web.Elements.Core; using Extensions; using Legerity.Web.Elements; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; /// /// Defines a wrapper for the core web Image control. @@ -17,7 +15,7 @@ public class Image : WebElementWrapper /// The reference. /// public Image(IWebElement element) - : this(element as RemoteWebElement) + : this(element as WebElement) { } @@ -25,9 +23,9 @@ public Image(IWebElement element) /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public Image(RemoteWebElement element) + public Image(WebElement element) : base(element) { } @@ -65,7 +63,7 @@ public Image(RemoteWebElement element) /// /// The . /// - public static implicit operator Image(RemoteWebElement element) + public static implicit operator Image(WebElement element) { return new Image(element); } diff --git a/src/Legerity.Web/Elements/Core/List.cs b/src/Legerity.Web/Elements/Core/List.cs index 420ee387..0cd44bcc 100644 --- a/src/Legerity.Web/Elements/Core/List.cs +++ b/src/Legerity.Web/Elements/Core/List.cs @@ -2,8 +2,6 @@ namespace Legerity.Web.Elements.Core; using System.Collections.ObjectModel; using Legerity.Web.Elements; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; /// /// Defines a wrapper for the core web ol or ul control. @@ -17,7 +15,7 @@ public class List : WebElementWrapper /// The reference. /// public List(IWebElement element) - : this(element as RemoteWebElement) + : this(element as WebElement) { } @@ -25,9 +23,9 @@ public List(IWebElement element) /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public List(RemoteWebElement element) + public List(WebElement element) : base(element) { } @@ -38,15 +36,15 @@ public List(RemoteWebElement element) public virtual ReadOnlyCollection Items => this.Element.FindElements(WebByExtras.ListItem()); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator List(RemoteWebElement element) + public static implicit operator List(WebElement element) { return new List(element); } diff --git a/src/Legerity.Web/Elements/Core/NumberInput.cs b/src/Legerity.Web/Elements/Core/NumberInput.cs index 57369b82..6af2468c 100644 --- a/src/Legerity.Web/Elements/Core/NumberInput.cs +++ b/src/Legerity.Web/Elements/Core/NumberInput.cs @@ -2,8 +2,6 @@ namespace Legerity.Web.Elements.Core; using System; using Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; /// /// Defines a wrapper for the core web Input number control. @@ -17,7 +15,7 @@ public class NumberInput : TextInput /// The reference. /// public NumberInput(IWebElement element) - : this(element as RemoteWebElement) + : this(element as WebElement) { } @@ -25,9 +23,9 @@ public NumberInput(IWebElement element) /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public NumberInput(RemoteWebElement element) + public NumberInput(WebElement element) : base(element) { } @@ -51,15 +49,15 @@ public NumberInput(RemoteWebElement element) public virtual double Value => double.TryParse(this.Text, out double val) ? val : 0; /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator NumberInput(RemoteWebElement element) + public static implicit operator NumberInput(WebElement element) { return new NumberInput(element); } diff --git a/src/Legerity.Web/Elements/Core/Option.cs b/src/Legerity.Web/Elements/Core/Option.cs index c35f31eb..1b7c9f9b 100644 --- a/src/Legerity.Web/Elements/Core/Option.cs +++ b/src/Legerity.Web/Elements/Core/Option.cs @@ -2,8 +2,6 @@ namespace Legerity.Web.Elements.Core; using Legerity.Web.Elements; using Legerity.Web.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; /// /// Defines a wrapper for the core web Option control. @@ -17,7 +15,7 @@ public class Option : WebElementWrapper /// The reference. /// public Option(IWebElement element) - : this(element as RemoteWebElement) + : this(element as WebElement) { } @@ -25,9 +23,9 @@ public Option(IWebElement element) /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public Option(RemoteWebElement element) + public Option(WebElement element) : base(element) { } @@ -59,7 +57,7 @@ public Option(RemoteWebElement element) /// /// The . /// - public static implicit operator Option(RemoteWebElement element) + public static implicit operator Option(WebElement element) { return new Option(element); } diff --git a/src/Legerity.Web/Elements/Core/RadioButton.cs b/src/Legerity.Web/Elements/Core/RadioButton.cs index 0f85cfb5..ed656234 100644 --- a/src/Legerity.Web/Elements/Core/RadioButton.cs +++ b/src/Legerity.Web/Elements/Core/RadioButton.cs @@ -1,8 +1,6 @@ namespace Legerity.Web.Elements.Core; using Legerity.Web.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; /// /// Defines a wrapper for the core web Input radio control. @@ -16,7 +14,7 @@ public class RadioButton : Button /// The reference. /// public RadioButton(IWebElement element) - : this(element as RemoteWebElement) + : this(element as WebElement) { } @@ -24,9 +22,9 @@ public RadioButton(IWebElement element) /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public RadioButton(RemoteWebElement element) + public RadioButton(WebElement element) : base(element) { } @@ -44,15 +42,15 @@ public RadioButton(RemoteWebElement element) public virtual string Group => this.GetName(); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator RadioButton(RemoteWebElement element) + public static implicit operator RadioButton(WebElement element) { return new RadioButton(element); } diff --git a/src/Legerity.Web/Elements/Core/RangeInput.cs b/src/Legerity.Web/Elements/Core/RangeInput.cs index 5a31a3e8..14c43da6 100644 --- a/src/Legerity.Web/Elements/Core/RangeInput.cs +++ b/src/Legerity.Web/Elements/Core/RangeInput.cs @@ -2,8 +2,6 @@ namespace Legerity.Web.Elements.Core; using System; using Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; /// /// Defines a wrapper for the core web Input range control. @@ -17,7 +15,7 @@ public class RangeInput : TextInput /// The reference. /// public RangeInput(IWebElement element) - : this(element as RemoteWebElement) + : this(element as WebElement) { } @@ -25,9 +23,9 @@ public RangeInput(IWebElement element) /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public RangeInput(RemoteWebElement element) + public RangeInput(WebElement element) : base(element) { } @@ -51,15 +49,15 @@ public RangeInput(RemoteWebElement element) public virtual double Value => double.TryParse(this.Text, out double val) ? val : 0; /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator RangeInput(RemoteWebElement element) + public static implicit operator RangeInput(WebElement element) { return new RangeInput(element); } diff --git a/src/Legerity.Web/Elements/Core/Select.cs b/src/Legerity.Web/Elements/Core/Select.cs index d34a1fb4..2618cefc 100644 --- a/src/Legerity.Web/Elements/Core/Select.cs +++ b/src/Legerity.Web/Elements/Core/Select.cs @@ -6,8 +6,6 @@ namespace Legerity.Web.Elements.Core; using System.Linq; using Legerity.Extensions; using Legerity.Web.Elements; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; /// /// Defines a wrapper for the core web Select control. @@ -21,7 +19,7 @@ public class Select : WebElementWrapper /// The reference. /// public Select(IWebElement element) - : this(element as RemoteWebElement) + : this(element as WebElement) { } @@ -29,9 +27,9 @@ public Select(IWebElement element) /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public Select(RemoteWebElement element) + public Select(WebElement element) : base(element) { } @@ -69,7 +67,7 @@ public Select(RemoteWebElement element) /// /// The . /// - public static implicit operator Select(RemoteWebElement element) + public static implicit operator Select(WebElement element) { return new Select(element); } diff --git a/src/Legerity.Web/Elements/Core/Table.cs b/src/Legerity.Web/Elements/Core/Table.cs index 72ab8660..42e90990 100644 --- a/src/Legerity.Web/Elements/Core/Table.cs +++ b/src/Legerity.Web/Elements/Core/Table.cs @@ -3,8 +3,6 @@ namespace Legerity.Web.Elements.Core; using System.Collections.Generic; using System.Linq; using Legerity.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; /// /// Defines a wrapper for the core web Table control. @@ -18,7 +16,7 @@ public class Table : WebElementWrapper /// The reference. /// public Table(IWebElement element) - : this(element as RemoteWebElement) + : this(element as WebElement) { } @@ -26,9 +24,9 @@ public Table(IWebElement element) /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public Table(RemoteWebElement element) + public Table(WebElement element) : base(element) { } @@ -64,7 +62,7 @@ public Table(RemoteWebElement element) /// /// The . /// - public static implicit operator Table(RemoteWebElement element) + public static implicit operator Table(WebElement element) { return new Table(element); } diff --git a/src/Legerity.Web/Elements/Core/TableRow.cs b/src/Legerity.Web/Elements/Core/TableRow.cs index 34bca9f4..ef026721 100644 --- a/src/Legerity.Web/Elements/Core/TableRow.cs +++ b/src/Legerity.Web/Elements/Core/TableRow.cs @@ -4,8 +4,6 @@ namespace Legerity.Web.Elements.Core; using System.Linq; using Legerity.Extensions; using Legerity.Web.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; /// /// Defines a wrapper for the core web Table Row (tr) control. @@ -19,7 +17,7 @@ public class TableRow : WebElementWrapper /// The reference. /// public TableRow(IWebElement element) - : this(element as RemoteWebElement) + : this(element as WebElement) { } @@ -27,9 +25,9 @@ public TableRow(IWebElement element) /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public TableRow(RemoteWebElement element) + public TableRow(WebElement element) : base(element) { } diff --git a/src/Legerity.Web/Elements/Core/TextArea.cs b/src/Legerity.Web/Elements/Core/TextArea.cs index d4d3cc95..4bad2f63 100644 --- a/src/Legerity.Web/Elements/Core/TextArea.cs +++ b/src/Legerity.Web/Elements/Core/TextArea.cs @@ -1,8 +1,5 @@ namespace Legerity.Web.Elements.Core; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; - /// /// Defines a wrapper for the core web TextArea control. /// @@ -15,7 +12,7 @@ public class TextArea : TextInput /// The reference. /// public TextArea(IWebElement element) - : this(element as RemoteWebElement) + : this(element as WebElement) { } @@ -23,9 +20,9 @@ public TextArea(IWebElement element) /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public TextArea(RemoteWebElement element) + public TextArea(WebElement element) : base(element) { } @@ -46,12 +43,12 @@ public TextArea(RemoteWebElement element) /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator TextArea(RemoteWebElement element) + public static implicit operator TextArea(WebElement element) { return new TextArea(element); } diff --git a/src/Legerity.Web/Elements/Core/TextInput.cs b/src/Legerity.Web/Elements/Core/TextInput.cs index ec418310..98523f02 100644 --- a/src/Legerity.Web/Elements/Core/TextInput.cs +++ b/src/Legerity.Web/Elements/Core/TextInput.cs @@ -2,8 +2,6 @@ namespace Legerity.Web.Elements.Core; using Legerity.Web.Elements; using Legerity.Web.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; /// /// Defines a wrapper for the core web Input text control. @@ -17,7 +15,7 @@ public class TextInput : WebElementWrapper /// The reference. /// public TextInput(IWebElement element) - : this(element as RemoteWebElement) + : this(element as WebElement) { } @@ -25,9 +23,9 @@ public TextInput(IWebElement element) /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public TextInput(RemoteWebElement element) + public TextInput(WebElement element) : base(element) { } @@ -47,7 +45,7 @@ public TextInput(RemoteWebElement element) /// /// The . /// - public static implicit operator TextInput(RemoteWebElement element) + public static implicit operator TextInput(WebElement element) { return new TextInput(element); } diff --git a/src/Legerity.Web/Elements/WebElementWrapper.cs b/src/Legerity.Web/Elements/WebElementWrapper.cs index aa68e911..9f5bd256 100644 --- a/src/Legerity.Web/Elements/WebElementWrapper.cs +++ b/src/Legerity.Web/Elements/WebElementWrapper.cs @@ -4,14 +4,12 @@ namespace Legerity.Web.Elements; using System.Collections.ObjectModel; using Legerity.Exceptions; using Legerity.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; using OpenQA.Selenium.Support.UI; /// -/// Defines an element wrapper for a . +/// Defines an element wrapper for a . /// -public class WebElementWrapper : IElementWrapper +public class WebElementWrapper : IElementWrapper { private readonly WeakReference elementReference; @@ -22,7 +20,7 @@ public class WebElementWrapper : IElementWrapper /// The reference. /// public WebElementWrapper(IWebElement element) - : this(element as RemoteWebElement) + : this(element as WebElement) { } @@ -30,17 +28,17 @@ public WebElementWrapper(IWebElement element) /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public WebElementWrapper(RemoteWebElement element) + public WebElementWrapper(WebElement element) { this.elementReference = new WeakReference(element); } - /// Gets the original reference object. - public RemoteWebElement Element => + /// Gets the original reference object. + public WebElement Element => this.elementReference is { IsAlive: true } - ? this.elementReference.Target as RemoteWebElement + ? this.elementReference.Target as WebElement : null; /// @@ -51,7 +49,7 @@ public WebElementWrapper(RemoteWebElement element) /// /// Gets the instance of the driver for the web application. /// - public RemoteWebDriver Driver => this.ElementDriver as RemoteWebDriver; + public WebDriver Driver => this.ElementDriver as WebDriver; /// /// Gets a value indicating whether the element is enabled. @@ -66,15 +64,15 @@ public WebElementWrapper(RemoteWebElement element) public virtual bool IsVisible => this.Element.Displayed; /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator WebElementWrapper(RemoteWebElement element) + public static implicit operator WebElementWrapper(WebElement element) { return new WebElementWrapper(element); } @@ -83,9 +81,9 @@ public static implicit operator WebElementWrapper(RemoteWebElement element) /// Finds a child element by the specified locator. /// /// The locator to find a child element by. - /// The . + /// The . /// Thrown when no element matches the expected locator. - public RemoteWebElement FindElement(By locator) + public WebElement FindElement(By locator) { return this.Element.FindWebElement(locator); } @@ -94,8 +92,8 @@ public RemoteWebElement FindElement(By locator) /// Finds a collection of child elements by the specified locator. /// /// The locator to find a child element by. - /// The readonly collection of . - public ReadOnlyCollection FindElements(By locator) + /// The readonly collection of . + public ReadOnlyCollection FindElements(By locator) { return this.Element.FindWebElements(locator); } diff --git a/src/Legerity.Web/Extensions/AttributeExtensions.cs b/src/Legerity.Web/Extensions/AttributeExtensions.cs index 7b657e17..0a5340b0 100644 --- a/src/Legerity.Web/Extensions/AttributeExtensions.cs +++ b/src/Legerity.Web/Extensions/AttributeExtensions.cs @@ -1,8 +1,5 @@ namespace Legerity.Web.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; - /// /// Defines a collection of extensions for retrieving element attributes. /// @@ -23,7 +20,7 @@ public static string GetName(this IWebElement element) /// Retrieves the name attribute from the specified element. /// /// - /// The type of . + /// The type of . /// /// The to retrieve a name from. /// The name of the element. @@ -49,7 +46,7 @@ public static string GetValue(this IWebElement element) /// Retrieves the value attribute from the specified element. /// /// - /// The type of . + /// The type of . /// /// The to retrieve a value from. /// The value of the element. @@ -75,7 +72,7 @@ public static string GetClass(this IWebElement element) /// Retrieves the class attribute from the specified element. /// /// - /// The type of . + /// The type of . /// /// The to retrieve a class from. /// The class of the element. @@ -101,7 +98,7 @@ public static double GetWidth(this IWebElement element) /// Retrieves the width attribute from the specified element. /// /// - /// The type of . + /// The type of . /// /// The to retrieve a width from. /// The width of the element. @@ -127,7 +124,7 @@ public static double GetHeight(this IWebElement element) /// Retrieves the height attribute from the specified element. /// /// - /// The type of . + /// The type of . /// /// The to retrieve a height from. /// The height of the element. @@ -153,7 +150,7 @@ public static double GetMinimum(this IWebElement element) /// Retrieves the minimum attribute from the specified element. /// /// - /// The type of . + /// The type of . /// /// The to retrieve a minimum from. /// The minimum value of the element. @@ -179,7 +176,7 @@ public static double GetMaximum(this IWebElement element) /// Retrieves the maximum attribute from the specified element. /// /// - /// The type of . + /// The type of . /// /// The to retrieve a maximum from. /// The maximum value of the element. diff --git a/src/Legerity.Web/Extensions/IWebElementExtensions.cs b/src/Legerity.Web/Extensions/IWebElementExtensions.cs index b9090159..088f0db3 100644 --- a/src/Legerity.Web/Extensions/IWebElementExtensions.cs +++ b/src/Legerity.Web/Extensions/IWebElementExtensions.cs @@ -1,8 +1,6 @@ namespace Legerity.Web.Extensions; using System; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; /// /// Defines a collection of extensions for the class. @@ -24,7 +22,7 @@ public static string GetInnerHtml(this IWebElement element) /// Retrieves the value attribute from the specified element. /// /// - /// The type of . + /// The type of . /// /// The to retrieve the inner HTML from. /// The inner HTML of the element. @@ -52,7 +50,7 @@ public static bool HasClass(this IWebElement element, string className) /// Determines whether the specified has the specified class. /// /// - /// The type of . + /// The type of . /// /// The to check. /// The name of the class the element should have. diff --git a/src/Legerity.Web/Extensions/WebElementWrapperExtensions.cs b/src/Legerity.Web/Extensions/WebElementWrapperExtensions.cs index 4a57de1b..af9dca3f 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 Legerity.Web.Elements; -using OpenQA.Selenium; using OpenQA.Selenium.Support.UI; /// diff --git a/src/Legerity.Web/GlobalUsings.cs b/src/Legerity.Web/GlobalUsings.cs new file mode 100644 index 00000000..62ca2f56 --- /dev/null +++ b/src/Legerity.Web/GlobalUsings.cs @@ -0,0 +1,4 @@ +// Global using directives + +global using OpenQA.Selenium; +global using OpenQA.Selenium.Remote; diff --git a/src/Legerity.Web/Legerity.Web.csproj b/src/Legerity.Web/Legerity.Web.csproj index 88abe8ee..3d723382 100644 --- a/src/Legerity.Web/Legerity.Web.csproj +++ b/src/Legerity.Web/Legerity.Web.csproj @@ -20,7 +20,7 @@ - TextArea, a multi-line text input element - TextInput, a default text input element - UI Test Appium Selenium ChromeDriver FirefoxDriver OperaDriver SafariDriver EdgeDriver InternetExplorerDriver RemoteWebDriver Web + UI Test Appium Selenium ChromeDriver FirefoxDriver OperaDriver SafariDriver EdgeDriver InternetExplorerDriver WebDriver Web diff --git a/src/Legerity.Web/WebByExtras.cs b/src/Legerity.Web/WebByExtras.cs index 7b367145..f0e77abd 100644 --- a/src/Legerity.Web/WebByExtras.cs +++ b/src/Legerity.Web/WebByExtras.cs @@ -1,7 +1,5 @@ namespace Legerity.Web; -using OpenQA.Selenium; - /// /// Defines a collection of extra locator constraints for . /// From 355363776f03344de117f7cb28a5795a1dcc08a6 Mon Sep 17 00:00:00 2001 From: James Croft Date: Tue, 5 Mar 2024 19:59:04 +0000 Subject: [PATCH 07/21] Fix Web Authentication upgrade --- src/Legerity.Web.Authentication/GlobalUsings.cs | 4 ++++ .../Legerity.Web.Authentication.csproj | 2 +- .../Pages/AzureAdLoginPage.cs | 10 ++++------ .../Pages/FacebookLoginPage.cs | 10 ++++------ .../Pages/GoogleLoginPage.cs | 10 ++++------ 5 files changed, 17 insertions(+), 19 deletions(-) create mode 100644 src/Legerity.Web.Authentication/GlobalUsings.cs diff --git a/src/Legerity.Web.Authentication/GlobalUsings.cs b/src/Legerity.Web.Authentication/GlobalUsings.cs new file mode 100644 index 00000000..62ca2f56 --- /dev/null +++ b/src/Legerity.Web.Authentication/GlobalUsings.cs @@ -0,0 +1,4 @@ +// Global using directives + +global using OpenQA.Selenium; +global using OpenQA.Selenium.Remote; diff --git a/src/Legerity.Web.Authentication/Legerity.Web.Authentication.csproj b/src/Legerity.Web.Authentication/Legerity.Web.Authentication.csproj index b5927232..68e466c3 100644 --- a/src/Legerity.Web.Authentication/Legerity.Web.Authentication.csproj +++ b/src/Legerity.Web.Authentication/Legerity.Web.Authentication.csproj @@ -7,7 +7,7 @@ An extension to the Legerity UI testing framework to support authenticating with common web identity providers. - UI Test AzureAD Facebook Google Appium Selenium ChromeDriver FirefoxDriver OperaDriver SafariDriver EdgeDriver InternetExplorerDriver RemoteWebDriver Web + UI Test AzureAD Facebook Google Appium Selenium ChromeDriver FirefoxDriver OperaDriver SafariDriver EdgeDriver InternetExplorerDriver WebDriver Web diff --git a/src/Legerity.Web.Authentication/Pages/AzureAdLoginPage.cs b/src/Legerity.Web.Authentication/Pages/AzureAdLoginPage.cs index 811640cc..8397470b 100644 --- a/src/Legerity.Web.Authentication/Pages/AzureAdLoginPage.cs +++ b/src/Legerity.Web.Authentication/Pages/AzureAdLoginPage.cs @@ -5,8 +5,6 @@ namespace Legerity.Web.Authentication.Pages; using Legerity.Extensions; using Legerity.Pages; using Legerity.Web.Elements.Core; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; /// /// Defines a page object for the Azure Active Directory login page. @@ -29,7 +27,7 @@ public AzureAdLoginPage() } /// - /// Initializes a new instance of the class using a instance that verifies the page has loaded within 2 seconds. + /// Initializes a new instance of the class using a instance that verifies the page has loaded within 2 seconds. /// /// /// The instance of the started application driver that will be used to drive the page interaction. @@ -37,7 +35,7 @@ public AzureAdLoginPage() /// Thrown when AppManager.StartApp() has not been called. /// Thrown when the page is not shown in 2 seconds. /// Thrown when no element matches the expected locator. - public AzureAdLoginPage(RemoteWebDriver app) + public AzureAdLoginPage(WebDriver app) : base(app) { } @@ -57,7 +55,7 @@ public AzureAdLoginPage(TimeSpan? traitTimeout) } /// - /// Initializes a new instance of the class using a instance that verifies the page has loaded within the given timeout. + /// Initializes a new instance of the class using a instance that verifies the page has loaded within the given timeout. /// /// /// The instance of the started application driver that will be used to drive the page interaction. @@ -68,7 +66,7 @@ public AzureAdLoginPage(TimeSpan? traitTimeout) /// Thrown when AppManager.StartApp() has not been called. /// Thrown when the page is not shown in the given timeout. /// Thrown when no element matches the expected locator. - public AzureAdLoginPage(RemoteWebDriver app, TimeSpan? traitTimeout) + public AzureAdLoginPage(WebDriver app, TimeSpan? traitTimeout) : base(app, traitTimeout) { } diff --git a/src/Legerity.Web.Authentication/Pages/FacebookLoginPage.cs b/src/Legerity.Web.Authentication/Pages/FacebookLoginPage.cs index 5f0f6588..701da0df 100644 --- a/src/Legerity.Web.Authentication/Pages/FacebookLoginPage.cs +++ b/src/Legerity.Web.Authentication/Pages/FacebookLoginPage.cs @@ -5,8 +5,6 @@ namespace Legerity.Web.Authentication.Pages; using Legerity.Extensions; using Legerity.Pages; using Legerity.Web.Elements.Core; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; /// /// Defines a page object for the Facebook login page. @@ -29,7 +27,7 @@ public FacebookLoginPage() } /// - /// Initializes a new instance of the class using a instance that verifies the page has loaded within 2 seconds. + /// Initializes a new instance of the class using a instance that verifies the page has loaded within 2 seconds. /// /// /// The instance of the started application driver that will be used to drive the page interaction. @@ -37,7 +35,7 @@ public FacebookLoginPage() /// Thrown when AppManager.StartApp() has not been called. /// Thrown when the page is not shown in 2 seconds. /// Thrown when no element matches the expected locator. - public FacebookLoginPage(RemoteWebDriver app) + public FacebookLoginPage(WebDriver app) : base(app) { } @@ -57,7 +55,7 @@ public FacebookLoginPage(TimeSpan? traitTimeout) } /// - /// Initializes a new instance of the class using a instance that verifies the page has loaded within the given timeout. + /// Initializes a new instance of the class using a instance that verifies the page has loaded within the given timeout. /// /// /// The instance of the started application driver that will be used to drive the page interaction. @@ -68,7 +66,7 @@ public FacebookLoginPage(TimeSpan? traitTimeout) /// Thrown when AppManager.StartApp() has not been called. /// Thrown when the page is not shown in the given timeout. /// Thrown when no element matches the expected locator. - public FacebookLoginPage(RemoteWebDriver app, TimeSpan? traitTimeout) + public FacebookLoginPage(WebDriver app, TimeSpan? traitTimeout) : base(app, traitTimeout) { } diff --git a/src/Legerity.Web.Authentication/Pages/GoogleLoginPage.cs b/src/Legerity.Web.Authentication/Pages/GoogleLoginPage.cs index c307c374..dddc2196 100644 --- a/src/Legerity.Web.Authentication/Pages/GoogleLoginPage.cs +++ b/src/Legerity.Web.Authentication/Pages/GoogleLoginPage.cs @@ -5,8 +5,6 @@ namespace Legerity.Web.Authentication.Pages; using Legerity.Extensions; using Legerity.Pages; using Legerity.Web.Elements.Core; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; /// /// Defines a page object for the Google login page. @@ -29,7 +27,7 @@ public GoogleLoginPage() } /// - /// Initializes a new instance of the class using a instance that verifies the page has loaded within 2 seconds. + /// Initializes a new instance of the class using a instance that verifies the page has loaded within 2 seconds. /// /// /// The instance of the started application driver that will be used to drive the page interaction. @@ -37,7 +35,7 @@ public GoogleLoginPage() /// Thrown when AppManager.StartApp() has not been called. /// Thrown when the page is not shown in 2 seconds. /// Thrown when no element matches the expected locator. - public GoogleLoginPage(RemoteWebDriver app) + public GoogleLoginPage(WebDriver app) : base(app) { } @@ -57,7 +55,7 @@ public GoogleLoginPage(TimeSpan? traitTimeout) } /// - /// Initializes a new instance of the class using a instance that verifies the page has loaded within the given timeout. + /// Initializes a new instance of the class using a instance that verifies the page has loaded within the given timeout. /// /// /// The instance of the started application driver that will be used to drive the page interaction. @@ -68,7 +66,7 @@ public GoogleLoginPage(TimeSpan? traitTimeout) /// Thrown when AppManager.StartApp() has not been called. /// Thrown when the page is not shown in the given timeout. /// Thrown when no element matches the expected locator. - public GoogleLoginPage(RemoteWebDriver app, TimeSpan? traitTimeout) + public GoogleLoginPage(WebDriver app, TimeSpan? traitTimeout) : base(app, traitTimeout) { } From 5cd6d298917d848483015482ed55248c9cddf1c1 Mon Sep 17 00:00:00 2001 From: James Croft Date: Mon, 11 Mar 2024 20:21:39 +0000 Subject: [PATCH 08/21] Fix Windows port --- .../Elements/Core/AppBarButton.cs | 44 ++---------- .../Elements/Core/AppBarToggleButton.cs | 46 ++----------- .../Elements/Core/AutoSuggestBox.cs | 50 +++----------- src/Legerity.Windows/Elements/Core/Button.cs | 44 ++---------- .../Elements/Core/CalendarDatePicker.cs | 46 ++----------- .../Elements/Core/CalendarView.cs | 52 +++----------- .../Elements/Core/CheckBox.cs | 46 ++----------- .../Elements/Core/ComboBox.cs | 60 ++++------------ .../Elements/Core/CommandBar.cs | 48 +++---------- .../Elements/Core/DatePicker.cs | 47 +++---------- .../Elements/Core/FlipView.cs | 50 +++----------- .../Elements/Core/GridView.cs | 59 ++++------------ src/Legerity.Windows/Elements/Core/Hub.cs | 47 +++---------- .../Elements/Core/HyperlinkButton.cs | 44 ++---------- .../Core/InkToolbar.BallpointPenFlyout.cs | 42 ++--------- .../Core/InkToolbar.ColorFlyoutBase.cs | 9 +-- .../Core/InkToolbar.HighlighterFlyout.cs | 42 ++--------- .../Elements/Core/InkToolbar.PencilFlyout.cs | 42 ++--------- .../Elements/Core/InkToolbar.cs | 46 ++----------- src/Legerity.Windows/Elements/Core/ListBox.cs | 55 +++------------ .../Elements/Core/ListView.cs | 53 +++----------- .../Elements/Core/MenuFlyoutItem.cs | 44 ++---------- .../Elements/Core/MenuFlyoutSubItem.cs | 48 +++---------- .../Elements/Core/PasswordBox.cs | 46 ++----------- src/Legerity.Windows/Elements/Core/Pivot.cs | 55 +++------------ .../Elements/Core/ProgressBar.cs | 44 ++---------- .../Elements/Core/ProgressRing.cs | 44 ++---------- .../Elements/Core/RadioButton.cs | 44 ++---------- .../Elements/Core/ScrollViewer.cs | 47 ++----------- src/Legerity.Windows/Elements/Core/Slider.cs | 44 ++---------- .../Elements/Core/TextBlock.cs | 45 ++---------- src/Legerity.Windows/Elements/Core/TextBox.cs | 46 ++----------- .../Elements/Core/TimePicker.cs | 47 +++---------- .../Elements/Core/ToggleButton.cs | 46 ++----------- .../Elements/Core/ToggleSwitch.cs | 44 ++---------- .../Elements/WindowsElementWrapper.cs | 49 +++---------- .../Extensions/AttributeExtensions.cs | 24 +++---- .../Extensions/ElementExtensions.cs | 10 +++ .../Extensions/LegerityTestClassExtensions.cs | 10 ++- .../Extensions/WindowsElementExtensions.cs | 69 +++---------------- .../WindowsElementWrapperExtensions.cs | 1 - src/Legerity.Windows/GlobalUsings.cs | 6 ++ src/Legerity.Windows/WindowsByExtras.cs | 1 - 43 files changed, 311 insertions(+), 1475 deletions(-) create mode 100644 src/Legerity.Windows/Extensions/ElementExtensions.cs create mode 100644 src/Legerity.Windows/GlobalUsings.cs diff --git a/src/Legerity.Windows/Elements/Core/AppBarButton.cs b/src/Legerity.Windows/Elements/Core/AppBarButton.cs index 6948777e..2258267a 100644 --- a/src/Legerity.Windows/Elements/Core/AppBarButton.cs +++ b/src/Legerity.Windows/Elements/Core/AppBarButton.cs @@ -1,11 +1,7 @@ namespace Legerity.Windows.Elements.Core; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; - /// -/// Defines a wrapper for the core UWP AppBarButton control. +/// Defines a wrapper for the core UWP AppBarButton control. /// public class AppBarButton : Button { @@ -13,52 +9,24 @@ public class AppBarButton : Button /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public AppBarButton(WindowsElement element) + public AppBarButton(WebElement element) : base(element) { } /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator AppBarButton(WindowsElement element) + public static implicit operator AppBarButton(WebElement element) { return new AppBarButton(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator AppBarButton(AppiumWebElement element) - { - return new AppBarButton(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator AppBarButton(RemoteWebElement element) - { - return new AppBarButton(element as WindowsElement); - } } \ No newline at end of file diff --git a/src/Legerity.Windows/Elements/Core/AppBarToggleButton.cs b/src/Legerity.Windows/Elements/Core/AppBarToggleButton.cs index 57ee0a6a..2b8336bb 100644 --- a/src/Legerity.Windows/Elements/Core/AppBarToggleButton.cs +++ b/src/Legerity.Windows/Elements/Core/AppBarToggleButton.cs @@ -1,13 +1,9 @@ namespace Legerity.Windows.Elements.Core; using Legerity.Windows.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core UWP AppBarToggleButton control. +/// Defines a wrapper for the core UWP AppBarToggleButton control. /// public class AppBarToggleButton : AppBarButton { @@ -15,9 +11,9 @@ public class AppBarToggleButton : AppBarButton /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public AppBarToggleButton(WindowsElement element) + public AppBarToggleButton(WebElement element) : base(element) { } @@ -29,47 +25,19 @@ public AppBarToggleButton(WindowsElement element) public virtual bool IsOn => this.GetToggleState() == ToggleState.Checked; /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator AppBarToggleButton(WindowsElement element) + public static implicit operator AppBarToggleButton(WebElement element) { return new AppBarToggleButton(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator AppBarToggleButton(AppiumWebElement element) - { - return new AppBarToggleButton(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator AppBarToggleButton(RemoteWebElement element) - { - return new AppBarToggleButton(element as WindowsElement); - } - + /// /// Toggles the button on. /// diff --git a/src/Legerity.Windows/Elements/Core/AutoSuggestBox.cs b/src/Legerity.Windows/Elements/Core/AutoSuggestBox.cs index f8c473ea..e31bdc56 100644 --- a/src/Legerity.Windows/Elements/Core/AutoSuggestBox.cs +++ b/src/Legerity.Windows/Elements/Core/AutoSuggestBox.cs @@ -2,13 +2,9 @@ namespace Legerity.Windows.Elements.Core; using System; using Legerity.Exceptions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core UWP AutoSuggestBox control. +/// Defines a wrapper for the core UWP AutoSuggestBox control. /// public class AutoSuggestBox : WindowsElementWrapper { @@ -18,9 +14,9 @@ public class AutoSuggestBox : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public AutoSuggestBox(WindowsElement element) + public AutoSuggestBox(WebElement element) : base(element) { } @@ -29,13 +25,13 @@ public AutoSuggestBox(WindowsElement element) /// Gets the element associated with the suggestions popup. /// /// Thrown when no element matches the expected locator. - public virtual AppiumWebElement SuggestionsPopup => this.FindElement(this.suggestionsPopupLocator); + public virtual WebElement SuggestionsPopup => this.FindElement(this.suggestionsPopupLocator); /// /// Gets the element associated with the suggestion list when the is shown. /// /// Thrown when no element matches the expected locator. - public virtual ListView SuggestionList => this.SuggestionsPopup.FindElement(WindowsByExtras.AutomationId("SuggestionsList")); + public virtual ListView SuggestionList => this.SuggestionsPopup.FindElement(WindowsByExtras.AutomationId("SuggestionsList")) as WebElement; /// /// Gets the element associated with the text box. @@ -50,47 +46,19 @@ public AutoSuggestBox(WindowsElement element) public virtual string Text => this.TextBox.Text; /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator AutoSuggestBox(WindowsElement element) + public static implicit operator AutoSuggestBox(WebElement element) { return new AutoSuggestBox(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator AutoSuggestBox(AppiumWebElement element) - { - return new AutoSuggestBox(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator AutoSuggestBox(RemoteWebElement element) - { - return new AutoSuggestBox(element as WindowsElement); - } - + /// /// Selects a suggestion from the auto-suggest box. /// diff --git a/src/Legerity.Windows/Elements/Core/Button.cs b/src/Legerity.Windows/Elements/Core/Button.cs index 1b3bd748..7ff12b02 100644 --- a/src/Legerity.Windows/Elements/Core/Button.cs +++ b/src/Legerity.Windows/Elements/Core/Button.cs @@ -1,11 +1,7 @@ namespace Legerity.Windows.Elements.Core; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; - /// -/// Defines a wrapper for the core UWP Button control. +/// Defines a wrapper for the core UWP Button control. /// public class Button : WindowsElementWrapper { @@ -13,52 +9,24 @@ public class Button : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public Button(WindowsElement element) + public Button(WebElement element) : base(element) { } /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator Button(WindowsElement element) + public static implicit operator Button(WebElement element) { return new Button(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator Button(AppiumWebElement element) - { - return new Button(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator Button(RemoteWebElement element) - { - return new Button(element as WindowsElement); - } } \ 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 81ab4714..1613490d 100644 --- a/src/Legerity.Windows/Elements/Core/CalendarDatePicker.cs +++ b/src/Legerity.Windows/Elements/Core/CalendarDatePicker.cs @@ -4,13 +4,9 @@ namespace Legerity.Windows.Elements.Core; using Legerity.Exceptions; using Legerity.Extensions; using Legerity.Windows.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core UWP CalendarDatePicker control. +/// Defines a wrapper for the core UWP CalendarDatePicker control. /// public class CalendarDatePicker : WindowsElementWrapper { @@ -20,9 +16,9 @@ public class CalendarDatePicker : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public CalendarDatePicker(WindowsElement element) + public CalendarDatePicker(WebElement element) : base(element) { } @@ -46,47 +42,19 @@ public CalendarDatePicker(WindowsElement element) public virtual DateTime? SelectedDate => this.GetSelectedDate(); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator CalendarDatePicker(WindowsElement element) + public static implicit operator CalendarDatePicker(WebElement element) { return new CalendarDatePicker(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator CalendarDatePicker(AppiumWebElement element) - { - return new CalendarDatePicker(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator CalendarDatePicker(RemoteWebElement element) - { - return new CalendarDatePicker(element as WindowsElement); - } - + /// /// Sets the selected date of the calendar view. /// diff --git a/src/Legerity.Windows/Elements/Core/CalendarView.cs b/src/Legerity.Windows/Elements/Core/CalendarView.cs index 8d030925..c69cea6b 100644 --- a/src/Legerity.Windows/Elements/Core/CalendarView.cs +++ b/src/Legerity.Windows/Elements/Core/CalendarView.cs @@ -7,13 +7,9 @@ namespace Legerity.Windows.Elements.Core; using System.Threading; using Legerity.Extensions; using Legerity.Windows.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core UWP CalendarView control. +/// Defines a wrapper for the core UWP CalendarView control. /// public class CalendarView : WindowsElementWrapper { @@ -37,9 +33,9 @@ public class CalendarView : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public CalendarView(WindowsElement element) + public CalendarView(WebElement element) : base(element) { } @@ -66,8 +62,8 @@ public CalendarView(WindowsElement element) /// /// Gets the collection of days associated with the current month in the calendar view. /// - public virtual ReadOnlyCollection Days => - this.Element.FindElements(By.ClassName("CalendarViewDayItem")); + public virtual ReadOnlyCollection Days => + this.Element.FindElements(By.ClassName("CalendarViewDayItem")).Cast().ToList().AsReadOnly(); /// /// Gets the value of the calendar view. @@ -81,47 +77,19 @@ public CalendarView(WindowsElement element) public virtual DateTime? SelectedDate => this.GetSelectedDate(); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator CalendarView(WindowsElement element) + public static implicit operator CalendarView(WebElement element) { return new CalendarView(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator CalendarView(AppiumWebElement element) - { - return new CalendarView(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator CalendarView(RemoteWebElement element) - { - return new CalendarView(element as WindowsElement); - } - + /// /// Sets the selected date of the calendar view. /// @@ -154,7 +122,7 @@ public void SetDate(DateTime date) currentHeader = this.HeaderButton.GetName(); } - AppiumWebElement item = this.Days.FirstOrDefault( + WebElement item = this.Days.FirstOrDefault( element => element.GetName().Equals(expectedDay, StringComparison.CurrentCultureIgnoreCase)); if (item == null) diff --git a/src/Legerity.Windows/Elements/Core/CheckBox.cs b/src/Legerity.Windows/Elements/Core/CheckBox.cs index 3e086f6a..3d6b7a91 100644 --- a/src/Legerity.Windows/Elements/Core/CheckBox.cs +++ b/src/Legerity.Windows/Elements/Core/CheckBox.cs @@ -1,13 +1,9 @@ namespace Legerity.Windows.Elements.Core; using Legerity.Windows.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core UWP CheckBox control. +/// Defines a wrapper for the core UWP CheckBox control. /// public class CheckBox : WindowsElementWrapper { @@ -15,9 +11,9 @@ public class CheckBox : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public CheckBox(WindowsElement element) + public CheckBox(WebElement element) : base(element) { } @@ -35,47 +31,19 @@ public CheckBox(WindowsElement element) public virtual bool IsIndeterminate => this.GetToggleState() == ToggleState.Indeterminate; /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator CheckBox(WindowsElement element) + public static implicit operator CheckBox(WebElement element) { return new CheckBox(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator CheckBox(AppiumWebElement element) - { - return new CheckBox(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator CheckBox(RemoteWebElement element) - { - return new CheckBox(element as WindowsElement); - } - + /// /// Checks the check box on. /// diff --git a/src/Legerity.Windows/Elements/Core/ComboBox.cs b/src/Legerity.Windows/Elements/Core/ComboBox.cs index 5b7f2190..f3d89ea9 100644 --- a/src/Legerity.Windows/Elements/Core/ComboBox.cs +++ b/src/Legerity.Windows/Elements/Core/ComboBox.cs @@ -7,13 +7,9 @@ namespace Legerity.Windows.Elements.Core; using System.Linq; using Legerity.Exceptions; using Legerity.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core UWP ComboBox control. +/// Defines a wrapper for the core UWP ComboBox control. /// public class ComboBox : WindowsElementWrapper { @@ -23,9 +19,9 @@ public class ComboBox : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public ComboBox(WindowsElement element) + public ComboBox(WebElement element) : base(element) { } @@ -37,47 +33,19 @@ public ComboBox(WindowsElement element) public virtual string SelectedItem => this.GetSelectedItem(); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator ComboBox(WindowsElement element) + public static implicit operator ComboBox(WebElement element) { return new ComboBox(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator ComboBox(AppiumWebElement element) - { - return new ComboBox(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator ComboBox(RemoteWebElement element) - { - return new ComboBox(element as WindowsElement); - } - + /// /// Selects an item in the combo-box with the specified item name. /// @@ -91,9 +59,9 @@ public static implicit operator ComboBox(RemoteWebElement element) /// Thrown when no elements are shown for the expected locator. public virtual void SelectItem(string name) { - IEnumerable listElements = this.GetItemsToSelect(); + IEnumerable listElements = this.GetItemsToSelect(); - AppiumWebElement item = listElements.FirstOrDefault( + WebElement item = listElements.FirstOrDefault( element => element.GetName().Equals(name, StringComparison.CurrentCultureIgnoreCase)); if (item == null) @@ -117,9 +85,9 @@ public virtual void SelectItem(string name) /// Thrown when no elements are shown for the expected locator. public virtual void SelectItemByPartialName(string name) { - IEnumerable listElements = this.GetItemsToSelect(); + IEnumerable listElements = this.GetItemsToSelect(); - AppiumWebElement item = listElements.FirstOrDefault( + WebElement item = listElements.FirstOrDefault( element => element.GetName().Contains(name, CultureInfo.CurrentCulture, CompareOptions.IgnoreCase)); if (item == null) @@ -133,7 +101,7 @@ public virtual void SelectItemByPartialName(string name) /// Thrown when an element is no longer valid in the document DOM. private string GetSelectedItem() { - ReadOnlyCollection listElements = this.Element.FindElements(this.comboBoxItemLocator); + ReadOnlyCollection listElements = this.Element.FindElements(this.comboBoxItemLocator).Cast().ToList().AsReadOnly(); return listElements.Count == 1 ? listElements.FirstOrDefault().GetName() : null; } @@ -141,11 +109,11 @@ private string GetSelectedItem() /// Thrown when an element is not enabled. /// Thrown when an element is not visible. /// Thrown when an element is no longer valid in the document DOM. - private IEnumerable GetItemsToSelect() + private IEnumerable GetItemsToSelect() { this.Click(); this.VerifyElementsShown(this.comboBoxItemLocator, TimeSpan.FromSeconds(2)); - ReadOnlyCollection listElements = this.Element.FindElements(this.comboBoxItemLocator); + ReadOnlyCollection listElements = this.Element.FindElements(this.comboBoxItemLocator).Cast().ToList().AsReadOnly(); return listElements; } } \ No newline at end of file diff --git a/src/Legerity.Windows/Elements/Core/CommandBar.cs b/src/Legerity.Windows/Elements/Core/CommandBar.cs index a9e56657..717078b3 100644 --- a/src/Legerity.Windows/Elements/Core/CommandBar.cs +++ b/src/Legerity.Windows/Elements/Core/CommandBar.cs @@ -5,13 +5,9 @@ namespace Legerity.Windows.Elements.Core; using System.Linq; using Legerity.Exceptions; using Legerity.Windows.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core UWP CommandBar control. +/// Defines a wrapper for the core UWP CommandBar control. /// public class CommandBar : WindowsElementWrapper { @@ -25,9 +21,9 @@ public class CommandBar : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public CommandBar(WindowsElement element) + public CommandBar(WebElement element) : base(element) { } @@ -37,7 +33,7 @@ public CommandBar(WindowsElement element) /// public virtual IEnumerable PrimaryButtons => this.Element.FindElements(this.appBarButtonLocator) - .Select(element => element); + .Select(element => element as WebElement); /// /// Gets the for opening the secondary button menu. @@ -54,50 +50,22 @@ public CommandBar(WindowsElement element) /// Thrown when no element matches the expected locator. public virtual IEnumerable SecondaryButtons => this.Driver.FindElement(this.overflowPopupLocator).FindElements(this.appBarButtonLocator) - .Select(element => element); + .Select(element => element); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator CommandBar(WindowsElement element) + public static implicit operator CommandBar(WebElement element) { return new CommandBar(element); } - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator CommandBar(AppiumWebElement element) - { - return new CommandBar(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator CommandBar(RemoteWebElement element) - { - return new CommandBar(element as WindowsElement); - } - /// /// Clicks a primary button in the command bar with the specified button name or Automation ID. /// diff --git a/src/Legerity.Windows/Elements/Core/DatePicker.cs b/src/Legerity.Windows/Elements/Core/DatePicker.cs index 08edfd5f..58b93e58 100644 --- a/src/Legerity.Windows/Elements/Core/DatePicker.cs +++ b/src/Legerity.Windows/Elements/Core/DatePicker.cs @@ -2,14 +2,11 @@ namespace Legerity.Windows.Elements.Core; using System; using System.Text.RegularExpressions; +using Extensions; using Legerity.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core UWP DatePicker control. +/// Defines a wrapper for the core UWP DatePicker control. /// public class DatePicker : WindowsElementWrapper { @@ -17,9 +14,9 @@ public class DatePicker : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public DatePicker(WindowsElement element) + public DatePicker(WebElement element) : base(element) { } @@ -37,47 +34,19 @@ public DatePicker(WindowsElement element) public virtual DateTime? SelectedDate => this.GetSelectedDate(); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator DatePicker(WindowsElement element) + public static implicit operator DatePicker(WebElement element) { return new DatePicker(element); } - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator DatePicker(AppiumWebElement element) - { - return new DatePicker(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator DatePicker(RemoteWebElement element) - { - return new DatePicker(element as WindowsElement); - } - /// /// Sets the date to the specified date. /// @@ -126,7 +95,7 @@ public virtual void SetDate(DateTime date) /// Thrown when an element is no longer valid in the document DOM. private string GetValue() { - AppiumWebElement button = this.FindElement(WindowsByExtras.AutomationId("FlyoutButton")); + WebElement button = this.FindElement(WindowsByExtras.AutomationId("FlyoutButton")); string name = button.GetName().RemoveUnicodeCharacters(); Match match = Regex.Match(name, @"\w+\s\d{1,2},\s\d{4}"); return match.Success ? match.Value : null; diff --git a/src/Legerity.Windows/Elements/Core/FlipView.cs b/src/Legerity.Windows/Elements/Core/FlipView.cs index 115119de..98a7289d 100644 --- a/src/Legerity.Windows/Elements/Core/FlipView.cs +++ b/src/Legerity.Windows/Elements/Core/FlipView.cs @@ -6,13 +6,9 @@ namespace Legerity.Windows.Elements.Core; using System.Linq; using Legerity.Extensions; using Legerity.Windows.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core UWP FlipView control. +/// Defines a wrapper for the core UWP FlipView control. /// public class FlipView : WindowsElementWrapper { @@ -20,9 +16,9 @@ public class FlipView : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public FlipView(WindowsElement element) + public FlipView(WebElement element) : base(element) { } @@ -30,7 +26,7 @@ public FlipView(WindowsElement element) /// /// Gets the collection of items associated with the flip view. /// - public virtual ReadOnlyCollection Items => this.Element.FindElements(By.ClassName("FlipViewItem")); + public virtual ReadOnlyCollection Items => this.Element.FindElements(By.ClassName("FlipViewItem")).Cast().ToList().AsReadOnly(); /// /// Gets the element associated with the next item button. @@ -47,7 +43,7 @@ public FlipView(WindowsElement element) /// /// Gets the currently selected item. /// - public virtual AppiumWebElement SelectedItem => this.Items.FirstOrDefault(i => i.IsSelected()); + public virtual WebElement SelectedItem => this.Items.FirstOrDefault(i => i.IsSelected()); /// /// Gets the currently selected item index. @@ -55,47 +51,19 @@ public FlipView(WindowsElement element) public virtual int SelectedIndex => this.Items.IndexOf(this.SelectedItem); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator FlipView(WindowsElement element) + public static implicit operator FlipView(WebElement element) { return new FlipView(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator FlipView(AppiumWebElement element) - { - return new FlipView(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator FlipView(RemoteWebElement element) - { - return new FlipView(element as WindowsElement); - } - + /// /// Selects an item in the flip view by the specified name. /// diff --git a/src/Legerity.Windows/Elements/Core/GridView.cs b/src/Legerity.Windows/Elements/Core/GridView.cs index 536d8fce..c0e79285 100644 --- a/src/Legerity.Windows/Elements/Core/GridView.cs +++ b/src/Legerity.Windows/Elements/Core/GridView.cs @@ -6,13 +6,8 @@ namespace Legerity.Windows.Elements.Core; using Legerity.Exceptions; using Legerity.Windows.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; - /// -/// Defines a wrapper for the core UWP GridView control. +/// Defines a wrapper for the core UWP GridView control. /// public class GridView : WindowsElementWrapper { @@ -22,9 +17,9 @@ public class GridView : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public GridView(WindowsElement element) + public GridView(WebElement element) : base(element) { } @@ -32,13 +27,13 @@ public GridView(WindowsElement element) /// /// Gets the collection of items associated with the grid view. /// - public virtual ReadOnlyCollection Items => - this.Element.FindElements(this.gridViewItemLocator); + public virtual ReadOnlyCollection Items => + this.Element.FindElements(this.gridViewItemLocator).Cast().ToList().AsReadOnly(); /// /// Gets the element associated with the currently selected item. /// - public virtual AppiumWebElement SelectedItem => this.Items.FirstOrDefault(i => i.IsSelected()); + public virtual WebElement SelectedItem => this.Items.FirstOrDefault(i => i.IsSelected()); /// /// Gets the currently selected item index. @@ -46,47 +41,19 @@ public GridView(WindowsElement element) public virtual int SelectedIndex => this.Items.IndexOf(this.SelectedItem); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator GridView(WindowsElement element) + public static implicit operator GridView(WebElement element) { return new GridView(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator GridView(AppiumWebElement element) - { - return new GridView(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator GridView(RemoteWebElement element) - { - return new GridView(element as WindowsElement); - } - + /// /// Clicks on an item in the list view with the specified item name. /// @@ -102,7 +69,7 @@ public virtual void ClickItem(string name) { this.VerifyElementsShown(this.gridViewItemLocator, TimeSpan.FromSeconds(2)); - AppiumWebElement item = this.Items.FirstOrDefault(element => element.VerifyNameOrAutomationIdEquals(name)); + WebElement item = this.Items.FirstOrDefault(element => element.VerifyNameOrAutomationIdEquals(name)); if (item == null) { @@ -127,7 +94,7 @@ public virtual void ClickItemByPartialName(string partialName) { this.VerifyElementsShown(this.gridViewItemLocator, TimeSpan.FromSeconds(2)); - AppiumWebElement item = + WebElement item = this.Items.FirstOrDefault(element => element.VerifyNameOrAutomationIdContains(partialName)); if (item == null) @@ -153,7 +120,7 @@ public virtual void ClickItemByIndex(int index) { this.VerifyElementsShown(this.gridViewItemLocator, TimeSpan.FromSeconds(2)); - AppiumWebElement item = this.Items[index]; + WebElement item = this.Items[index]; if (item == null) { diff --git a/src/Legerity.Windows/Elements/Core/Hub.cs b/src/Legerity.Windows/Elements/Core/Hub.cs index 1aaff34a..675b1de4 100644 --- a/src/Legerity.Windows/Elements/Core/Hub.cs +++ b/src/Legerity.Windows/Elements/Core/Hub.cs @@ -1,13 +1,10 @@ namespace Legerity.Windows.Elements.Core; using System.Collections.ObjectModel; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; +using System.Linq; /// -/// Defines a wrapper for the core UWP Hub control. +/// Defines a wrapper for the core UWP Hub control. /// public class Hub : WindowsElementWrapper { @@ -15,9 +12,9 @@ public class Hub : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public Hub(WindowsElement element) + public Hub(WebElement element) : base(element) { } @@ -25,47 +22,19 @@ public Hub(WindowsElement element) /// /// Gets the collection of items associated with the hub. /// - public virtual ReadOnlyCollection Items => this.Element.FindElements(By.ClassName("HubSection")); + public virtual ReadOnlyCollection Items => this.Element.FindElements(By.ClassName("HubSection")).Cast().ToList().AsReadOnly(); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator Hub(WindowsElement element) + public static implicit operator Hub(WebElement element) { return new Hub(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator Hub(AppiumWebElement element) - { - return new Hub(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator Hub(RemoteWebElement element) - { - return new Hub(element as WindowsElement); - } } \ 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 74744673..bff0308f 100644 --- a/src/Legerity.Windows/Elements/Core/HyperlinkButton.cs +++ b/src/Legerity.Windows/Elements/Core/HyperlinkButton.cs @@ -1,11 +1,7 @@ namespace Legerity.Windows.Elements.Core; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; - /// -/// Defines a wrapper for the core UWP HyperlinkButton control. +/// Defines a wrapper for the core UWP HyperlinkButton control. /// public class HyperlinkButton : Button { @@ -13,52 +9,24 @@ public class HyperlinkButton : Button /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public HyperlinkButton(WindowsElement element) + public HyperlinkButton(WebElement element) : base(element) { } /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator HyperlinkButton(WindowsElement element) + public static implicit operator HyperlinkButton(WebElement element) { return new HyperlinkButton(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator HyperlinkButton(AppiumWebElement element) - { - return new HyperlinkButton(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator HyperlinkButton(RemoteWebElement element) - { - return new HyperlinkButton(element as WindowsElement); - } } \ 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 ccd62a8e..b08eaf75 100644 --- a/src/Legerity.Windows/Elements/Core/InkToolbar.BallpointPenFlyout.cs +++ b/src/Legerity.Windows/Elements/Core/InkToolbar.BallpointPenFlyout.cs @@ -1,9 +1,5 @@ namespace Legerity.Windows.Elements.Core; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; - /// /// Defines the ballpoint pen flyout components of the . /// @@ -18,53 +14,25 @@ public class InkToolbarBallpointPenFlyout : InkToolbarColorFlyoutBase /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public InkToolbarBallpointPenFlyout(WindowsElement element) + public InkToolbarBallpointPenFlyout(WebElement element) : base(element) { } /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator InkToolbarBallpointPenFlyout(WindowsElement element) + public static implicit operator InkToolbarBallpointPenFlyout(WebElement element) { return new InkToolbarBallpointPenFlyout(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator InkToolbarBallpointPenFlyout(AppiumWebElement element) - { - return new InkToolbarBallpointPenFlyout(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator InkToolbarBallpointPenFlyout(RemoteWebElement element) - { - return new InkToolbarBallpointPenFlyout(element as WindowsElement); - } } } \ 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 d5e23c66..0483bbcb 100644 --- a/src/Legerity.Windows/Elements/Core/InkToolbar.ColorFlyoutBase.cs +++ b/src/Legerity.Windows/Elements/Core/InkToolbar.ColorFlyoutBase.cs @@ -5,9 +5,6 @@ namespace Legerity.Windows.Elements.Core; using Legerity.Exceptions; using Legerity.Extensions; using Legerity.Windows.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; /// /// Defines the color flyout components of the . @@ -25,9 +22,9 @@ public abstract class InkToolbarColorFlyoutBase : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - protected InkToolbarColorFlyoutBase(WindowsElement element) + protected InkToolbarColorFlyoutBase(WebElement element) : base(element) { } @@ -89,7 +86,7 @@ public virtual void SetColorByPartialName(string partialColor) /// Thrown when an element is not shown for the expected locator. /// Thrown when no element matches the expected locator. /// Thrown when an element is no longer valid in the document DOM. - private AppiumWebElement GetSelectedColor() + private WebElement GetSelectedColor() { this.VerifyElementShown(this.penColorPaletteLocator, TimeSpan.FromSeconds(2)); diff --git a/src/Legerity.Windows/Elements/Core/InkToolbar.HighlighterFlyout.cs b/src/Legerity.Windows/Elements/Core/InkToolbar.HighlighterFlyout.cs index ca357ce9..b7ef5c80 100644 --- a/src/Legerity.Windows/Elements/Core/InkToolbar.HighlighterFlyout.cs +++ b/src/Legerity.Windows/Elements/Core/InkToolbar.HighlighterFlyout.cs @@ -1,9 +1,5 @@ namespace Legerity.Windows.Elements.Core; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; - /// /// Defines the highlighter flyout components of the . /// @@ -18,53 +14,25 @@ public class InkToolbarHighlighterFlyout : InkToolbarColorFlyoutBase /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public InkToolbarHighlighterFlyout(WindowsElement element) + public InkToolbarHighlighterFlyout(WebElement element) : base(element) { } /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator InkToolbarHighlighterFlyout(WindowsElement element) + public static implicit operator InkToolbarHighlighterFlyout(WebElement element) { return new InkToolbarHighlighterFlyout(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator InkToolbarHighlighterFlyout(AppiumWebElement element) - { - return new InkToolbarHighlighterFlyout(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator InkToolbarHighlighterFlyout(RemoteWebElement element) - { - return new InkToolbarHighlighterFlyout(element as WindowsElement); - } } } \ 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 a3c25d24..bc69630e 100644 --- a/src/Legerity.Windows/Elements/Core/InkToolbar.PencilFlyout.cs +++ b/src/Legerity.Windows/Elements/Core/InkToolbar.PencilFlyout.cs @@ -1,9 +1,5 @@ namespace Legerity.Windows.Elements.Core; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; - /// /// Defines the pencil flyout components of the . /// @@ -18,53 +14,25 @@ public class InkToolbarPencilFlyout : InkToolbarColorFlyoutBase /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public InkToolbarPencilFlyout(WindowsElement element) + public InkToolbarPencilFlyout(WebElement element) : base(element) { } /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator InkToolbarPencilFlyout(WindowsElement element) + public static implicit operator InkToolbarPencilFlyout(WebElement element) { return new InkToolbarPencilFlyout(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator InkToolbarPencilFlyout(AppiumWebElement element) - { - return new InkToolbarPencilFlyout(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator InkToolbarPencilFlyout(RemoteWebElement element) - { - return new InkToolbarPencilFlyout(element as WindowsElement); - } } } \ 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 42f675fd..b49361b2 100644 --- a/src/Legerity.Windows/Elements/Core/InkToolbar.cs +++ b/src/Legerity.Windows/Elements/Core/InkToolbar.cs @@ -3,13 +3,9 @@ namespace Legerity.Windows.Elements.Core; using System; using Extensions; using Legerity.Exceptions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core UWP InkToolbar control. +/// Defines a wrapper for the core UWP InkToolbar control. /// public partial class InkToolbar : WindowsElementWrapper { @@ -23,9 +19,9 @@ public partial class InkToolbar : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public InkToolbar(WindowsElement element) + public InkToolbar(WebElement element) : base(element) { } @@ -109,47 +105,19 @@ public InkToolbar(WindowsElement element) this.Driver.FindElement(this.highlighterFlyoutLocator); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator InkToolbar(WindowsElement element) + public static implicit operator InkToolbar(WebElement element) { return new InkToolbar(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator InkToolbar(AppiumWebElement element) - { - return new InkToolbar(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator InkToolbar(RemoteWebElement element) - { - return new InkToolbar(element as WindowsElement); - } - + /// /// Selects the ballpoint pen option. /// diff --git a/src/Legerity.Windows/Elements/Core/ListBox.cs b/src/Legerity.Windows/Elements/Core/ListBox.cs index bf97b6c8..cb278fba 100644 --- a/src/Legerity.Windows/Elements/Core/ListBox.cs +++ b/src/Legerity.Windows/Elements/Core/ListBox.cs @@ -6,13 +6,8 @@ namespace Legerity.Windows.Elements.Core; using Legerity.Exceptions; using Legerity.Windows.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; - /// -/// Defines a wrapper for the core UWP ListBox control. +/// Defines a wrapper for the core UWP ListBox control. /// public class ListBox : WindowsElementWrapper { @@ -22,9 +17,9 @@ public class ListBox : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public ListBox(WindowsElement element) + public ListBox(WebElement element) : base(element) { } @@ -32,56 +27,28 @@ public ListBox(WindowsElement element) /// /// Gets the collection of items associated with the list box. /// - public virtual ReadOnlyCollection Items => this.Element.FindElements(this.listBoxItemLocator); + public virtual ReadOnlyCollection Items => this.Element.FindElements(this.listBoxItemLocator).Cast().ToList().AsReadOnly(); /// /// Gets the element associated with the currently selected item. /// /// Thrown when an element is no longer valid in the document DOM. - public virtual AppiumWebElement SelectedItem => this.Items.FirstOrDefault(i => i.IsSelected()); + public virtual WebElement SelectedItem => this.Items.FirstOrDefault(i => i.IsSelected()); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator ListBox(WindowsElement element) + public static implicit operator ListBox(WebElement element) { return new ListBox(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator ListBox(AppiumWebElement element) - { - return new ListBox(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator ListBox(RemoteWebElement element) - { - return new ListBox(element as WindowsElement); - } - + /// /// Clicks on an item in the list box with the specified item name. /// @@ -96,7 +63,7 @@ public static implicit operator ListBox(RemoteWebElement element) public virtual void ClickItem(string name) { this.VerifyElementsShown(this.listBoxItemLocator, TimeSpan.FromSeconds(2)); - AppiumWebElement item = this.Items.FirstOrDefault(element => element.VerifyNameOrAutomationIdEquals(name)); + WebElement item = this.Items.FirstOrDefault(element => element.VerifyNameOrAutomationIdEquals(name)); if (item == null) { @@ -118,7 +85,7 @@ public virtual void ClickItem(string name) public virtual void ClickItemByPartialName(string partialName) { this.VerifyElementsShown(this.listBoxItemLocator, TimeSpan.FromSeconds(2)); - AppiumWebElement item = + WebElement item = this.Items.FirstOrDefault(element => element.VerifyNameOrAutomationIdContains(partialName)); if (item == null) diff --git a/src/Legerity.Windows/Elements/Core/ListView.cs b/src/Legerity.Windows/Elements/Core/ListView.cs index 01d1f05a..55993d11 100644 --- a/src/Legerity.Windows/Elements/Core/ListView.cs +++ b/src/Legerity.Windows/Elements/Core/ListView.cs @@ -6,13 +6,8 @@ namespace Legerity.Windows.Elements.Core; using Legerity.Exceptions; using Legerity.Windows.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; - /// -/// Defines a wrapper for the core UWP ListView control. +/// Defines a wrapper for the core UWP ListView control. /// public class ListView : WindowsElementWrapper { @@ -22,9 +17,9 @@ public class ListView : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public ListView(WindowsElement element) + public ListView(WebElement element) : base(element) { } @@ -32,56 +27,28 @@ public ListView(WindowsElement element) /// /// Gets the collection of items associated with the list view. /// - public virtual ReadOnlyCollection Items => this.Element.FindElements(this.listViewItemLocator); + public virtual ReadOnlyCollection Items => this.Element.FindElements(this.listViewItemLocator).Cast().ToList().AsReadOnly(); /// /// Gets the element associated with the currently selected item. /// /// Thrown when an element is no longer valid in the document DOM. - public virtual AppiumWebElement SelectedItem => this.Items.FirstOrDefault(i => i.IsSelected()); + public virtual WebElement SelectedItem => this.Items.FirstOrDefault(i => i.IsSelected()); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator ListView(WindowsElement element) + public static implicit operator ListView(WebElement element) { return new ListView(element); } - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator ListView(AppiumWebElement element) - { - return new ListView(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator ListView(RemoteWebElement element) - { - return new ListView(element as WindowsElement); - } - /// /// Clicks on an item in the list view with the specified item name. /// @@ -96,7 +63,7 @@ public static implicit operator ListView(RemoteWebElement element) public virtual void ClickItem(string name) { this.VerifyElementsShown(this.listViewItemLocator, TimeSpan.FromSeconds(2)); - AppiumWebElement item = this.Items.FirstOrDefault(element => element.VerifyNameOrAutomationIdEquals(name)); + WebElement item = this.Items.FirstOrDefault(element => element.VerifyNameOrAutomationIdEquals(name)); if (item == null) { @@ -118,7 +85,7 @@ public virtual void ClickItem(string name) public virtual void ClickItemByPartialName(string partialName) { this.VerifyElementsShown(this.listViewItemLocator, TimeSpan.FromSeconds(2)); - AppiumWebElement item = + WebElement item = this.Items.FirstOrDefault(element => element.VerifyNameOrAutomationIdContains(partialName)); if (item == null) diff --git a/src/Legerity.Windows/Elements/Core/MenuFlyoutItem.cs b/src/Legerity.Windows/Elements/Core/MenuFlyoutItem.cs index a14c5999..b6b9718d 100644 --- a/src/Legerity.Windows/Elements/Core/MenuFlyoutItem.cs +++ b/src/Legerity.Windows/Elements/Core/MenuFlyoutItem.cs @@ -1,11 +1,7 @@ namespace Legerity.Windows.Elements.Core; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; - /// -/// Defines a wrapper for the UWP MenuFlyoutItem control. +/// Defines a wrapper for the UWP MenuFlyoutItem control. /// public class MenuFlyoutItem : WindowsElementWrapper { @@ -13,52 +9,24 @@ public class MenuFlyoutItem : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public MenuFlyoutItem(WindowsElement element) + public MenuFlyoutItem(WebElement element) : base(element) { } /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator MenuFlyoutItem(WindowsElement element) + public static implicit operator MenuFlyoutItem(WebElement element) { return new MenuFlyoutItem(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator MenuFlyoutItem(AppiumWebElement element) - { - return new MenuFlyoutItem(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator MenuFlyoutItem(RemoteWebElement element) - { - return new MenuFlyoutItem(element as WindowsElement); - } } \ No newline at end of file diff --git a/src/Legerity.Windows/Elements/Core/MenuFlyoutSubItem.cs b/src/Legerity.Windows/Elements/Core/MenuFlyoutSubItem.cs index e12e008b..a0b6ba2c 100644 --- a/src/Legerity.Windows/Elements/Core/MenuFlyoutSubItem.cs +++ b/src/Legerity.Windows/Elements/Core/MenuFlyoutSubItem.cs @@ -5,13 +5,9 @@ namespace Legerity.Windows.Elements.Core; using System.Globalization; using System.Linq; using Legerity.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the UWP MenuFlyoutSubItem control. +/// Defines a wrapper for the UWP MenuFlyoutSubItem control. /// public class MenuFlyoutSubItem : WindowsElementWrapper { @@ -19,9 +15,9 @@ public class MenuFlyoutSubItem : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public MenuFlyoutSubItem(WindowsElement element) + public MenuFlyoutSubItem(WebElement element) : base(element) { } @@ -39,47 +35,19 @@ public MenuFlyoutSubItem(WindowsElement element) public virtual IEnumerable ChildMenuSubItems => this.GetChildMenuSubItems(); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator MenuFlyoutSubItem(WindowsElement element) + public static implicit operator MenuFlyoutSubItem(WebElement element) { return new MenuFlyoutSubItem(element); } - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator MenuFlyoutSubItem(AppiumWebElement element) - { - return new MenuFlyoutSubItem(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator MenuFlyoutSubItem(RemoteWebElement element) - { - return new MenuFlyoutSubItem(element as WindowsElement); - } - /// /// Clicks on a child menu option with the specified item name. /// @@ -189,7 +157,7 @@ private IEnumerable GetChildMenuItems() { return this.Driver.FindElement(By.ClassName("MenuFlyout")) .FindElements(By.ClassName(nameof(MenuFlyoutItem))).Select( - element => new MenuFlyoutItem(element as WindowsElement)); + element => new MenuFlyoutItem(element)); } /// Thrown when no element matches the expected locator. @@ -197,6 +165,6 @@ private IEnumerable GetChildMenuSubItems() { return this.Driver.FindElement(By.ClassName("MenuFlyout")) .FindElements(By.ClassName(nameof(MenuFlyoutSubItem))).Select( - element => new MenuFlyoutSubItem(element as WindowsElement)); + element => new MenuFlyoutSubItem(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 1c2c56d2..0a617636 100644 --- a/src/Legerity.Windows/Elements/Core/PasswordBox.cs +++ b/src/Legerity.Windows/Elements/Core/PasswordBox.cs @@ -1,13 +1,9 @@ namespace Legerity.Windows.Elements.Core; using Legerity.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core UWP PasswordBox control. +/// Defines a wrapper for the core UWP PasswordBox control. /// public class PasswordBox : TextBox { @@ -15,9 +11,9 @@ public class PasswordBox : TextBox /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public PasswordBox(WindowsElement element) + public PasswordBox(WebElement element) : base(element) { } @@ -38,47 +34,19 @@ public PasswordBox(WindowsElement element) public virtual string Password => this.Text; /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator PasswordBox(WindowsElement element) + public static implicit operator PasswordBox(WebElement element) { return new PasswordBox(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator PasswordBox(AppiumWebElement element) - { - return new PasswordBox(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator PasswordBox(RemoteWebElement element) - { - return new PasswordBox(element as WindowsElement); - } - + /// /// Reveals the password text in the password box. /// diff --git a/src/Legerity.Windows/Elements/Core/Pivot.cs b/src/Legerity.Windows/Elements/Core/Pivot.cs index fe53237f..3bb4c3ee 100644 --- a/src/Legerity.Windows/Elements/Core/Pivot.cs +++ b/src/Legerity.Windows/Elements/Core/Pivot.cs @@ -6,13 +6,8 @@ namespace Legerity.Windows.Elements.Core; using Legerity.Exceptions; using Legerity.Windows.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; - /// -/// Defines a wrapper for the core UWP Pivot control. +/// Defines a wrapper for the core UWP Pivot control. /// public class Pivot : WindowsElementWrapper { @@ -22,9 +17,9 @@ public class Pivot : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public Pivot(WindowsElement element) + public Pivot(WebElement element) : base(element) { } @@ -32,56 +27,28 @@ public Pivot(WindowsElement element) /// /// Gets the collection of items associated with the pivot. /// - public virtual ReadOnlyCollection Items => this.Element.FindElements(this.pivotItemLocator); + public virtual ReadOnlyCollection Items => this.Element.FindElements(this.pivotItemLocator).Cast().ToList().AsReadOnly(); /// /// Gets the currently selected item. /// /// Thrown when an element is no longer valid in the document DOM. - public virtual AppiumWebElement SelectedItem => this.Items.FirstOrDefault(i => i.IsSelected()); + public virtual WebElement SelectedItem => this.Items.FirstOrDefault(i => i.IsSelected()); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator Pivot(WindowsElement element) + public static implicit operator Pivot(WebElement element) { return new Pivot(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator Pivot(AppiumWebElement element) - { - return new Pivot(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator Pivot(RemoteWebElement element) - { - return new Pivot(element as WindowsElement); - } - + /// /// Clicks on an item in the pivot with the specified item name. /// @@ -97,7 +64,7 @@ public virtual void ClickItem(string name) { this.VerifyElementsShown(this.pivotItemLocator, TimeSpan.FromSeconds(2)); - AppiumWebElement item = this.Items.FirstOrDefault(element => element.VerifyNameOrAutomationIdEquals(name)); + WebElement item = this.Items.FirstOrDefault(element => element.VerifyNameOrAutomationIdEquals(name)); if (item == null) { @@ -122,7 +89,7 @@ public virtual void ClickItemByPartialName(string name) { this.VerifyElementsShown(this.pivotItemLocator, TimeSpan.FromSeconds(2)); - AppiumWebElement item = this.Items.FirstOrDefault(element => element.VerifyNameOrAutomationIdContains(name)); + WebElement item = this.Items.FirstOrDefault(element => element.VerifyNameOrAutomationIdContains(name)); if (item == null) { diff --git a/src/Legerity.Windows/Elements/Core/ProgressBar.cs b/src/Legerity.Windows/Elements/Core/ProgressBar.cs index d67f03f6..1cb0189e 100644 --- a/src/Legerity.Windows/Elements/Core/ProgressBar.cs +++ b/src/Legerity.Windows/Elements/Core/ProgressBar.cs @@ -2,13 +2,9 @@ namespace Legerity.Windows.Elements.Core; using System; using Legerity.Windows.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core UWP ProgressBar control. +/// Defines a wrapper for the core UWP ProgressBar control. /// public class ProgressBar : WindowsElementWrapper { @@ -16,9 +12,9 @@ public class ProgressBar : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public ProgressBar(WindowsElement element) + public ProgressBar(WebElement element) : base(element) { } @@ -39,44 +35,16 @@ public ProgressBar(WindowsElement element) StringComparison.CurrentCultureIgnoreCase); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator ProgressBar(WindowsElement element) + public static implicit operator ProgressBar(WebElement element) { return new ProgressBar(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator ProgressBar(AppiumWebElement element) - { - return new ProgressBar(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator ProgressBar(RemoteWebElement element) - { - return new ProgressBar(element as WindowsElement); - } } \ No newline at end of file diff --git a/src/Legerity.Windows/Elements/Core/ProgressRing.cs b/src/Legerity.Windows/Elements/Core/ProgressRing.cs index 766437ef..6c3d20e2 100644 --- a/src/Legerity.Windows/Elements/Core/ProgressRing.cs +++ b/src/Legerity.Windows/Elements/Core/ProgressRing.cs @@ -2,13 +2,9 @@ namespace Legerity.Windows.Elements.Core; using Legerity.Windows.Extensions; using System; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core UWP ProgressRing control. +/// Defines a wrapper for the core UWP ProgressRing control. /// public class ProgressRing : WindowsElementWrapper { @@ -16,9 +12,9 @@ public class ProgressRing : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public ProgressRing(WindowsElement element) + public ProgressRing(WebElement element) : base(element) { } @@ -39,44 +35,16 @@ public ProgressRing(WindowsElement element) StringComparison.CurrentCultureIgnoreCase); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator ProgressRing(WindowsElement element) + public static implicit operator ProgressRing(WebElement element) { return new ProgressRing(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator ProgressRing(AppiumWebElement element) - { - return new ProgressRing(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator ProgressRing(RemoteWebElement element) - { - return new ProgressRing(element as WindowsElement); - } } \ No newline at end of file diff --git a/src/Legerity.Windows/Elements/Core/RadioButton.cs b/src/Legerity.Windows/Elements/Core/RadioButton.cs index 73dbb5ee..813c9b18 100644 --- a/src/Legerity.Windows/Elements/Core/RadioButton.cs +++ b/src/Legerity.Windows/Elements/Core/RadioButton.cs @@ -1,13 +1,9 @@ namespace Legerity.Windows.Elements.Core; using Legerity.Windows.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core UWP RadioButton control. +/// Defines a wrapper for the core UWP RadioButton control. /// public class RadioButton : Button { @@ -15,9 +11,9 @@ public class RadioButton : Button /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public RadioButton(WindowsElement element) + public RadioButton(WebElement element) : base(element) { } @@ -29,44 +25,16 @@ public RadioButton(WindowsElement element) public virtual bool IsSelected => this.IsSelected(); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator RadioButton(WindowsElement element) + public static implicit operator RadioButton(WebElement element) { return new RadioButton(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator RadioButton(AppiumWebElement element) - { - return new RadioButton(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator RadioButton(RemoteWebElement element) - { - return new RadioButton(element as WindowsElement); - } } \ No newline at end of file diff --git a/src/Legerity.Windows/Elements/Core/ScrollViewer.cs b/src/Legerity.Windows/Elements/Core/ScrollViewer.cs index 49c3f9c6..d4cb5673 100644 --- a/src/Legerity.Windows/Elements/Core/ScrollViewer.cs +++ b/src/Legerity.Windows/Elements/Core/ScrollViewer.cs @@ -1,12 +1,7 @@ namespace Legerity.Windows.Elements.Core; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; - /// -/// Defines a wrapper for the Windows ScrollViewer control. +/// Defines a wrapper for the Windows ScrollViewer control. /// public class ScrollViewer : WindowsElementWrapper { @@ -14,55 +9,27 @@ public class ScrollViewer : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public ScrollViewer(WindowsElement element) + public ScrollViewer(WebElement element) : base(element) { } /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator ScrollViewer(WindowsElement element) + public static implicit operator ScrollViewer(WebElement element) { return new ScrollViewer(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator ScrollViewer(AppiumWebElement element) - { - return new ScrollViewer(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator ScrollViewer(RemoteWebElement element) - { - return new ScrollViewer(element as WindowsElement); - } - + /// /// Scrolls the scroll viewer to the top. /// diff --git a/src/Legerity.Windows/Elements/Core/Slider.cs b/src/Legerity.Windows/Elements/Core/Slider.cs index 279ca448..3fe9d2e5 100644 --- a/src/Legerity.Windows/Elements/Core/Slider.cs +++ b/src/Legerity.Windows/Elements/Core/Slider.cs @@ -2,13 +2,9 @@ namespace Legerity.Windows.Elements.Core; using System; using Legerity.Windows.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core UWP Slider control. +/// Defines a wrapper for the core UWP Slider control. /// public class Slider : WindowsElementWrapper { @@ -16,9 +12,9 @@ public class Slider : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public Slider(WindowsElement element) + public Slider(WebElement element) : base(element) { } @@ -54,47 +50,19 @@ public Slider(WindowsElement element) public virtual bool IsReadonly => this.IsRangeReadonly(); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator Slider(WindowsElement element) + public static implicit operator Slider(WebElement element) { return new Slider(element); } - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator Slider(AppiumWebElement element) - { - return new Slider(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator Slider(RemoteWebElement element) - { - return new Slider(element as WindowsElement); - } - /// /// Sets the value of the slider. /// diff --git a/src/Legerity.Windows/Elements/Core/TextBlock.cs b/src/Legerity.Windows/Elements/Core/TextBlock.cs index b88333f1..ad28fb39 100644 --- a/src/Legerity.Windows/Elements/Core/TextBlock.cs +++ b/src/Legerity.Windows/Elements/Core/TextBlock.cs @@ -1,12 +1,7 @@ namespace Legerity.Windows.Elements.Core; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; - /// -/// Defines a wrapper for the core UWP TextBlock control. +/// Defines a wrapper for the core UWP TextBlock control. /// public class TextBlock : WindowsElementWrapper { @@ -14,9 +9,9 @@ public class TextBlock : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public TextBlock(WindowsElement element) + public TextBlock(WebElement element) : base(element) { } @@ -28,44 +23,16 @@ public TextBlock(WindowsElement element) public virtual string Text => this.Element.Text; /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator TextBlock(WindowsElement element) + public static implicit operator TextBlock(WebElement element) { return new TextBlock(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator TextBlock(AppiumWebElement element) - { - return new TextBlock(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator TextBlock(RemoteWebElement element) - { - return new TextBlock(element as WindowsElement); - } } \ No newline at end of file diff --git a/src/Legerity.Windows/Elements/Core/TextBox.cs b/src/Legerity.Windows/Elements/Core/TextBox.cs index 0eed2f88..481d196b 100644 --- a/src/Legerity.Windows/Elements/Core/TextBox.cs +++ b/src/Legerity.Windows/Elements/Core/TextBox.cs @@ -1,13 +1,9 @@ namespace Legerity.Windows.Elements.Core; using Legerity.Windows.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core UWP TextBox control. +/// Defines a wrapper for the core UWP TextBox control. /// public class TextBox : WindowsElementWrapper { @@ -15,9 +11,9 @@ public class TextBox : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public TextBox(WindowsElement element) + public TextBox(WebElement element) : base(element) { } @@ -35,47 +31,19 @@ public TextBox(WindowsElement element) public virtual bool IsReadonly => this.IsReadonly(); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator TextBox(WindowsElement element) + public static implicit operator TextBox(WebElement element) { return new TextBox(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator TextBox(AppiumWebElement element) - { - return new TextBox(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator TextBox(RemoteWebElement element) - { - return new TextBox(element as WindowsElement); - } - + /// /// Sets the text of the text box to the specified text. /// diff --git a/src/Legerity.Windows/Elements/Core/TimePicker.cs b/src/Legerity.Windows/Elements/Core/TimePicker.cs index 9dd14089..55e8d5f4 100644 --- a/src/Legerity.Windows/Elements/Core/TimePicker.cs +++ b/src/Legerity.Windows/Elements/Core/TimePicker.cs @@ -1,13 +1,10 @@ namespace Legerity.Windows.Elements.Core; using System; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; +using Extensions; /// -/// Defines a wrapper for the core UWP TimePicker control. +/// Defines a wrapper for the core UWP TimePicker control. /// public class TimePicker : WindowsElementWrapper { @@ -15,55 +12,27 @@ public class TimePicker : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public TimePicker(WindowsElement element) + public TimePicker(WebElement element) : base(element) { } /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator TimePicker(WindowsElement element) + public static implicit operator TimePicker(WebElement element) { return new TimePicker(element); } - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator TimePicker(AppiumWebElement element) - { - return new TimePicker(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator TimePicker(RemoteWebElement element) - { - return new TimePicker(element as WindowsElement); - } - /// /// Sets the time to the specified time. /// @@ -80,7 +49,7 @@ public virtual void SetTime(TimeSpan time) this.Click(); // Finds the popup and changes the time. - WindowsElement popup = this.Driver.FindElement(WindowsByExtras.AutomationId("TimePickerFlyoutPresenter")); + WebElement popup = this.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(); diff --git a/src/Legerity.Windows/Elements/Core/ToggleButton.cs b/src/Legerity.Windows/Elements/Core/ToggleButton.cs index 269e27a1..ca15cf5a 100644 --- a/src/Legerity.Windows/Elements/Core/ToggleButton.cs +++ b/src/Legerity.Windows/Elements/Core/ToggleButton.cs @@ -1,13 +1,9 @@ namespace Legerity.Windows.Elements.Core; using Legerity.Windows.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core UWP ToggleButton control. +/// Defines a wrapper for the core UWP ToggleButton control. /// public class ToggleButton : Button { @@ -15,9 +11,9 @@ public class ToggleButton : Button /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public ToggleButton(WindowsElement element) + public ToggleButton(WebElement element) : base(element) { } @@ -29,47 +25,19 @@ public ToggleButton(WindowsElement element) public virtual bool IsOn => this.GetToggleState() == ToggleState.Checked; /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator ToggleButton(WindowsElement element) + public static implicit operator ToggleButton(WebElement element) { return new ToggleButton(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator ToggleButton(AppiumWebElement element) - { - return new ToggleButton(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator ToggleButton(RemoteWebElement element) - { - return new ToggleButton(element as WindowsElement); - } - + /// /// Toggles the button on. /// diff --git a/src/Legerity.Windows/Elements/Core/ToggleSwitch.cs b/src/Legerity.Windows/Elements/Core/ToggleSwitch.cs index 04dd72b7..d0c7deb8 100644 --- a/src/Legerity.Windows/Elements/Core/ToggleSwitch.cs +++ b/src/Legerity.Windows/Elements/Core/ToggleSwitch.cs @@ -1,13 +1,9 @@ namespace Legerity.Windows.Elements.Core; using Legerity.Windows.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the core UWP ToggleSwitch control. +/// Defines a wrapper for the core UWP ToggleSwitch control. /// public class ToggleSwitch : WindowsElementWrapper { @@ -15,9 +11,9 @@ public class ToggleSwitch : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public ToggleSwitch(WindowsElement element) + public ToggleSwitch(WebElement element) : base(element) { } @@ -29,47 +25,19 @@ public ToggleSwitch(WindowsElement element) public virtual bool IsOn => this.GetToggleState() == ToggleState.Checked; /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator ToggleSwitch(WindowsElement element) + public static implicit operator ToggleSwitch(WebElement element) { return new ToggleSwitch(element); } - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator ToggleSwitch(AppiumWebElement element) - { - return new ToggleSwitch(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator ToggleSwitch(RemoteWebElement element) - { - return new ToggleSwitch(element as WindowsElement); - } - /// /// Toggles the switch on. /// diff --git a/src/Legerity.Windows/Elements/WindowsElementWrapper.cs b/src/Legerity.Windows/Elements/WindowsElementWrapper.cs index 2d60aa21..e5810122 100644 --- a/src/Legerity.Windows/Elements/WindowsElementWrapper.cs +++ b/src/Legerity.Windows/Elements/WindowsElementWrapper.cs @@ -2,25 +2,20 @@ namespace Legerity.Windows.Elements; using System; using Legerity.Exceptions; - -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; using OpenQA.Selenium.Support.UI; /// -/// Defines an element wrapper for a . +/// Defines an element wrapper for a Windows . /// -public class WindowsElementWrapper : ElementWrapper +public class WindowsElementWrapper : ElementWrapper { /// /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public WindowsElementWrapper(WindowsElement element) + public WindowsElementWrapper(WebElement element) : base(element) { } @@ -28,50 +23,22 @@ public WindowsElementWrapper(WindowsElement element) /// /// Gets the instance of the Appium driver for the Windows application. /// - public WindowsDriver Driver => this.ElementDriver as WindowsDriver; + public WindowsDriver Driver => this.ElementDriver as WindowsDriver; /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator WindowsElementWrapper(WindowsElement element) + public static implicit operator WindowsElementWrapper(WebElement element) { return new WindowsElementWrapper(element); } - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator WindowsElementWrapper(AppiumWebElement element) - { - return new WindowsElementWrapper(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator WindowsElementWrapper(RemoteWebElement element) - { - return new WindowsElementWrapper(element as WindowsElement); - } - /// /// Determines whether the specified element is shown with the specified timeout. /// diff --git a/src/Legerity.Windows/Extensions/AttributeExtensions.cs b/src/Legerity.Windows/Extensions/AttributeExtensions.cs index 165406e9..b39a7af1 100644 --- a/src/Legerity.Windows/Extensions/AttributeExtensions.cs +++ b/src/Legerity.Windows/Extensions/AttributeExtensions.cs @@ -2,8 +2,6 @@ namespace Legerity.Windows.Extensions; using System; using Legerity.Windows.Elements.Core; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; /// /// Defines a collection of extensions for retrieving element attributes. @@ -25,7 +23,7 @@ public static string GetAutomationId(this IWebElement element) /// Retrieves the AutomationId attribute from the specified element. /// /// - /// The type of . + /// The type of . /// /// The to retrieve an AutomationId from. /// The AutomationId of the element. @@ -51,7 +49,7 @@ public static string GetHelpText(this IWebElement element) /// Retrieves the HelpText attribute from the specified element. /// /// - /// The type of . + /// The type of . /// /// The to retrieve the HelpText from. /// The HelpText of the element. @@ -77,7 +75,7 @@ public static string GetValue(this IWebElement element) /// Retrieves the Value.Value attribute from the specified element. /// /// - /// The type of . + /// The type of . /// /// The to retrieve a value from. /// The value of the element. @@ -103,7 +101,7 @@ public static bool IsReadonly(this IWebElement element) /// Retrieves the Value.IsReadonly attribute from the specified element. /// /// - /// The type of . + /// The type of . /// /// The to retrieve the readonly state from. /// A value indicating whether the item is readonly. @@ -134,7 +132,7 @@ public static ToggleState GetToggleState(this IWebElement element) /// Retrieves the Toggle.ToggleState attribute from the specified element. /// /// - /// The type of . + /// The type of . /// /// The to retrieve a toggle state from. /// The of the element. @@ -161,7 +159,7 @@ public static bool IsSelected(this IWebElement element) /// Retrieves the SelectionItem.IsSelected attribute from the specified element. /// /// - /// The type of . + /// The type of . /// /// The to retrieve the selected state from. /// A value indicating whether the item is selected. @@ -187,7 +185,7 @@ public static double GetRangeValue(this IWebElement element) /// Retrieves the RangeValue.Value attribute from the specified element. /// /// - /// The type of . + /// The type of . /// /// The to retrieve the range value from. /// The range value of the element. @@ -213,7 +211,7 @@ public static double GetRangeMaximum(this IWebElement element) /// Retrieves the RangeValue.Maximum attribute from the specified element. /// /// - /// The type of . + /// The type of . /// /// The to retrieve the range max value from. /// The range max value of the element. @@ -239,7 +237,7 @@ public static double GetRangeMinimum(this IWebElement element) /// Retrieves the RangeValue.Minimum attribute from the specified element. /// /// - /// The type of . + /// The type of . /// /// The to retrieve the range min value from. /// The range min value of the element. @@ -265,7 +263,7 @@ public static double GetRangeSmallChange(this IWebElement element) /// Retrieves the RangeValue.SmallChange attribute from the specified element. /// /// - /// The type of . + /// The type of . /// /// The to retrieve the range step value from. /// The range step value of the element. @@ -291,7 +289,7 @@ public static bool IsRangeReadonly(this IWebElement element) /// Retrieves the RangeValue.IsReadOnly attribute from the specified element. /// /// - /// The type of . + /// The type of . /// /// The to retrieve the readonly state from. /// A value indicating whether the item is readonly. diff --git a/src/Legerity.Windows/Extensions/ElementExtensions.cs b/src/Legerity.Windows/Extensions/ElementExtensions.cs new file mode 100644 index 00000000..9ef27fee --- /dev/null +++ b/src/Legerity.Windows/Extensions/ElementExtensions.cs @@ -0,0 +1,10 @@ +namespace Legerity.Windows.Extensions; + +public static class ElementExtensions +{ + /// Thrown when no element matches the expected locator. + public static WebElement FindElementByName(this IWebElement element, string name) + { + return element.FindElement(By.Name(name)) as WebElement; + } +} \ No newline at end of file diff --git a/src/Legerity.Windows/Extensions/LegerityTestClassExtensions.cs b/src/Legerity.Windows/Extensions/LegerityTestClassExtensions.cs index cdebcd6a..c780604a 100644 --- a/src/Legerity.Windows/Extensions/LegerityTestClassExtensions.cs +++ b/src/Legerity.Windows/Extensions/LegerityTestClassExtensions.cs @@ -2,8 +2,6 @@ namespace Legerity.Windows.Extensions; using System; using Legerity.Exceptions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium.Windows; /// /// Defines a collection of extensions for instances. @@ -32,13 +30,13 @@ public static class LegerityTestClassExtensions /// - The WinAppDriver could not be found when running with true. /// - The WinAppDriver failed to load when running with true. /// - public static WindowsDriver StartWindowsApp( + public static WindowsDriver StartWindowsApp( this LegerityTestClass testClass, Func waitUntil = default, TimeSpan? waitUntilTimeout = default, int waitUntilRetries = 0) { - return testClass.StartApp(waitUntil, waitUntilTimeout, waitUntilRetries) as WindowsDriver; + return testClass.StartApp(waitUntil, waitUntilTimeout, waitUntilRetries) as WindowsDriver; } /// @@ -68,7 +66,7 @@ public static WindowsDriver StartWindowsApp( /// - The WinAppDriver failed to load when running with true. /// /// Thrown when the wait until condition is not met in the allocated timeout period if provided. - public static WindowsDriver StartWindowsApp( + public static WindowsDriver StartWindowsApp( this LegerityTestClass testClass, WindowsAppManagerOptions options, Func waitUntil = default, @@ -76,6 +74,6 @@ public static WindowsDriver StartWindowsApp( int waitUntilRetries = 0) { return testClass.StartApp(options, waitUntil, waitUntilTimeout, waitUntilRetries) as - WindowsDriver; + WindowsDriver; } } \ No newline at end of file diff --git a/src/Legerity.Windows/Extensions/WindowsElementExtensions.cs b/src/Legerity.Windows/Extensions/WindowsElementExtensions.cs index 39809d77..888ec39d 100644 --- a/src/Legerity.Windows/Extensions/WindowsElementExtensions.cs +++ b/src/Legerity.Windows/Extensions/WindowsElementExtensions.cs @@ -3,30 +3,23 @@ namespace Legerity.Windows.Extensions; using System; using System.Globalization; using Legerity.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; /// -/// Defines a collection of extensions for objects. +/// Defines a collection of extensions for objects. /// public static class WindowsElementExtensions { /// /// Finds an element within the with the given . /// - /// - /// The type of . For this method, this would likely be . - /// - /// The to search. + /// The to search. /// The automation ID associated with the element to locate. - /// The located . + /// The located . /// Thrown when no element matches the expected locator. /// Thrown when the is null. - public static TElement FindElementByAutomationId( - this WindowsDriver driver, + public static WebElement FindElementByAutomationId( + this WindowsDriver driver, string automationId) - where TElement : IWebElement { return driver.FindElement(WindowsByExtras.AutomationId(automationId)); } @@ -36,12 +29,12 @@ public static TElement FindElementByAutomationId( /// /// The element to search. /// The automation ID associated with the element to locate. - /// The located . + /// The located . /// Thrown when no element matches the expected locator. /// Thrown when the is null. - public static AppiumWebElement FindElementByAutomationId(this WindowsElement element, string automationId) + public static WebElement FindElementByAutomationId(this WebElement element, string automationId) { - return element.FindElement(WindowsByExtras.AutomationId(automationId)); + return element.FindElement(WindowsByExtras.AutomationId(automationId)) as WebElement; } /// @@ -57,7 +50,7 @@ public static AppiumWebElement FindElementByAutomationId(this WindowsElement ele /// True if the element's name or AutomationId matches; otherwise, false. /// /// Thrown when an element is no longer valid in the document DOM. - public static bool VerifyNameOrAutomationIdEquals(this AppiumWebElement element, string compare) + public static bool VerifyNameOrAutomationIdEquals(this WebElement element, string compare) { string name = element.GetName(); string automationId = element.GetAutomationId(); @@ -67,31 +60,7 @@ public static bool VerifyNameOrAutomationIdEquals(this AppiumWebElement element, automationId, StringComparison.CurrentCultureIgnoreCase); } - - /// - /// Verifies the elements name or AutomationId based on the given compare. - /// - /// - /// The element to verify. - /// - /// - /// The value to verify is the name or AutomationId. - /// - /// - /// True if the element's name or AutomationId matches; otherwise, false. - /// - /// Thrown when an element is no longer valid in the document DOM. - public static bool VerifyNameOrAutomationIdEquals(this WindowsElement element, string compare) - { - string name = element.GetName(); - string automationId = element.GetAutomationId(); - - return string.Equals(compare, name, StringComparison.CurrentCultureIgnoreCase) || string.Equals( - compare, - automationId, - StringComparison.CurrentCultureIgnoreCase); - } - + /// /// Verifies the elements name or AutomationId based on the given partial compare. /// @@ -103,23 +72,7 @@ public static bool VerifyNameOrAutomationIdEquals(this WindowsElement element, s /// True if the element's name or AutomationId matches; otherwise, false. /// /// Thrown when an element is no longer valid in the document DOM. - public static bool VerifyNameOrAutomationIdContains(this AppiumWebElement element, string partialCompare) - { - string name = element.GetName(); - string automationId = element.GetAutomationId(); - - return name.Contains(partialCompare, CultureInfo.CurrentCulture, CompareOptions.IgnoreCase) || - automationId.Contains(partialCompare, CultureInfo.CurrentCulture, CompareOptions.IgnoreCase); - } - - /// - /// Verifies the elements name or AutomationId based on the given partial compare. - /// - /// The element to verify. - /// The partial value to verify is the name or AutomationId. - /// True if the element's name or AutomationId partially matches; otherwise, false. - /// Thrown when an element is no longer valid in the document DOM. - public static bool VerifyNameOrAutomationIdContains(this WindowsElement element, string partialCompare) + public static bool VerifyNameOrAutomationIdContains(this WebElement element, string partialCompare) { string name = element.GetName(); string automationId = element.GetAutomationId(); diff --git a/src/Legerity.Windows/Extensions/WindowsElementWrapperExtensions.cs b/src/Legerity.Windows/Extensions/WindowsElementWrapperExtensions.cs index 5c592255..fccbbc49 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 Legerity.Windows.Elements; -using OpenQA.Selenium; using OpenQA.Selenium.Support.UI; /// diff --git a/src/Legerity.Windows/GlobalUsings.cs b/src/Legerity.Windows/GlobalUsings.cs new file mode 100644 index 00000000..d33e0522 --- /dev/null +++ b/src/Legerity.Windows/GlobalUsings.cs @@ -0,0 +1,6 @@ +// 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.Windows/WindowsByExtras.cs b/src/Legerity.Windows/WindowsByExtras.cs index 32005689..5459e74e 100644 --- a/src/Legerity.Windows/WindowsByExtras.cs +++ b/src/Legerity.Windows/WindowsByExtras.cs @@ -1,7 +1,6 @@ namespace Legerity.Windows; using System; -using OpenQA.Selenium; /// /// Defines a collection of extra locator constraints for . From cd15574eef52e329a49f69c821e1f660f8c29cfa Mon Sep 17 00:00:00 2001 From: James Croft Date: Mon, 11 Mar 2024 20:32:45 +0000 Subject: [PATCH 09/21] Update additional Windows libraries --- src/Legerity.MADE/DropDownList.cs | 46 +++----------- src/Legerity.MADE/GlobalUsings.cs | 6 ++ src/Legerity.MADE/InputValidator.cs | 50 +++------------ src/Legerity.Telerik.Uwp/GlobalUsings.cs | 6 ++ .../RadAutoCompleteBox.cs | 46 +++----------- src/Legerity.Telerik.Uwp/RadBulletGraph.cs | 44 ++----------- src/Legerity.Telerik.Uwp/RadBusyIndicator.cs | 45 ++------------ src/Legerity.Telerik.Uwp/RadNumericBox.cs | 46 +++----------- src/Legerity.WCT/BladeView.cs | 46 +++----------- src/Legerity.WCT/BladeViewItem.cs | 48 +++----------- src/Legerity.WCT/Carousel.cs | 52 +++------------- src/Legerity.WCT/Expander.cs | 44 ++----------- src/Legerity.WCT/GlobalUsings.cs | 6 ++ src/Legerity.WCT/InAppNotification.cs | 47 +++----------- src/Legerity.WCT/RadialGauge.cs | 46 +++----------- src/Legerity.WinUI/GlobalUsings.cs | 6 ++ src/Legerity.WinUI/InfoBar.cs | 46 +++----------- src/Legerity.WinUI/MenuBar.cs | 48 +++----------- src/Legerity.WinUI/MenuBarItem.cs | 54 ++++------------ src/Legerity.WinUI/NavigationView.cs | 54 ++++------------ src/Legerity.WinUI/NavigationViewItem.cs | 62 +++++-------------- src/Legerity.WinUI/NumberBox.cs | 46 +++----------- src/Legerity.WinUI/RatingControl.cs | 46 +++----------- src/Legerity.WinUI/TabView.cs | 60 +++++------------- .../Extensions/ElementExtensions.cs | 8 +++ 25 files changed, 200 insertions(+), 808 deletions(-) create mode 100644 src/Legerity.MADE/GlobalUsings.cs create mode 100644 src/Legerity.Telerik.Uwp/GlobalUsings.cs create mode 100644 src/Legerity.WCT/GlobalUsings.cs create mode 100644 src/Legerity.WinUI/GlobalUsings.cs diff --git a/src/Legerity.MADE/DropDownList.cs b/src/Legerity.MADE/DropDownList.cs index 3b6a344d..2096c7a4 100644 --- a/src/Legerity.MADE/DropDownList.cs +++ b/src/Legerity.MADE/DropDownList.cs @@ -2,13 +2,9 @@ namespace Legerity.Windows.Elements.MADE; using Legerity.Exceptions; using Legerity.Windows.Elements.Core; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the MADE.NET UWP DropDownList control. +/// Defines a wrapper for the MADE.NET UWP DropDownList control. /// public class DropDownList : WindowsElementWrapper { @@ -16,9 +12,9 @@ public class DropDownList : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public DropDownList(WindowsElement element) + public DropDownList(WebElement element) : base(element) { } @@ -30,47 +26,19 @@ public DropDownList(WindowsElement element) public virtual ListView DropDown => this.FindElement(WindowsByExtras.AutomationId("DropDownContent")); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator DropDownList(WindowsElement element) + public static implicit operator DropDownList(WebElement element) { return new DropDownList(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator DropDownList(AppiumWebElement element) - { - return new DropDownList(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator DropDownList(RemoteWebElement element) - { - return new DropDownList(element as WindowsElement); - } - + /// /// Selects an item in the combo-box with the specified item name. /// diff --git a/src/Legerity.MADE/GlobalUsings.cs b/src/Legerity.MADE/GlobalUsings.cs new file mode 100644 index 00000000..d33e0522 --- /dev/null +++ b/src/Legerity.MADE/GlobalUsings.cs @@ -0,0 +1,6 @@ +// 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.MADE/InputValidator.cs b/src/Legerity.MADE/InputValidator.cs index e307529b..f0dbadc2 100644 --- a/src/Legerity.MADE/InputValidator.cs +++ b/src/Legerity.MADE/InputValidator.cs @@ -1,13 +1,9 @@ namespace Legerity.Windows.Elements.MADE; using Legerity.Windows.Elements.Core; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the MADE.NET UWP InputValidator control. +/// Defines a wrapper for the MADE.NET UWP InputValidator control. /// public class InputValidator : WindowsElementWrapper { @@ -15,9 +11,9 @@ public class InputValidator : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public InputValidator(WindowsElement element) + public InputValidator(WebElement element) : base(element) { } @@ -36,54 +32,26 @@ public InputValidator(WindowsElement element) public virtual string Message => this.ValidationFeedback?.Text; /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator InputValidator(WindowsElement element) + public static implicit operator InputValidator(WebElement element) { return new InputValidator(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator InputValidator(AppiumWebElement element) - { - return new InputValidator(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator InputValidator(RemoteWebElement element) - { - return new InputValidator(element as WindowsElement); - } - + /// /// Retrieves the input element with the given locator. /// /// The locator to find the input element. - /// The if found; otherwise, throws . + /// The if found; otherwise, throws . /// Thrown when no element matches the expected locator. - public AppiumWebElement Input(By locator) + public WebElement Input(By locator) { return this.FindElement(locator); } diff --git a/src/Legerity.Telerik.Uwp/GlobalUsings.cs b/src/Legerity.Telerik.Uwp/GlobalUsings.cs new file mode 100644 index 00000000..d33e0522 --- /dev/null +++ b/src/Legerity.Telerik.Uwp/GlobalUsings.cs @@ -0,0 +1,6 @@ +// 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 259722aa..53e7e780 100644 --- a/src/Legerity.Telerik.Uwp/RadAutoCompleteBox.cs +++ b/src/Legerity.Telerik.Uwp/RadAutoCompleteBox.cs @@ -3,13 +3,9 @@ namespace Legerity.Windows.Elements.Telerik; using System; using Legerity.Exceptions; using Legerity.Windows.Elements.Core; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the Telerik UWP RadAutoCompleteBox control. +/// Defines a wrapper for the Telerik UWP RadAutoCompleteBox control. /// public class RadAutoCompleteBox : WindowsElementWrapper { @@ -19,9 +15,9 @@ public class RadAutoCompleteBox : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public RadAutoCompleteBox(WindowsElement element) + public RadAutoCompleteBox(WebElement element) : base(element) { } @@ -39,47 +35,19 @@ public RadAutoCompleteBox(WindowsElement element) public virtual string Text => this.TextBox.Text; /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator RadAutoCompleteBox(WindowsElement element) + public static implicit operator RadAutoCompleteBox(WebElement element) { return new RadAutoCompleteBox(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator RadAutoCompleteBox(AppiumWebElement element) - { - return new RadAutoCompleteBox(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator RadAutoCompleteBox(RemoteWebElement element) - { - return new RadAutoCompleteBox(element as WindowsElement); - } - + /// /// Selects a suggestion from the auto-suggest box. /// diff --git a/src/Legerity.Telerik.Uwp/RadBulletGraph.cs b/src/Legerity.Telerik.Uwp/RadBulletGraph.cs index a74ad09d..e9c45eff 100644 --- a/src/Legerity.Telerik.Uwp/RadBulletGraph.cs +++ b/src/Legerity.Telerik.Uwp/RadBulletGraph.cs @@ -1,13 +1,9 @@ namespace Legerity.Windows.Elements.Telerik; using Legerity.Windows.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the Telerik UWP RadBulletGraph control. +/// Defines a wrapper for the Telerik UWP RadBulletGraph control. /// public class RadBulletGraph : WindowsElementWrapper { @@ -15,9 +11,9 @@ public class RadBulletGraph : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public RadBulletGraph(WindowsElement element) + public RadBulletGraph(WebElement element) : base(element) { } @@ -41,44 +37,16 @@ public RadBulletGraph(WindowsElement element) public virtual double Value => this.GetRangeValue(); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator RadBulletGraph(WindowsElement element) + public static implicit operator RadBulletGraph(WebElement element) { return new RadBulletGraph(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator RadBulletGraph(AppiumWebElement element) - { - return new RadBulletGraph(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator RadBulletGraph(RemoteWebElement element) - { - return new RadBulletGraph(element as WindowsElement); - } } \ No newline at end of file diff --git a/src/Legerity.Telerik.Uwp/RadBusyIndicator.cs b/src/Legerity.Telerik.Uwp/RadBusyIndicator.cs index c825b2a9..af8a90c3 100644 --- a/src/Legerity.Telerik.Uwp/RadBusyIndicator.cs +++ b/src/Legerity.Telerik.Uwp/RadBusyIndicator.cs @@ -1,12 +1,7 @@ namespace Legerity.Windows.Elements.Telerik; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; - /// -/// Defines a wrapper for the Telerik UWP RadBusyIndicator control. +/// Defines a wrapper for the Telerik UWP RadBusyIndicator control. /// public class RadBusyIndicator : WindowsElementWrapper { @@ -16,9 +11,9 @@ public class RadBusyIndicator : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public RadBusyIndicator(WindowsElement element) + public RadBusyIndicator(WebElement element) : base(element) { } @@ -30,44 +25,16 @@ public RadBusyIndicator(WindowsElement element) public virtual bool IsOn => this.GetAttribute("ItemStatus") == OnValue; /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator RadBusyIndicator(WindowsElement element) + public static implicit operator RadBusyIndicator(WebElement element) { return new RadBusyIndicator(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator RadBusyIndicator(AppiumWebElement element) - { - return new RadBusyIndicator(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator RadBusyIndicator(RemoteWebElement element) - { - return new RadBusyIndicator(element as WindowsElement); - } } \ No newline at end of file diff --git a/src/Legerity.Telerik.Uwp/RadNumericBox.cs b/src/Legerity.Telerik.Uwp/RadNumericBox.cs index b25451b3..49e5223c 100644 --- a/src/Legerity.Telerik.Uwp/RadNumericBox.cs +++ b/src/Legerity.Telerik.Uwp/RadNumericBox.cs @@ -3,13 +3,9 @@ namespace Legerity.Windows.Elements.Telerik; using System; using Legerity.Windows.Elements.Core; using Legerity.Windows.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the Telerik UWP RadNumericBox control. +/// Defines a wrapper for the Telerik UWP RadNumericBox control. /// public class RadNumericBox : WindowsElementWrapper { @@ -17,9 +13,9 @@ public class RadNumericBox : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public RadNumericBox(WindowsElement element) + public RadNumericBox(WebElement element) : base(element) { } @@ -73,47 +69,19 @@ public RadNumericBox(WindowsElement element) public virtual TextBox InputBox => this.FindElement(WindowsByExtras.AutomationId("PART_TextBox")); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator RadNumericBox(WindowsElement element) + public static implicit operator RadNumericBox(WebElement element) { return new RadNumericBox(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator RadNumericBox(AppiumWebElement element) - { - return new RadNumericBox(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator RadNumericBox(RemoteWebElement element) - { - return new RadNumericBox(element as WindowsElement); - } - + /// /// Sets the value of the RadNumericBox. /// diff --git a/src/Legerity.WCT/BladeView.cs b/src/Legerity.WCT/BladeView.cs index f2ed3a38..8d73e1c9 100644 --- a/src/Legerity.WCT/BladeView.cs +++ b/src/Legerity.WCT/BladeView.cs @@ -3,13 +3,9 @@ namespace Legerity.Windows.Elements.WCT; using System.Collections.Generic; using System.Linq; using Legerity.Windows.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the Windows Community Toolkit BladeView control. +/// Defines a wrapper for the Windows Community Toolkit BladeView control. /// public class BladeView : WindowsElementWrapper { @@ -17,9 +13,9 @@ public class BladeView : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public BladeView(WindowsElement element) + public BladeView(WebElement element) : base(element) { } @@ -29,50 +25,22 @@ public BladeView(WindowsElement element) /// public virtual IEnumerable Blades => this.Element.FindElements(By.ClassName("BladeItem")) - .Select(element => new BladeViewItem(this, element as WindowsElement)); + .Select(element => new BladeViewItem(this, element as WebElement)); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator BladeView(WindowsElement element) + public static implicit operator BladeView(WebElement element) { return new BladeView(element); } - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator BladeView(AppiumWebElement element) - { - return new BladeView(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator BladeView(RemoteWebElement element) - { - return new BladeView(element as WindowsElement); - } - /// /// Retrieves a by the given name. /// diff --git a/src/Legerity.WCT/BladeViewItem.cs b/src/Legerity.WCT/BladeViewItem.cs index 05dd3948..694cc61e 100644 --- a/src/Legerity.WCT/BladeViewItem.cs +++ b/src/Legerity.WCT/BladeViewItem.cs @@ -2,13 +2,9 @@ namespace Legerity.Windows.Elements.WCT; using System; using Legerity.Windows.Elements.Core; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the Windows Community Toolkit BladeViewItem control. +/// Defines a wrapper for the Windows Community Toolkit BladeViewItem control. /// public class BladeViewItem : WindowsElementWrapper { @@ -18,9 +14,9 @@ public class BladeViewItem : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public BladeViewItem(WindowsElement element) + public BladeViewItem(WebElement element) : this(null, element) { } @@ -32,11 +28,11 @@ public BladeViewItem(WindowsElement element) /// The parent . /// /// - /// The reference. + /// The reference. /// public BladeViewItem( BladeView parentBladeView, - WindowsElement element) + WebElement element) : base(element) { if (parentBladeView != null) @@ -64,47 +60,19 @@ public BladeViewItem( public virtual Button CloseButton => this.FindElement(WindowsByExtras.AutomationId("CloseButton")); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator BladeViewItem(WindowsElement element) + public static implicit operator BladeViewItem(WebElement element) { return new BladeViewItem(element); } - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator BladeViewItem(AppiumWebElement element) - { - return new BladeViewItem(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator BladeViewItem(RemoteWebElement element) - { - return new BladeViewItem(element as WindowsElement); - } - /// /// Closes the blade item. /// diff --git a/src/Legerity.WCT/Carousel.cs b/src/Legerity.WCT/Carousel.cs index a113eb6f..7ccb0dd6 100644 --- a/src/Legerity.WCT/Carousel.cs +++ b/src/Legerity.WCT/Carousel.cs @@ -6,13 +6,9 @@ namespace Legerity.Windows.Elements.WCT; using Legerity.Exceptions; using Legerity.Windows.Elements.Core; using Legerity.Windows.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the Windows Community Toolkit Carousel control. +/// Defines a wrapper for the Windows Community Toolkit Carousel control. /// public class Carousel : WindowsElementWrapper { @@ -22,9 +18,9 @@ public class Carousel : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public Carousel(WindowsElement element) + public Carousel(WebElement element) : base(element) { } @@ -32,14 +28,14 @@ public Carousel(WindowsElement element) /// /// Gets the collection of items associated with the carousel. /// - public virtual ReadOnlyCollection Items => - this.Element.FindElements(this.carouselItemLocator); + public virtual ReadOnlyCollection Items => + this.Element.FindElements(this.carouselItemLocator).Cast().ToList().AsReadOnly(); /// /// Gets the element associated with the currently selected item. /// /// Thrown when an element is no longer valid in the document DOM. - public virtual AppiumWebElement SelectedItem => this.Items.FirstOrDefault(i => i.IsSelected()); + public virtual WebElement SelectedItem => this.Items.FirstOrDefault(i => i.IsSelected()); /// /// Gets the index of the element associated with the currently selected item. @@ -48,47 +44,19 @@ public Carousel(WindowsElement element) public virtual int SelectedIndex => this.Items.IndexOf(this.SelectedItem); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator Carousel(WindowsElement element) + public static implicit operator Carousel(WebElement element) { return new Carousel(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator Carousel(AppiumWebElement element) - { - return new Carousel(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator Carousel(RemoteWebElement element) - { - return new Carousel(element as WindowsElement); - } - + /// /// Clicks on an item in the carousel with the specified item name. /// diff --git a/src/Legerity.WCT/Expander.cs b/src/Legerity.WCT/Expander.cs index 3d7d02f5..69861be6 100644 --- a/src/Legerity.WCT/Expander.cs +++ b/src/Legerity.WCT/Expander.cs @@ -2,13 +2,9 @@ namespace Legerity.Windows.Elements.WCT; using Legerity.Windows.Elements.Core; using Legerity.Windows.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the Windows Community Toolkit Expander control. +/// Defines a wrapper for the Windows Community Toolkit Expander control. /// public class Expander : WindowsElementWrapper { @@ -16,9 +12,9 @@ public class Expander : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public Expander(WindowsElement element) + public Expander(WebElement element) : base(element) { } @@ -36,47 +32,19 @@ public Expander(WindowsElement element) public virtual ToggleButton ToggleButton => this.FindElement(WindowsByExtras.AutomationId("PART_ExpanderToggleButton")); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator Expander(WindowsElement element) + public static implicit operator Expander(WebElement element) { return new Expander(element); } - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator Expander(AppiumWebElement element) - { - return new Expander(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator Expander(RemoteWebElement element) - { - return new Expander(element as WindowsElement); - } - /// /// Expands the content of the expander. /// diff --git a/src/Legerity.WCT/GlobalUsings.cs b/src/Legerity.WCT/GlobalUsings.cs new file mode 100644 index 00000000..d33e0522 --- /dev/null +++ b/src/Legerity.WCT/GlobalUsings.cs @@ -0,0 +1,6 @@ +// 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.WCT/InAppNotification.cs b/src/Legerity.WCT/InAppNotification.cs index e57eb252..6cf0ccef 100644 --- a/src/Legerity.WCT/InAppNotification.cs +++ b/src/Legerity.WCT/InAppNotification.cs @@ -1,14 +1,11 @@ namespace Legerity.Windows.Elements.WCT; using System.Linq; +using Extensions; using Legerity.Windows.Elements.Core; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the Windows Community Toolkit InAppNotification control. +/// Defines a wrapper for the Windows Community Toolkit InAppNotification control. /// public class InAppNotification : WindowsElementWrapper { @@ -16,9 +13,9 @@ public class InAppNotification : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public InAppNotification(WindowsElement element) + public InAppNotification(WebElement element) : base(element) { } @@ -39,47 +36,19 @@ public InAppNotification(WindowsElement element) public virtual string Message => this.Element.FindElementsByClassName("TextBlock").FirstOrDefault()?.Text; /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator InAppNotification(WindowsElement element) + public static implicit operator InAppNotification(WebElement element) { return new InAppNotification(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator InAppNotification(AppiumWebElement element) - { - return new InAppNotification(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator InAppNotification(RemoteWebElement element) - { - return new InAppNotification(element as WindowsElement); - } - + /// /// Dismissed the in-app notification. /// diff --git a/src/Legerity.WCT/RadialGauge.cs b/src/Legerity.WCT/RadialGauge.cs index 2dcf9db5..26c42e3a 100644 --- a/src/Legerity.WCT/RadialGauge.cs +++ b/src/Legerity.WCT/RadialGauge.cs @@ -2,13 +2,9 @@ namespace Legerity.Windows.Elements.WCT; using System; using Legerity.Windows.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the Windows Community Toolkit RadialGauge control. +/// Defines a wrapper for the Windows Community Toolkit RadialGauge control. /// public class RadialGauge : WindowsElementWrapper { @@ -16,9 +12,9 @@ public class RadialGauge : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public RadialGauge(WindowsElement element) + public RadialGauge(WebElement element) : base(element) { } @@ -54,47 +50,19 @@ public RadialGauge(WindowsElement element) public virtual bool IsReadonly => this.IsRangeReadonly(); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator RadialGauge(WindowsElement element) + public static implicit operator RadialGauge(WebElement element) { return new RadialGauge(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator RadialGauge(AppiumWebElement element) - { - return new RadialGauge(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator RadialGauge(RemoteWebElement element) - { - return new RadialGauge(element as WindowsElement); - } - + /// /// Sets the value of the gauge. /// diff --git a/src/Legerity.WinUI/GlobalUsings.cs b/src/Legerity.WinUI/GlobalUsings.cs new file mode 100644 index 00000000..d33e0522 --- /dev/null +++ b/src/Legerity.WinUI/GlobalUsings.cs @@ -0,0 +1,6 @@ +// 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/InfoBar.cs b/src/Legerity.WinUI/InfoBar.cs index b5e2a795..f0be27f3 100644 --- a/src/Legerity.WinUI/InfoBar.cs +++ b/src/Legerity.WinUI/InfoBar.cs @@ -1,13 +1,9 @@ namespace Legerity.Windows.Elements.WinUI; using Legerity.Windows.Elements.Core; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the WinUI InfoBar control. +/// Defines a wrapper for the WinUI InfoBar control. /// public class InfoBar : WindowsElementWrapper { @@ -15,9 +11,9 @@ public class InfoBar : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public InfoBar(WindowsElement element) + public InfoBar(WebElement element) : base(element) { } @@ -57,47 +53,19 @@ public InfoBar(WindowsElement element) public virtual Button CloseButton => this.FindElement(WindowsByExtras.AutomationId("CloseButton")); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator InfoBar(WindowsElement element) + public static implicit operator InfoBar(WebElement element) { return new InfoBar(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator InfoBar(AppiumWebElement element) - { - return new InfoBar(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator InfoBar(RemoteWebElement element) - { - return new InfoBar(element as WindowsElement); - } - + /// /// Closes the info bar. /// diff --git a/src/Legerity.WinUI/MenuBar.cs b/src/Legerity.WinUI/MenuBar.cs index 7926efca..14d58159 100644 --- a/src/Legerity.WinUI/MenuBar.cs +++ b/src/Legerity.WinUI/MenuBar.cs @@ -5,13 +5,9 @@ namespace Legerity.Windows.Elements.WinUI; using System.Globalization; using System.Linq; using Legerity.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the WinUI UWP MenuBar control. +/// Defines a wrapper for the WinUI UWP MenuBar control. /// public class MenuBar : WindowsElementWrapper { @@ -19,9 +15,9 @@ public class MenuBar : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public MenuBar(WindowsElement element) + public MenuBar(WebElement element) : base(element) { } @@ -31,50 +27,22 @@ public MenuBar(WindowsElement element) /// public virtual IEnumerable MenuItems => this.Element.FindElements(By.ClassName("Microsoft.UI.Xaml.Controls.MenuBarItem")) - .Select(element => new MenuBarItem(this, element as WindowsElement)); + .Select(element => new MenuBarItem(this, element as WebElement)); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator MenuBar(WindowsElement element) + public static implicit operator MenuBar(WebElement element) { return new MenuBar(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator MenuBar(AppiumWebElement element) - { - return new MenuBar(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator MenuBar(RemoteWebElement element) - { - return new MenuBar(element as WindowsElement); - } - + /// /// Clicks on a child menu option with the specified item name. /// diff --git a/src/Legerity.WinUI/MenuBarItem.cs b/src/Legerity.WinUI/MenuBarItem.cs index 98c3ddda..611da7c9 100644 --- a/src/Legerity.WinUI/MenuBarItem.cs +++ b/src/Legerity.WinUI/MenuBarItem.cs @@ -6,13 +6,9 @@ namespace Legerity.Windows.Elements.WinUI; using System.Linq; using Legerity.Extensions; using Legerity.Windows.Elements.Core; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the WinUI MenuBarItem control. +/// Defines a wrapper for the WinUI MenuBarItem control. /// public class MenuBarItem : WindowsElementWrapper { @@ -22,9 +18,9 @@ public class MenuBarItem : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public MenuBarItem(WindowsElement element) + public MenuBarItem(WebElement element) : this(null, element) { } @@ -36,11 +32,11 @@ public MenuBarItem(WindowsElement element) /// The parent . /// /// - /// The reference. + /// The reference. /// public MenuBarItem( MenuBar parentMenuBar, - WindowsElement element) + WebElement element) : base(element) { if (parentMenuBar != null) @@ -68,47 +64,19 @@ public MenuBarItem( public virtual IEnumerable ChildMenuSubItems => this.GetChildMenuSubItems(); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator MenuBarItem(WindowsElement element) + public static implicit operator MenuBarItem(WebElement element) { return new MenuBarItem(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator MenuBarItem(AppiumWebElement element) - { - return new MenuBarItem(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator MenuBarItem(RemoteWebElement element) - { - return new MenuBarItem(element as WindowsElement); - } - + /// /// Clicks on a child menu option with the specified item name. /// @@ -218,7 +186,7 @@ private IEnumerable GetChildMenuItems() { return this.Driver.FindElement(By.ClassName("MenuFlyout")) .FindElements(By.ClassName(nameof(MenuFlyoutItem))).Select( - element => new MenuFlyoutItem(element as WindowsElement)); + element => new MenuFlyoutItem(element)); } /// Thrown when no element matches the expected locator. @@ -226,6 +194,6 @@ private IEnumerable GetChildMenuSubItems() { return this.Driver.FindElement(By.ClassName("MenuFlyout")) .FindElements(By.ClassName(nameof(MenuFlyoutSubItem))).Select( - element => new MenuFlyoutSubItem(element as WindowsElement)); + element => new MenuFlyoutSubItem(element)); } } \ No newline at end of file diff --git a/src/Legerity.WinUI/NavigationView.cs b/src/Legerity.WinUI/NavigationView.cs index 653fb48a..13b8da3f 100644 --- a/src/Legerity.WinUI/NavigationView.cs +++ b/src/Legerity.WinUI/NavigationView.cs @@ -7,13 +7,9 @@ namespace Legerity.Windows.Elements.WinUI; using Extensions; using Legerity.Extensions; using Legerity.Windows.Elements.Core; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the WinUI NavigationView control. +/// Defines a wrapper for the WinUI NavigationView control. /// public class NavigationView : WindowsElementWrapper { @@ -21,9 +17,9 @@ public class NavigationView : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public NavigationView(WindowsElement element) + public NavigationView(WebElement element) : base(element) { } @@ -32,7 +28,7 @@ public NavigationView(WindowsElement element) /// Gets the UI component associated with displaying the menu items. /// /// Thrown when no element matches the expected locator. - public virtual AppiumWebElement MenuItemsView => + public virtual WebElement MenuItemsView => this.FindElement(WindowsByExtras.AutomationId("MenuItemsHost")); /// @@ -41,7 +37,7 @@ public NavigationView(WindowsElement element) /// Thrown when no element matches the expected locator. public virtual IEnumerable MenuItems => this.MenuItemsView.FindElements(By.ClassName("Microsoft.UI.Xaml.Controls.NavigationViewItem")) - .Select(element => new NavigationViewItem(this, element as WindowsElement)); + .Select(element => new NavigationViewItem(this, element as WebElement)); /// /// Gets the currently selected menu item. @@ -55,7 +51,7 @@ public NavigationView(WindowsElement element) /// Gets the UI component associated with the settings menu item. /// /// Thrown when no element matches the expected locator. - public virtual AppiumWebElement SettingsMenuItem => + public virtual WebElement SettingsMenuItem => this.FindElement(WindowsByExtras.AutomationId("SettingsItem")); /// @@ -84,47 +80,19 @@ public NavigationView(WindowsElement element) public virtual int ExpectedCompactPaneWidth { get; set; } = 72; /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator NavigationView(WindowsElement element) + public static implicit operator NavigationView(WebElement element) { return new NavigationView(element); } - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator NavigationView(AppiumWebElement element) - { - return new NavigationView(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator NavigationView(RemoteWebElement element) - { - return new NavigationView(element as WindowsElement); - } - /// /// Opens the navigation pane. /// @@ -248,8 +216,8 @@ public virtual void OpenSettings() /// Thrown when no element matches the expected locator. public virtual bool VerifyPaneOpen(int expectedCompactPaneWidth) { - AppiumWebElement pane = this.FindElement(WindowsByExtras.AutomationId("PaneRoot")); - int paneWidth = pane.Rect.Width; + WebElement pane = this.FindElement(WindowsByExtras.AutomationId("PaneRoot")); + int paneWidth = pane.GetBoundingRect().Width; return paneWidth > expectedCompactPaneWidth; } } \ No newline at end of file diff --git a/src/Legerity.WinUI/NavigationViewItem.cs b/src/Legerity.WinUI/NavigationViewItem.cs index 57480032..bbab5819 100644 --- a/src/Legerity.WinUI/NavigationViewItem.cs +++ b/src/Legerity.WinUI/NavigationViewItem.cs @@ -5,13 +5,9 @@ namespace Legerity.Windows.Elements.WinUI; using System.Globalization; using System.Linq; using Legerity.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the WinUI NavigationViewItem control. +/// Defines a wrapper for the WinUI NavigationViewItem control. /// public class NavigationViewItem : WindowsElementWrapper { @@ -25,9 +21,9 @@ public class NavigationViewItem : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public NavigationViewItem(WindowsElement element) + public NavigationViewItem(WebElement element) : this(null, null, element) { } @@ -39,9 +35,9 @@ public NavigationViewItem(WindowsElement element) /// The parent . /// /// - /// The reference. + /// The reference. /// - public NavigationViewItem(NavigationView parentNavigationView, WindowsElement element) + public NavigationViewItem(NavigationView parentNavigationView, WebElement element) : this(parentNavigationView, null, element) { } @@ -53,9 +49,9 @@ public NavigationViewItem(NavigationView parentNavigationView, WindowsElement el /// The parent . /// /// - /// The reference. + /// The reference. /// - public NavigationViewItem(NavigationViewItem parentItem, WindowsElement element) + public NavigationViewItem(NavigationViewItem parentItem, WebElement element) : this(null, parentItem, element) { } @@ -70,12 +66,12 @@ public NavigationViewItem(NavigationViewItem parentItem, WindowsElement element) /// The parent . /// /// - /// The reference. + /// The reference. /// public NavigationViewItem( NavigationView parentNavigationView, NavigationViewItem parentItem, - WindowsElement element) + WebElement element) : base(element) { if (parentNavigationView != null) @@ -108,47 +104,19 @@ public NavigationViewItem( public virtual IEnumerable ChildMenuItems => this.GetChildMenuItems(); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator NavigationViewItem(WindowsElement element) + public static implicit operator NavigationViewItem(WebElement element) { return new NavigationViewItem(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator NavigationViewItem(AppiumWebElement element) - { - return new NavigationViewItem(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator NavigationViewItem(RemoteWebElement element) - { - return new NavigationViewItem(element as WindowsElement); - } - + /// /// Clicks on a child menu option with the specified item name. /// @@ -211,11 +179,11 @@ private IEnumerable GetChildMenuItems() if (this.ParentNavigationView == null || this.ParentNavigationView.IsPaneOpen) { return this.Element.FindElements(this.navigationViewItemLocator).Select( - element => new NavigationViewItem(this.ParentNavigationView, this, element as WindowsElement)); + element => new NavigationViewItem(this.ParentNavigationView, this, element as WebElement)); } return this.Driver.FindElement(WindowsByExtras.AutomationId("ChildrenFlyout")) .FindElements(this.navigationViewItemLocator).Select( - element => new NavigationViewItem(this.ParentNavigationView, this, element as WindowsElement)); + element => new NavigationViewItem(this.ParentNavigationView, this, element)); } } \ No newline at end of file diff --git a/src/Legerity.WinUI/NumberBox.cs b/src/Legerity.WinUI/NumberBox.cs index 4e440dcd..a28e2907 100644 --- a/src/Legerity.WinUI/NumberBox.cs +++ b/src/Legerity.WinUI/NumberBox.cs @@ -3,13 +3,9 @@ namespace Legerity.Windows.Elements.WinUI; using System; using Legerity.Windows.Elements.Core; using Legerity.Windows.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the WinUI NumberBox control. +/// Defines a wrapper for the WinUI NumberBox control. /// public class NumberBox : WindowsElementWrapper { @@ -17,9 +13,9 @@ public class NumberBox : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public NumberBox(WindowsElement element) + public NumberBox(WebElement element) : base(element) { } @@ -74,47 +70,19 @@ public NumberBox(WindowsElement element) public virtual TextBox InputBox => this.FindElement(WindowsByExtras.AutomationId("InputBox")); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator NumberBox(WindowsElement element) + public static implicit operator NumberBox(WebElement element) { return new NumberBox(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator NumberBox(AppiumWebElement element) - { - return new NumberBox(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator NumberBox(RemoteWebElement element) - { - return new NumberBox(element as WindowsElement); - } - + /// /// Sets the value of the NumberBox. /// diff --git a/src/Legerity.WinUI/RatingControl.cs b/src/Legerity.WinUI/RatingControl.cs index aef3ca8c..fd493d75 100644 --- a/src/Legerity.WinUI/RatingControl.cs +++ b/src/Legerity.WinUI/RatingControl.cs @@ -2,13 +2,9 @@ namespace Legerity.Windows.Elements.WinUI; using System; using Legerity.Windows.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the WinUI Rating control. +/// Defines a wrapper for the WinUI Rating control. /// public class RatingControl : WindowsElementWrapper { @@ -16,9 +12,9 @@ public class RatingControl : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public RatingControl(WindowsElement element) + public RatingControl(WebElement element) : base(element) { } @@ -48,47 +44,19 @@ public RatingControl(WindowsElement element) public virtual double Maximum => this.GetRangeMaximum(); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator RatingControl(WindowsElement element) + public static implicit operator RatingControl(WebElement element) { return new RatingControl(element); } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator RatingControl(AppiumWebElement element) - { - return new RatingControl(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator RatingControl(RemoteWebElement element) - { - return new RatingControl(element as WindowsElement); - } - + /// /// Sets the value of the slider. /// diff --git a/src/Legerity.WinUI/TabView.cs b/src/Legerity.WinUI/TabView.cs index 9e05f4f9..f98c5c4f 100644 --- a/src/Legerity.WinUI/TabView.cs +++ b/src/Legerity.WinUI/TabView.cs @@ -6,13 +6,9 @@ namespace Legerity.Windows.Elements.WinUI; using Legerity.Exceptions; using Legerity.Windows.Elements.Core; using Legerity.Windows.Extensions; -using OpenQA.Selenium; -using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Remote; /// -/// Defines a wrapper for the WinUI TabView control. +/// Defines a wrapper for the WinUI TabView control. /// public class TabView : WindowsElementWrapper { @@ -22,9 +18,9 @@ public class TabView : WindowsElementWrapper /// Initializes a new instance of the class. /// /// - /// The reference. + /// The reference. /// - public TabView(WindowsElement element) + public TabView(WebElement element) : base(element) { } @@ -39,60 +35,32 @@ public TabView(WindowsElement element) /// Gets the collection of items associated with the pivot. /// /// Thrown when no element matches the expected locator. - public virtual ReadOnlyCollection Tabs => this.TabsListView.Items; + public virtual ReadOnlyCollection Tabs => this.TabsListView.Items; /// /// Gets the element associated with the currently selected item. /// /// Thrown when no element matches the expected locator. /// Thrown when an element is no longer valid in the document DOM. - public virtual AppiumWebElement SelectedItem => this.TabsListView.SelectedItem; + public virtual WebElement SelectedItem => this.TabsListView.SelectedItem; /// Thrown when no element matches the expected locator. private ListView TabsListView => this.FindElement(this.tabListViewLocator); /// - /// Allows conversion of a to the without direct casting. + /// Allows conversion of a to the without direct casting. /// /// - /// The . + /// The . /// /// /// The . /// - public static implicit operator TabView(WindowsElement element) + public static implicit operator TabView(WebElement element) { return new TabView(element); } - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator TabView(AppiumWebElement element) - { - return new TabView(element as WindowsElement); - } - - /// - /// Allows conversion of a to the without direct casting. - /// - /// - /// The . - /// - /// - /// The . - /// - public static implicit operator TabView(RemoteWebElement element) - { - return new TabView(element as WindowsElement); - } - /// /// Adds a new tab to the tab view. /// @@ -121,7 +89,7 @@ public virtual void CreateTab() public virtual void SelectTab(string name) { this.VerifyElementShown(this.tabListViewLocator, TimeSpan.FromSeconds(2)); - AppiumWebElement item = this.Tabs.FirstOrDefault(element => element.VerifyNameOrAutomationIdEquals(name)); + WebElement item = this.Tabs.FirstOrDefault(element => element.VerifyNameOrAutomationIdEquals(name)); if (item == null) { @@ -145,7 +113,7 @@ public virtual void SelectTab(string name) public virtual void SelectTabByPartialName(string name) { this.VerifyElementShown(this.tabListViewLocator, TimeSpan.FromSeconds(2)); - AppiumWebElement item = this.Tabs.FirstOrDefault(element => element.VerifyNameOrAutomationIdContains(name)); + WebElement item = this.Tabs.FirstOrDefault(element => element.VerifyNameOrAutomationIdContains(name)); if (item == null) { @@ -167,14 +135,14 @@ public virtual void SelectTabByPartialName(string name) public virtual void CloseTab(string name) { this.VerifyElementShown(this.tabListViewLocator, TimeSpan.FromSeconds(2)); - AppiumWebElement item = this.Tabs.FirstOrDefault(element => element.VerifyNameOrAutomationIdEquals(name)); + WebElement item = this.Tabs.FirstOrDefault(element => element.VerifyNameOrAutomationIdEquals(name)); if (item == null) { throw new NoSuchElementException($"Unable to locate element by {name}"); } - Button closeButton = item.FindElement(WindowsByExtras.AutomationId("CloseButton")); + Button closeButton = item.FindElement(WindowsByExtras.AutomationId("CloseButton")) as WebElement; closeButton.Click(); } @@ -190,14 +158,14 @@ public virtual void CloseTab(string name) public virtual void CloseTabByPartialName(string name) { this.VerifyElementShown(this.tabListViewLocator, TimeSpan.FromSeconds(2)); - AppiumWebElement item = this.Tabs.FirstOrDefault(element => element.VerifyNameOrAutomationIdContains(name)); + WebElement item = this.Tabs.FirstOrDefault(element => element.VerifyNameOrAutomationIdContains(name)); if (item == null) { throw new NoSuchElementException($"Unable to locate element by {name}"); } - Button closeButton = item.FindElement(WindowsByExtras.AutomationId("CloseButton")); + Button closeButton = item.FindElement(WindowsByExtras.AutomationId("CloseButton")) as WebElement; closeButton.Click(); } } \ No newline at end of file diff --git a/src/Legerity.Windows/Extensions/ElementExtensions.cs b/src/Legerity.Windows/Extensions/ElementExtensions.cs index 9ef27fee..3144640a 100644 --- a/src/Legerity.Windows/Extensions/ElementExtensions.cs +++ b/src/Legerity.Windows/Extensions/ElementExtensions.cs @@ -1,5 +1,8 @@ namespace Legerity.Windows.Extensions; +using System.Collections.Generic; +using System.Linq; + public static class ElementExtensions { /// Thrown when no element matches the expected locator. @@ -7,4 +10,9 @@ public static WebElement FindElementByName(this IWebElement element, string name { return element.FindElement(By.Name(name)) as WebElement; } + + public static IEnumerable FindElementsByClassName(this IWebElement element, string className) + { + return element.FindElements(By.ClassName(className)).Cast(); + } } \ No newline at end of file From 786c753c8ff4b66148b0d2f363a2ca86c1bfa4d4 Mon Sep 17 00:00:00 2001 From: James Croft Date: Mon, 11 Mar 2024 21:17:13 +0000 Subject: [PATCH 10/21] Fix tests --- tests/Legerity.Core.Tests/GlobalUsings.cs | 4 +++- .../Legerity.Core.Tests/Legerity.Core.Tests.csproj | 2 +- tests/Legerity.Core.Tests/Pages/W3SchoolsPage.cs | 4 ++-- tests/Legerity.Core.Tests/Tests/ByAllTests.cs | 14 +++++++------- tests/Legerity.Core.Tests/Tests/ByNestedTests.cs | 14 +++++++------- .../Tests/WaitUntilElementIsNotVisibleTests.cs | 14 +++++++------- .../Tests/WaitUntilElementIsVisibleTests.cs | 14 +++++++------- .../Tests/WebAppManagerOptionsTests.cs | 3 ++- tests/Legerity.Telerik.Uwp.Tests/GlobalUsings.cs | 4 +++- .../Pages/BaseNavigationPage.cs | 4 ++-- tests/Legerity.Telerik.Uwp.Tests/Pages/HomePage.cs | 3 ++- tests/Legerity.WCT.Tests/GlobalUsings.cs | 4 +++- .../Legerity.WCT.Tests/Pages/BaseNavigationPage.cs | 4 ++-- tests/Legerity.WCT.Tests/Pages/HomePage.cs | 3 ++- tests/Legerity.Web.Tests/GlobalUsings.cs | 4 +++- tests/Legerity.Web.Tests/Legerity.Web.Tests.csproj | 2 +- tests/Legerity.Web.Tests/Pages/ButtonPage.cs | 2 +- tests/Legerity.Web.Tests/Pages/CheckBoxPage.cs | 2 +- tests/Legerity.Web.Tests/Pages/DateInputPage.cs | 2 +- tests/Legerity.Web.Tests/Pages/FileInputPage.cs | 2 +- tests/Legerity.Web.Tests/Pages/ImagePage.cs | 2 +- tests/Legerity.Web.Tests/Pages/ListPage.cs | 2 +- tests/Legerity.Web.Tests/Pages/NumberInputPage.cs | 2 +- tests/Legerity.Web.Tests/Pages/OptionPage.cs | 2 +- tests/Legerity.Web.Tests/Pages/RadioButtonPage.cs | 2 +- tests/Legerity.Web.Tests/Pages/RangeInputPage.cs | 2 +- tests/Legerity.Web.Tests/Pages/SelectPage.cs | 2 +- tests/Legerity.Web.Tests/Pages/TablePage.cs | 2 +- tests/Legerity.Web.Tests/Pages/TextAreaPage.cs | 2 +- tests/Legerity.Web.Tests/Pages/TextInputPage.cs | 2 +- .../Legerity.Web.Tests/Pages/W3SchoolsBasePage.cs | 4 ++-- tests/Legerity.Web.Tests/Tests/ButtonTests.cs | 3 ++- tests/Legerity.Web.Tests/Tests/CheckBoxTests.cs | 8 ++++---- tests/Legerity.Web.Tests/Tests/DateInputTests.cs | 2 +- tests/Legerity.Web.Tests/Tests/FileInputTests.cs | 4 ++-- tests/Legerity.Web.Tests/Tests/ImageTests.cs | 6 +++--- tests/Legerity.Web.Tests/Tests/ListTests.cs | 2 +- .../Tests/MultipleSelectTests.cs | 4 ++-- tests/Legerity.Web.Tests/Tests/NumberInputTests.cs | 12 ++++++------ tests/Legerity.Web.Tests/Tests/OptionTests.cs | 4 ++-- tests/Legerity.Web.Tests/Tests/RadioButtonTests.cs | 4 ++-- tests/Legerity.Web.Tests/Tests/RangeInputTests.cs | 12 ++++++------ tests/Legerity.Web.Tests/Tests/SelectTests.cs | 12 ++++++------ tests/Legerity.Web.Tests/Tests/TableTests.cs | 12 ++++++------ tests/Legerity.Web.Tests/Tests/TextAreaTests.cs | 8 ++++---- tests/Legerity.Web.Tests/Tests/TextInputTests.cs | 6 +++--- .../Tests/W3SchoolsBaseTestClass.cs | 3 ++- tests/Legerity.Web.Tests/Tests/WebByExtraTests.cs | 4 ++-- .../Tests/WebElementWrapperTests.cs | 14 +++++++------- tests/Legerity.WinUI.Tests/GlobalUsings.cs | 4 +++- .../Pages/BaseNavigationPage.cs | 2 +- tests/Legerity.WinUI.Tests/Pages/HomePage.cs | 3 ++- tests/Legerity.WinUI.Tests/Pages/InfoBarPage.cs | 3 ++- tests/Legerity.WinUI.Tests/Pages/MenuBarPage.cs | 3 ++- .../Pages/NavigationViewPage.cs | 3 ++- tests/Legerity.WinUI.Tests/Pages/NumberBoxPage.cs | 3 ++- .../Pages/RatingControlPage.cs | 3 ++- tests/Legerity.WinUI.Tests/Pages/TabViewPage.cs | 3 ++- tests/Legerity.WinUI.Tests/Tests/InfoBarTests.cs | 2 +- tests/Legerity.WinUI.Tests/Tests/MenuBarTests.cs | 8 ++++---- .../Tests/NavigationViewTests.cs | 2 +- tests/Legerity.WinUI.Tests/Tests/NumberBoxTests.cs | 2 +- .../Tests/RatingControlTests.cs | 2 +- tests/Legerity.WinUI.Tests/Tests/TabViewTests.cs | 4 ++-- tests/Legerity.Windows.Tests/GlobalUsings.cs | 4 +++- .../Pages/AppBarButtonPage.cs | 2 +- .../Pages/AppBarToggleButtonPage.cs | 2 +- .../Pages/AutoSuggestBoxPage.cs | 2 +- .../Pages/BaseNavigationPage.cs | 2 +- tests/Legerity.Windows.Tests/Pages/ButtonPage.cs | 3 ++- .../Pages/CalendarDatePickerPage.cs | 2 +- .../Pages/CalendarViewPage.cs | 2 +- tests/Legerity.Windows.Tests/Pages/CheckBoxPage.cs | 2 +- tests/Legerity.Windows.Tests/Pages/ComboBoxPage.cs | 2 +- .../Legerity.Windows.Tests/Pages/CommandBarPage.cs | 3 ++- .../Legerity.Windows.Tests/Pages/DatePickerPage.cs | 2 +- tests/Legerity.Windows.Tests/Pages/FlipViewPage.cs | 2 +- tests/Legerity.Windows.Tests/Pages/GridViewPage.cs | 3 ++- tests/Legerity.Windows.Tests/Pages/HomePage.cs | 3 ++- .../Pages/HyperlinkButtonPage.cs | 3 ++- .../Legerity.Windows.Tests/Pages/InkToolbarPage.cs | 3 ++- tests/Legerity.Windows.Tests/Pages/ListBoxPage.cs | 3 ++- .../Pages/PasswordBoxPage.cs | 2 +- tests/Legerity.Windows.Tests/Pages/PivotPage.cs | 2 +- .../Pages/ProgressBarPage.cs | 2 +- .../Pages/ProgressRingPage.cs | 2 +- .../Pages/RadioButtonPage.cs | 2 +- tests/Legerity.Windows.Tests/Pages/SliderPage.cs | 2 +- .../Legerity.Windows.Tests/Pages/TextBlockPage.cs | 2 +- tests/Legerity.Windows.Tests/Pages/TextBoxPage.cs | 2 +- .../Legerity.Windows.Tests/Pages/TimePickerPage.cs | 2 +- .../Pages/ToggleSwitchPage.cs | 2 +- .../Tests/AppBarButtonTests.cs | 2 +- .../Tests/AppBarToggleButtonTests.cs | 8 ++++---- .../Tests/AutoSuggestBoxTests.cs | 8 ++++---- tests/Legerity.Windows.Tests/Tests/ButtonTests.cs | 2 +- .../Tests/CalendarDatePickerTests.cs | 6 +++--- .../Tests/CalendarViewTests.cs | 4 ++-- .../Legerity.Windows.Tests/Tests/CheckBoxTests.cs | 10 +++++----- .../Legerity.Windows.Tests/Tests/ComboBoxTests.cs | 4 ++-- .../Tests/CommandBarTests.cs | 8 ++++---- .../Tests/DatePickerTests.cs | 4 ++-- .../Legerity.Windows.Tests/Tests/FlipViewTests.cs | 8 ++++---- .../Legerity.Windows.Tests/Tests/GridViewTests.cs | 10 +++++----- .../Tests/HyperlinkButtonTests.cs | 2 +- .../Tests/InkToolbarTests.cs | 12 ++++++------ tests/Legerity.Windows.Tests/Tests/ListBoxTests.cs | 4 ++-- .../Tests/PasswordBoxTests.cs | 2 +- tests/Legerity.Windows.Tests/Tests/PivotTests.cs | 4 ++-- .../Tests/ProgressBarTests.cs | 4 ++-- .../Tests/ProgressRingTests.cs | 2 +- .../Tests/RadioButtonTests.cs | 2 +- tests/Legerity.Windows.Tests/Tests/SliderTests.cs | 2 +- .../Legerity.Windows.Tests/Tests/TextBlockTests.cs | 2 +- tests/Legerity.Windows.Tests/Tests/TextBoxTests.cs | 2 +- .../Tests/TimePickerTests.cs | 2 +- .../Tests/ToggleSwitchTests.cs | 2 +- .../Tests/WindowsElementExtensionsTests.cs | 13 +++++++------ 118 files changed, 261 insertions(+), 229 deletions(-) diff --git a/tests/Legerity.Core.Tests/GlobalUsings.cs b/tests/Legerity.Core.Tests/GlobalUsings.cs index 2ac570eb..0d499602 100644 --- a/tests/Legerity.Core.Tests/GlobalUsings.cs +++ b/tests/Legerity.Core.Tests/GlobalUsings.cs @@ -3,4 +3,6 @@ global using Legerity; global using Legerity.Pages; global using Legerity.Web; -global using NUnit.Framework; \ No newline at end of file +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/Legerity.Core.Tests.csproj b/tests/Legerity.Core.Tests/Legerity.Core.Tests.csproj index 5d1785f6..9d1517c0 100644 --- a/tests/Legerity.Core.Tests/Legerity.Core.Tests.csproj +++ b/tests/Legerity.Core.Tests/Legerity.Core.Tests.csproj @@ -10,7 +10,7 @@ - + diff --git a/tests/Legerity.Core.Tests/Pages/W3SchoolsPage.cs b/tests/Legerity.Core.Tests/Pages/W3SchoolsPage.cs index a90c2a66..925aa551 100644 --- a/tests/Legerity.Core.Tests/Pages/W3SchoolsPage.cs +++ b/tests/Legerity.Core.Tests/Pages/W3SchoolsPage.cs @@ -11,7 +11,7 @@ internal class W3SchoolsPage : BasePage private readonly By contentFrameLocator = By.Id("iframeResult"); private readonly By acceptCookiesButtonLocator = By.Id("accept-choices"); - public W3SchoolsPage(RemoteWebDriver app) + public W3SchoolsPage(WebDriver app) : base(app, BaseTestClass.ImplicitWait) { } @@ -20,7 +20,7 @@ public W3SchoolsPage(RemoteWebDriver app) public Button AcceptCookiesButton => this.FindElement(this.acceptCookiesButtonLocator); - public RemoteWebElement ContentFrame => this.FindElement(this.contentFrameLocator); + public WebElement ContentFrame => this.FindElement(this.contentFrameLocator); public T AcceptCookies() where T : W3SchoolsPage { diff --git a/tests/Legerity.Core.Tests/Tests/ByAllTests.cs b/tests/Legerity.Core.Tests/Tests/ByAllTests.cs index 3a430d93..98127a80 100644 --- a/tests/Legerity.Core.Tests/Tests/ByAllTests.cs +++ b/tests/Legerity.Core.Tests/Tests/ByAllTests.cs @@ -26,14 +26,14 @@ public void ShouldFindElementByAll() DriverOptions = new ChromeOptions() }; - RemoteWebDriver app = this.StartApp(options); + WebDriver app = this.StartApp(options); W3SchoolsPage page = new W3SchoolsPage(app) .AcceptCookies() .SwitchToContentFrame(); // Act - RemoteWebElement element = page.FindElement(new ByAll(By.TagName("p"), ByExtras.PartialText("Please select"))); + WebElement element = page.FindElement(new ByAll(By.TagName("p"), ByExtras.PartialText("Please select"))); // Assert element.ShouldNotBeNull(); @@ -53,14 +53,14 @@ public void ShouldFindElementsByAll() DriverOptions = new ChromeOptions() }; - RemoteWebDriver app = this.StartApp(options); + WebDriver app = this.StartApp(options); W3SchoolsPage page = new W3SchoolsPage(app) .AcceptCookies() .SwitchToContentFrame(); // Act - ReadOnlyCollection elements = + ReadOnlyCollection elements = page.FindElements(new ByAll(By.TagName("p"), ByExtras.PartialText("Please select"))); // Assert @@ -81,7 +81,7 @@ public void ShouldThrowNoSuchElementExceptionIfFindElementReturnsNoResult() DriverOptions = new ChromeOptions() }; - RemoteWebDriver app = this.StartApp(options); + WebDriver app = this.StartApp(options); W3SchoolsPage page = new W3SchoolsPage(app) .AcceptCookies() @@ -105,14 +105,14 @@ public void ShouldReturnEmptyCollectionIfFindElementsReturnsNoResult() DriverOptions = new ChromeOptions() }; - RemoteWebDriver app = this.StartApp(options); + WebDriver app = this.StartApp(options); W3SchoolsPage page = new W3SchoolsPage(app) .AcceptCookies() .SwitchToContentFrame(); // Act - ReadOnlyCollection elements = + ReadOnlyCollection elements = page.FindElements(new ByAll(By.TagName("p"), ByExtras.PartialText("This text does not exist"))); // Assert diff --git a/tests/Legerity.Core.Tests/Tests/ByNestedTests.cs b/tests/Legerity.Core.Tests/Tests/ByNestedTests.cs index 86056c67..3d88fab2 100644 --- a/tests/Legerity.Core.Tests/Tests/ByNestedTests.cs +++ b/tests/Legerity.Core.Tests/Tests/ByNestedTests.cs @@ -27,14 +27,14 @@ public void ShouldFindElementByNested() DriverOptions = new ChromeOptions() }; - RemoteWebDriver app = this.StartApp(options); + WebDriver app = this.StartApp(options); W3SchoolsPage page = new W3SchoolsPage(app) .AcceptCookies() .SwitchToContentFrame(); // Act - RemoteWebElement element = page.FindElement(new ByNested(By.TagName("form"), By.TagName("input"))); + WebElement element = page.FindElement(new ByNested(By.TagName("form"), By.TagName("input"))); // Assert element.ShouldNotBeNull(); @@ -54,14 +54,14 @@ public void ShouldFindElementsByNested() DriverOptions = new ChromeOptions() }; - RemoteWebDriver app = this.StartApp(options); + WebDriver app = this.StartApp(options); W3SchoolsPage page = new W3SchoolsPage(app) .AcceptCookies() .SwitchToContentFrame(); // Act - ReadOnlyCollection elements = + ReadOnlyCollection elements = page.FindElements(new ByNested(By.TagName("form"), WebByExtras.InputType("radio"))); // Assert @@ -81,7 +81,7 @@ public void ShouldThrowNoSuchElementExceptionIfFindElementReturnsNoResult() DriverOptions = new ChromeOptions() }; - RemoteWebDriver app = this.StartApp(options); + WebDriver app = this.StartApp(options); W3SchoolsPage page = new W3SchoolsPage(app) .AcceptCookies() @@ -105,14 +105,14 @@ public void ShouldReturnEmptyCollectionIfFindElementsReturnsNoResult() DriverOptions = new ChromeOptions() }; - RemoteWebDriver app = this.StartApp(options); + WebDriver app = this.StartApp(options); W3SchoolsPage page = new W3SchoolsPage(app) .AcceptCookies() .SwitchToContentFrame(); // Act - ReadOnlyCollection elements = + ReadOnlyCollection elements = page.FindElements(new ByNested(By.TagName("form"), By.TagName("div"))); // Assert diff --git a/tests/Legerity.Core.Tests/Tests/WaitUntilElementIsNotVisibleTests.cs b/tests/Legerity.Core.Tests/Tests/WaitUntilElementIsNotVisibleTests.cs index d535ec84..f5560208 100644 --- a/tests/Legerity.Core.Tests/Tests/WaitUntilElementIsNotVisibleTests.cs +++ b/tests/Legerity.Core.Tests/Tests/WaitUntilElementIsNotVisibleTests.cs @@ -27,7 +27,7 @@ public void ShouldWaitUntilElementIsNotVisible() DriverOptions = new ChromeOptions() }; - RemoteWebDriver app = this.StartApp(options); + WebDriver app = this.StartApp(options); new W3SchoolsPage(app) .AcceptCookies() @@ -50,16 +50,16 @@ public void ShouldWaitUntilElementIsNotVisibleInElement() DriverOptions = new ChromeOptions() }; - RemoteWebDriver app = this.StartApp(options); + WebDriver app = this.StartApp(options); W3SchoolsPage page = new W3SchoolsPage(app) .AcceptCookies() .SwitchToContentFrame(); - RemoteWebElement element = page.FindElement(By.TagName("form")); + WebElement element = page.FindElement(By.TagName("form")); // Act & Assert - element.WaitUntil(WaitUntilConditions.ElementIsNotVisibleInElement(By.TagName("select")), + element.WaitUntil(WaitUntilConditions.ElementIsNotVisibleInElement(By.TagName("select")), ImplicitWait); } @@ -76,7 +76,7 @@ public void ShouldWaitUntilElementIsNotVisibleInElementWrapper() DriverOptions = new ChromeOptions() }; - RemoteWebDriver app = this.StartApp(options); + WebDriver app = this.StartApp(options); W3SchoolsPage page = new W3SchoolsPage(app) .AcceptCookies() @@ -85,7 +85,7 @@ public void ShouldWaitUntilElementIsNotVisibleInElementWrapper() Form form = page.FindElement(By.TagName("form")); // Act & Assert - form.WaitUntil(WaitUntilConditions.ElementIsNotVisibleInElementWrapper(By.TagName("select")), + form.WaitUntil(WaitUntilConditions.ElementIsNotVisibleInElementWrapper(By.TagName("select")), ImplicitWait); } @@ -102,7 +102,7 @@ public void ShouldWaitUntilElementIsNotVisibleInPageObject() DriverOptions = new ChromeOptions() }; - RemoteWebDriver app = this.StartApp(options); + WebDriver app = this.StartApp(options); W3SchoolsPage page = new W3SchoolsPage(app) .AcceptCookies() diff --git a/tests/Legerity.Core.Tests/Tests/WaitUntilElementIsVisibleTests.cs b/tests/Legerity.Core.Tests/Tests/WaitUntilElementIsVisibleTests.cs index fb2cca47..04c881e5 100644 --- a/tests/Legerity.Core.Tests/Tests/WaitUntilElementIsVisibleTests.cs +++ b/tests/Legerity.Core.Tests/Tests/WaitUntilElementIsVisibleTests.cs @@ -27,7 +27,7 @@ public void ShouldWaitUntilElementIsVisible() DriverOptions = new ChromeOptions() }; - RemoteWebDriver app = this.StartApp(options); + WebDriver app = this.StartApp(options); new W3SchoolsPage(app) .AcceptCookies() @@ -50,16 +50,16 @@ public void ShouldWaitUntilElementIsVisibleInElement() DriverOptions = new ChromeOptions() }; - RemoteWebDriver app = this.StartApp(options); + WebDriver app = this.StartApp(options); W3SchoolsPage page = new W3SchoolsPage(app) .AcceptCookies() .SwitchToContentFrame(); - RemoteWebElement element = page.FindElement(By.TagName("form")); + WebElement element = page.FindElement(By.TagName("form")); // Act & Assert - element.WaitUntil(WaitUntilConditions.ElementIsVisibleInElement(By.TagName("input")), + element.WaitUntil(WaitUntilConditions.ElementIsVisibleInElement(By.TagName("input")), ImplicitWait); } @@ -76,7 +76,7 @@ public void ShouldWaitUntilElementIsVisibleInElementWrapper() DriverOptions = new ChromeOptions() }; - RemoteWebDriver app = this.StartApp(options); + WebDriver app = this.StartApp(options); W3SchoolsPage page = new W3SchoolsPage(app) .AcceptCookies() @@ -85,7 +85,7 @@ public void ShouldWaitUntilElementIsVisibleInElementWrapper() Form form = page.FindElement(By.TagName("form")); // Act & Assert - form.WaitUntil(WaitUntilConditions.ElementIsVisibleInElementWrapper(By.TagName("input")), + form.WaitUntil(WaitUntilConditions.ElementIsVisibleInElementWrapper(By.TagName("input")), ImplicitWait); } @@ -102,7 +102,7 @@ public void ShouldWaitUntilElementIsVisibleInPageObject() DriverOptions = new ChromeOptions() }; - RemoteWebDriver app = this.StartApp(options); + WebDriver app = this.StartApp(options); W3SchoolsPage page = new W3SchoolsPage(app) .AcceptCookies() diff --git a/tests/Legerity.Core.Tests/Tests/WebAppManagerOptionsTests.cs b/tests/Legerity.Core.Tests/Tests/WebAppManagerOptionsTests.cs index 825cec95..d72bbbc7 100644 --- a/tests/Legerity.Core.Tests/Tests/WebAppManagerOptionsTests.cs +++ b/tests/Legerity.Core.Tests/Tests/WebAppManagerOptionsTests.cs @@ -3,6 +3,7 @@ namespace Legerity.Core.Tests.Tests; using System; using System.Drawing; using System.IO; +using OpenQA.Selenium; using OpenQA.Selenium.Chrome; using OpenQA.Selenium.Remote; using Shouldly; @@ -26,7 +27,7 @@ public void ShouldLaunchBrowserAtDesiredSize() }; // Act - RemoteWebDriver app = this.StartApp(options); + WebDriver app = this.StartApp(options); // Assert app.Manage().Window.Size.ShouldBe(options.DesiredSize); diff --git a/tests/Legerity.Telerik.Uwp.Tests/GlobalUsings.cs b/tests/Legerity.Telerik.Uwp.Tests/GlobalUsings.cs index 4ee19433..0eadd8a0 100644 --- a/tests/Legerity.Telerik.Uwp.Tests/GlobalUsings.cs +++ b/tests/Legerity.Telerik.Uwp.Tests/GlobalUsings.cs @@ -3,4 +3,6 @@ global using Legerity; global using Legerity.Pages; global using Legerity.Windows; -global using NUnit.Framework; \ No newline at end of file +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 b1c802e3..473cdb12 100644 --- a/tests/Legerity.Telerik.Uwp.Tests/Pages/BaseNavigationPage.cs +++ b/tests/Legerity.Telerik.Uwp.Tests/Pages/BaseNavigationPage.cs @@ -9,7 +9,7 @@ internal class BaseNavigationPage : BasePage { private readonly By searchBoxLocator = By.Name("Search"); - public BaseNavigationPage(RemoteWebDriver app) + public BaseNavigationPage(WebDriver app) : base(app) { } @@ -23,7 +23,7 @@ public TPage NavigateTo(string controlName, string sampleName) { this.SearchBox.SetText(controlName); - RemoteWebElement item = this.FindElement(By.XPath($".//*[@ClassName='ListViewItem'][@Name='{sampleName}']")); + WebElement item = this.FindElement(By.XPath($".//*[@ClassName='ListViewItem'][@Name='{sampleName}']")); item.Click(); return Activator.CreateInstance(typeof(TPage), this.App) as TPage; diff --git a/tests/Legerity.Telerik.Uwp.Tests/Pages/HomePage.cs b/tests/Legerity.Telerik.Uwp.Tests/Pages/HomePage.cs index d92248f1..696e4501 100644 --- a/tests/Legerity.Telerik.Uwp.Tests/Pages/HomePage.cs +++ b/tests/Legerity.Telerik.Uwp.Tests/Pages/HomePage.cs @@ -1,10 +1,11 @@ namespace Legerity.Telerik.Uwp.Tests.Pages; +using OpenQA.Selenium; using OpenQA.Selenium.Remote; internal class HomePage : BaseNavigationPage { - public HomePage(RemoteWebDriver app) : base(app) + public HomePage(WebDriver app) : base(app) { } } \ No newline at end of file diff --git a/tests/Legerity.WCT.Tests/GlobalUsings.cs b/tests/Legerity.WCT.Tests/GlobalUsings.cs index 4ee19433..0eadd8a0 100644 --- a/tests/Legerity.WCT.Tests/GlobalUsings.cs +++ b/tests/Legerity.WCT.Tests/GlobalUsings.cs @@ -3,4 +3,6 @@ global using Legerity; global using Legerity.Pages; global using Legerity.Windows; -global using NUnit.Framework; \ No newline at end of file +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 bd0da57b..13cf6bb0 100644 --- a/tests/Legerity.WCT.Tests/Pages/BaseNavigationPage.cs +++ b/tests/Legerity.WCT.Tests/Pages/BaseNavigationPage.cs @@ -13,7 +13,7 @@ internal class BaseNavigationPage : BasePage { private readonly By navigationViewLocator = WindowsByExtras.AutomationId("NavView"); - public BaseNavigationPage(RemoteWebDriver app) + public BaseNavigationPage(WebDriver app) : base(app) { } @@ -33,7 +33,7 @@ public TPage NavigateTo(string sampleName) this.WaitUntil(p => p.SamplePicker.Items.Any(), this.WaitTimeout); - AppiumWebElement item = this.SamplePicker.Items.FirstOrDefault(i => + WebElement item = this.SamplePicker.Items.FirstOrDefault(i => i.FindElement(By.XPath($".//*[@ClassName='TextBlock'][@Name='{sampleName}']")) != null); item.Click(); diff --git a/tests/Legerity.WCT.Tests/Pages/HomePage.cs b/tests/Legerity.WCT.Tests/Pages/HomePage.cs index 0f9d51db..17c764b4 100644 --- a/tests/Legerity.WCT.Tests/Pages/HomePage.cs +++ b/tests/Legerity.WCT.Tests/Pages/HomePage.cs @@ -1,10 +1,11 @@ namespace Legerity.WCT.Tests.Pages; +using OpenQA.Selenium; using OpenQA.Selenium.Remote; internal class HomePage : BaseNavigationPage { - public HomePage(RemoteWebDriver app) : base(app) + public HomePage(WebDriver app) : base(app) { } } \ No newline at end of file diff --git a/tests/Legerity.Web.Tests/GlobalUsings.cs b/tests/Legerity.Web.Tests/GlobalUsings.cs index 2ac570eb..0d499602 100644 --- a/tests/Legerity.Web.Tests/GlobalUsings.cs +++ b/tests/Legerity.Web.Tests/GlobalUsings.cs @@ -3,4 +3,6 @@ global using Legerity; global using Legerity.Pages; global using Legerity.Web; -global using NUnit.Framework; \ No newline at end of file +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 5d1785f6..9d1517c0 100644 --- a/tests/Legerity.Web.Tests/Legerity.Web.Tests.csproj +++ b/tests/Legerity.Web.Tests/Legerity.Web.Tests.csproj @@ -10,7 +10,7 @@ - + diff --git a/tests/Legerity.Web.Tests/Pages/ButtonPage.cs b/tests/Legerity.Web.Tests/Pages/ButtonPage.cs index 2755c5ac..64febad5 100644 --- a/tests/Legerity.Web.Tests/Pages/ButtonPage.cs +++ b/tests/Legerity.Web.Tests/Pages/ButtonPage.cs @@ -8,7 +8,7 @@ internal class ButtonPage : W3SchoolsBasePage { private readonly By buttonLocator = By.TagName("button"); - public ButtonPage(RemoteWebDriver app) + public ButtonPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Web.Tests/Pages/CheckBoxPage.cs b/tests/Legerity.Web.Tests/Pages/CheckBoxPage.cs index ece350ad..d1d05c90 100644 --- a/tests/Legerity.Web.Tests/Pages/CheckBoxPage.cs +++ b/tests/Legerity.Web.Tests/Pages/CheckBoxPage.cs @@ -8,7 +8,7 @@ internal class CheckBoxPage : W3SchoolsBasePage { private readonly By bikeCheckBoxLocator = By.Id("vehicle1"); - public CheckBoxPage(RemoteWebDriver app) : base(app) + public CheckBoxPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Web.Tests/Pages/DateInputPage.cs b/tests/Legerity.Web.Tests/Pages/DateInputPage.cs index 4d579f8c..8abc2003 100644 --- a/tests/Legerity.Web.Tests/Pages/DateInputPage.cs +++ b/tests/Legerity.Web.Tests/Pages/DateInputPage.cs @@ -7,7 +7,7 @@ namespace Legerity.Web.Tests.Pages; internal class DateInputPage : W3SchoolsBasePage { - public DateInputPage(RemoteWebDriver app) : base(app) + public DateInputPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Web.Tests/Pages/FileInputPage.cs b/tests/Legerity.Web.Tests/Pages/FileInputPage.cs index 32c4e4ef..6e7a0502 100644 --- a/tests/Legerity.Web.Tests/Pages/FileInputPage.cs +++ b/tests/Legerity.Web.Tests/Pages/FileInputPage.cs @@ -8,7 +8,7 @@ internal class FileInputPage : W3SchoolsBasePage { private readonly By fileInputLocator = By.Id("myfile"); - public FileInputPage(RemoteWebDriver app) : base(app) + public FileInputPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Web.Tests/Pages/ImagePage.cs b/tests/Legerity.Web.Tests/Pages/ImagePage.cs index d46b8c16..250a0292 100644 --- a/tests/Legerity.Web.Tests/Pages/ImagePage.cs +++ b/tests/Legerity.Web.Tests/Pages/ImagePage.cs @@ -8,7 +8,7 @@ internal class ImagePage : W3SchoolsBasePage { private readonly By imageLocator = By.TagName("img"); - public ImagePage(RemoteWebDriver app) : base(app) + public ImagePage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Web.Tests/Pages/ListPage.cs b/tests/Legerity.Web.Tests/Pages/ListPage.cs index d946beb8..c5b82244 100644 --- a/tests/Legerity.Web.Tests/Pages/ListPage.cs +++ b/tests/Legerity.Web.Tests/Pages/ListPage.cs @@ -9,7 +9,7 @@ internal class ListPage : W3SchoolsBasePage { private readonly By orderedListLocator = By.TagName("ol"); - public ListPage(RemoteWebDriver app) : base(app) + public ListPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Web.Tests/Pages/NumberInputPage.cs b/tests/Legerity.Web.Tests/Pages/NumberInputPage.cs index 9fd8e6c3..7df3417d 100644 --- a/tests/Legerity.Web.Tests/Pages/NumberInputPage.cs +++ b/tests/Legerity.Web.Tests/Pages/NumberInputPage.cs @@ -8,7 +8,7 @@ internal class NumberInputPage : W3SchoolsBasePage { private readonly By quantityNumberInputLocator = By.Id("quantity"); - public NumberInputPage(RemoteWebDriver app) : base(app) + public NumberInputPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Web.Tests/Pages/OptionPage.cs b/tests/Legerity.Web.Tests/Pages/OptionPage.cs index aee1a40a..16c17c9f 100644 --- a/tests/Legerity.Web.Tests/Pages/OptionPage.cs +++ b/tests/Legerity.Web.Tests/Pages/OptionPage.cs @@ -10,7 +10,7 @@ internal class OptionPage : W3SchoolsBasePage { private readonly By carOptionLocator = By.TagName("option"); - public OptionPage(RemoteWebDriver app) : base(app) + public OptionPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Web.Tests/Pages/RadioButtonPage.cs b/tests/Legerity.Web.Tests/Pages/RadioButtonPage.cs index 6198ae90..9c89d837 100644 --- a/tests/Legerity.Web.Tests/Pages/RadioButtonPage.cs +++ b/tests/Legerity.Web.Tests/Pages/RadioButtonPage.cs @@ -12,7 +12,7 @@ internal class RadioButtonPage : W3SchoolsBasePage private readonly By cssRadioButtonLocator = By.Id("css"); - public RadioButtonPage(RemoteWebDriver app) : base(app) + public RadioButtonPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Web.Tests/Pages/RangeInputPage.cs b/tests/Legerity.Web.Tests/Pages/RangeInputPage.cs index 77d3c220..9195dac7 100644 --- a/tests/Legerity.Web.Tests/Pages/RangeInputPage.cs +++ b/tests/Legerity.Web.Tests/Pages/RangeInputPage.cs @@ -8,7 +8,7 @@ internal class RangeInputPage : W3SchoolsBasePage { private readonly By volumeRangeInputLocator = By.Id("vol"); - public RangeInputPage(RemoteWebDriver app) : base(app) + public RangeInputPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Web.Tests/Pages/SelectPage.cs b/tests/Legerity.Web.Tests/Pages/SelectPage.cs index 291ea6ae..05d86078 100644 --- a/tests/Legerity.Web.Tests/Pages/SelectPage.cs +++ b/tests/Legerity.Web.Tests/Pages/SelectPage.cs @@ -8,7 +8,7 @@ internal class SelectPage : W3SchoolsBasePage { private readonly By carsSelectLocator = By.Id("cars"); - public SelectPage(RemoteWebDriver app) : base(app) + public SelectPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Web.Tests/Pages/TablePage.cs b/tests/Legerity.Web.Tests/Pages/TablePage.cs index 695740b2..d8165f39 100644 --- a/tests/Legerity.Web.Tests/Pages/TablePage.cs +++ b/tests/Legerity.Web.Tests/Pages/TablePage.cs @@ -8,7 +8,7 @@ internal class TablePage : W3SchoolsBasePage { private readonly By tableLocator = By.TagName("table"); - public TablePage(RemoteWebDriver app) : base(app) + public TablePage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Web.Tests/Pages/TextAreaPage.cs b/tests/Legerity.Web.Tests/Pages/TextAreaPage.cs index eaefcb13..46181068 100644 --- a/tests/Legerity.Web.Tests/Pages/TextAreaPage.cs +++ b/tests/Legerity.Web.Tests/Pages/TextAreaPage.cs @@ -8,7 +8,7 @@ internal class TextAreaPage : W3SchoolsBasePage { private readonly By reviewTextAreaLocator = By.Id("w3review"); - public TextAreaPage(RemoteWebDriver app) : base(app) + public TextAreaPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Web.Tests/Pages/TextInputPage.cs b/tests/Legerity.Web.Tests/Pages/TextInputPage.cs index e9c94ed0..3c7acd4f 100644 --- a/tests/Legerity.Web.Tests/Pages/TextInputPage.cs +++ b/tests/Legerity.Web.Tests/Pages/TextInputPage.cs @@ -8,7 +8,7 @@ internal class TextInputPage : W3SchoolsBasePage { private readonly By firstNameInputLocator = By.Id("fname"); - public TextInputPage(RemoteWebDriver app) : base(app) + public TextInputPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Web.Tests/Pages/W3SchoolsBasePage.cs b/tests/Legerity.Web.Tests/Pages/W3SchoolsBasePage.cs index 00622a55..1b560a34 100644 --- a/tests/Legerity.Web.Tests/Pages/W3SchoolsBasePage.cs +++ b/tests/Legerity.Web.Tests/Pages/W3SchoolsBasePage.cs @@ -11,7 +11,7 @@ internal abstract class W3SchoolsBasePage : BasePage private readonly By contentFrameLocator = By.Id("iframeResult"); private readonly By acceptCookiesButtonLocator = By.Id("accept-choices"); - protected W3SchoolsBasePage(RemoteWebDriver app) + protected W3SchoolsBasePage(WebDriver app) : base(app, BaseTestClass.ImplicitWait) { } @@ -20,7 +20,7 @@ protected W3SchoolsBasePage(RemoteWebDriver app) public Button AcceptCookiesButton => this.FindElement(this.acceptCookiesButtonLocator); - public RemoteWebElement ContentFrame => this.FindElement(this.contentFrameLocator); + public WebElement ContentFrame => this.FindElement(this.contentFrameLocator); public T AcceptCookies() where T : W3SchoolsBasePage { diff --git a/tests/Legerity.Web.Tests/Tests/ButtonTests.cs b/tests/Legerity.Web.Tests/Tests/ButtonTests.cs index 5d36ae00..e2aeed5d 100644 --- a/tests/Legerity.Web.Tests/Tests/ButtonTests.cs +++ b/tests/Legerity.Web.Tests/Tests/ButtonTests.cs @@ -3,6 +3,7 @@ namespace Legerity.Web.Tests.Tests; using System; using System.Collections.Generic; using System.IO; +using OpenQA.Selenium; using OpenQA.Selenium.Remote; using Pages; @@ -34,7 +35,7 @@ public ButtonTests(AppManagerOptions options) public void ShouldClickButton() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); ButtonPage buttonPage = new ButtonPage(app) .AcceptCookies() diff --git a/tests/Legerity.Web.Tests/Tests/CheckBoxTests.cs b/tests/Legerity.Web.Tests/Tests/CheckBoxTests.cs index 98783fec..8879e9bb 100644 --- a/tests/Legerity.Web.Tests/Tests/CheckBoxTests.cs +++ b/tests/Legerity.Web.Tests/Tests/CheckBoxTests.cs @@ -36,7 +36,7 @@ public CheckBoxTests(AppManagerOptions options) public void ShouldCheckUncheckedCheckbox() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); CheckBoxPage checkBoxPage = new CheckBoxPage(app) .AcceptCookies() @@ -54,7 +54,7 @@ public void ShouldCheckUncheckedCheckbox() public void ShouldKeepCheckedIfCheckedAgain() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); CheckBoxPage checkBoxPage = new CheckBoxPage(app) .AcceptCookies() @@ -72,7 +72,7 @@ public void ShouldKeepCheckedIfCheckedAgain() public void ShouldUncheckCheckedCheckbox() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); CheckBoxPage checkBoxPage = new CheckBoxPage(app) .AcceptCookies() @@ -90,7 +90,7 @@ public void ShouldUncheckCheckedCheckbox() public void ShouldKeepUncheckedIfUncheckedAgain() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); CheckBoxPage checkBoxPage = new CheckBoxPage(app) .AcceptCookies() diff --git a/tests/Legerity.Web.Tests/Tests/DateInputTests.cs b/tests/Legerity.Web.Tests/Tests/DateInputTests.cs index a0e0457e..1019f16c 100644 --- a/tests/Legerity.Web.Tests/Tests/DateInputTests.cs +++ b/tests/Legerity.Web.Tests/Tests/DateInputTests.cs @@ -37,7 +37,7 @@ public void ShouldSetDate() // Arrange DateTime expected = DateTime.Now.Date; - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); DateInputPage dateInputPage = new DateInputPage(app) .AcceptCookies() diff --git a/tests/Legerity.Web.Tests/Tests/FileInputTests.cs b/tests/Legerity.Web.Tests/Tests/FileInputTests.cs index 850685cb..deb99275 100644 --- a/tests/Legerity.Web.Tests/Tests/FileInputTests.cs +++ b/tests/Legerity.Web.Tests/Tests/FileInputTests.cs @@ -38,7 +38,7 @@ public void ShouldSetFilePath() const string fileName = "chromedriver.exe"; string filePath = Path.Combine(Environment.CurrentDirectory, fileName); - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); FileInputPage fileInputPage = new FileInputPage(app) .AcceptCookies() @@ -58,7 +58,7 @@ public void ShouldClearFilePath() const string fileName = "chromedriver.exe"; string filePath = Path.Combine(Environment.CurrentDirectory, fileName); - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); FileInputPage fileInputPage = new FileInputPage(app) .AcceptCookies() diff --git a/tests/Legerity.Web.Tests/Tests/ImageTests.cs b/tests/Legerity.Web.Tests/Tests/ImageTests.cs index d2db7766..8c9395a9 100644 --- a/tests/Legerity.Web.Tests/Tests/ImageTests.cs +++ b/tests/Legerity.Web.Tests/Tests/ImageTests.cs @@ -37,7 +37,7 @@ public void ShouldGetImageSource() // Arrange const string expectedImageSource = "img_girl.jpg"; - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); ImagePage imagePage = new ImagePage(app) .AcceptCookies() @@ -56,7 +56,7 @@ public void ShouldGetImageAltText() // Arrange const string expectedAltText = "Girl in a jacket"; - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); ImagePage imagePage = new ImagePage(app) .AcceptCookies() @@ -76,7 +76,7 @@ public void ShouldGetImageSize() const double expectedHeight = 600; const double expectedWidth = 500; - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); ImagePage imagePage = new ImagePage(app) .AcceptCookies() diff --git a/tests/Legerity.Web.Tests/Tests/ListTests.cs b/tests/Legerity.Web.Tests/Tests/ListTests.cs index 576d3c58..8d3c90c2 100644 --- a/tests/Legerity.Web.Tests/Tests/ListTests.cs +++ b/tests/Legerity.Web.Tests/Tests/ListTests.cs @@ -36,7 +36,7 @@ public ListTests(AppManagerOptions options) public void ShouldContainItems() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); ListPage listPage = new ListPage(app) .AcceptCookies() diff --git a/tests/Legerity.Web.Tests/Tests/MultipleSelectTests.cs b/tests/Legerity.Web.Tests/Tests/MultipleSelectTests.cs index f20795c3..19d92c11 100644 --- a/tests/Legerity.Web.Tests/Tests/MultipleSelectTests.cs +++ b/tests/Legerity.Web.Tests/Tests/MultipleSelectTests.cs @@ -36,7 +36,7 @@ public MultipleSelectTests(AppManagerOptions options) public void ShouldGetIsMultipleTrue() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); SelectPage selectPage = new SelectPage(app) .AcceptCookies() @@ -53,7 +53,7 @@ public void ShouldGetIsMultipleTrue() public void ShouldSelectMultipleOptions() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); SelectPage selectPage = new SelectPage(app) .AcceptCookies() diff --git a/tests/Legerity.Web.Tests/Tests/NumberInputTests.cs b/tests/Legerity.Web.Tests/Tests/NumberInputTests.cs index 72cf0934..f9a5d5d4 100644 --- a/tests/Legerity.Web.Tests/Tests/NumberInputTests.cs +++ b/tests/Legerity.Web.Tests/Tests/NumberInputTests.cs @@ -35,7 +35,7 @@ public NumberInputTests(AppManagerOptions options) public void ShouldGetValueRange() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); NumberInputPage numberInputPage = new NumberInputPage(app) .AcceptCookies() @@ -54,7 +54,7 @@ public void ShouldGetValueRange() public void ShouldSetValue() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); NumberInputPage numberInputPage = new NumberInputPage(app) .AcceptCookies() @@ -71,7 +71,7 @@ public void ShouldSetValue() public void ShouldThrowOutOfRangeExceptionIfValueIsLessThanMinimum() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); NumberInputPage numberInputPage = new NumberInputPage(app) .AcceptCookies() @@ -85,7 +85,7 @@ public void ShouldThrowOutOfRangeExceptionIfValueIsLessThanMinimum() public void ShouldThrowOutOfRangeExceptionIfValueIsGreaterThanMaximum() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); NumberInputPage numberInputPage = new NumberInputPage(app) .AcceptCookies() @@ -99,7 +99,7 @@ public void ShouldThrowOutOfRangeExceptionIfValueIsGreaterThanMaximum() public void ShouldIncrementValue() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); NumberInputPage numberInputPage = new NumberInputPage(app) .AcceptCookies() @@ -118,7 +118,7 @@ public void ShouldIncrementValue() public void ShouldDecrementValue() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); NumberInputPage numberInputPage = new NumberInputPage(app) .AcceptCookies() diff --git a/tests/Legerity.Web.Tests/Tests/OptionTests.cs b/tests/Legerity.Web.Tests/Tests/OptionTests.cs index 798cd884..5c6da212 100644 --- a/tests/Legerity.Web.Tests/Tests/OptionTests.cs +++ b/tests/Legerity.Web.Tests/Tests/OptionTests.cs @@ -38,7 +38,7 @@ public void ShouldSelectOptionByValue() // Arrange string expected = "audi"; - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); OptionPage optionPage = new OptionPage(app) .AcceptCookies() @@ -57,7 +57,7 @@ public void ShouldSelectOptionByDisplayValue() // Arrange string expected = "Audi"; - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); OptionPage optionPage = new OptionPage(app) .AcceptCookies() diff --git a/tests/Legerity.Web.Tests/Tests/RadioButtonTests.cs b/tests/Legerity.Web.Tests/Tests/RadioButtonTests.cs index bc31fa61..7def7549 100644 --- a/tests/Legerity.Web.Tests/Tests/RadioButtonTests.cs +++ b/tests/Legerity.Web.Tests/Tests/RadioButtonTests.cs @@ -36,7 +36,7 @@ public RadioButtonTests(AppManagerOptions options) public void ShouldSelectRadioButton() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); RadioButtonPage radioButtonPage = new RadioButtonPage(app) .AcceptCookies() @@ -55,7 +55,7 @@ public void ShouldGetGroupName() // Arrange const string expectedGroupName = "fav_language"; - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); RadioButtonPage radioButtonPage = new RadioButtonPage(app) .AcceptCookies() diff --git a/tests/Legerity.Web.Tests/Tests/RangeInputTests.cs b/tests/Legerity.Web.Tests/Tests/RangeInputTests.cs index 0bb75068..ef1d7f8e 100644 --- a/tests/Legerity.Web.Tests/Tests/RangeInputTests.cs +++ b/tests/Legerity.Web.Tests/Tests/RangeInputTests.cs @@ -35,7 +35,7 @@ public RangeInputTests(AppManagerOptions options) public void ShouldGetValueRange() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); RangeInputPage rangeInputPage = new RangeInputPage(app) .AcceptCookies() @@ -54,7 +54,7 @@ public void ShouldGetValueRange() public void ShouldSetValue() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); RangeInputPage rangeInputPage = new RangeInputPage(app) .AcceptCookies() @@ -71,7 +71,7 @@ public void ShouldSetValue() public void ShouldThrowOutOfRangeExceptionIfValueIsLessThanMinimum() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); RangeInputPage rangeInputPage = new RangeInputPage(app) .AcceptCookies() @@ -85,7 +85,7 @@ public void ShouldThrowOutOfRangeExceptionIfValueIsLessThanMinimum() public void ShouldThrowOutOfRangeExceptionIfValueIsGreaterThanMaximum() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); RangeInputPage rangeInputPage = new RangeInputPage(app) .AcceptCookies() @@ -99,7 +99,7 @@ public void ShouldThrowOutOfRangeExceptionIfValueIsGreaterThanMaximum() public void ShouldIncrementValue() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); RangeInputPage rangeInputPage = new RangeInputPage(app) .AcceptCookies() @@ -118,7 +118,7 @@ public void ShouldIncrementValue() public void ShouldDecrementValue() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); RangeInputPage rangeInputPage = new RangeInputPage(app) .AcceptCookies() diff --git a/tests/Legerity.Web.Tests/Tests/SelectTests.cs b/tests/Legerity.Web.Tests/Tests/SelectTests.cs index 6d1293e7..fe57da62 100644 --- a/tests/Legerity.Web.Tests/Tests/SelectTests.cs +++ b/tests/Legerity.Web.Tests/Tests/SelectTests.cs @@ -36,7 +36,7 @@ public SelectTests(AppManagerOptions options) public void ShouldGetOptions() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); SelectPage selectPage = new SelectPage(app) .AcceptCookies() @@ -57,7 +57,7 @@ public void ShouldGetOptions() public void ShouldGetIsMultipleFalse() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); SelectPage selectPage = new SelectPage(app) .AcceptCookies() @@ -76,7 +76,7 @@ public void ShouldSelectOptionByValue() // Arrange string expected = "audi"; - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); SelectPage selectPage = new SelectPage(app) .AcceptCookies() @@ -95,7 +95,7 @@ public void ShouldSelectOptionByDisplayValue() // Arrange string expected = "Audi"; - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); SelectPage selectPage = new SelectPage(app) .AcceptCookies() @@ -114,7 +114,7 @@ public void ShouldSelectOptionByPartialValue() // Arrange string expected = "audi"; - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); SelectPage selectPage = new SelectPage(app) .AcceptCookies() @@ -133,7 +133,7 @@ public void ShouldSelectOptionByPartialDisplayValue() // Arrange string expected = "Audi"; - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); SelectPage selectPage = new SelectPage(app) .AcceptCookies() diff --git a/tests/Legerity.Web.Tests/Tests/TableTests.cs b/tests/Legerity.Web.Tests/Tests/TableTests.cs index ad5882cf..6468910e 100644 --- a/tests/Legerity.Web.Tests/Tests/TableTests.cs +++ b/tests/Legerity.Web.Tests/Tests/TableTests.cs @@ -37,7 +37,7 @@ public TableTests(AppManagerOptions options) public void ShouldGetTableHeaders() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); TablePage tablePage = new TablePage(app) .AcceptCookies() @@ -57,7 +57,7 @@ public void ShouldGetTableHeaders() public void ShouldGetTableRows() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); TablePage tablePage = new TablePage(app) .AcceptCookies() @@ -74,7 +74,7 @@ public void ShouldGetTableRows() public void ShouldGetDataTableRows() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); TablePage tablePage = new TablePage(app) .AcceptCookies() @@ -91,7 +91,7 @@ public void ShouldGetDataTableRows() public void ShouldGetRowDataByIndex() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); TablePage tablePage = new TablePage(app) .AcceptCookies() @@ -111,7 +111,7 @@ public void ShouldGetRowDataByIndex() public void ShouldGetColumnDataByIndex() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); TablePage tablePage = new TablePage(app) .AcceptCookies() @@ -134,7 +134,7 @@ public void ShouldGetColumnDataByIndex() public void ShouldGetColumnDataByHeader() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); TablePage tablePage = new TablePage(app) .AcceptCookies() diff --git a/tests/Legerity.Web.Tests/Tests/TextAreaTests.cs b/tests/Legerity.Web.Tests/Tests/TextAreaTests.cs index 30521e2f..c7c1452f 100644 --- a/tests/Legerity.Web.Tests/Tests/TextAreaTests.cs +++ b/tests/Legerity.Web.Tests/Tests/TextAreaTests.cs @@ -35,7 +35,7 @@ public TextAreaTests(AppManagerOptions options) public void ShouldGetSize() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); TextAreaPage textAreaPage = new TextAreaPage(app) .AcceptCookies() @@ -56,7 +56,7 @@ public void ShouldSetText() // Arrange const string expected = "The cat was playing in the garden."; - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); TextAreaPage textAreaPage = new TextAreaPage(app) .AcceptCookies() @@ -75,7 +75,7 @@ public void ShouldAppendText() // Arrange const string expected = "The cat was playing in the garden."; - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); TextAreaPage textAreaPage = new TextAreaPage(app) .AcceptCookies() @@ -94,7 +94,7 @@ public void ShouldAppendText() public void ShouldClearText() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); TextAreaPage textAreaPage = new TextAreaPage(app) .AcceptCookies() diff --git a/tests/Legerity.Web.Tests/Tests/TextInputTests.cs b/tests/Legerity.Web.Tests/Tests/TextInputTests.cs index f460dd92..9b2f9f94 100644 --- a/tests/Legerity.Web.Tests/Tests/TextInputTests.cs +++ b/tests/Legerity.Web.Tests/Tests/TextInputTests.cs @@ -37,7 +37,7 @@ public void ShouldSetText() // Arrange const string expected = "James"; - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); TextInputPage textInputPage = new TextInputPage(app) .AcceptCookies() @@ -56,7 +56,7 @@ public void ShouldAppendText() // Arrange const string expected = "James"; - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); TextInputPage textInputPage = new TextInputPage(app) .AcceptCookies() @@ -75,7 +75,7 @@ public void ShouldAppendText() public void ShouldClearText() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); TextInputPage textInputPage = new TextInputPage(app) .AcceptCookies() diff --git a/tests/Legerity.Web.Tests/Tests/W3SchoolsBaseTestClass.cs b/tests/Legerity.Web.Tests/Tests/W3SchoolsBaseTestClass.cs index b990aef0..0d5bb577 100644 --- a/tests/Legerity.Web.Tests/Tests/W3SchoolsBaseTestClass.cs +++ b/tests/Legerity.Web.Tests/Tests/W3SchoolsBaseTestClass.cs @@ -1,6 +1,7 @@ namespace Legerity.Web.Tests.Tests; using Legerity.Helpers; +using OpenQA.Selenium; using OpenQA.Selenium.Remote; internal abstract class W3SchoolsBaseTestClass : BaseTestClass @@ -14,7 +15,7 @@ protected W3SchoolsBaseTestClass(AppManagerOptions options) { } - protected RemoteWebDriver StartApp(AppManagerOptions options = default) + protected WebDriver StartApp(AppManagerOptions options = default) { return this.StartApp(options ?? this.Options, WaitUntilConditions.TitleContains("W3Schools"), ImplicitWait); } diff --git a/tests/Legerity.Web.Tests/Tests/WebByExtraTests.cs b/tests/Legerity.Web.Tests/Tests/WebByExtraTests.cs index b36f837d..bf73ca71 100644 --- a/tests/Legerity.Web.Tests/Tests/WebByExtraTests.cs +++ b/tests/Legerity.Web.Tests/Tests/WebByExtraTests.cs @@ -17,7 +17,7 @@ public void ShouldFindRadioButtonsByInputType() // Arrange const int expectedCount = 6; - RemoteWebDriver app = this.StartApp(new WebAppManagerOptions( + WebDriver app = this.StartApp(new WebAppManagerOptions( WebAppDriverType.Chrome, Path.Combine(Environment.CurrentDirectory)) { @@ -32,7 +32,7 @@ public void ShouldFindRadioButtonsByInputType() .SwitchToContentFrame(); // Act - ReadOnlyCollection + ReadOnlyCollection radioButtons = radioButtonPage.FindElements(WebByExtras.InputType("radio")); // Assert diff --git a/tests/Legerity.Web.Tests/Tests/WebElementWrapperTests.cs b/tests/Legerity.Web.Tests/Tests/WebElementWrapperTests.cs index 17476b11..6a25629e 100644 --- a/tests/Legerity.Web.Tests/Tests/WebElementWrapperTests.cs +++ b/tests/Legerity.Web.Tests/Tests/WebElementWrapperTests.cs @@ -37,7 +37,7 @@ public WebElementWrapperTests(AppManagerOptions options) public void ShouldGetElementDriverMatchingAppDriver() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); TextInputPage textInputPage = new TextInputPage(app) .AcceptCookies() @@ -54,7 +54,7 @@ public void ShouldGetElementDriverMatchingAppDriver() public void ShouldGetEnabledState() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); TextInputPage textInputPage = new TextInputPage(app) .AcceptCookies() @@ -71,7 +71,7 @@ public void ShouldGetEnabledState() public void ShouldGetVisibleState() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); TextInputPage textInputPage = new TextInputPage(app) .AcceptCookies() @@ -88,7 +88,7 @@ public void ShouldGetVisibleState() public void ShouldWaitUntilConditionMet() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); TextInputPage textInputPage = new TextInputPage(app) .AcceptCookies() @@ -102,7 +102,7 @@ public void ShouldWaitUntilConditionMet() public void ShouldThrowExceptionIfWaitUntilConditionNotMet() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); TextInputPage textInputPage = new TextInputPage(app) .AcceptCookies() @@ -116,7 +116,7 @@ public void ShouldThrowExceptionIfWaitUntilConditionNotMet() public void ShouldTryWaitUntilConditionMet() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); TextInputPage textInputPage = new TextInputPage(app) .AcceptCookies() @@ -133,7 +133,7 @@ public void ShouldTryWaitUntilConditionMet() public void ShouldTryWaitUntilConditionNotMet() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); TextInputPage textInputPage = new TextInputPage(app) .AcceptCookies() diff --git a/tests/Legerity.WinUI.Tests/GlobalUsings.cs b/tests/Legerity.WinUI.Tests/GlobalUsings.cs index 4ee19433..0eadd8a0 100644 --- a/tests/Legerity.WinUI.Tests/GlobalUsings.cs +++ b/tests/Legerity.WinUI.Tests/GlobalUsings.cs @@ -3,4 +3,6 @@ global using Legerity; global using Legerity.Pages; global using Legerity.Windows; -global using NUnit.Framework; \ No newline at end of file +global using NUnit.Framework; +global using OpenQA.Selenium; +global using OpenQA.Selenium.Remote; \ No newline at end of file diff --git a/tests/Legerity.WinUI.Tests/Pages/BaseNavigationPage.cs b/tests/Legerity.WinUI.Tests/Pages/BaseNavigationPage.cs index de79012a..ece641bc 100644 --- a/tests/Legerity.WinUI.Tests/Pages/BaseNavigationPage.cs +++ b/tests/Legerity.WinUI.Tests/Pages/BaseNavigationPage.cs @@ -10,7 +10,7 @@ internal class BaseNavigationPage : BasePage { private readonly By navigationViewLocator = WindowsByExtras.AutomationId("NavigationViewControl"); - public BaseNavigationPage(RemoteWebDriver app) + public BaseNavigationPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.WinUI.Tests/Pages/HomePage.cs b/tests/Legerity.WinUI.Tests/Pages/HomePage.cs index 68beca48..b01cec7c 100644 --- a/tests/Legerity.WinUI.Tests/Pages/HomePage.cs +++ b/tests/Legerity.WinUI.Tests/Pages/HomePage.cs @@ -1,10 +1,11 @@ namespace Legerity.WinUI.Tests.Pages; +using OpenQA.Selenium; using OpenQA.Selenium.Remote; internal class HomePage : BaseNavigationPage { - public HomePage(RemoteWebDriver app) : base(app) + public HomePage(WebDriver app) : base(app) { } } \ No newline at end of file diff --git a/tests/Legerity.WinUI.Tests/Pages/InfoBarPage.cs b/tests/Legerity.WinUI.Tests/Pages/InfoBarPage.cs index 6554f2fa..c997ddd3 100644 --- a/tests/Legerity.WinUI.Tests/Pages/InfoBarPage.cs +++ b/tests/Legerity.WinUI.Tests/Pages/InfoBarPage.cs @@ -2,11 +2,12 @@ namespace Legerity.WinUI.Tests.Pages; using Legerity.Windows; using Legerity.Windows.Elements.WinUI; +using OpenQA.Selenium; using OpenQA.Selenium.Remote; internal class InfoBarPage : BaseNavigationPage { - public InfoBarPage(RemoteWebDriver app) : base(app) + public InfoBarPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.WinUI.Tests/Pages/MenuBarPage.cs b/tests/Legerity.WinUI.Tests/Pages/MenuBarPage.cs index d7687130..fa5f160f 100644 --- a/tests/Legerity.WinUI.Tests/Pages/MenuBarPage.cs +++ b/tests/Legerity.WinUI.Tests/Pages/MenuBarPage.cs @@ -2,11 +2,12 @@ namespace Legerity.WinUI.Tests.Pages; using Legerity.Windows; using Legerity.Windows.Elements.WinUI; +using OpenQA.Selenium; using OpenQA.Selenium.Remote; internal class MenuBarPage : BaseNavigationPage { - public MenuBarPage(RemoteWebDriver app) : base(app) + public MenuBarPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.WinUI.Tests/Pages/NavigationViewPage.cs b/tests/Legerity.WinUI.Tests/Pages/NavigationViewPage.cs index b76aa03a..197b0294 100644 --- a/tests/Legerity.WinUI.Tests/Pages/NavigationViewPage.cs +++ b/tests/Legerity.WinUI.Tests/Pages/NavigationViewPage.cs @@ -1,11 +1,12 @@ namespace Legerity.WinUI.Tests.Pages; using Windows.Elements.WinUI; +using OpenQA.Selenium; using OpenQA.Selenium.Remote; internal class NavigationViewPage : BaseNavigationPage { - public NavigationViewPage(RemoteWebDriver app) : base(app) + public NavigationViewPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.WinUI.Tests/Pages/NumberBoxPage.cs b/tests/Legerity.WinUI.Tests/Pages/NumberBoxPage.cs index f68ef412..7b777053 100644 --- a/tests/Legerity.WinUI.Tests/Pages/NumberBoxPage.cs +++ b/tests/Legerity.WinUI.Tests/Pages/NumberBoxPage.cs @@ -2,11 +2,12 @@ namespace Legerity.WinUI.Tests.Pages; using Legerity.Windows; using Legerity.Windows.Elements.WinUI; +using OpenQA.Selenium; using OpenQA.Selenium.Remote; internal class NumberBoxPage : BaseNavigationPage { - public NumberBoxPage(RemoteWebDriver app) : base(app) + public NumberBoxPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.WinUI.Tests/Pages/RatingControlPage.cs b/tests/Legerity.WinUI.Tests/Pages/RatingControlPage.cs index f83c458a..ec442d84 100644 --- a/tests/Legerity.WinUI.Tests/Pages/RatingControlPage.cs +++ b/tests/Legerity.WinUI.Tests/Pages/RatingControlPage.cs @@ -2,11 +2,12 @@ namespace Legerity.WinUI.Tests.Pages; using Legerity.Windows; using Legerity.Windows.Elements.WinUI; +using OpenQA.Selenium; using OpenQA.Selenium.Remote; internal class RatingControlPage : BaseNavigationPage { - public RatingControlPage(RemoteWebDriver app) : base(app) + public RatingControlPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.WinUI.Tests/Pages/TabViewPage.cs b/tests/Legerity.WinUI.Tests/Pages/TabViewPage.cs index 3b49bcc3..3692cc6b 100644 --- a/tests/Legerity.WinUI.Tests/Pages/TabViewPage.cs +++ b/tests/Legerity.WinUI.Tests/Pages/TabViewPage.cs @@ -3,11 +3,12 @@ namespace Legerity.WinUI.Tests.Pages; using Windows.Elements.Core; using Legerity.Windows; using Legerity.Windows.Elements.WinUI; +using OpenQA.Selenium; using OpenQA.Selenium.Remote; internal class TabViewPage : BaseNavigationPage { - public TabViewPage(RemoteWebDriver app) : base(app) + public TabViewPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.WinUI.Tests/Tests/InfoBarTests.cs b/tests/Legerity.WinUI.Tests/Tests/InfoBarTests.cs index e79bcc8f..f28c4b6c 100644 --- a/tests/Legerity.WinUI.Tests/Tests/InfoBarTests.cs +++ b/tests/Legerity.WinUI.Tests/Tests/InfoBarTests.cs @@ -54,7 +54,7 @@ public void ShouldClose() private InfoBarPage StartAndNavigateToPage() { - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); return new HomePage(app).NavigateTo("InfoBar"); } } \ No newline at end of file diff --git a/tests/Legerity.WinUI.Tests/Tests/MenuBarTests.cs b/tests/Legerity.WinUI.Tests/Tests/MenuBarTests.cs index ff568c1f..a6aa1157 100644 --- a/tests/Legerity.WinUI.Tests/Tests/MenuBarTests.cs +++ b/tests/Legerity.WinUI.Tests/Tests/MenuBarTests.cs @@ -15,7 +15,7 @@ public MenuBarTests(AppManagerOptions options) public void ShouldClickOption() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); MenuBarPage menuBarPage = new HomePage(app).NavigateTo("MenuBar"); // Act & Assert @@ -26,7 +26,7 @@ public void ShouldClickOption() public void ShouldClickOptionByPartialName() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); MenuBarPage menuBarPage = new HomePage(app).NavigateTo("MenuBar"); // Act & Assert @@ -37,7 +37,7 @@ public void ShouldClickOptionByPartialName() public void ShouldClickChildOption() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); MenuBarPage menuBarPage = new HomePage(app).NavigateTo("MenuBar"); // Act & Assert @@ -48,7 +48,7 @@ public void ShouldClickChildOption() public void ShouldClickChildOptionByPartialName() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); MenuBarPage menuBarPage = new HomePage(app).NavigateTo("MenuBar"); // Act & Assert diff --git a/tests/Legerity.WinUI.Tests/Tests/NavigationViewTests.cs b/tests/Legerity.WinUI.Tests/Tests/NavigationViewTests.cs index a91e572d..2d373c46 100644 --- a/tests/Legerity.WinUI.Tests/Tests/NavigationViewTests.cs +++ b/tests/Legerity.WinUI.Tests/Tests/NavigationViewTests.cs @@ -106,7 +106,7 @@ public void ShouldKeepPaneClosedIfClosePane() private NavigationViewPage StartAndNavigateToPage() { - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); return new HomePage(app).NavigateTo("NavigationView"); } } \ No newline at end of file diff --git a/tests/Legerity.WinUI.Tests/Tests/NumberBoxTests.cs b/tests/Legerity.WinUI.Tests/Tests/NumberBoxTests.cs index 8807c4ac..86065320 100644 --- a/tests/Legerity.WinUI.Tests/Tests/NumberBoxTests.cs +++ b/tests/Legerity.WinUI.Tests/Tests/NumberBoxTests.cs @@ -73,7 +73,7 @@ public void ShouldDecrementValue() private NumberBoxPage StartAndNavigateToPage() { - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); return new HomePage(app).NavigateTo("NumberBox"); } } \ No newline at end of file diff --git a/tests/Legerity.WinUI.Tests/Tests/RatingControlTests.cs b/tests/Legerity.WinUI.Tests/Tests/RatingControlTests.cs index 4444bde7..4233cf86 100644 --- a/tests/Legerity.WinUI.Tests/Tests/RatingControlTests.cs +++ b/tests/Legerity.WinUI.Tests/Tests/RatingControlTests.cs @@ -48,7 +48,7 @@ public void ShouldGetIsReadonly() private RatingControlPage StartAndNavigateToPage() { - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); return new HomePage(app).NavigateTo("RatingControl"); } } \ No newline at end of file diff --git a/tests/Legerity.WinUI.Tests/Tests/TabViewTests.cs b/tests/Legerity.WinUI.Tests/Tests/TabViewTests.cs index 178fba7e..3c90f803 100644 --- a/tests/Legerity.WinUI.Tests/Tests/TabViewTests.cs +++ b/tests/Legerity.WinUI.Tests/Tests/TabViewTests.cs @@ -17,7 +17,7 @@ public TabViewTests(AppManagerOptions options) public void ShouldSelectTabViewItem() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); TabViewPage tabViewPage = new HomePage(app).NavigateTo("TabView"); // Act @@ -31,7 +31,7 @@ public void ShouldSelectTabViewItem() public void ShouldSelectTabViewItemByPartialName() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); TabViewPage tabViewPage = new HomePage(app).NavigateTo("TabView"); // Act diff --git a/tests/Legerity.Windows.Tests/GlobalUsings.cs b/tests/Legerity.Windows.Tests/GlobalUsings.cs index 4ee19433..0eadd8a0 100644 --- a/tests/Legerity.Windows.Tests/GlobalUsings.cs +++ b/tests/Legerity.Windows.Tests/GlobalUsings.cs @@ -3,4 +3,6 @@ global using Legerity; global using Legerity.Pages; global using Legerity.Windows; -global using NUnit.Framework; \ No newline at end of file +global using NUnit.Framework; +global using OpenQA.Selenium; +global using OpenQA.Selenium.Remote; \ No newline at end of file diff --git a/tests/Legerity.Windows.Tests/Pages/AppBarButtonPage.cs b/tests/Legerity.Windows.Tests/Pages/AppBarButtonPage.cs index 222c3aaa..cf87b4cf 100644 --- a/tests/Legerity.Windows.Tests/Pages/AppBarButtonPage.cs +++ b/tests/Legerity.Windows.Tests/Pages/AppBarButtonPage.cs @@ -6,7 +6,7 @@ namespace Legerity.Windows.Tests.Pages; internal class AppBarButtonPage : BaseNavigationPage { - public AppBarButtonPage(RemoteWebDriver app) : base(app) + public AppBarButtonPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Windows.Tests/Pages/AppBarToggleButtonPage.cs b/tests/Legerity.Windows.Tests/Pages/AppBarToggleButtonPage.cs index b3d97e4b..e875cda2 100644 --- a/tests/Legerity.Windows.Tests/Pages/AppBarToggleButtonPage.cs +++ b/tests/Legerity.Windows.Tests/Pages/AppBarToggleButtonPage.cs @@ -6,7 +6,7 @@ namespace Legerity.Windows.Tests.Pages; internal class AppBarToggleButtonPage : BaseNavigationPage { - public AppBarToggleButtonPage(RemoteWebDriver app) : base(app) + public AppBarToggleButtonPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Windows.Tests/Pages/AutoSuggestBoxPage.cs b/tests/Legerity.Windows.Tests/Pages/AutoSuggestBoxPage.cs index b4a6bb34..cb3ca5b9 100644 --- a/tests/Legerity.Windows.Tests/Pages/AutoSuggestBoxPage.cs +++ b/tests/Legerity.Windows.Tests/Pages/AutoSuggestBoxPage.cs @@ -8,7 +8,7 @@ internal class AutoSuggestBoxPage : BaseNavigationPage { private readonly By basicAutoSuggestBoxLocator = By.Name("Basic AutoSuggestBox"); - public AutoSuggestBoxPage(RemoteWebDriver app) : base(app) + public AutoSuggestBoxPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Windows.Tests/Pages/BaseNavigationPage.cs b/tests/Legerity.Windows.Tests/Pages/BaseNavigationPage.cs index 86236561..17700032 100644 --- a/tests/Legerity.Windows.Tests/Pages/BaseNavigationPage.cs +++ b/tests/Legerity.Windows.Tests/Pages/BaseNavigationPage.cs @@ -10,7 +10,7 @@ internal class BaseNavigationPage : BasePage { private readonly By navigationViewLocator = WindowsByExtras.AutomationId("NavigationViewControl"); - public BaseNavigationPage(RemoteWebDriver app) + public BaseNavigationPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Windows.Tests/Pages/ButtonPage.cs b/tests/Legerity.Windows.Tests/Pages/ButtonPage.cs index aaa9d21c..4d281cf3 100644 --- a/tests/Legerity.Windows.Tests/Pages/ButtonPage.cs +++ b/tests/Legerity.Windows.Tests/Pages/ButtonPage.cs @@ -1,11 +1,12 @@ namespace Legerity.Windows.Tests.Pages; using Elements.Core; +using OpenQA.Selenium; using OpenQA.Selenium.Remote; internal class ButtonPage : BaseNavigationPage { - public ButtonPage(RemoteWebDriver app) : base(app) + public ButtonPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Windows.Tests/Pages/CalendarDatePickerPage.cs b/tests/Legerity.Windows.Tests/Pages/CalendarDatePickerPage.cs index 90666a5f..5f5563b3 100644 --- a/tests/Legerity.Windows.Tests/Pages/CalendarDatePickerPage.cs +++ b/tests/Legerity.Windows.Tests/Pages/CalendarDatePickerPage.cs @@ -7,7 +7,7 @@ namespace Legerity.Windows.Tests.Pages; internal class CalendarDatePickerPage : BaseNavigationPage { - public CalendarDatePickerPage(RemoteWebDriver app) : base(app) + public CalendarDatePickerPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Windows.Tests/Pages/CalendarViewPage.cs b/tests/Legerity.Windows.Tests/Pages/CalendarViewPage.cs index c1e638d8..b0e9a837 100644 --- a/tests/Legerity.Windows.Tests/Pages/CalendarViewPage.cs +++ b/tests/Legerity.Windows.Tests/Pages/CalendarViewPage.cs @@ -7,7 +7,7 @@ namespace Legerity.Windows.Tests.Pages; internal class CalendarViewPage : BaseNavigationPage { - public CalendarViewPage(RemoteWebDriver app) : base(app) + public CalendarViewPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Windows.Tests/Pages/CheckBoxPage.cs b/tests/Legerity.Windows.Tests/Pages/CheckBoxPage.cs index 0e0b48d3..840c18a2 100644 --- a/tests/Legerity.Windows.Tests/Pages/CheckBoxPage.cs +++ b/tests/Legerity.Windows.Tests/Pages/CheckBoxPage.cs @@ -6,7 +6,7 @@ namespace Legerity.Windows.Tests.Pages; internal class CheckBoxPage : BaseNavigationPage { - public CheckBoxPage(RemoteWebDriver app) : base(app) + public CheckBoxPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Windows.Tests/Pages/ComboBoxPage.cs b/tests/Legerity.Windows.Tests/Pages/ComboBoxPage.cs index b2d15112..ee6bea99 100644 --- a/tests/Legerity.Windows.Tests/Pages/ComboBoxPage.cs +++ b/tests/Legerity.Windows.Tests/Pages/ComboBoxPage.cs @@ -8,7 +8,7 @@ internal class ComboBoxPage : BaseNavigationPage { private readonly By colorComboBox = By.Name("Colors"); - public ComboBoxPage(RemoteWebDriver app) : base(app) + public ComboBoxPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Windows.Tests/Pages/CommandBarPage.cs b/tests/Legerity.Windows.Tests/Pages/CommandBarPage.cs index 076410d1..899b48ac 100644 --- a/tests/Legerity.Windows.Tests/Pages/CommandBarPage.cs +++ b/tests/Legerity.Windows.Tests/Pages/CommandBarPage.cs @@ -2,11 +2,12 @@ namespace Legerity.Windows.Tests.Pages; using Legerity.Windows; using Legerity.Windows.Elements.Core; +using OpenQA.Selenium; using OpenQA.Selenium.Remote; internal class CommandBarPage : BaseNavigationPage { - public CommandBarPage(RemoteWebDriver app) : base(app) + public CommandBarPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Windows.Tests/Pages/DatePickerPage.cs b/tests/Legerity.Windows.Tests/Pages/DatePickerPage.cs index 8a0bf7ed..8a7819f5 100644 --- a/tests/Legerity.Windows.Tests/Pages/DatePickerPage.cs +++ b/tests/Legerity.Windows.Tests/Pages/DatePickerPage.cs @@ -9,7 +9,7 @@ internal class DatePickerPage : BaseNavigationPage { private readonly By simpleDatePicker = By.XPath(".//*[@ClassName='DatePicker'][@Name='Pick a date']"); - public DatePickerPage(RemoteWebDriver app) : base(app) + public DatePickerPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Windows.Tests/Pages/FlipViewPage.cs b/tests/Legerity.Windows.Tests/Pages/FlipViewPage.cs index 143694de..9a8d4376 100644 --- a/tests/Legerity.Windows.Tests/Pages/FlipViewPage.cs +++ b/tests/Legerity.Windows.Tests/Pages/FlipViewPage.cs @@ -9,7 +9,7 @@ internal class FlipViewPage : BaseNavigationPage { private readonly By flipViewLocator = By.ClassName(nameof(FlipView)); - public FlipViewPage(RemoteWebDriver app) : base(app) + public FlipViewPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Windows.Tests/Pages/GridViewPage.cs b/tests/Legerity.Windows.Tests/Pages/GridViewPage.cs index 9baf6087..44796679 100644 --- a/tests/Legerity.Windows.Tests/Pages/GridViewPage.cs +++ b/tests/Legerity.Windows.Tests/Pages/GridViewPage.cs @@ -1,11 +1,12 @@ namespace Legerity.Windows.Tests.Pages; using Elements.Core; +using OpenQA.Selenium; using OpenQA.Selenium.Remote; internal class GridViewPage : BaseNavigationPage { - public GridViewPage(RemoteWebDriver app) : base(app) + public GridViewPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Windows.Tests/Pages/HomePage.cs b/tests/Legerity.Windows.Tests/Pages/HomePage.cs index 864042e1..34db493a 100644 --- a/tests/Legerity.Windows.Tests/Pages/HomePage.cs +++ b/tests/Legerity.Windows.Tests/Pages/HomePage.cs @@ -1,10 +1,11 @@ namespace Legerity.Windows.Tests.Pages; +using OpenQA.Selenium; using OpenQA.Selenium.Remote; internal class HomePage : BaseNavigationPage { - public HomePage(RemoteWebDriver app) : base(app) + public HomePage(WebDriver app) : base(app) { } } \ No newline at end of file diff --git a/tests/Legerity.Windows.Tests/Pages/HyperlinkButtonPage.cs b/tests/Legerity.Windows.Tests/Pages/HyperlinkButtonPage.cs index 9982f7a2..1300c1fd 100644 --- a/tests/Legerity.Windows.Tests/Pages/HyperlinkButtonPage.cs +++ b/tests/Legerity.Windows.Tests/Pages/HyperlinkButtonPage.cs @@ -1,11 +1,12 @@ namespace Legerity.Windows.Tests.Pages; using Elements.Core; +using OpenQA.Selenium; using OpenQA.Selenium.Remote; internal class HyperlinkButtonPage : BaseNavigationPage { - public HyperlinkButtonPage(RemoteWebDriver app) : base(app) + public HyperlinkButtonPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Windows.Tests/Pages/InkToolbarPage.cs b/tests/Legerity.Windows.Tests/Pages/InkToolbarPage.cs index 55cf87f6..16225c63 100644 --- a/tests/Legerity.Windows.Tests/Pages/InkToolbarPage.cs +++ b/tests/Legerity.Windows.Tests/Pages/InkToolbarPage.cs @@ -2,11 +2,12 @@ namespace Legerity.Windows.Tests.Pages; using Legerity.Windows; using Legerity.Windows.Elements.Core; +using OpenQA.Selenium; using OpenQA.Selenium.Remote; internal class InkToolbarPage : BaseNavigationPage { - public InkToolbarPage(RemoteWebDriver app) : base(app) + public InkToolbarPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Windows.Tests/Pages/ListBoxPage.cs b/tests/Legerity.Windows.Tests/Pages/ListBoxPage.cs index 0c72f85c..c4570202 100644 --- a/tests/Legerity.Windows.Tests/Pages/ListBoxPage.cs +++ b/tests/Legerity.Windows.Tests/Pages/ListBoxPage.cs @@ -2,11 +2,12 @@ namespace Legerity.Windows.Tests.Pages; using Legerity.Windows; using Legerity.Windows.Elements.Core; +using OpenQA.Selenium; using OpenQA.Selenium.Remote; internal class ListBoxPage : BaseNavigationPage { - public ListBoxPage(RemoteWebDriver app) : base(app) + public ListBoxPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Windows.Tests/Pages/PasswordBoxPage.cs b/tests/Legerity.Windows.Tests/Pages/PasswordBoxPage.cs index 662138ee..4b683697 100644 --- a/tests/Legerity.Windows.Tests/Pages/PasswordBoxPage.cs +++ b/tests/Legerity.Windows.Tests/Pages/PasswordBoxPage.cs @@ -6,7 +6,7 @@ namespace Legerity.Windows.Tests.Pages; internal class PasswordBoxPage : BaseNavigationPage { - public PasswordBoxPage(RemoteWebDriver app) : base(app) + public PasswordBoxPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Windows.Tests/Pages/PivotPage.cs b/tests/Legerity.Windows.Tests/Pages/PivotPage.cs index e0a405dd..27b04f39 100644 --- a/tests/Legerity.Windows.Tests/Pages/PivotPage.cs +++ b/tests/Legerity.Windows.Tests/Pages/PivotPage.cs @@ -6,7 +6,7 @@ namespace Legerity.Windows.Tests.Pages; internal class PivotPage : BaseNavigationPage { - public PivotPage(RemoteWebDriver app) : base(app) + public PivotPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Windows.Tests/Pages/ProgressBarPage.cs b/tests/Legerity.Windows.Tests/Pages/ProgressBarPage.cs index 0dc55a68..bc91d506 100644 --- a/tests/Legerity.Windows.Tests/Pages/ProgressBarPage.cs +++ b/tests/Legerity.Windows.Tests/Pages/ProgressBarPage.cs @@ -7,7 +7,7 @@ namespace Legerity.Windows.Tests.Pages; internal class ProgressBarPage : BaseNavigationPage { - public ProgressBarPage(RemoteWebDriver app) : base(app) + public ProgressBarPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Windows.Tests/Pages/ProgressRingPage.cs b/tests/Legerity.Windows.Tests/Pages/ProgressRingPage.cs index abace099..2680bfaa 100644 --- a/tests/Legerity.Windows.Tests/Pages/ProgressRingPage.cs +++ b/tests/Legerity.Windows.Tests/Pages/ProgressRingPage.cs @@ -7,7 +7,7 @@ namespace Legerity.Windows.Tests.Pages; internal class ProgressRingPage : BaseNavigationPage { - public ProgressRingPage(RemoteWebDriver app) : base(app) + public ProgressRingPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Windows.Tests/Pages/RadioButtonPage.cs b/tests/Legerity.Windows.Tests/Pages/RadioButtonPage.cs index 39477638..4c58f70f 100644 --- a/tests/Legerity.Windows.Tests/Pages/RadioButtonPage.cs +++ b/tests/Legerity.Windows.Tests/Pages/RadioButtonPage.cs @@ -6,7 +6,7 @@ namespace Legerity.Windows.Tests.Pages; internal class RadioButtonPage : BaseNavigationPage { - public RadioButtonPage(RemoteWebDriver app) : base(app) + public RadioButtonPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Windows.Tests/Pages/SliderPage.cs b/tests/Legerity.Windows.Tests/Pages/SliderPage.cs index 29bd0758..67d8875b 100644 --- a/tests/Legerity.Windows.Tests/Pages/SliderPage.cs +++ b/tests/Legerity.Windows.Tests/Pages/SliderPage.cs @@ -6,7 +6,7 @@ namespace Legerity.Windows.Tests.Pages; internal class SliderPage : BaseNavigationPage { - public SliderPage(RemoteWebDriver app) : base(app) + public SliderPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Windows.Tests/Pages/TextBlockPage.cs b/tests/Legerity.Windows.Tests/Pages/TextBlockPage.cs index adc4ca7f..134d2809 100644 --- a/tests/Legerity.Windows.Tests/Pages/TextBlockPage.cs +++ b/tests/Legerity.Windows.Tests/Pages/TextBlockPage.cs @@ -6,7 +6,7 @@ namespace Legerity.Windows.Tests.Pages; internal class TextBlockPage : BaseNavigationPage { - public TextBlockPage(RemoteWebDriver app) : base(app) + public TextBlockPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Windows.Tests/Pages/TextBoxPage.cs b/tests/Legerity.Windows.Tests/Pages/TextBoxPage.cs index 9f66273f..ea023f0b 100644 --- a/tests/Legerity.Windows.Tests/Pages/TextBoxPage.cs +++ b/tests/Legerity.Windows.Tests/Pages/TextBoxPage.cs @@ -6,7 +6,7 @@ namespace Legerity.Windows.Tests.Pages; internal class TextBoxPage : BaseNavigationPage { - public TextBoxPage(RemoteWebDriver app) : base(app) + public TextBoxPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Windows.Tests/Pages/TimePickerPage.cs b/tests/Legerity.Windows.Tests/Pages/TimePickerPage.cs index 4bd64d3c..29328eb1 100644 --- a/tests/Legerity.Windows.Tests/Pages/TimePickerPage.cs +++ b/tests/Legerity.Windows.Tests/Pages/TimePickerPage.cs @@ -7,7 +7,7 @@ namespace Legerity.Windows.Tests.Pages; internal class TimePickerPage : BaseNavigationPage { - public TimePickerPage(RemoteWebDriver app) : base(app) + public TimePickerPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Windows.Tests/Pages/ToggleSwitchPage.cs b/tests/Legerity.Windows.Tests/Pages/ToggleSwitchPage.cs index a9d3252e..cb38f7f8 100644 --- a/tests/Legerity.Windows.Tests/Pages/ToggleSwitchPage.cs +++ b/tests/Legerity.Windows.Tests/Pages/ToggleSwitchPage.cs @@ -6,7 +6,7 @@ namespace Legerity.Windows.Tests.Pages; internal class ToggleSwitchPage : BaseNavigationPage { - public ToggleSwitchPage(RemoteWebDriver app) : base(app) + public ToggleSwitchPage(WebDriver app) : base(app) { } diff --git a/tests/Legerity.Windows.Tests/Tests/AppBarButtonTests.cs b/tests/Legerity.Windows.Tests/Tests/AppBarButtonTests.cs index 2caebadc..dc9cefad 100644 --- a/tests/Legerity.Windows.Tests/Tests/AppBarButtonTests.cs +++ b/tests/Legerity.Windows.Tests/Tests/AppBarButtonTests.cs @@ -15,7 +15,7 @@ public AppBarButtonTests(AppManagerOptions options) public void ShouldClickSymbolButton() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); AppBarButtonPage appBarButtonPage = new HomePage(app).NavigateTo("AppBarButton"); // Act & Assert diff --git a/tests/Legerity.Windows.Tests/Tests/AppBarToggleButtonTests.cs b/tests/Legerity.Windows.Tests/Tests/AppBarToggleButtonTests.cs index 7ad05c87..7e4f40dc 100644 --- a/tests/Legerity.Windows.Tests/Tests/AppBarToggleButtonTests.cs +++ b/tests/Legerity.Windows.Tests/Tests/AppBarToggleButtonTests.cs @@ -16,7 +16,7 @@ public AppBarToggleButtonTests(AppManagerOptions options) public void ShouldToggleOn() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); AppBarToggleButtonPage appBarToggleButtonPage = new HomePage(app).NavigateTo("AppBarToggleButton"); // Act @@ -30,7 +30,7 @@ public void ShouldToggleOn() public void ShouldKeepToggledOnIfToggledOn() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); AppBarToggleButtonPage appBarToggleButtonPage = new HomePage(app).NavigateTo("AppBarToggleButton").ToggleSymbolOn(); // Act @@ -44,7 +44,7 @@ public void ShouldKeepToggledOnIfToggledOn() public void ShouldToggleOff() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); AppBarToggleButtonPage appBarToggleButtonPage = new HomePage(app).NavigateTo("AppBarToggleButton").ToggleSymbolOn(); // Act @@ -58,7 +58,7 @@ public void ShouldToggleOff() public void ShouldKeepToggledOffIfToggledOff() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); AppBarToggleButtonPage appBarToggleButtonPage = new HomePage(app).NavigateTo("AppBarToggleButton").ToggleSymbolOff(); // Act diff --git a/tests/Legerity.Windows.Tests/Tests/AutoSuggestBoxTests.cs b/tests/Legerity.Windows.Tests/Tests/AutoSuggestBoxTests.cs index 74a5bbfb..49617dd5 100644 --- a/tests/Legerity.Windows.Tests/Tests/AutoSuggestBoxTests.cs +++ b/tests/Legerity.Windows.Tests/Tests/AutoSuggestBoxTests.cs @@ -18,7 +18,7 @@ public void ShouldSetText() // Arrange const string expectedText = "British Shorthair"; - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); AutoSuggestBoxPage autoSuggestBoxPage = new HomePage(app).NavigateTo("AutoSuggestBox"); // Act @@ -34,7 +34,7 @@ public void ShouldSelectSuggestion() // Arrange const string expectedText = "British Shorthair"; - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); AutoSuggestBoxPage autoSuggestBoxPage = new HomePage(app).NavigateTo("AutoSuggestBox"); // Act @@ -50,7 +50,7 @@ public void ShouldSelectSuggestionByValue() // Arrange const string expectedText = "British Shorthair"; - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); AutoSuggestBoxPage autoSuggestBoxPage = new HomePage(app).NavigateTo("AutoSuggestBox"); // Act @@ -64,7 +64,7 @@ public void ShouldSelectSuggestionByValue() public void ShouldSelectSuggestionByPartialSuggestion() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); AutoSuggestBoxPage autoSuggestBoxPage = new HomePage(app).NavigateTo("AutoSuggestBox"); // Act diff --git a/tests/Legerity.Windows.Tests/Tests/ButtonTests.cs b/tests/Legerity.Windows.Tests/Tests/ButtonTests.cs index ba55eeed..f5dc17a6 100644 --- a/tests/Legerity.Windows.Tests/Tests/ButtonTests.cs +++ b/tests/Legerity.Windows.Tests/Tests/ButtonTests.cs @@ -15,7 +15,7 @@ public ButtonTests(AppManagerOptions options) public void ShouldClickSymbolButton() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); ButtonPage buttonPage = new HomePage(app).NavigateTo("Button"); // Act & Assert diff --git a/tests/Legerity.Windows.Tests/Tests/CalendarDatePickerTests.cs b/tests/Legerity.Windows.Tests/Tests/CalendarDatePickerTests.cs index a8dea723..2db8adb3 100644 --- a/tests/Legerity.Windows.Tests/Tests/CalendarDatePickerTests.cs +++ b/tests/Legerity.Windows.Tests/Tests/CalendarDatePickerTests.cs @@ -18,7 +18,7 @@ public CalendarDatePickerTests(AppManagerOptions options) public void ShouldReturnNullSelectedDateIfNoDateSelected() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); CalendarDatePickerPage calendarDatePickerPage = new HomePage(app).NavigateTo("CalendarDatePicker"); // Act @@ -33,7 +33,7 @@ public void ShouldSelectDate() { // Arrange DateTime expectedDate = DateTime.Now.AddDays(1).Date; - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); CalendarDatePickerPage calendarDatePickerPage = new HomePage(app).NavigateTo("CalendarDatePicker"); @@ -49,7 +49,7 @@ public void ShouldSelectDateWithFormat() { // Arrange DateTime expectedDate = DateTime.Now.AddDays(1); - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); CalendarDatePickerPage calendarDatePickerPage = new HomePage(app).NavigateTo("CalendarDatePicker"); diff --git a/tests/Legerity.Windows.Tests/Tests/CalendarViewTests.cs b/tests/Legerity.Windows.Tests/Tests/CalendarViewTests.cs index 5a9ed086..093a27c5 100644 --- a/tests/Legerity.Windows.Tests/Tests/CalendarViewTests.cs +++ b/tests/Legerity.Windows.Tests/Tests/CalendarViewTests.cs @@ -21,7 +21,7 @@ public void ShouldSelectDate(string dateString) { // Arrange var expectedDate = DateTime.Parse(dateString, CultureInfo.InvariantCulture); - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); CalendarViewPage calendarViewPage = new HomePage(app).NavigateTo("CalendarView"); // Act @@ -36,7 +36,7 @@ public void ShouldSelectDateWithFormat() { // Arrange DateTime expectedDate = DateTime.Now.AddDays(1); - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); CalendarViewPage calendarViewPage = new HomePage(app).NavigateTo("CalendarView"); // Act diff --git a/tests/Legerity.Windows.Tests/Tests/CheckBoxTests.cs b/tests/Legerity.Windows.Tests/Tests/CheckBoxTests.cs index 62388e6d..0ec7d9ec 100644 --- a/tests/Legerity.Windows.Tests/Tests/CheckBoxTests.cs +++ b/tests/Legerity.Windows.Tests/Tests/CheckBoxTests.cs @@ -16,7 +16,7 @@ public CheckBoxTests(AppManagerOptions options) public void ShouldCheckOn() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); CheckBoxPage checkBoxPage = new HomePage(app).NavigateTo("CheckBox"); // Act @@ -30,7 +30,7 @@ public void ShouldCheckOn() public void ShouldKeepCheckedIfCheckOn() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); CheckBoxPage checkBoxPage = new HomePage(app).NavigateTo("CheckBox").CheckOnTwoStateCheckBox(); // Act @@ -44,7 +44,7 @@ public void ShouldKeepCheckedIfCheckOn() public void ShouldCheckOff() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); CheckBoxPage checkBoxPage = new HomePage(app).NavigateTo("CheckBox").CheckOnTwoStateCheckBox(); // Act @@ -58,7 +58,7 @@ public void ShouldCheckOff() public void ShouldKeepCheckedOffIfCheckOff() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); CheckBoxPage checkBoxPage = new HomePage(app).NavigateTo("CheckBox").CheckOffTwoStateCheckBox(); // Act @@ -72,7 +72,7 @@ public void ShouldKeepCheckedOffIfCheckOff() public void ShouldSetIndeterminateStateIfSupported() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); CheckBoxPage checkBoxPage = new HomePage(app).NavigateTo("CheckBox"); // Act diff --git a/tests/Legerity.Windows.Tests/Tests/ComboBoxTests.cs b/tests/Legerity.Windows.Tests/Tests/ComboBoxTests.cs index 3794b5cf..25f5ff5e 100644 --- a/tests/Legerity.Windows.Tests/Tests/ComboBoxTests.cs +++ b/tests/Legerity.Windows.Tests/Tests/ComboBoxTests.cs @@ -16,7 +16,7 @@ public ComboBoxTests(AppManagerOptions options) public void ShouldSelectItemByName() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); ComboBoxPage comboBoxPage = new HomePage(app).NavigateTo("ComboBox"); // Act @@ -30,7 +30,7 @@ public void ShouldSelectItemByName() public void ShouldSelectItemByPartialName() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); ComboBoxPage comboBoxPage = new HomePage(app).NavigateTo("ComboBox"); // Act diff --git a/tests/Legerity.Windows.Tests/Tests/CommandBarTests.cs b/tests/Legerity.Windows.Tests/Tests/CommandBarTests.cs index f847298b..8a601585 100644 --- a/tests/Legerity.Windows.Tests/Tests/CommandBarTests.cs +++ b/tests/Legerity.Windows.Tests/Tests/CommandBarTests.cs @@ -15,7 +15,7 @@ public CommandBarTests(AppManagerOptions options) public void ShouldClickPrimaryButtonByName() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); CommandBarPage commandBarPage = new HomePage(app).NavigateTo("CommandBar"); // Act & Assert @@ -26,7 +26,7 @@ public void ShouldClickPrimaryButtonByName() public void ShouldClickPrimaryButtonByPartialName() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); CommandBarPage commandBarPage = new HomePage(app).NavigateTo("CommandBar"); // Act & Assert @@ -37,7 +37,7 @@ public void ShouldClickPrimaryButtonByPartialName() public void ShouldClickSecondaryButtonByName() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); CommandBarPage commandBarPage = new HomePage(app).NavigateTo("CommandBar"); // Act & Assert @@ -48,7 +48,7 @@ public void ShouldClickSecondaryButtonByName() public void ShouldClickSecondaryButtonByPartialName() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); CommandBarPage commandBarPage = new HomePage(app).NavigateTo("CommandBar"); // Act & Assert diff --git a/tests/Legerity.Windows.Tests/Tests/DatePickerTests.cs b/tests/Legerity.Windows.Tests/Tests/DatePickerTests.cs index 5138a858..51ca543a 100644 --- a/tests/Legerity.Windows.Tests/Tests/DatePickerTests.cs +++ b/tests/Legerity.Windows.Tests/Tests/DatePickerTests.cs @@ -19,7 +19,7 @@ public DatePickerTests(AppManagerOptions options) public void ShouldSelectDate(DateTime expectedDate) { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); DatePickerPage datePickerPage = new HomePage(app).NavigateTo("DatePicker"); // Act @@ -34,7 +34,7 @@ public void ShouldSelectDateWithFormat() { // Arrange DateTime expectedDate = DateTime.Now.AddDays(1); - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); DatePickerPage datePickerPage = new HomePage(app).NavigateTo("DatePicker"); // Act diff --git a/tests/Legerity.Windows.Tests/Tests/FlipViewTests.cs b/tests/Legerity.Windows.Tests/Tests/FlipViewTests.cs index 04c505a8..47c945a4 100644 --- a/tests/Legerity.Windows.Tests/Tests/FlipViewTests.cs +++ b/tests/Legerity.Windows.Tests/Tests/FlipViewTests.cs @@ -17,7 +17,7 @@ public FlipViewTests(AppManagerOptions options) public void ShouldSelectNextItem() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); FlipViewPage flipViewPage = new HomePage(app).NavigateTo("FlipView").SelectXamlFlipViewItemByIndex(1); int selectedItem = flipViewPage.XamlFlipView.SelectedIndex; int expected = selectedItem + 1; @@ -33,7 +33,7 @@ public void ShouldSelectNextItem() public void ShouldSelectPreviousItem() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); FlipViewPage flipViewPage = new HomePage(app).NavigateTo("FlipView").SelectXamlFlipViewItemByIndex(1); int selectedItem = flipViewPage.XamlFlipView.SelectedIndex; int expected = selectedItem - 1; @@ -49,7 +49,7 @@ public void ShouldSelectPreviousItem() public void ShouldSelectItemByName() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); FlipViewPage flipViewPage = new HomePage(app).NavigateTo("FlipView"); const string expected = "Grapes"; @@ -64,7 +64,7 @@ public void ShouldSelectItemByName() public void ShouldSelectItemByIndex() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); FlipViewPage flipViewPage = new HomePage(app).NavigateTo("FlipView"); const int expected = 2; diff --git a/tests/Legerity.Windows.Tests/Tests/GridViewTests.cs b/tests/Legerity.Windows.Tests/Tests/GridViewTests.cs index c0e4f11b..01cc5d13 100644 --- a/tests/Legerity.Windows.Tests/Tests/GridViewTests.cs +++ b/tests/Legerity.Windows.Tests/Tests/GridViewTests.cs @@ -18,11 +18,11 @@ public GridViewTests(AppManagerOptions options) public void ShouldGetItems() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); GridViewPage gridViewPage = new HomePage(app).NavigateTo("GridView"); // Act - ReadOnlyCollection items = gridViewPage.BasicGridView.Items; + ReadOnlyCollection items = gridViewPage.BasicGridView.Items; // Assert items.Count.ShouldBe(8); @@ -32,7 +32,7 @@ public void ShouldGetItems() public void ShouldClickItemByName() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); GridViewPage gridViewPage = new HomePage(app).NavigateTo("GridView"); const string expected = "Item 2"; @@ -47,7 +47,7 @@ public void ShouldClickItemByName() public void ShouldClickItemByPartialName() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); GridViewPage gridViewPage = new HomePage(app).NavigateTo("GridView"); const string expected = "Item 2"; @@ -62,7 +62,7 @@ public void ShouldClickItemByPartialName() public void ShouldClickItemByIndex() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); GridViewPage gridViewPage = new HomePage(app).NavigateTo("GridView"); const int expected = 2; diff --git a/tests/Legerity.Windows.Tests/Tests/HyperlinkButtonTests.cs b/tests/Legerity.Windows.Tests/Tests/HyperlinkButtonTests.cs index 1f8c85f0..a90885ea 100644 --- a/tests/Legerity.Windows.Tests/Tests/HyperlinkButtonTests.cs +++ b/tests/Legerity.Windows.Tests/Tests/HyperlinkButtonTests.cs @@ -15,7 +15,7 @@ public HyperlinkButtonTests(AppManagerOptions options) public void ShouldClickHyperlinkButton() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); HyperlinkButtonPage hyperlinkButtonPage = new HomePage(app).NavigateTo("HyperlinkButton"); // Act & Assert diff --git a/tests/Legerity.Windows.Tests/Tests/InkToolbarTests.cs b/tests/Legerity.Windows.Tests/Tests/InkToolbarTests.cs index 9248a57d..fcf03f71 100644 --- a/tests/Legerity.Windows.Tests/Tests/InkToolbarTests.cs +++ b/tests/Legerity.Windows.Tests/Tests/InkToolbarTests.cs @@ -16,7 +16,7 @@ public InkToolbarTests(AppManagerOptions options) public void ShouldSetBallpointPenColor() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); InkToolbarPage inkToolbarPage = new HomePage(app).NavigateTo("InkToolbar"); // Act @@ -30,7 +30,7 @@ public void ShouldSetBallpointPenColor() public void ShouldSetPencilColor() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); InkToolbarPage inkToolbarPage = new HomePage(app).NavigateTo("InkToolbar"); // Act @@ -44,7 +44,7 @@ public void ShouldSetPencilColor() public void ShouldSetHighlighterColor() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); InkToolbarPage inkToolbarPage = new HomePage(app).NavigateTo("InkToolbar"); // Act @@ -58,7 +58,7 @@ public void ShouldSetHighlighterColor() public void ShouldSetBallpointPenColorByPartialName() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); InkToolbarPage inkToolbarPage = new HomePage(app).NavigateTo("InkToolbar"); // Act @@ -72,7 +72,7 @@ public void ShouldSetBallpointPenColorByPartialName() public void ShouldSetPencilColorByPartialName() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); InkToolbarPage inkToolbarPage = new HomePage(app).NavigateTo("InkToolbar"); // Act @@ -86,7 +86,7 @@ public void ShouldSetPencilColorByPartialName() public void ShouldSetHighlighterColorByPartialName() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); InkToolbarPage inkToolbarPage = new HomePage(app).NavigateTo("InkToolbar"); // Act diff --git a/tests/Legerity.Windows.Tests/Tests/ListBoxTests.cs b/tests/Legerity.Windows.Tests/Tests/ListBoxTests.cs index 4cff8ae8..96ccb612 100644 --- a/tests/Legerity.Windows.Tests/Tests/ListBoxTests.cs +++ b/tests/Legerity.Windows.Tests/Tests/ListBoxTests.cs @@ -17,7 +17,7 @@ public ListBoxTests(AppManagerOptions options) public void ShouldClickItem() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); ListBoxPage listBoxPage = new HomePage(app).NavigateTo("ListBox"); // Act @@ -31,7 +31,7 @@ public void ShouldClickItem() public void ShouldClickItemByPartialName() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); ListBoxPage listBoxPage = new HomePage(app).NavigateTo("ListBox"); // Act diff --git a/tests/Legerity.Windows.Tests/Tests/PasswordBoxTests.cs b/tests/Legerity.Windows.Tests/Tests/PasswordBoxTests.cs index 91ab0873..0281ce61 100644 --- a/tests/Legerity.Windows.Tests/Tests/PasswordBoxTests.cs +++ b/tests/Legerity.Windows.Tests/Tests/PasswordBoxTests.cs @@ -16,7 +16,7 @@ public PasswordBoxTests(AppManagerOptions options) public void ShouldSetPassword() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); PasswordBoxPage passwordBoxPage = new HomePage(app).NavigateTo("PasswordBox"); // Act diff --git a/tests/Legerity.Windows.Tests/Tests/PivotTests.cs b/tests/Legerity.Windows.Tests/Tests/PivotTests.cs index 3ae3f137..94c3295b 100644 --- a/tests/Legerity.Windows.Tests/Tests/PivotTests.cs +++ b/tests/Legerity.Windows.Tests/Tests/PivotTests.cs @@ -17,7 +17,7 @@ public PivotTests(AppManagerOptions options) public void ShouldSelectPivotItem() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); PivotPage pivotPage = new HomePage(app).NavigateTo("Pivot"); // Act @@ -31,7 +31,7 @@ public void ShouldSelectPivotItem() public void ShouldSelectPivotItemByPartialName() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); PivotPage pivotPage = new HomePage(app).NavigateTo("Pivot"); // Act diff --git a/tests/Legerity.Windows.Tests/Tests/ProgressBarTests.cs b/tests/Legerity.Windows.Tests/Tests/ProgressBarTests.cs index 52d400f2..bf2d1a2c 100644 --- a/tests/Legerity.Windows.Tests/Tests/ProgressBarTests.cs +++ b/tests/Legerity.Windows.Tests/Tests/ProgressBarTests.cs @@ -16,7 +16,7 @@ public ProgressBarTests(AppManagerOptions options) public void ShouldGetDeterminateValue() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); ProgressBarPage progressBarPage = new HomePage(app).NavigateTo("ProgressBar"); // Act @@ -31,7 +31,7 @@ public void ShouldGetDeterminateValue() public void ShouldGetIndeterminateValue() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); ProgressBarPage progressBarPage = new HomePage(app).NavigateTo("ProgressBar"); // Act & Assert diff --git a/tests/Legerity.Windows.Tests/Tests/ProgressRingTests.cs b/tests/Legerity.Windows.Tests/Tests/ProgressRingTests.cs index 1890453d..37782364 100644 --- a/tests/Legerity.Windows.Tests/Tests/ProgressRingTests.cs +++ b/tests/Legerity.Windows.Tests/Tests/ProgressRingTests.cs @@ -38,7 +38,7 @@ public void ShouldGetIsIndeterminate() private ProgressRingPage StartAndNavigateToPage() { - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); return new HomePage(app).NavigateTo("ProgressRing"); } } \ No newline at end of file diff --git a/tests/Legerity.Windows.Tests/Tests/RadioButtonTests.cs b/tests/Legerity.Windows.Tests/Tests/RadioButtonTests.cs index 2b93dfc4..2faff432 100644 --- a/tests/Legerity.Windows.Tests/Tests/RadioButtonTests.cs +++ b/tests/Legerity.Windows.Tests/Tests/RadioButtonTests.cs @@ -16,7 +16,7 @@ public RadioButtonTests(AppManagerOptions options) public void ShouldSelectRadioButton() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); RadioButtonPage radioButtonPage = new HomePage(app).NavigateTo("RadioButton"); // Act diff --git a/tests/Legerity.Windows.Tests/Tests/SliderTests.cs b/tests/Legerity.Windows.Tests/Tests/SliderTests.cs index cda37a15..c76e87fe 100644 --- a/tests/Legerity.Windows.Tests/Tests/SliderTests.cs +++ b/tests/Legerity.Windows.Tests/Tests/SliderTests.cs @@ -70,7 +70,7 @@ public void ShouldGetSmallChangeValue() private SliderPage StartAndNavigateToPage() { - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); return new HomePage(app).NavigateTo("Slider"); } } \ No newline at end of file diff --git a/tests/Legerity.Windows.Tests/Tests/TextBlockTests.cs b/tests/Legerity.Windows.Tests/Tests/TextBlockTests.cs index 98f91504..ced65427 100644 --- a/tests/Legerity.Windows.Tests/Tests/TextBlockTests.cs +++ b/tests/Legerity.Windows.Tests/Tests/TextBlockTests.cs @@ -16,7 +16,7 @@ public TextBlockTests(AppManagerOptions options) public void ShouldGetText() { // Arrange - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); TextBlockPage textBlockPage = new HomePage(app).NavigateTo("TextBlock"); // Act & Assert diff --git a/tests/Legerity.Windows.Tests/Tests/TextBoxTests.cs b/tests/Legerity.Windows.Tests/Tests/TextBoxTests.cs index 6b797106..025a999a 100644 --- a/tests/Legerity.Windows.Tests/Tests/TextBoxTests.cs +++ b/tests/Legerity.Windows.Tests/Tests/TextBoxTests.cs @@ -63,7 +63,7 @@ public void ShouldGetIsReadonly() private TextBoxPage StartAndNavigateToPage() { - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); return new HomePage(app).NavigateTo("TextBox"); } } \ No newline at end of file diff --git a/tests/Legerity.Windows.Tests/Tests/TimePickerTests.cs b/tests/Legerity.Windows.Tests/Tests/TimePickerTests.cs index 4bd014ed..08e01655 100644 --- a/tests/Legerity.Windows.Tests/Tests/TimePickerTests.cs +++ b/tests/Legerity.Windows.Tests/Tests/TimePickerTests.cs @@ -24,7 +24,7 @@ public void ShouldSetTime() private TimePickerPage StartAndNavigateToPage() { - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); return new HomePage(app).NavigateTo("TimePicker"); } } \ No newline at end of file diff --git a/tests/Legerity.Windows.Tests/Tests/ToggleSwitchTests.cs b/tests/Legerity.Windows.Tests/Tests/ToggleSwitchTests.cs index 2e784144..790b86a8 100644 --- a/tests/Legerity.Windows.Tests/Tests/ToggleSwitchTests.cs +++ b/tests/Legerity.Windows.Tests/Tests/ToggleSwitchTests.cs @@ -66,7 +66,7 @@ public void ShouldKeepToggledOffIfToggledOff() private ToggleSwitchPage StartAndNavigateToPage() { - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); return new HomePage(app).NavigateTo("ToggleSwitch"); } } \ No newline at end of file diff --git a/tests/Legerity.Windows.Tests/Tests/WindowsElementExtensionsTests.cs b/tests/Legerity.Windows.Tests/Tests/WindowsElementExtensionsTests.cs index f80a7f3c..153c0f20 100644 --- a/tests/Legerity.Windows.Tests/Tests/WindowsElementExtensionsTests.cs +++ b/tests/Legerity.Windows.Tests/Tests/WindowsElementExtensionsTests.cs @@ -2,6 +2,7 @@ namespace Legerity.Windows.Tests.Tests; using Elements.Core; using Extensions; +using OpenQA.Selenium; using OpenQA.Selenium.Appium; using OpenQA.Selenium.Appium.Windows; using Shouldly; @@ -18,10 +19,10 @@ public WindowsElementExtensionsTests(AppManagerOptions options) public void ShouldFindWindowsDriverElementByAutomationId() { // Arrange - WindowsDriver app = this.StartWindowsApp(); + WindowsDriver app = this.StartWindowsApp(); // Act - WindowsElement element = app.FindElementByAutomationId("headerImage"); + WebElement element = app.FindElementByAutomationId("headerImage"); // Assert element.ShouldNotBeNull(); @@ -31,11 +32,11 @@ public void ShouldFindWindowsDriverElementByAutomationId() public void ShouldFindNestedWrapperElementByAutomationId() { // Arrange - WindowsDriver app = this.StartWindowsApp(); - WindowsElement itemGridView = app.FindElement(WindowsByExtras.AutomationId("ItemGridView")); + WindowsDriver app = this.StartWindowsApp(); + WebElement itemGridView = app.FindElement(WindowsByExtras.AutomationId("ItemGridView")); // Act - AppiumWebElement element = itemGridView.FindElementByAutomationId("headerImage"); + WebElement element = itemGridView.FindElementByAutomationId("headerImage"); // Assert element.ShouldNotBeNull(); @@ -45,7 +46,7 @@ public void ShouldFindNestedWrapperElementByAutomationId() public void ShouldTryWaitUntilWrapperElementConditionIsMet() { // Arrange - WindowsDriver app = this.StartWindowsApp(); + WindowsDriver app = this.StartWindowsApp(); GridView itemGridView = app.FindElement(WindowsByExtras.AutomationId("ItemGridView")); // Act From 10f4dbab0e3fb91e3caf06a17b552af4da650153 Mon Sep 17 00:00:00 2001 From: James Croft Date: Mon, 11 Mar 2024 21:17:39 +0000 Subject: [PATCH 11/21] Update Legerity solution with templates --- src/Legerity.sln | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/Legerity.sln b/src/Legerity.sln index a48e6ea9..36afcdfc 100644 --- a/src/Legerity.sln +++ b/src/Legerity.sln @@ -45,6 +45,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Legerity.WCT.Tests", "..\te EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Legerity.Telerik.Uwp.Tests", "..\tests\Legerity.Telerik.Uwp.Tests\Legerity.Telerik.Uwp.Tests.csproj", "{10EB86E8-C74E-44AA-B5E8-C38BBC86B503}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Legerity.Templates.Android.NUnit", "..\tools\Legerity.Templates\templates\Legerity.Templates.Android.NUnit\Legerity.Templates.Android.NUnit.csproj", "{652E1951-1A5A-4BFB-B46A-D8DBF7A74E9E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Legerity.Templates.CrossPlatform.NUnit", "..\tools\Legerity.Templates\templates\Legerity.Templates.CrossPlatform.NUnit\Legerity.Templates.CrossPlatform.NUnit.csproj", "{84A589E7-5B41-46E0-81D9-AB72283F2619}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Legerity.Templates.IOS.NUnit", "..\tools\Legerity.Templates\templates\Legerity.Templates.IOS.NUnit\Legerity.Templates.IOS.NUnit.csproj", "{AEAA37EF-1D8E-4C51-AF2B-27DB52E2C70C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Legerity.Templates.Web.NUnit", "..\tools\Legerity.Templates\templates\Legerity.Templates.Web.NUnit\Legerity.Templates.Web.NUnit.csproj", "{5E638927-108F-47CB-974C-3F8F4CF7579F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Legerity.Templates.Windows.NUnit", "..\tools\Legerity.Templates\templates\Legerity.Templates.Windows.NUnit\Legerity.Templates.Windows.NUnit.csproj", "{BE462D02-8DE7-4DB3-A2AB-6CED0A6ED4BC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -127,6 +137,26 @@ Global {10EB86E8-C74E-44AA-B5E8-C38BBC86B503}.Debug|Any CPU.Build.0 = Debug|Any CPU {10EB86E8-C74E-44AA-B5E8-C38BBC86B503}.Release|Any CPU.ActiveCfg = Release|Any CPU {10EB86E8-C74E-44AA-B5E8-C38BBC86B503}.Release|Any CPU.Build.0 = Release|Any CPU + {652E1951-1A5A-4BFB-B46A-D8DBF7A74E9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {652E1951-1A5A-4BFB-B46A-D8DBF7A74E9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {652E1951-1A5A-4BFB-B46A-D8DBF7A74E9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {652E1951-1A5A-4BFB-B46A-D8DBF7A74E9E}.Release|Any CPU.Build.0 = Release|Any CPU + {84A589E7-5B41-46E0-81D9-AB72283F2619}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {84A589E7-5B41-46E0-81D9-AB72283F2619}.Debug|Any CPU.Build.0 = Debug|Any CPU + {84A589E7-5B41-46E0-81D9-AB72283F2619}.Release|Any CPU.ActiveCfg = Release|Any CPU + {84A589E7-5B41-46E0-81D9-AB72283F2619}.Release|Any CPU.Build.0 = Release|Any CPU + {AEAA37EF-1D8E-4C51-AF2B-27DB52E2C70C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AEAA37EF-1D8E-4C51-AF2B-27DB52E2C70C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AEAA37EF-1D8E-4C51-AF2B-27DB52E2C70C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AEAA37EF-1D8E-4C51-AF2B-27DB52E2C70C}.Release|Any CPU.Build.0 = Release|Any CPU + {5E638927-108F-47CB-974C-3F8F4CF7579F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5E638927-108F-47CB-974C-3F8F4CF7579F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5E638927-108F-47CB-974C-3F8F4CF7579F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5E638927-108F-47CB-974C-3F8F4CF7579F}.Release|Any CPU.Build.0 = Release|Any CPU + {BE462D02-8DE7-4DB3-A2AB-6CED0A6ED4BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BE462D02-8DE7-4DB3-A2AB-6CED0A6ED4BC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BE462D02-8DE7-4DB3-A2AB-6CED0A6ED4BC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BE462D02-8DE7-4DB3-A2AB-6CED0A6ED4BC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -140,6 +170,11 @@ Global {74257F8D-E2F0-4327-B672-59F0530F2FD0} = {3024AB14-F3D4-4B9B-AF9D-64EBC00F5361} {C779A490-C926-4BF9-9165-0F407AA49A9F} = {3024AB14-F3D4-4B9B-AF9D-64EBC00F5361} {10EB86E8-C74E-44AA-B5E8-C38BBC86B503} = {3024AB14-F3D4-4B9B-AF9D-64EBC00F5361} + {652E1951-1A5A-4BFB-B46A-D8DBF7A74E9E} = {9064E354-7A64-4288-93E5-B3628CA12DD3} + {84A589E7-5B41-46E0-81D9-AB72283F2619} = {9064E354-7A64-4288-93E5-B3628CA12DD3} + {AEAA37EF-1D8E-4C51-AF2B-27DB52E2C70C} = {9064E354-7A64-4288-93E5-B3628CA12DD3} + {5E638927-108F-47CB-974C-3F8F4CF7579F} = {9064E354-7A64-4288-93E5-B3628CA12DD3} + {BE462D02-8DE7-4DB3-A2AB-6CED0A6ED4BC} = {9064E354-7A64-4288-93E5-B3628CA12DD3} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {FAB58D66-B3F1-408A-A96F-572170771367} From 705d43bf0ab323228e5023fc0b6cd28d013919f9 Mon Sep 17 00:00:00 2001 From: James Croft Date: Mon, 11 Mar 2024 21:18:11 +0000 Subject: [PATCH 12/21] Update templates --- .../GlobalUsings.cs | 4 ++- .../Legerity.Templates.Android.NUnit.csproj | 18 +++++++++---- .../Pages/SamplePage.cs | 2 +- .../Tests/SampleTests.cs | 3 ++- .../GlobalUsings.cs | 4 ++- ...erity.Templates.CrossPlatform.NUnit.csproj | 26 ++++++++++++++----- .../Pages/SamplePage.cs | 8 +++--- .../Tests/SampleTests.cs | 2 +- .../GlobalUsings.cs | 4 ++- .../Legerity.Templates.IOS.NUnit.csproj | 18 +++++++++---- .../Pages/SamplePage.cs | 2 +- .../Tests/SampleTests.cs | 2 +- .../GlobalUsings.cs | 4 ++- .../Legerity.Templates.Web.NUnit.csproj | 22 +++++++++++----- .../Pages/SamplePage.cs | 2 +- .../Tests/SampleTests.cs | 2 +- .../GlobalUsings.cs | 4 ++- .../Legerity.Templates.Windows.NUnit.csproj | 23 +++++++++++----- .../Pages/SamplePage.cs | 2 +- .../Tests/SampleTests.cs | 2 +- 20 files changed, 105 insertions(+), 49 deletions(-) diff --git a/tools/Legerity.Templates/templates/Legerity.Templates.Android.NUnit/GlobalUsings.cs b/tools/Legerity.Templates/templates/Legerity.Templates.Android.NUnit/GlobalUsings.cs index afa4133d..c7f7e880 100644 --- a/tools/Legerity.Templates/templates/Legerity.Templates.Android.NUnit/GlobalUsings.cs +++ b/tools/Legerity.Templates/templates/Legerity.Templates.Android.NUnit/GlobalUsings.cs @@ -3,4 +3,6 @@ global using Legerity; global using Legerity.Android; global using Legerity.Pages; -global using NUnit.Framework; \ No newline at end of file +global using NUnit.Framework; +global using OpenQA.Selenium; +global using OpenQA.Selenium.Remote; \ No newline at end of file diff --git a/tools/Legerity.Templates/templates/Legerity.Templates.Android.NUnit/Legerity.Templates.Android.NUnit.csproj b/tools/Legerity.Templates/templates/Legerity.Templates.Android.NUnit/Legerity.Templates.Android.NUnit.csproj index efa8cc8a..d691b7aa 100644 --- a/tools/Legerity.Templates/templates/Legerity.Templates.Android.NUnit/Legerity.Templates.Android.NUnit.csproj +++ b/tools/Legerity.Templates/templates/Legerity.Templates.Android.NUnit/Legerity.Templates.Android.NUnit.csproj @@ -7,15 +7,23 @@ - - - - - + + + + + + + + + + + + + \ No newline at end of file diff --git a/tools/Legerity.Templates/templates/Legerity.Templates.Android.NUnit/Pages/SamplePage.cs b/tools/Legerity.Templates/templates/Legerity.Templates.Android.NUnit/Pages/SamplePage.cs index 7bf57ade..5cced7e8 100644 --- a/tools/Legerity.Templates/templates/Legerity.Templates.Android.NUnit/Pages/SamplePage.cs +++ b/tools/Legerity.Templates/templates/Legerity.Templates.Android.NUnit/Pages/SamplePage.cs @@ -10,7 +10,7 @@ public SamplePage() { } - public SamplePage(RemoteWebDriver app) + public SamplePage(WebDriver app) : base(app, BaseTestClass.ImplicitWait) { } diff --git a/tools/Legerity.Templates/templates/Legerity.Templates.Android.NUnit/Tests/SampleTests.cs b/tools/Legerity.Templates/templates/Legerity.Templates.Android.NUnit/Tests/SampleTests.cs index 00939a73..50f2279a 100644 --- a/tools/Legerity.Templates/templates/Legerity.Templates.Android.NUnit/Tests/SampleTests.cs +++ b/tools/Legerity.Templates/templates/Legerity.Templates.Android.NUnit/Tests/SampleTests.cs @@ -1,6 +1,7 @@ namespace Legerity.Templates.Android.NUnit.Tests; using Legerity.Templates.Android.NUnit.Pages; +using OpenQA.Selenium; using OpenQA.Selenium.Remote; [TestFixtureSource(nameof(PlatformOptions))] @@ -14,7 +15,7 @@ public SampleTests(AppManagerOptions options) [Test] public void ShouldLoadPage() { - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); new SamplePage(app).VerifyPageLoaded(); } } \ No newline at end of file diff --git a/tools/Legerity.Templates/templates/Legerity.Templates.CrossPlatform.NUnit/GlobalUsings.cs b/tools/Legerity.Templates/templates/Legerity.Templates.CrossPlatform.NUnit/GlobalUsings.cs index 6f44aebe..b4af81b4 100644 --- a/tools/Legerity.Templates/templates/Legerity.Templates.CrossPlatform.NUnit/GlobalUsings.cs +++ b/tools/Legerity.Templates/templates/Legerity.Templates.CrossPlatform.NUnit/GlobalUsings.cs @@ -6,4 +6,6 @@ global using Legerity.Web; global using Legerity.Windows; global using Legerity.Pages; -global using NUnit.Framework; \ No newline at end of file +global using NUnit.Framework; +global using OpenQA.Selenium; +global using OpenQA.Selenium.Remote; \ No newline at end of file diff --git a/tools/Legerity.Templates/templates/Legerity.Templates.CrossPlatform.NUnit/Legerity.Templates.CrossPlatform.NUnit.csproj b/tools/Legerity.Templates/templates/Legerity.Templates.CrossPlatform.NUnit/Legerity.Templates.CrossPlatform.NUnit.csproj index baa1bcbd..5469c5c2 100644 --- a/tools/Legerity.Templates/templates/Legerity.Templates.CrossPlatform.NUnit/Legerity.Templates.CrossPlatform.NUnit.csproj +++ b/tools/Legerity.Templates/templates/Legerity.Templates.CrossPlatform.NUnit/Legerity.Templates.CrossPlatform.NUnit.csproj @@ -7,19 +7,31 @@ + + + + + + + + + + + + + + + + + + + - - - - - - - \ No newline at end of file diff --git a/tools/Legerity.Templates/templates/Legerity.Templates.CrossPlatform.NUnit/Pages/SamplePage.cs b/tools/Legerity.Templates/templates/Legerity.Templates.CrossPlatform.NUnit/Pages/SamplePage.cs index 69d04e92..7f52dede 100644 --- a/tools/Legerity.Templates/templates/Legerity.Templates.CrossPlatform.NUnit/Pages/SamplePage.cs +++ b/tools/Legerity.Templates/templates/Legerity.Templates.CrossPlatform.NUnit/Pages/SamplePage.cs @@ -13,7 +13,7 @@ public SamplePage() { } - public SamplePage(RemoteWebDriver app) + public SamplePage(WebDriver app) : base(app, BaseTestClass.ImplicitWait) { } @@ -33,9 +33,9 @@ private By DetermineTrait() { return this.App switch { - WindowsDriver => WindowsByExtras.AutomationId("sampleButton"), - AndroidDriver => By.Id("sampleButton"), - IOSDriver => By.Name("sampleButton"), + WindowsDriver => WindowsByExtras.AutomationId("sampleButton"), + AndroidDriver => By.Id("sampleButton"), + IOSDriver => By.Name("sampleButton"), _ => By.TagName("button") }; } diff --git a/tools/Legerity.Templates/templates/Legerity.Templates.CrossPlatform.NUnit/Tests/SampleTests.cs b/tools/Legerity.Templates/templates/Legerity.Templates.CrossPlatform.NUnit/Tests/SampleTests.cs index e44c529d..bbd1b8d5 100644 --- a/tools/Legerity.Templates/templates/Legerity.Templates.CrossPlatform.NUnit/Tests/SampleTests.cs +++ b/tools/Legerity.Templates/templates/Legerity.Templates.CrossPlatform.NUnit/Tests/SampleTests.cs @@ -14,7 +14,7 @@ public SampleTests(AppManagerOptions options) [Test] public void ShouldLoadPage() { - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); new SamplePage(app).VerifyPageLoaded(); } } \ No newline at end of file diff --git a/tools/Legerity.Templates/templates/Legerity.Templates.IOS.NUnit/GlobalUsings.cs b/tools/Legerity.Templates/templates/Legerity.Templates.IOS.NUnit/GlobalUsings.cs index 9d31f4dc..87d28eb6 100644 --- a/tools/Legerity.Templates/templates/Legerity.Templates.IOS.NUnit/GlobalUsings.cs +++ b/tools/Legerity.Templates/templates/Legerity.Templates.IOS.NUnit/GlobalUsings.cs @@ -3,4 +3,6 @@ global using Legerity; global using Legerity.IOS; global using Legerity.Pages; -global using NUnit.Framework; \ No newline at end of file +global using NUnit.Framework; +global using OpenQA.Selenium; +global using OpenQA.Selenium.Remote; \ No newline at end of file diff --git a/tools/Legerity.Templates/templates/Legerity.Templates.IOS.NUnit/Legerity.Templates.IOS.NUnit.csproj b/tools/Legerity.Templates/templates/Legerity.Templates.IOS.NUnit/Legerity.Templates.IOS.NUnit.csproj index 99d2cae5..dcff7999 100644 --- a/tools/Legerity.Templates/templates/Legerity.Templates.IOS.NUnit/Legerity.Templates.IOS.NUnit.csproj +++ b/tools/Legerity.Templates/templates/Legerity.Templates.IOS.NUnit/Legerity.Templates.IOS.NUnit.csproj @@ -7,15 +7,23 @@ - - - - - + + + + + + + + + + + + + \ No newline at end of file diff --git a/tools/Legerity.Templates/templates/Legerity.Templates.IOS.NUnit/Pages/SamplePage.cs b/tools/Legerity.Templates/templates/Legerity.Templates.IOS.NUnit/Pages/SamplePage.cs index c1655896..e21890d4 100644 --- a/tools/Legerity.Templates/templates/Legerity.Templates.IOS.NUnit/Pages/SamplePage.cs +++ b/tools/Legerity.Templates/templates/Legerity.Templates.IOS.NUnit/Pages/SamplePage.cs @@ -10,7 +10,7 @@ public SamplePage() { } - public SamplePage(RemoteWebDriver app) + public SamplePage(WebDriver app) : base(app, BaseTestClass.ImplicitWait) { } diff --git a/tools/Legerity.Templates/templates/Legerity.Templates.IOS.NUnit/Tests/SampleTests.cs b/tools/Legerity.Templates/templates/Legerity.Templates.IOS.NUnit/Tests/SampleTests.cs index 236d677d..f5a626ad 100644 --- a/tools/Legerity.Templates/templates/Legerity.Templates.IOS.NUnit/Tests/SampleTests.cs +++ b/tools/Legerity.Templates/templates/Legerity.Templates.IOS.NUnit/Tests/SampleTests.cs @@ -14,7 +14,7 @@ public SampleTests(AppManagerOptions options) [Test] public void ShouldLoadPage() { - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); new SamplePage(app).VerifyPageLoaded(); } } \ No newline at end of file diff --git a/tools/Legerity.Templates/templates/Legerity.Templates.Web.NUnit/GlobalUsings.cs b/tools/Legerity.Templates/templates/Legerity.Templates.Web.NUnit/GlobalUsings.cs index 2ac570eb..0d499602 100644 --- a/tools/Legerity.Templates/templates/Legerity.Templates.Web.NUnit/GlobalUsings.cs +++ b/tools/Legerity.Templates/templates/Legerity.Templates.Web.NUnit/GlobalUsings.cs @@ -3,4 +3,6 @@ global using Legerity; global using Legerity.Pages; global using Legerity.Web; -global using NUnit.Framework; \ No newline at end of file +global using NUnit.Framework; +global using OpenQA.Selenium; +global using OpenQA.Selenium.Remote; \ No newline at end of file diff --git a/tools/Legerity.Templates/templates/Legerity.Templates.Web.NUnit/Legerity.Templates.Web.NUnit.csproj b/tools/Legerity.Templates/templates/Legerity.Templates.Web.NUnit/Legerity.Templates.Web.NUnit.csproj index 7c56cc4c..303fe09d 100644 --- a/tools/Legerity.Templates/templates/Legerity.Templates.Web.NUnit/Legerity.Templates.Web.NUnit.csproj +++ b/tools/Legerity.Templates/templates/Legerity.Templates.Web.NUnit/Legerity.Templates.Web.NUnit.csproj @@ -1,4 +1,4 @@ - + net6.0;net7.0;net8.0 @@ -7,16 +7,24 @@ - - - - - - + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tools/Legerity.Templates/templates/Legerity.Templates.Web.NUnit/Pages/SamplePage.cs b/tools/Legerity.Templates/templates/Legerity.Templates.Web.NUnit/Pages/SamplePage.cs index fe592dfc..5fd6db90 100644 --- a/tools/Legerity.Templates/templates/Legerity.Templates.Web.NUnit/Pages/SamplePage.cs +++ b/tools/Legerity.Templates/templates/Legerity.Templates.Web.NUnit/Pages/SamplePage.cs @@ -10,7 +10,7 @@ public SamplePage() { } - public SamplePage(RemoteWebDriver app) + public SamplePage(WebDriver app) : base(app, BaseTestClass.ImplicitWait) { } diff --git a/tools/Legerity.Templates/templates/Legerity.Templates.Web.NUnit/Tests/SampleTests.cs b/tools/Legerity.Templates/templates/Legerity.Templates.Web.NUnit/Tests/SampleTests.cs index a756c39b..43a6b4cd 100644 --- a/tools/Legerity.Templates/templates/Legerity.Templates.Web.NUnit/Tests/SampleTests.cs +++ b/tools/Legerity.Templates/templates/Legerity.Templates.Web.NUnit/Tests/SampleTests.cs @@ -15,7 +15,7 @@ public SampleTests(AppManagerOptions options) [Test] public void ShouldLoadPage() { - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); new SamplePage(app).VerifyPageLoaded(); } } \ No newline at end of file diff --git a/tools/Legerity.Templates/templates/Legerity.Templates.Windows.NUnit/GlobalUsings.cs b/tools/Legerity.Templates/templates/Legerity.Templates.Windows.NUnit/GlobalUsings.cs index 4ee19433..0eadd8a0 100644 --- a/tools/Legerity.Templates/templates/Legerity.Templates.Windows.NUnit/GlobalUsings.cs +++ b/tools/Legerity.Templates/templates/Legerity.Templates.Windows.NUnit/GlobalUsings.cs @@ -3,4 +3,6 @@ global using Legerity; global using Legerity.Pages; global using Legerity.Windows; -global using NUnit.Framework; \ No newline at end of file +global using NUnit.Framework; +global using OpenQA.Selenium; +global using OpenQA.Selenium.Remote; \ No newline at end of file diff --git a/tools/Legerity.Templates/templates/Legerity.Templates.Windows.NUnit/Legerity.Templates.Windows.NUnit.csproj b/tools/Legerity.Templates/templates/Legerity.Templates.Windows.NUnit/Legerity.Templates.Windows.NUnit.csproj index ac494b0c..a328ae5e 100644 --- a/tools/Legerity.Templates/templates/Legerity.Templates.Windows.NUnit/Legerity.Templates.Windows.NUnit.csproj +++ b/tools/Legerity.Templates/templates/Legerity.Templates.Windows.NUnit/Legerity.Templates.Windows.NUnit.csproj @@ -1,4 +1,4 @@ - + net6.0;net7.0;net8.0 @@ -7,16 +7,25 @@ - - - - - - + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tools/Legerity.Templates/templates/Legerity.Templates.Windows.NUnit/Pages/SamplePage.cs b/tools/Legerity.Templates/templates/Legerity.Templates.Windows.NUnit/Pages/SamplePage.cs index 0e06d6e5..42f3a60a 100644 --- a/tools/Legerity.Templates/templates/Legerity.Templates.Windows.NUnit/Pages/SamplePage.cs +++ b/tools/Legerity.Templates/templates/Legerity.Templates.Windows.NUnit/Pages/SamplePage.cs @@ -10,7 +10,7 @@ public SamplePage() { } - public SamplePage(RemoteWebDriver app) + public SamplePage(WebDriver app) : base(app, BaseTestClass.ImplicitWait) { } diff --git a/tools/Legerity.Templates/templates/Legerity.Templates.Windows.NUnit/Tests/SampleTests.cs b/tools/Legerity.Templates/templates/Legerity.Templates.Windows.NUnit/Tests/SampleTests.cs index 1b6e7369..c90dd5f9 100644 --- a/tools/Legerity.Templates/templates/Legerity.Templates.Windows.NUnit/Tests/SampleTests.cs +++ b/tools/Legerity.Templates/templates/Legerity.Templates.Windows.NUnit/Tests/SampleTests.cs @@ -14,7 +14,7 @@ public SampleTests(AppManagerOptions options) [Test] public void ShouldLoadPage() { - RemoteWebDriver app = this.StartApp(); + WebDriver app = this.StartApp(); new SamplePage(app).VerifyPageLoaded(); } } \ No newline at end of file From 89895ab450375282cc8713723564fc60177a9d3b Mon Sep 17 00:00:00 2001 From: James Croft Date: Tue, 12 Mar 2024 19:47:21 +0000 Subject: [PATCH 13/21] Update pipelines with .NET SDK versions --- .github/workflows/ci.yml | 87 +++++++++++++++++++++----------------- .github/workflows/docs.yml | 73 ++++++++++++++++++-------------- 2 files changed, 89 insertions(+), 71 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2229bb3f..e31a605d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,62 +3,71 @@ name: CI on: push: tags: - - v* + - v* branches: - - main + - main paths: - - src/** - - samples/** - - tests/** - - build/** - - tools/** - - .github/workflows/ci.yml + - src/** + - samples/** + - tests/** + - build/** + - tools/** + - .github/workflows/ci.yml pull_request: branches: - - main + - main paths: - - src/** - - samples/** - - tests/** - - build/** - - tools/** - - .github/workflows/ci.yml + - src/** + - samples/** + - tests/** + - build/** + - tools/** + - .github/workflows/ci.yml workflow_dispatch: jobs: build: - env: - BUILD_CONFIG: 'Release' - SOLUTION: 'src/Legerity.sln' + BUILD_CONFIG: "Release" + SOLUTION: "src/Legerity.sln" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 + + - name: Get Build Version + run: | + Import-Module .\build\GetBuildVersion.psm1 + Write-Host $Env:GITHUB_REF + $version = GetBuildVersion -VersionString $Env:GITHUB_REF + echo "BUILD_VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append + shell: pwsh + + - name: Setup .NET 6.0 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 6.0.x - - name: Get Build Version - run: | - Import-Module .\build\GetBuildVersion.psm1 - Write-Host $Env:GITHUB_REF - $version = GetBuildVersion -VersionString $Env:GITHUB_REF - echo "BUILD_VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append - shell: pwsh + - name: Setup .NET 7.0 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 7.0.x - - name: Setup .NET 6.0 - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 6.0.x + - name: Setup .NET 8.0 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 8.0.x - - name: Setup NuGet - uses: NuGet/setup-nuget@v1.0.5 + - name: Setup NuGet + uses: NuGet/setup-nuget@v1.0.5 - - name: Restore dependencies - run: dotnet restore $SOLUTION + - name: Restore dependencies + run: dotnet restore $SOLUTION - - name: Build - run: dotnet build $SOLUTION --configuration $BUILD_CONFIG -p:Version=$BUILD_VERSION --no-restore + - name: Build + run: dotnet build $SOLUTION --configuration $BUILD_CONFIG -p:Version=$BUILD_VERSION --no-restore - - name: Publish - if: startsWith(github.ref, 'refs/tags/v') - run: nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}} + - name: Publish + if: startsWith(github.ref, 'refs/tags/v') + run: nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 4ae649ee..59ea65e5 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -3,46 +3,55 @@ name: Docs on: push: branches: - - main + - main paths: - - docs/** - - src/** - - .github/workflows/docs.yml + - docs/** + - src/** + - .github/workflows/docs.yml pull_request: branches: - - main + - main paths: - - docs/** - - .github/workflows/docs.yml + - docs/** + - .github/workflows/docs.yml workflow_dispatch: jobs: generate-docs: - runs-on: windows-latest steps: - - uses: actions/checkout@v2 - - - name: Setup .NET 6.0 - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 6.0.x - - - name: Setup DocFX - uses: crazy-max/ghaction-chocolatey@v1 - with: - args: install docfx - - - name: DocFX Build - working-directory: docs - run: docfx .\docfx.json - continue-on-error: false - - - name: Publish - if: github.event_name == 'push' - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: docs/_site - force_orphan: true + - uses: actions/checkout@v2 + + - name: Setup .NET 6.0 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 6.0.x + + - name: Setup .NET 7.0 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 7.0.x + + - name: Setup .NET 8.0 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 8.0.x + + - name: Setup DocFX + uses: crazy-max/ghaction-chocolatey@v1 + with: + args: install docfx + + - name: DocFX Build + working-directory: docs + run: docfx .\docfx.json + continue-on-error: false + + - name: Publish + if: github.event_name == 'push' + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: docs/_site + force_orphan: true From 4d0ae6566cac318bb46ed00cfc5b1ff714bbe389 Mon Sep 17 00:00:00 2001 From: James Croft Date: Tue, 12 Mar 2024 19:48:26 +0000 Subject: [PATCH 14/21] Update git files --- .gitattributes | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ .gitignore | 2 -- 2 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..671f86ba --- /dev/null +++ b/.gitattributes @@ -0,0 +1,60 @@ +# Set default behavior to automatically normalize line endings. +* text=auto + +# Collapse these files in PRs by default +*.xlf linguist-generated=true +*.lcl linguist-generated=true + +*.jpg binary +*.png binary +*.gif binary + +# Force bash scripts to always use lf line endings so that if a repo is accessed +# in Unix via a file share from Windows, the scripts will work. +*.in text eol=lf +*.sh text eol=lf + +# Likewise, force cmd and batch scripts to always use crlf +*.cmd text eol=crlf +*.bat text eol=crlf + +*.cs text=auto diff=csharp +*.vb text=auto +*.resx text=auto +*.c text=auto +*.cpp text=auto +*.cxx text=auto +*.h text=auto +*.hxx text=auto +*.py text=auto +*.rb text=auto +*.java text=auto +*.html text=auto +*.htm text=auto +*.css text=auto +*.scss text=auto +*.sass text=auto +*.less text=auto +*.js text=auto +*.lisp text=auto +*.clj text=auto +*.sql text=auto +*.php text=auto +*.lua text=auto +*.m text=auto +*.asm text=auto +*.erl text=auto +*.fs text=auto +*.fsx text=auto +*.hs text=auto + +*.csproj text=auto +*.vbproj text=auto +*.fsproj text=auto +*.dbproj text=auto +*.sln text=auto eol=crlf + +# Set linguist language for .h files explicitly based on +# https://github.com/github/linguist/issues/1626#issuecomment-401442069 +# this only affects the repo's language statistics +*.h linguist-language=C diff --git a/.gitignore b/.gitignore index b958e232..8a30d258 100644 --- a/.gitignore +++ b/.gitignore @@ -396,5 +396,3 @@ FodyWeavers.xsd # JetBrains Rider *.sln.iml -*.dcvr -*.dcvr.settings \ No newline at end of file From ebf336334a55dc3468f59af801c3a27dd8b02d0a Mon Sep 17 00:00:00 2001 From: James Croft Date: Tue, 12 Mar 2024 19:58:29 +0000 Subject: [PATCH 15/21] Update solution --- .editorconfig | 694 +++++++++++++++++++++-------------------------- src/Legerity.sln | 35 --- 2 files changed, 312 insertions(+), 417 deletions(-) diff --git a/.editorconfig b/.editorconfig index 968afd97..5b99dcca 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,404 +1,334 @@ -########################################## -# Common Settings -########################################## - -# This file is the top-most EditorConfig file root = true -# All Files [*] -charset = utf-8 -end_of_line = crlf indent_style = space -indent_size = 4 -insert_final_newline = false +charset = utf-8 trim_trailing_whitespace = true +insert_final_newline = true +spelling_exclusion_path = spelling.dic + +[*.cs] +indent_size = 4 +dotnet_sort_system_directives_first = true -########################################## -# File Extension Settings -########################################## +# Don't use this. qualifier +dotnet_style_qualification_for_field = false:suggestion +dotnet_style_qualification_for_property = false:suggestion -# Visual Studio Solution Files -[*.sln] -indent_style = tab +# use int x = .. over Int32 +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion -# Visual Studio XML Project Files -[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] -indent_size = 2 +# use int.MaxValue over Int32.MaxValue +dotnet_style_predefined_type_for_member_access = true:suggestion -# Various XML Configuration Files -[*.{xml,config,props,targets,nuspec,resx,ruleset,vsixmanifest,vsct}] -indent_size = 2 +# Require var all the time. +csharp_style_var_for_built_in_types = true:suggestion +csharp_style_var_when_type_is_apparent = true:suggestion +csharp_style_var_elsewhere = true:suggestion -# JSON Files -[*.{json,json5}] -indent_size = 2 +# Disallow throw expressions. +csharp_style_throw_expression = false:suggestion + +# Newline settings +csharp_new_line_before_open_brace = all +csharp_new_line_before_else = true +csharp_new_line_before_catch = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_members_in_anonymous_types = true + +# Namespace settings +csharp_style_namespace_declarations = file_scoped + +# Brace settings +csharp_prefer_braces = true # Prefer curly braces even for one line of code + +# name all constant fields using PascalCase +dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = warning +dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields +dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style +dotnet_naming_symbols.constant_fields.applicable_kinds = field +dotnet_naming_symbols.constant_fields.required_modifiers = const +dotnet_naming_style.pascal_case_style.capitalization = pascal_case -# YAML Files -[*.{yml,yaml}] +# static fields should have s_ prefix +dotnet_naming_rule.static_fields_should_have_prefix.severity = warning +dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields +dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style +dotnet_naming_symbols.static_fields.applicable_kinds = field +dotnet_naming_symbols.static_fields.required_modifiers = static +dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected +dotnet_naming_style.static_prefix_style.required_prefix = s_ +dotnet_naming_style.static_prefix_style.capitalization = camel_case + +# internal and private fields should be _camelCase +dotnet_naming_rule.camel_case_for_private_internal_fields.severity = warning +dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields +dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style +dotnet_naming_symbols.private_internal_fields.applicable_kinds = field +dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal +dotnet_naming_style.camel_case_underscore_style.required_prefix = _ +dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case + +[*.{xml,config,*proj,nuspec,props,resx,targets,yml,tasks}] indent_size = 2 -# Markdown Files -[*.md] -trim_trailing_whitespace = false +# Xml config files +[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] +indent_size = 2 -# Web Files -[*.{htm,html,js,ts,tsx,css,sass,scss,less,svg,vue}] +[*.json] indent_size = 2 -insert_final_newline = true -# Batch Files -[*.{cmd,bat}] +[*.{ps1,psm1}] +indent_size = 4 -# Bash Files [*.sh] +indent_size = 4 end_of_line = lf -########################################## -# .NET Language Conventions -# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#language-conventions -########################################## - -# .NET Code Style Settings -[*.{cs,csx,cake,vb}] -# "this." and "Me." qualifiers -# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#this_and_me -#prefer fields to be prefaced with this. in C# or Me. in Visual Basic -dotnet_style_qualification_for_field = true:warning -#prefer properties to be prefaced with this. or Me. in Visual Basic -dotnet_style_qualification_for_property = true:warning -#prefer methods to be prefaced with this. in C# or Me. in Visual Basic -dotnet_style_qualification_for_method = true:warning -#prefer events to be prefaced with this. in C# or Me. in Visual Basic -dotnet_style_qualification_for_event = true:warning - -# Language keywords instead of framework type names for type references -# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#language_keywords -#prefer the language keyword for local variables, method parameters, and class members, instead of the type name, for types that have a keyword to represent them -dotnet_style_predefined_type_for_locals_parameters_members = true:warning -#prefer the language keyword for member access expressions, instead of the type name, for types that have a keyword to represent them -dotnet_style_predefined_type_for_member_access = true:warning - -# Modifier preferences -# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#normalize_modifiers -dotnet_style_require_accessibility_modifiers = always:warning -csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async -visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async -dotnet_style_readonly_field = true:warning - -# Parentheses preferences -# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#parentheses -dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:warning -dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:warning -dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning -dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion - -# Expression-level preferences -# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#expression_level -dotnet_style_object_initializer = true:warning -dotnet_style_collection_initializer = true:warning -dotnet_style_explicit_tuple_names = true:warning -dotnet_style_prefer_inferred_tuple_names = true:warning -dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning -dotnet_style_prefer_auto_properties = true:warning -dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning -dotnet_style_prefer_conditional_expression_over_assignment = false:suggestion -dotnet_style_prefer_conditional_expression_over_return = false:suggestion - -# Null-checking preferences -# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#null_checking -dotnet_style_coalesce_expression = true:warning -dotnet_style_null_propagation = true:warning - -# C# Code Style Settings -[*.{cs,csx,cake}] -# Implicit and explicit types -# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#implicit-and-explicit-types -#prefer explicit type over var to declare variables with built-in system types such as int -csharp_style_var_for_built_in_types = false:suggestion -#prefer explicit var over type when the type is already mentioned on the right-hand side of a declaration -csharp_style_var_when_type_is_apparent = true:warning -#prefer explicit type over var to declare variables where type is elsewhere -csharp_style_var_elsewhere = false:warning - -# Expression-bodied members -# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#expression_bodied_members -#prefer block bodies for methods -csharp_style_expression_bodied_methods = false:warning -#prefer block bodies for constructors -csharp_style_expression_bodied_constructors = false:warning -#prefer block bodies for operators -csharp_style_expression_bodied_operators = false:warning -#prefer expression-bodied members for properties -csharp_style_expression_bodied_properties = true:warning -#prefer expression-bodied members for indexers -csharp_style_expression_bodied_indexers = true:warning -#prefer expression-bodied members for accessors -csharp_style_expression_bodied_accessors = true:warning - -# Pattern matching -# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#pattern_matching -csharp_style_pattern_matching_over_is_with_cast_check = true:warning -csharp_style_pattern_matching_over_as_with_null_check = true:warning - -# Inlined variable declarations -# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#inlined_variable_declarations -#prefer out variables to be declared inline in the argument list of a method call when possible -csharp_style_inlined_variable_declaration = true:suggestion - -# Expression-level preferences -# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#expression_level_csharp -csharp_prefer_simple_default_expression = true:warning -csharp_style_deconstructed_variable_declaration = true:warning -csharp_style_pattern_local_over_anonymous_function = true:warning - -# "Null" checking preferences -# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#null_checking_csharp -csharp_style_throw_expression = true:warning -csharp_style_conditional_delegate_call = true:warning - -# Code block preferences -# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#code_block -csharp_prefer_braces = true:warning - -########################################## -# .NET Formatting Conventions -# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#formatting-conventions -########################################## - -# Organize usings -# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#usings -#sort System.* using directives alphabetically, and place them before other usings -dotnet_sort_system_directives_first = true +[*.{razor,cshtml}] +charset = utf-8-bom -# Using statement placement (Undocumented) -csharp_using_directive_placement = inside_namespace:warning +[*.{cs,vb}] -# C# formatting settings -# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#c-formatting-settings -csharp_new_line_before_open_brace = all -csharp_new_line_before_else = true -csharp_new_line_before_catch = true -csharp_new_line_before_finally = true -csharp_new_line_before_members_in_object_initializers = true -csharp_new_line_before_members_in_anonymous_types = true -csharp_new_line_between_query_expression_clauses = true - -# Indentation options -# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#indent -#indent switch case contents. -csharp_indent_case_contents = true -#indent switch labels -csharp_indent_switch_labels = true -csharp_indent_labels = no_change - -# Spacing options -# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#spacing -#require NO space between a cast and the value -csharp_space_after_cast = false -#require a space after a keyword in a control flow statement such as a for loop -csharp_space_after_keywords_in_control_flow_statements = true -#place a space character after the opening parenthesis and before the closing parenthesis of a method declaration parameter list. -csharp_space_between_method_declaration_parameter_list_parentheses = false -#do not place space characters after the opening parenthesis and before the closing parenthesis of a method call -csharp_space_between_method_call_parameter_list_parentheses = false -csharp_space_between_parentheses = false -#require a space before the colon for bases or interfaces in a type declaration -csharp_space_before_colon_in_inheritance_clause = true -#require a space before the colon for bases or interfaces in a type declaration -csharp_space_after_colon_in_inheritance_clause = true -csharp_space_around_binary_operators = before_and_after -#remove space within empty parameter list parentheses for a method declaration -csharp_space_between_method_declaration_empty_parameter_list_parentheses = false -#remove space between method call name and opening parenthesis -csharp_space_between_method_call_name_and_opening_parenthesis = false -#remove space within empty argument list parentheses -csharp_space_between_method_call_empty_parameter_list_parentheses = false - -# Wrapping options -# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#wrapping -#leave statements and member declarations on the same line -csharp_preserve_single_line_statements = true -#leave code block on single line -csharp_preserve_single_line_blocks = true - -# More Indentation options (Undocumented) -csharp_indent_block_contents = true -csharp_indent_braces = false - -# Spacing Options (Undocumented) -csharp_space_after_comma = true -csharp_space_after_dot = false -csharp_space_after_semicolon_in_for_statement = true -csharp_space_around_declaration_statements = do_not_ignore -csharp_space_before_comma = false -csharp_space_before_dot = false -csharp_space_before_semicolon_in_for_statement = false -csharp_space_before_open_square_brackets = false -csharp_space_between_empty_square_brackets = false -csharp_space_between_method_declaration_name_and_open_parenthesis = false -csharp_space_between_square_brackets = false - -########################################## -# .NET Naming Conventions -# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-naming-conventions -########################################## - -[*.{cs,csx,cake,vb}] - -########################################## -# Styles -########################################## - -# camel_case_style - Define the camelCase style -dotnet_naming_style.camel_case_style.capitalization = camel_case -# pascal_case_style - Define the Pascal_case style -dotnet_naming_style.pascal_case_style.capitalization = pascal_case -# first_upper_style - The first character must start with an upper-case character -dotnet_naming_style.first_upper_style.capitalization = first_word_upper -# prefix_interface_with_i_style - Interfaces must be PascalCase and the first character of an interface must be an 'I' -dotnet_naming_style.prefix_interface_with_i_style.capitalization = pascal_case -dotnet_naming_style.prefix_interface_with_i_style.required_prefix = I -# prefix_type_parameters_with_t_style - Generic Type Parameters must be PascalCase and the first character must be a 'T' -dotnet_naming_style.prefix_type_parameters_with_t_style.capitalization = pascal_case -dotnet_naming_style.prefix_type_parameters_with_t_style.required_prefix = T -# disallowed_style - Anything that has this style applied is marked as disallowed -dotnet_naming_style.disallowed_style.capitalization = pascal_case -dotnet_naming_style.disallowed_style.required_prefix = ____RULE_VIOLATION____ -dotnet_naming_style.disallowed_style.required_suffix = ____RULE_VIOLATION____ -# internal_error_style - This style should never occur... if it does, it's indicates a bug in file or in the parser using the file -dotnet_naming_style.internal_error_style.capitalization = pascal_case -dotnet_naming_style.internal_error_style.required_prefix = ____INTERNAL_ERROR____ -dotnet_naming_style.internal_error_style.required_suffix = ____INTERNAL_ERROR____ - -########################################## -# .NET Design Guideline Field Naming Rules -# Naming rules for fields follow the .NET Framework design guidelines -# https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/index -########################################## - -# All public/protected/protected_internal constant fields must be PascalCase -# https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/field -dotnet_naming_symbols.public_protected_constant_fields_group.applicable_accessibilities = public, protected, protected_internal -dotnet_naming_symbols.public_protected_constant_fields_group.required_modifiers = const -dotnet_naming_symbols.public_protected_constant_fields_group.applicable_kinds = field -dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.symbols = public_protected_constant_fields_group -dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.style = pascal_case_style -dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.severity = warning - -# All public/protected/protected_internal static readonly fields must be PascalCase -# https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/field -dotnet_naming_symbols.public_protected_static_readonly_fields_group.applicable_accessibilities = public, protected, protected_internal -dotnet_naming_symbols.public_protected_static_readonly_fields_group.required_modifiers = static, readonly -dotnet_naming_symbols.public_protected_static_readonly_fields_group.applicable_kinds = field -dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.symbols = public_protected_static_readonly_fields_group -dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.style = pascal_case_style -dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.severity = warning - -# No other public/protected/protected_internal fields are allowed -# https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/field -dotnet_naming_symbols.other_public_protected_fields_group.applicable_accessibilities = public, protected, protected_internal -dotnet_naming_symbols.other_public_protected_fields_group.applicable_kinds = field -dotnet_naming_rule.other_public_protected_fields_disallowed_rule.symbols = other_public_protected_fields_group -dotnet_naming_rule.other_public_protected_fields_disallowed_rule.style = disallowed_style -dotnet_naming_rule.other_public_protected_fields_disallowed_rule.severity = error - -########################################## -# StyleCop Field Naming Rules -# Naming rules for fields follow the StyleCop analyzers -# This does not override any rules using disallowed_style above -# https://github.com/DotNetAnalyzers/StyleCopAnalyzers -########################################## - -# All constant fields must be PascalCase -# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1303.md -dotnet_naming_symbols.stylecop_constant_fields_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected, private -dotnet_naming_symbols.stylecop_constant_fields_group.required_modifiers = const -dotnet_naming_symbols.stylecop_constant_fields_group.applicable_kinds = field -dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.symbols = stylecop_constant_fields_group -dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.style = pascal_case_style -dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.severity = warning - -# All static readonly fields must be PascalCase -# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1311.md -dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected, private -dotnet_naming_symbols.stylecop_static_readonly_fields_group.required_modifiers = static, readonly -dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_kinds = field -dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.symbols = stylecop_static_readonly_fields_group -dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.style = pascal_case_style -dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.severity = warning - -# No non-private instance fields are allowed -# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1401.md -dotnet_naming_symbols.stylecop_fields_must_be_private_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected -dotnet_naming_symbols.stylecop_fields_must_be_private_group.applicable_kinds = field -dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.symbols = stylecop_fields_must_be_private_group -dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.style = disallowed_style -dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.severity = error - -# Private fields must be camelCase -# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1306.md -dotnet_naming_symbols.stylecop_private_fields_group.applicable_accessibilities = private -dotnet_naming_symbols.stylecop_private_fields_group.applicable_kinds = field -dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.symbols = stylecop_private_fields_group -dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.style = camel_case_style -dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.severity = warning - -# Local variables must be camelCase -# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1312.md -dotnet_naming_symbols.stylecop_local_fields_group.applicable_accessibilities = local -dotnet_naming_symbols.stylecop_local_fields_group.applicable_kinds = local -dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.symbols = stylecop_local_fields_group -dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.style = camel_case_style -dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.severity = silent - -# This rule should never fire. However, it's included for at least two purposes: -# First, it helps to understand, reason about, and root-case certain types of issues, such as bugs in .editorconfig parsers. -# Second, it helps to raise immediate awareness if a new field type is added (as occurred recently in C#). -dotnet_naming_symbols.sanity_check_uncovered_field_case_group.applicable_accessibilities = * -dotnet_naming_symbols.sanity_check_uncovered_field_case_group.applicable_kinds = field -dotnet_naming_rule.sanity_check_uncovered_field_case_rule.symbols = sanity_check_uncovered_field_case_group -dotnet_naming_rule.sanity_check_uncovered_field_case_rule.style = internal_error_style -dotnet_naming_rule.sanity_check_uncovered_field_case_rule.severity = error - - -########################################## -# Other Naming Rules -########################################## - -# All of the following must be PascalCase: -# - Namespaces -# https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/names-of-namespaces -# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1300.md -# - Classes and Enumerations -# https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces -# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1300.md -# - Delegates -# https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces#names-of-common-types -# - Constructors, Properties, Events, Methods -# https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/names-of-type-members -dotnet_naming_symbols.element_group.applicable_kinds = namespace, class, enum, struct, delegate, event, method, property -dotnet_naming_rule.element_rule.symbols = element_group -dotnet_naming_rule.element_rule.style = pascal_case_style -dotnet_naming_rule.element_rule.severity = warning - -# Interfaces use PascalCase and are prefixed with uppercase 'I' -# https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces -dotnet_naming_symbols.interface_group.applicable_kinds = interface -dotnet_naming_rule.interface_rule.symbols = interface_group -dotnet_naming_rule.interface_rule.style = prefix_interface_with_i_style -dotnet_naming_rule.interface_rule.severity = warning - -# Generics Type Parameters use PascalCase and are prefixed with uppercase 'T' -# https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces -dotnet_naming_symbols.type_parameter_group.applicable_kinds = type_parameter -dotnet_naming_rule.type_parameter_rule.symbols = type_parameter_group -dotnet_naming_rule.type_parameter_rule.style = prefix_type_parameters_with_t_style -dotnet_naming_rule.type_parameter_rule.severity = warning - -# Function parameters use camelCase -# https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/naming-parameters -dotnet_naming_symbols.parameters_group.applicable_kinds = parameter -dotnet_naming_rule.parameters_rule.symbols = parameters_group -dotnet_naming_rule.parameters_rule.style = camel_case_style -dotnet_naming_rule.parameters_rule.severity = warning +# SYSLIB1054: Use 'LibraryImportAttribute' instead of 'DllImportAttribute' to generate P/Invoke marshalling code at compile time +dotnet_diagnostic.SYSLIB1054.severity = warning + +# CA1018: Mark attributes with AttributeUsageAttribute +dotnet_diagnostic.CA1018.severity = warning + +# CA1047: Do not declare protected member in sealed type +dotnet_diagnostic.CA1047.severity = warning + +# CA1305: Specify IFormatProvider +dotnet_diagnostic.CA1305.severity = warning + +# CA1507: Use nameof to express symbol names +dotnet_diagnostic.CA1507.severity = warning + +# CA1510: Use ArgumentNullException throw helper +dotnet_diagnostic.CA1510.severity = warning + +# CA1511: Use ArgumentException throw helper +dotnet_diagnostic.CA1511.severity = warning + +# CA1512: Use ArgumentOutOfRangeException throw helper +dotnet_diagnostic.CA1512.severity = warning + +# CA1513: Use ObjectDisposedException throw helper +dotnet_diagnostic.CA1513.severity = warning + +# CA1725: Parameter names should match base declaration +dotnet_diagnostic.CA1725.severity = suggestion + +# CA1802: Use literals where appropriate +dotnet_diagnostic.CA1802.severity = warning + +# CA1805: Do not initialize unnecessarily +dotnet_diagnostic.CA1805.severity = warning + +# CA1810: Do not initialize unnecessarily +dotnet_diagnostic.CA1810.severity = warning + +# CA1821: Remove empty Finalizers +dotnet_diagnostic.CA1821.severity = warning + +# CA1822: Make member static +dotnet_diagnostic.CA1822.severity = warning +dotnet_code_quality.CA1822.api_surface = private, internal + +# CA1823: Avoid unused private fields +dotnet_diagnostic.CA1823.severity = warning + +# CA1825: Avoid zero-length array allocations +dotnet_diagnostic.CA1825.severity = warning + +# CA1826: Do not use Enumerable methods on indexable collections. Instead use the collection directly +dotnet_diagnostic.CA1826.severity = warning + +# CA1827: Do not use Count() or LongCount() when Any() can be used +dotnet_diagnostic.CA1827.severity = warning + +# CA1828: Do not use CountAsync() or LongCountAsync() when AnyAsync() can be used +dotnet_diagnostic.CA1828.severity = warning + +# CA1829: Use Length/Count property instead of Count() when available +dotnet_diagnostic.CA1829.severity = warning + +# CA1830: Prefer strongly-typed Append and Insert method overloads on StringBuilder +dotnet_diagnostic.CA1830.severity = warning + +# CA1831: Use AsSpan or AsMemory instead of Range-based indexers when appropriate +dotnet_diagnostic.CA1831.severity = warning + +# CA1832: Use AsSpan or AsMemory instead of Range-based indexers when appropriate +dotnet_diagnostic.CA1832.severity = warning + +# CA1833: Use AsSpan or AsMemory instead of Range-based indexers when appropriate +dotnet_diagnostic.CA1833.severity = warning + +# CA1834: Consider using 'StringBuilder.Append(char)' when applicable +dotnet_diagnostic.CA1834.severity = warning + +# CA1835: Prefer the 'Memory'-based overloads for 'ReadAsync' and 'WriteAsync' +dotnet_diagnostic.CA1835.severity = warning + +# CA1836: Prefer IsEmpty over Count +dotnet_diagnostic.CA1836.severity = warning + +# CA1837: Use 'Environment.ProcessId' +dotnet_diagnostic.CA1837.severity = warning + +# CA1838: Avoid 'StringBuilder' parameters for P/Invokes +dotnet_diagnostic.CA1838.severity = warning + +# CA1839: Use 'Environment.ProcessPath' +dotnet_diagnostic.CA1839.severity = warning + +# CA1840: Use 'Environment.CurrentManagedThreadId' +dotnet_diagnostic.CA1840.severity = warning + +# CA1841: Prefer Dictionary.Contains methods +dotnet_diagnostic.CA1841.severity = warning + +# CA1842: Do not use 'WhenAll' with a single task +dotnet_diagnostic.CA1842.severity = warning + +# CA1843: Do not use 'WaitAll' with a single task +dotnet_diagnostic.CA1843.severity = warning + +# CA1844: Provide memory-based overrides of async methods when subclassing 'Stream' +dotnet_diagnostic.CA1844.severity = warning + +# CA1845: Use span-based 'string.Concat' +dotnet_diagnostic.CA1845.severity = warning + +# CA1846: Prefer AsSpan over Substring +dotnet_diagnostic.CA1846.severity = warning + +# CA1847: Use string.Contains(char) instead of string.Contains(string) with single characters +dotnet_diagnostic.CA1847.severity = warning + +# CA1852: Seal internal types +dotnet_diagnostic.CA1852.severity = warning + +# CA1854: Prefer the IDictionary.TryGetValue(TKey, out TValue) method +dotnet_diagnostic.CA1854.severity = warning + +# CA1855: Prefer 'Clear' over 'Fill' +dotnet_diagnostic.CA1855.severity = warning + +# CA1856: Incorrect usage of ConstantExpected attribute +dotnet_diagnostic.CA1856.severity = error + +# CA1857: A constant is expected for the parameter +dotnet_diagnostic.CA1857.severity = warning + +# CA1858: Use 'StartsWith' instead of 'IndexOf' +dotnet_diagnostic.CA1858.severity = warning + +# CA2007: Consider calling ConfigureAwait on the awaited task +dotnet_diagnostic.CA2007.severity = none + +# CA2008: Do not create tasks without passing a TaskScheduler +dotnet_diagnostic.CA2008.severity = warning + +# CA2009: Do not call ToImmutableCollection on an ImmutableCollection value +dotnet_diagnostic.CA2009.severity = warning + +# CA2011: Avoid infinite recursion +dotnet_diagnostic.CA2011.severity = warning + +# CA2012: Use ValueTask correctly +dotnet_diagnostic.CA2012.severity = warning + +# CA2013: Do not use ReferenceEquals with value types +dotnet_diagnostic.CA2013.severity = warning + +# CA2014: Do not use stackalloc in loops. +dotnet_diagnostic.CA2014.severity = warning + +# CA2016: Forward the 'CancellationToken' parameter to methods that take one +dotnet_diagnostic.CA2016.severity = warning + +# CA2200: Rethrow to preserve stack details +dotnet_diagnostic.CA2200.severity = warning + +# CA2201: Do not raise reserved exception types +dotnet_diagnostic.CA2201.severity = warning + +# CA2208: Instantiate argument exceptions correctly +dotnet_diagnostic.CA2208.severity = warning + +# CA2245: Do not assign a property to itself +dotnet_diagnostic.CA2245.severity = warning + +# CA2246: Assigning symbol and its member in the same statement +dotnet_diagnostic.CA2246.severity = warning + +# CA2249: Use string.Contains instead of string.IndexOf to improve readability. +dotnet_diagnostic.CA2249.severity = warning + +# IDE0005: Remove unnecessary usings +dotnet_diagnostic.IDE0005.severity = warning + +# IDE0011: Curly braces to surround blocks of code +dotnet_diagnostic.IDE0011.severity = warning + +# IDE0020: Use pattern matching to avoid is check followed by a cast (with variable) +dotnet_diagnostic.IDE0020.severity = warning + +# IDE0029: Use coalesce expression (non-nullable types) +dotnet_diagnostic.IDE0029.severity = warning + +# IDE0030: Use coalesce expression (nullable types) +dotnet_diagnostic.IDE0030.severity = warning + +# IDE0031: Use null propagation +dotnet_diagnostic.IDE0031.severity = warning + +# IDE0035: Remove unreachable code +dotnet_diagnostic.IDE0035.severity = warning + +# IDE0036: Order modifiers +csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion +dotnet_diagnostic.IDE0036.severity = warning + +# IDE0038: Use pattern matching to avoid is check followed by a cast (without variable) +dotnet_diagnostic.IDE0038.severity = warning + +# IDE0043: Format string contains invalid placeholder +dotnet_diagnostic.IDE0043.severity = warning + +# IDE0044: Make field readonly +dotnet_diagnostic.IDE0044.severity = warning + +# IDE0051: Remove unused private members +dotnet_diagnostic.IDE0051.severity = warning + +# IDE0055: All formatting rules +dotnet_diagnostic.IDE0055.severity = suggestion + +# IDE0059: Unnecessary assignment to a value +dotnet_diagnostic.IDE0059.severity = warning + +# IDE0060: Remove unused parameter +dotnet_code_quality_unused_parameters = non_public +dotnet_diagnostic.IDE0060.severity = warning + +# IDE0062: Make local function static +dotnet_diagnostic.IDE0062.severity = warning + +# IDE1006: Required naming style +dotnet_diagnostic.IDE1006.severity = warning + +# IDE0161: Convert to file-scoped namespace +dotnet_diagnostic.IDE0161.severity = warning + +# IDE0200: Lambda expression can be removed +dotnet_diagnostic.IDE0200.severity = warning + +# IDE2000: Disallow multiple blank lines +dotnet_style_allow_multiple_blank_lines_experimental = false +dotnet_diagnostic.IDE2000.severity = warning diff --git a/src/Legerity.sln b/src/Legerity.sln index 36afcdfc..a48e6ea9 100644 --- a/src/Legerity.sln +++ b/src/Legerity.sln @@ -45,16 +45,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Legerity.WCT.Tests", "..\te EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Legerity.Telerik.Uwp.Tests", "..\tests\Legerity.Telerik.Uwp.Tests\Legerity.Telerik.Uwp.Tests.csproj", "{10EB86E8-C74E-44AA-B5E8-C38BBC86B503}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Legerity.Templates.Android.NUnit", "..\tools\Legerity.Templates\templates\Legerity.Templates.Android.NUnit\Legerity.Templates.Android.NUnit.csproj", "{652E1951-1A5A-4BFB-B46A-D8DBF7A74E9E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Legerity.Templates.CrossPlatform.NUnit", "..\tools\Legerity.Templates\templates\Legerity.Templates.CrossPlatform.NUnit\Legerity.Templates.CrossPlatform.NUnit.csproj", "{84A589E7-5B41-46E0-81D9-AB72283F2619}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Legerity.Templates.IOS.NUnit", "..\tools\Legerity.Templates\templates\Legerity.Templates.IOS.NUnit\Legerity.Templates.IOS.NUnit.csproj", "{AEAA37EF-1D8E-4C51-AF2B-27DB52E2C70C}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Legerity.Templates.Web.NUnit", "..\tools\Legerity.Templates\templates\Legerity.Templates.Web.NUnit\Legerity.Templates.Web.NUnit.csproj", "{5E638927-108F-47CB-974C-3F8F4CF7579F}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Legerity.Templates.Windows.NUnit", "..\tools\Legerity.Templates\templates\Legerity.Templates.Windows.NUnit\Legerity.Templates.Windows.NUnit.csproj", "{BE462D02-8DE7-4DB3-A2AB-6CED0A6ED4BC}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -137,26 +127,6 @@ Global {10EB86E8-C74E-44AA-B5E8-C38BBC86B503}.Debug|Any CPU.Build.0 = Debug|Any CPU {10EB86E8-C74E-44AA-B5E8-C38BBC86B503}.Release|Any CPU.ActiveCfg = Release|Any CPU {10EB86E8-C74E-44AA-B5E8-C38BBC86B503}.Release|Any CPU.Build.0 = Release|Any CPU - {652E1951-1A5A-4BFB-B46A-D8DBF7A74E9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {652E1951-1A5A-4BFB-B46A-D8DBF7A74E9E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {652E1951-1A5A-4BFB-B46A-D8DBF7A74E9E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {652E1951-1A5A-4BFB-B46A-D8DBF7A74E9E}.Release|Any CPU.Build.0 = Release|Any CPU - {84A589E7-5B41-46E0-81D9-AB72283F2619}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {84A589E7-5B41-46E0-81D9-AB72283F2619}.Debug|Any CPU.Build.0 = Debug|Any CPU - {84A589E7-5B41-46E0-81D9-AB72283F2619}.Release|Any CPU.ActiveCfg = Release|Any CPU - {84A589E7-5B41-46E0-81D9-AB72283F2619}.Release|Any CPU.Build.0 = Release|Any CPU - {AEAA37EF-1D8E-4C51-AF2B-27DB52E2C70C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AEAA37EF-1D8E-4C51-AF2B-27DB52E2C70C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AEAA37EF-1D8E-4C51-AF2B-27DB52E2C70C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AEAA37EF-1D8E-4C51-AF2B-27DB52E2C70C}.Release|Any CPU.Build.0 = Release|Any CPU - {5E638927-108F-47CB-974C-3F8F4CF7579F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5E638927-108F-47CB-974C-3F8F4CF7579F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5E638927-108F-47CB-974C-3F8F4CF7579F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5E638927-108F-47CB-974C-3F8F4CF7579F}.Release|Any CPU.Build.0 = Release|Any CPU - {BE462D02-8DE7-4DB3-A2AB-6CED0A6ED4BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BE462D02-8DE7-4DB3-A2AB-6CED0A6ED4BC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BE462D02-8DE7-4DB3-A2AB-6CED0A6ED4BC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BE462D02-8DE7-4DB3-A2AB-6CED0A6ED4BC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -170,11 +140,6 @@ Global {74257F8D-E2F0-4327-B672-59F0530F2FD0} = {3024AB14-F3D4-4B9B-AF9D-64EBC00F5361} {C779A490-C926-4BF9-9165-0F407AA49A9F} = {3024AB14-F3D4-4B9B-AF9D-64EBC00F5361} {10EB86E8-C74E-44AA-B5E8-C38BBC86B503} = {3024AB14-F3D4-4B9B-AF9D-64EBC00F5361} - {652E1951-1A5A-4BFB-B46A-D8DBF7A74E9E} = {9064E354-7A64-4288-93E5-B3628CA12DD3} - {84A589E7-5B41-46E0-81D9-AB72283F2619} = {9064E354-7A64-4288-93E5-B3628CA12DD3} - {AEAA37EF-1D8E-4C51-AF2B-27DB52E2C70C} = {9064E354-7A64-4288-93E5-B3628CA12DD3} - {5E638927-108F-47CB-974C-3F8F4CF7579F} = {9064E354-7A64-4288-93E5-B3628CA12DD3} - {BE462D02-8DE7-4DB3-A2AB-6CED0A6ED4BC} = {9064E354-7A64-4288-93E5-B3628CA12DD3} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {FAB58D66-B3F1-408A-A96F-572170771367} From edfd9417249dca781d37293af2cbe302868fcfd8 Mon Sep 17 00:00:00 2001 From: James Croft Date: Tue, 12 Mar 2024 20:02:12 +0000 Subject: [PATCH 16/21] Remove this. --- .../Elements/AndroidElementWrapper.cs | 10 +-- .../Elements/Core/CheckBox.cs | 8 +- .../Elements/Core/DatePicker.cs | 28 +++---- .../Elements/Core/EditText.cs | 14 ++-- src/Legerity.Android/Elements/Core/Spinner.cs | 12 +-- src/Legerity.Android/Elements/Core/Switch.cs | 8 +- .../Elements/Core/TextView.cs | 2 +- .../Elements/Core/ToggleButton.cs | 8 +- .../Android/AndroidAppManagerOptions.cs | 66 ++++++++--------- src/Legerity.Core/AppManagerOptions.cs | 2 +- src/Legerity.Core/AppiumManagerOptions.cs | 12 +-- src/Legerity.Core/ByAll.cs | 6 +- src/Legerity.Core/ByNested.cs | 6 +- src/Legerity.Core/ElementWrapper{TElement}.cs | 32 ++++---- .../Exceptions/DriverLoadFailedException.cs | 2 +- .../Exceptions/ElementNotShownException.cs | 2 +- .../Exceptions/ElementShownException.cs | 2 +- .../Exceptions/ElementsNotShownException.cs | 2 +- .../Exceptions/PageNotShownException.cs | 2 +- src/Legerity.Core/IOS/IOSAppManagerOptions.cs | 44 +++++------ src/Legerity.Core/LegerityTestClass.cs | 32 ++++---- src/Legerity.Core/Pages/BasePage.cs | 52 ++++++------- src/Legerity.Core/Web/WebAppManagerOptions.cs | 10 +-- .../WinAppDriverLoadFailedException.cs | 2 +- .../WinAppDriverNotFoundException.cs | 2 +- .../Windows/WindowsAppManagerOptions.cs | 20 ++--- src/Legerity.IOS/Elements/Core/Slider.cs | 10 +-- src/Legerity.IOS/Elements/Core/Switch.cs | 8 +- src/Legerity.IOS/Elements/Core/TextField.cs | 14 ++-- .../Elements/IOSElementWrapper.cs | 10 +-- src/Legerity.MADE/DropDownList.cs | 16 ++-- src/Legerity.MADE/InputValidator.cs | 8 +- .../RadAutoCompleteBox.cs | 20 ++--- src/Legerity.Telerik.Uwp/RadBusyIndicator.cs | 2 +- src/Legerity.Telerik.Uwp/RadNumericBox.cs | 22 +++--- src/Legerity.WCT/BladeView.cs | 10 +-- src/Legerity.WCT/BladeViewItem.cs | 12 +-- src/Legerity.WCT/Carousel.cs | 30 ++++---- src/Legerity.WCT/Expander.cs | 10 +-- src/Legerity.WCT/InAppNotification.cs | 6 +- src/Legerity.WCT/RadialGauge.cs | 16 ++-- .../Pages/AzureAdLoginPage.cs | 24 +++--- .../Pages/FacebookLoginPage.cs | 14 ++-- .../Pages/GoogleLoginPage.cs | 20 ++--- src/Legerity.Web/Elements/Core/CheckBox.cs | 10 +-- src/Legerity.Web/Elements/Core/DateInput.cs | 8 +- src/Legerity.Web/Elements/Core/FileInput.cs | 6 +- src/Legerity.Web/Elements/Core/Image.cs | 4 +- src/Legerity.Web/Elements/Core/List.cs | 2 +- src/Legerity.Web/Elements/Core/NumberInput.cs | 16 ++-- src/Legerity.Web/Elements/Core/Option.cs | 6 +- src/Legerity.Web/Elements/Core/RadioButton.cs | 2 +- src/Legerity.Web/Elements/Core/RangeInput.cs | 22 +++--- src/Legerity.Web/Elements/Core/Select.cs | 18 ++--- src/Legerity.Web/Elements/Core/Table.cs | 18 ++--- src/Legerity.Web/Elements/Core/TextArea.cs | 4 +- src/Legerity.Web/Elements/Core/TextInput.cs | 12 +-- .../Elements/WebElementWrapper.cs | 36 ++++----- src/Legerity.WinUI/InfoBar.cs | 14 ++-- src/Legerity.WinUI/MenuBar.cs | 6 +- src/Legerity.WinUI/MenuBarItem.cs | 22 +++--- src/Legerity.WinUI/NavigationView.cs | 34 ++++----- src/Legerity.WinUI/NavigationViewItem.cs | 30 ++++---- src/Legerity.WinUI/NumberBox.cs | 22 +++--- src/Legerity.WinUI/RatingControl.cs | 16 ++-- src/Legerity.WinUI/TabView.cs | 28 +++---- .../Elements/Core/AppBarToggleButton.cs | 8 +- .../Elements/Core/AutoSuggestBox.cs | 24 +++--- .../Elements/Core/CalendarDatePicker.cs | 12 +-- .../Elements/Core/CalendarView.cs | 26 +++---- .../Elements/Core/CheckBox.cs | 8 +- .../Elements/Core/ComboBox.cs | 14 ++-- .../Elements/Core/CommandBar.cs | 24 +++--- .../Elements/Core/DatePicker.cs | 14 ++-- .../Elements/Core/FlipView.cs | 28 +++---- .../Elements/Core/GridView.cs | 18 ++--- src/Legerity.Windows/Elements/Core/Hub.cs | 2 +- .../Core/InkToolbar.ColorFlyoutBase.cs | 16 ++-- .../Elements/Core/InkToolbar.cs | 74 +++++++++---------- src/Legerity.Windows/Elements/Core/ListBox.cs | 12 +-- .../Elements/Core/ListView.cs | 12 +-- .../Elements/Core/MenuFlyoutSubItem.cs | 16 ++-- .../Elements/Core/PasswordBox.cs | 8 +- src/Legerity.Windows/Elements/Core/Pivot.cs | 12 +-- .../Elements/Core/ProgressBar.cs | 2 +- .../Elements/Core/ProgressRing.cs | 2 +- .../Elements/Core/ScrollViewer.cs | 4 +- src/Legerity.Windows/Elements/Core/Slider.cs | 16 ++-- .../Elements/Core/TextBlock.cs | 2 +- src/Legerity.Windows/Elements/Core/TextBox.cs | 8 +- .../Elements/Core/TimePicker.cs | 4 +- .../Elements/Core/ToggleButton.cs | 8 +- .../Elements/Core/ToggleSwitch.cs | 8 +- .../Elements/WindowsElementWrapper.cs | 10 +-- src/Legerity.sln.DotSettings | 4 + .../Pages/W3SchoolsPage.cs | 14 ++-- .../Tests/BaseTestClass.cs | 2 +- tests/Legerity.Core.Tests/Tests/ByAllTests.cs | 8 +- .../Tests/ByNestedTests.cs | 8 +- .../WaitUntilElementIsNotVisibleTests.cs | 8 +- .../Tests/WaitUntilElementIsVisibleTests.cs | 8 +- .../Tests/WebAppManagerOptionsTests.cs | 2 +- .../Pages/BaseNavigationPage.cs | 10 +-- .../Tests/BaseTestClass.cs | 2 +- .../Pages/BaseNavigationPage.cs | 16 ++-- .../Legerity.WCT.Tests/Tests/BaseTestClass.cs | 2 +- tests/Legerity.Web.Tests/Pages/ButtonPage.cs | 4 +- .../Legerity.Web.Tests/Pages/CheckBoxPage.cs | 6 +- .../Legerity.Web.Tests/Pages/DateInputPage.cs | 4 +- .../Legerity.Web.Tests/Pages/FileInputPage.cs | 6 +- tests/Legerity.Web.Tests/Pages/ImagePage.cs | 2 +- tests/Legerity.Web.Tests/Pages/ListPage.cs | 2 +- .../Pages/NumberInputPage.cs | 8 +- tests/Legerity.Web.Tests/Pages/OptionPage.cs | 6 +- .../Pages/RadioButtonPage.cs | 6 +- .../Pages/RangeInputPage.cs | 8 +- tests/Legerity.Web.Tests/Pages/SelectPage.cs | 10 +-- tests/Legerity.Web.Tests/Pages/TablePage.cs | 2 +- .../Legerity.Web.Tests/Pages/TextAreaPage.cs | 8 +- .../Legerity.Web.Tests/Pages/TextInputPage.cs | 8 +- .../Pages/W3SchoolsBasePage.cs | 14 ++-- .../Legerity.Web.Tests/Tests/BaseTestClass.cs | 2 +- tests/Legerity.Web.Tests/Tests/ButtonTests.cs | 2 +- .../Legerity.Web.Tests/Tests/CheckBoxTests.cs | 8 +- .../Tests/DateInputTests.cs | 2 +- .../Tests/FileInputTests.cs | 4 +- tests/Legerity.Web.Tests/Tests/ImageTests.cs | 6 +- tests/Legerity.Web.Tests/Tests/ListTests.cs | 2 +- .../Tests/MultipleSelectTests.cs | 4 +- .../Tests/NumberInputTests.cs | 12 +-- tests/Legerity.Web.Tests/Tests/OptionTests.cs | 4 +- .../Tests/RadioButtonTests.cs | 4 +- .../Tests/RangeInputTests.cs | 12 +-- tests/Legerity.Web.Tests/Tests/SelectTests.cs | 12 +-- tests/Legerity.Web.Tests/Tests/TableTests.cs | 12 +-- .../Legerity.Web.Tests/Tests/TextAreaTests.cs | 8 +- .../Tests/TextInputTests.cs | 6 +- .../Tests/W3SchoolsBaseTestClass.cs | 2 +- .../Tests/WebByExtraTests.cs | 2 +- .../Tests/WebElementWrapperTests.cs | 14 ++-- .../Pages/BaseNavigationPage.cs | 12 +-- .../Legerity.WinUI.Tests/Pages/InfoBarPage.cs | 4 +- .../Legerity.WinUI.Tests/Pages/MenuBarPage.cs | 6 +- .../Pages/NavigationViewPage.cs | 14 ++-- .../Pages/NumberBoxPage.cs | 8 +- .../Pages/RatingControlPage.cs | 4 +- .../Legerity.WinUI.Tests/Pages/TabViewPage.cs | 24 +++--- .../Tests/BaseTestClass.cs | 2 +- .../Tests/InfoBarTests.cs | 10 +-- .../Tests/MenuBarTests.cs | 8 +- .../Tests/NavigationViewTests.cs | 16 ++-- .../Tests/NumberBoxTests.cs | 12 +-- .../Tests/RatingControlTests.cs | 8 +- .../Tests/TabViewTests.cs | 4 +- .../Pages/AppBarButtonPage.cs | 4 +- .../Pages/AppBarToggleButtonPage.cs | 6 +- .../Pages/AutoSuggestBoxPage.cs | 10 +-- .../Pages/BaseNavigationPage.cs | 12 +-- .../Pages/ButtonPage.cs | 4 +- .../Pages/CalendarDatePickerPage.cs | 4 +- .../Pages/CalendarViewPage.cs | 4 +- .../Pages/CheckBoxPage.cs | 12 +-- .../Pages/ComboBoxPage.cs | 6 +- .../Pages/CommandBarPage.cs | 10 +-- .../Pages/DatePickerPage.cs | 4 +- .../Pages/FlipViewPage.cs | 14 ++-- .../Pages/GridViewPage.cs | 8 +- .../Pages/HyperlinkButtonPage.cs | 4 +- .../Pages/InkToolbarPage.cs | 14 ++-- .../Pages/ListBoxPage.cs | 6 +- .../Pages/PasswordBoxPage.cs | 4 +- .../Legerity.Windows.Tests/Pages/PivotPage.cs | 6 +- .../Pages/ProgressBarPage.cs | 8 +- .../Pages/ProgressRingPage.cs | 8 +- .../Pages/RadioButtonPage.cs | 8 +- .../Pages/SliderPage.cs | 6 +- .../Pages/TextBlockPage.cs | 2 +- .../Pages/TextBoxPage.cs | 10 +-- .../Pages/TimePickerPage.cs | 4 +- .../Pages/ToggleSwitchPage.cs | 6 +- .../Tests/AppBarButtonTests.cs | 2 +- .../Tests/AppBarToggleButtonTests.cs | 8 +- .../Tests/AutoSuggestBoxTests.cs | 8 +- .../Tests/BaseTestClass.cs | 2 +- .../Tests/ButtonTests.cs | 2 +- .../Tests/CalendarDatePickerTests.cs | 6 +- .../Tests/CalendarViewTests.cs | 4 +- .../Tests/CheckBoxTests.cs | 10 +-- .../Tests/ComboBoxTests.cs | 4 +- .../Tests/CommandBarTests.cs | 8 +- .../Tests/DatePickerTests.cs | 4 +- .../Tests/FlipViewTests.cs | 8 +- .../Tests/GridViewTests.cs | 8 +- .../Tests/HyperlinkButtonTests.cs | 2 +- .../Tests/InkToolbarTests.cs | 12 +-- .../Tests/ListBoxTests.cs | 4 +- .../Tests/PasswordBoxTests.cs | 2 +- .../Tests/PivotTests.cs | 4 +- .../Tests/ProgressBarTests.cs | 4 +- .../Tests/ProgressRingTests.cs | 6 +- .../Tests/RadioButtonTests.cs | 2 +- .../Tests/SliderTests.cs | 12 +-- .../Tests/TextBlockTests.cs | 2 +- .../Tests/TextBoxTests.cs | 10 +-- .../Tests/TimePickerTests.cs | 4 +- .../Tests/ToggleSwitchTests.cs | 10 +-- .../Android/AxmlPageObjectGenerator.cs | 4 +- .../Models/GeneratorTemplateData.cs | 8 +- .../Features/Generators/Models/UiElement.cs | 10 +-- .../Windows/XamlPageObjectGenerator.cs | 4 +- 210 files changed, 1078 insertions(+), 1074 deletions(-) create mode 100644 src/Legerity.sln.DotSettings diff --git a/src/Legerity.Android/Elements/AndroidElementWrapper.cs b/src/Legerity.Android/Elements/AndroidElementWrapper.cs index e17e1e23..de924d22 100644 --- a/src/Legerity.Android/Elements/AndroidElementWrapper.cs +++ b/src/Legerity.Android/Elements/AndroidElementWrapper.cs @@ -24,7 +24,7 @@ public AndroidElementWrapper(WebElement element) /// /// Gets the instance of the Appium driver for the Android application. /// - public AndroidDriver Driver => this.ElementDriver as AndroidDriver; + public AndroidDriver Driver => ElementDriver as AndroidDriver; /// /// Allows conversion of a to the without direct casting. @@ -55,7 +55,7 @@ protected void VerifyDriverElementShown(By locator, TimeSpan? timeout) { try { - if (this.Driver.FindElement(locator) == null) + if (Driver.FindElement(locator) == null) { throw new ElementNotShownException(locator.ToString()); } @@ -67,7 +67,7 @@ protected void VerifyDriverElementShown(By locator, TimeSpan? timeout) } else { - var wait = new WebDriverWait(this.Driver, timeout.Value); + var wait = new WebDriverWait(Driver, timeout.Value); wait.Until(driver => driver.FindElement(locator) != null); } } @@ -86,14 +86,14 @@ protected void VerifyDriverElementsShown(By locator, TimeSpan? timeout) { if (timeout == null) { - if (this.Driver.FindElements(locator).Count == 0) + if (Driver.FindElements(locator).Count == 0) { throw new ElementsNotShownException(locator.ToString()); } } else { - var wait = new WebDriverWait(this.Driver, timeout.Value); + var wait = new WebDriverWait(Driver, timeout.Value); wait.Until(driver => driver.FindElements(locator).Count != 0); } } diff --git a/src/Legerity.Android/Elements/Core/CheckBox.cs b/src/Legerity.Android/Elements/Core/CheckBox.cs index 38fe6072..c7178f5f 100644 --- a/src/Legerity.Android/Elements/Core/CheckBox.cs +++ b/src/Legerity.Android/Elements/Core/CheckBox.cs @@ -46,12 +46,12 @@ public static implicit operator CheckBox(WebElement element) /// Thrown when an element is no longer valid in the document DOM. public virtual void CheckOn() { - if (this.IsChecked) + if (IsChecked) { return; } - this.Click(); + Click(); } /// @@ -62,11 +62,11 @@ public virtual void CheckOn() /// Thrown when an element is no longer valid in the document DOM. public virtual void CheckOff() { - if (!this.IsChecked) + if (!IsChecked) { return; } - this.Click(); + 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 c1ff80ac..e046b40d 100644 --- a/src/Legerity.Android/Elements/Core/DatePicker.cs +++ b/src/Legerity.Android/Elements/Core/DatePicker.cs @@ -44,7 +44,7 @@ public DatePicker(WebElement element) /// /// /// Thrown when no element matches the expected locator. - public virtual TextView DateTextView => this.FindElement(By.Id("android:id/date_picker_header_date")); + public virtual TextView DateTextView => FindElement(By.Id("android:id/date_picker_header_date")); /// /// Gets the element associated with the year text. @@ -53,32 +53,32 @@ public DatePicker(WebElement element) /// /// /// Thrown when no element matches the expected locator. - public virtual TextView YearTextView => this.FindElement(By.Id("android:id/date_picker_header_year")); + public virtual TextView YearTextView => FindElement(By.Id("android:id/date_picker_header_year")); /// /// Gets the element associated with the day picker. /// /// Thrown when no element matches the expected locator. - public virtual View DayPickerView => this.FindElement(By.Id("android:id/day_picker_view_pager")); + public virtual View DayPickerView => FindElement(By.Id("android:id/day_picker_view_pager")); /// /// Gets the element associated with the next month button. /// /// Thrown when no element matches the expected locator. - public virtual Button NextMonthButton => this.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 => this.Element.FindElementByAndroidUIAutomator("UiSelector().description(\"Previous month\")"); + public virtual Button PreviousMonthButton => Element.FindElementByAndroidUIAutomator("UiSelector().description(\"Previous month\")"); /// /// Gets the selected date/time value. /// /// Thrown when an element is no longer valid in the document DOM. /// Thrown when no element matches the expected locator. - public virtual DateTime SelectedDate => this.GetCurrentViewDate(); + public virtual DateTime SelectedDate => GetCurrentViewDate(); /// /// Allows conversion of a to the without direct casting. @@ -104,7 +104,7 @@ public static implicit operator DatePicker(WebElement element) /// Thrown when no element matches the expected locator. public virtual void SetDate(DateTime date) { - DateTime currentViewDate = this.GetCurrentViewDate(); + DateTime currentViewDate = GetCurrentViewDate(); int monthDifference = ((date.Year - currentViewDate.Year) * 12) + date.Month - currentViewDate.Month; @@ -112,18 +112,18 @@ public virtual void SetDate(DateTime date) { for (int i = 0; i < monthDifference; i++) { - this.NextMonthButton.Click(); + NextMonthButton.Click(); } } else { for (int i = 0; i < Math.Abs(monthDifference); i++) { - this.PreviousMonthButton.Click(); + PreviousMonthButton.Click(); } } - View item = this.DayPickerView.Element.FindElementByAndroidUIAutomator($"UiSelector().text(\"{date.Day}\")"); + View item = DayPickerView.Element.FindElementByAndroidUIAutomator($"UiSelector().text(\"{date.Day}\")"); item.Click(); } @@ -131,9 +131,9 @@ public virtual void SetDate(DateTime date) /// Thrown when an element is no longer valid in the document DOM. private DateTime GetCurrentViewDate() { - string currentYear = this.YearTextView.Text; - string currentDate = this.DateTextView.Text; - return this.GetCurrentViewDate(currentDate, currentYear); + string currentYear = YearTextView.Text; + string currentDate = DateTextView.Text; + return GetCurrentViewDate(currentDate, currentYear); } private DateTime GetCurrentViewDate(string currentDate, string currentYear) @@ -143,7 +143,7 @@ private DateTime GetCurrentViewDate(string currentDate, string currentYear) var currentDateSplit = currentDate.Split(',').ToList(); string currentMonthPart = currentDateSplit.LastOrDefault(); - this.months.TryGetValue( + months.TryGetValue( string.Join(string.Empty, (currentMonthPart ?? string.Empty).Where(char.IsLetter)).Trim(), out string month); diff --git a/src/Legerity.Android/Elements/Core/EditText.cs b/src/Legerity.Android/Elements/Core/EditText.cs index af00881d..b924d1f8 100644 --- a/src/Legerity.Android/Elements/Core/EditText.cs +++ b/src/Legerity.Android/Elements/Core/EditText.cs @@ -17,7 +17,7 @@ public EditText(WebElement element) /// /// Gets the text value of the text box. /// - public virtual string Text => this.Element.Text; + public virtual string Text => Element.Text; /// /// Allows conversion of a to the without direct casting. @@ -42,8 +42,8 @@ public static implicit operator EditText(WebElement element) /// Thrown when an element is not visible. public virtual void SetText(string text) { - this.ClearText(); - this.AppendText(text); + ClearText(); + AppendText(text); } /// @@ -55,8 +55,8 @@ public virtual void SetText(string text) /// Thrown when an element is no longer valid in the document DOM. public virtual void AppendText(string text) { - this.Click(); - this.Element.SendKeys(text); + Click(); + Element.SendKeys(text); } /// @@ -67,7 +67,7 @@ public virtual void AppendText(string text) /// Thrown when an element is no longer valid in the document DOM. public virtual void ClearText() { - this.Click(); - this.Element.Clear(); + Click(); + Element.Clear(); } } \ 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 95aafe09..732bb0eb 100644 --- a/src/Legerity.Android/Elements/Core/Spinner.cs +++ b/src/Legerity.Android/Elements/Core/Spinner.cs @@ -20,7 +20,7 @@ public Spinner(WebElement element) /// Gets the currently selected item. /// /// Thrown when no element matches the expected locator. - public virtual string SelectedItem => this.GetSelectedItem(); + public virtual string SelectedItem => GetSelectedItem(); /// /// Allows conversion of a to the without direct casting. @@ -48,12 +48,12 @@ public static implicit operator Spinner(WebElement element) /// Thrown when no element matches the expected locator. public virtual void SelectItem(string name) { - this.Click(); + Click(); var locator = new ByAndroidUIAutomator( $"new UiScrollable(new UiSelector()).scrollIntoView(new UiSelector().text(\"{name}\"));"); - WebElement item = this.Driver.FindElement(locator); + WebElement item = Driver.FindElement(locator); item.Click(); } @@ -68,12 +68,12 @@ public virtual void SelectItem(string name) /// Thrown when no element matches the expected locator. public virtual void SelectItemByPartialName(string partialName) { - this.Click(); + Click(); var locator = new ByAndroidUIAutomator( $"new UiScrollable(new UiSelector()).scrollIntoView(new UiSelector().textContains(\"{partialName}\"));"); - WebElement item = this.Driver.FindElement(locator); + WebElement item = Driver.FindElement(locator); item.Click(); } @@ -81,7 +81,7 @@ public virtual void SelectItemByPartialName(string partialName) /// Thrown when no element matches the expected locator. private string GetSelectedItem() { - TextView textElement = this.FindElement(By.ClassName("android.widget.TextView")); + 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 753d0264..fa623064 100644 --- a/src/Legerity.Android/Elements/Core/Switch.cs +++ b/src/Legerity.Android/Elements/Core/Switch.cs @@ -46,12 +46,12 @@ public static implicit operator Switch(WebElement element) /// Thrown when an element is no longer valid in the document DOM. public virtual void ToggleOn() { - if (this.IsOn) + if (IsOn) { return; } - this.Click(); + Click(); } /// @@ -62,11 +62,11 @@ public virtual void ToggleOn() /// Thrown when an element is no longer valid in the document DOM. public virtual void ToggleOff() { - if (!this.IsOn) + if (!IsOn) { return; } - this.Click(); + 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 71b11484..19e3b8e7 100644 --- a/src/Legerity.Android/Elements/Core/TextView.cs +++ b/src/Legerity.Android/Elements/Core/TextView.cs @@ -20,7 +20,7 @@ public TextView(WebElement element) /// Gets the text value of the text view. /// /// Thrown when an element is no longer valid in the document DOM. - public virtual string Text => this.Element.Text; + public virtual string Text => Element.Text; /// /// Allows conversion of a to the without direct casting. diff --git a/src/Legerity.Android/Elements/Core/ToggleButton.cs b/src/Legerity.Android/Elements/Core/ToggleButton.cs index 65f4734e..0603fb5d 100644 --- a/src/Legerity.Android/Elements/Core/ToggleButton.cs +++ b/src/Legerity.Android/Elements/Core/ToggleButton.cs @@ -46,12 +46,12 @@ public static implicit operator ToggleButton(WebElement element) /// Thrown when an element is no longer valid in the document DOM. public virtual void ToggleOn() { - if (this.IsOn) + if (IsOn) { return; } - this.Click(); + Click(); } /// @@ -62,11 +62,11 @@ public virtual void ToggleOn() /// Thrown when an element is no longer valid in the document DOM. public virtual void ToggleOff() { - if (!this.IsOn) + if (!IsOn) { return; } - this.Click(); + Click(); } } \ No newline at end of file diff --git a/src/Legerity.Core/Android/AndroidAppManagerOptions.cs b/src/Legerity.Core/Android/AndroidAppManagerOptions.cs index dafc1501..1cea94ad 100644 --- a/src/Legerity.Core/Android/AndroidAppManagerOptions.cs +++ b/src/Legerity.Core/Android/AndroidAppManagerOptions.cs @@ -112,13 +112,13 @@ public AndroidAppManagerOptions( string deviceId, params (string, object)[] additionalOptions) { - this.AppId = appId; - this.AppActivity = appActivity; - this.AppPath = appPath; - this.OSVersion = osVersion; - this.DeviceName = deviceName; - this.DeviceId = deviceId; - this.AdditionalOptions = additionalOptions; + AppId = appId; + AppActivity = appActivity; + AppPath = appPath; + OSVersion = osVersion; + DeviceName = deviceName; + DeviceId = deviceId; + AdditionalOptions = additionalOptions; } /// @@ -163,36 +163,36 @@ public override void Configure() { base.Configure(); - this.AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.PlatformName, "Android"); + AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.PlatformName, "Android"); - if (!string.IsNullOrWhiteSpace(this.OSVersion)) + if (!string.IsNullOrWhiteSpace(OSVersion)) { - this.AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.PlatformVersion, this.OSVersion); + AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.PlatformVersion, OSVersion); } - if (!string.IsNullOrWhiteSpace(this.DeviceName)) + if (!string.IsNullOrWhiteSpace(DeviceName)) { - this.AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.DeviceName, this.DeviceName); + AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.DeviceName, DeviceName); } - if (!string.IsNullOrWhiteSpace(this.DeviceId)) + if (!string.IsNullOrWhiteSpace(DeviceId)) { - this.AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.Udid, this.DeviceId); + AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.Udid, DeviceId); } - if (!string.IsNullOrWhiteSpace(this.AppId)) + if (!string.IsNullOrWhiteSpace(AppId)) { - this.AppiumOptions.AddAdditionalAppiumOption("appPackage", this.AppId); + AppiumOptions.AddAdditionalAppiumOption("appPackage", AppId); } - if (!string.IsNullOrWhiteSpace(this.AppActivity)) + if (!string.IsNullOrWhiteSpace(AppActivity)) { - this.AppiumOptions.AddAdditionalAppiumOption("appActivity", this.AppActivity); + AppiumOptions.AddAdditionalAppiumOption("appActivity", AppActivity); } - if (!string.IsNullOrWhiteSpace(this.AppPath)) + if (!string.IsNullOrWhiteSpace(AppPath)) { - this.AppiumOptions.AddAdditionalAppiumOption("app", this.AppPath); + AppiumOptions.AddAdditionalAppiumOption("app", AppPath); } } @@ -204,44 +204,44 @@ public override void Configure() /// public void Configure((string, object)[] additionalOptions) { - this.AdditionalOptions = additionalOptions; - this.Configure(); + AdditionalOptions = additionalOptions; + Configure(); } /// Returns a string that represents the current object. /// A string that represents the current object. public override string ToString() { - return $"Platform [Android], {base.ToString()}, {this.GetOptionDetails()}"; + return $"Platform [Android], {base.ToString()}, {GetOptionDetails()}"; } private string GetOptionDetails() { var options = new List(); - if (!string.IsNullOrWhiteSpace(this.AppId)) + if (!string.IsNullOrWhiteSpace(AppId)) { - options.Add($"App ID [{this.AppId}]"); + options.Add($"App ID [{AppId}]"); } - if (!string.IsNullOrWhiteSpace(this.AppPath)) + if (!string.IsNullOrWhiteSpace(AppPath)) { - options.Add($"App Path [{this.AppPath}]"); + options.Add($"App Path [{AppPath}]"); } - if (!string.IsNullOrWhiteSpace(this.DeviceId)) + if (!string.IsNullOrWhiteSpace(DeviceId)) { - options.Add($"Device ID [{this.DeviceId}]"); + options.Add($"Device ID [{DeviceId}]"); } - if (!string.IsNullOrWhiteSpace(this.DeviceName)) + if (!string.IsNullOrWhiteSpace(DeviceName)) { - options.Add($"Device Name [{this.DeviceName}]"); + options.Add($"Device Name [{DeviceName}]"); } - if (this.AdditionalOptions != null) + if (AdditionalOptions != null) { - foreach ((string name, object value) in this.AdditionalOptions) + foreach ((string name, object value) in AdditionalOptions) { options.Add($"{name} [{value}]"); } diff --git a/src/Legerity.Core/AppManagerOptions.cs b/src/Legerity.Core/AppManagerOptions.cs index bb883cdf..34a7a69c 100644 --- a/src/Legerity.Core/AppManagerOptions.cs +++ b/src/Legerity.Core/AppManagerOptions.cs @@ -32,6 +32,6 @@ public abstract class AppManagerOptions /// A string that represents the current object. public override string ToString() { - return $"Driver URI [{this.DriverUri}]"; + 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 d7d14df5..2ebd39f3 100644 --- a/src/Legerity.Core/AppiumManagerOptions.cs +++ b/src/Legerity.Core/AppiumManagerOptions.cs @@ -21,8 +21,8 @@ public abstract class AppiumManagerOptions : AppManagerOptions /// public AppiumOptions AppiumOptions { - get => this.DriverOptions as AppiumOptions; - set => this.DriverOptions = value; + get => DriverOptions as AppiumOptions; + set => DriverOptions = value; } /// @@ -30,16 +30,16 @@ public AppiumOptions AppiumOptions /// public virtual void Configure() { - this.AppiumOptions = new AppiumOptions(); + AppiumOptions = new AppiumOptions(); - if (this.AdditionalOptions == null) + if (AdditionalOptions == null) { return; } - foreach ((string capabilityName, object capabilityValue) in this.AdditionalOptions) + foreach ((string capabilityName, object capabilityValue) in AdditionalOptions) { - this.AppiumOptions.AddAdditionalAppiumOption(capabilityName, capabilityValue); + AppiumOptions.AddAdditionalAppiumOption(capabilityName, capabilityValue); } } } \ No newline at end of file diff --git a/src/Legerity.Core/ByAll.cs b/src/Legerity.Core/ByAll.cs index df79708f..4feeba4b 100644 --- a/src/Legerity.Core/ByAll.cs +++ b/src/Legerity.Core/ByAll.cs @@ -35,7 +35,7 @@ public ByAll(params By[] locators) /// Thrown when no element matches the expected locator. public override IWebElement FindElement(ISearchContext context) { - ReadOnlyCollection elements = this.FindElements(context); + ReadOnlyCollection elements = FindElements(context); if (elements.Count == 0) { throw new NoSuchElementException($"No element could be located using locator: {this}"); @@ -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 (this.locators.Length == 0) + if (locators.Length == 0) { return new List().AsReadOnly(); } IEnumerable elements = null; - foreach (By locator in this.locators) + foreach (By locator in locators) { ReadOnlyCollection foundElements = locator.FindElements(context); if (foundElements.Count == 0) diff --git a/src/Legerity.Core/ByNested.cs b/src/Legerity.Core/ByNested.cs index 49704489..a8c25874 100644 --- a/src/Legerity.Core/ByNested.cs +++ b/src/Legerity.Core/ByNested.cs @@ -32,7 +32,7 @@ public ByNested(params By[] locators) /// Thrown when no element matches the expected locator. public override IWebElement FindElement(ISearchContext context) { - ReadOnlyCollection elements = this.FindElements(context); + ReadOnlyCollection elements = FindElements(context); if (elements.Count == 0) { throw new NoSuchElementException($"No element could be located using locator: {this}"); @@ -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 (this.locators.Length == 0) + if (locators.Length == 0) { return new List().AsReadOnly(); } IEnumerable elements = null; - foreach (By locator in this.locators) + foreach (By locator in locators) { var nestedElements = new List(); diff --git a/src/Legerity.Core/ElementWrapper{TElement}.cs b/src/Legerity.Core/ElementWrapper{TElement}.cs index e66a5d7b..ebb83c7e 100644 --- a/src/Legerity.Core/ElementWrapper{TElement}.cs +++ b/src/Legerity.Core/ElementWrapper{TElement}.cs @@ -24,31 +24,31 @@ public abstract class ElementWrapper : IElementWrapper /// protected ElementWrapper(TElement element) { - this.elementReference = new WeakReference(element); + elementReference = new WeakReference(element); } /// Gets the original reference object. public TElement Element => - this.elementReference is { IsAlive: true } - ? this.elementReference.Target as TElement + elementReference is { IsAlive: true } + ? elementReference.Target as TElement : null; /// /// Gets the driver used to find this element. /// - public IWebDriver ElementDriver => this.Element.WrappedDriver; + public IWebDriver ElementDriver => Element.WrappedDriver; /// /// Gets a value indicating whether the element is visible. /// /// Thrown when an element is no longer valid in the document DOM. - public virtual bool IsVisible => this.Element.Displayed; + public virtual bool IsVisible => Element.Displayed; /// /// Gets a value indicating whether the element is enabled. /// /// Thrown when an element is no longer valid in the document DOM. - public virtual bool IsEnabled => this.Element.Enabled; + public virtual bool IsEnabled => Element.Enabled; /// /// Clicks the element. @@ -58,7 +58,7 @@ protected ElementWrapper(TElement element) /// Thrown when an element is no longer valid in the document DOM. public virtual void Click() { - this.Element.Click(); + Element.Click(); } /// @@ -69,7 +69,7 @@ public virtual void Click() /// Thrown when an element is no longer valid in the document DOM. public string GetAttribute(string attributeName) { - return this.Element.GetAttribute(attributeName); + return Element.GetAttribute(attributeName); } /// @@ -80,7 +80,7 @@ public string GetAttribute(string attributeName) /// Thrown when no element matches the expected locator. public WebElement FindElement(By locator) { - return this.Element.FindElement(locator) as WebElement; + return Element.FindElement(locator) as WebElement; } /// @@ -95,7 +95,7 @@ public void VerifyElementNotShown(By locator) { try { - this.VerifyElementShown(locator); + VerifyElementShown(locator); throw new ElementShownException(locator.ToString()); } catch (ElementNotShownException) @@ -113,7 +113,7 @@ public void VerifyElementNotShown(By locator) /// Thrown when no element matches the expected locator. public void VerifyElementShown(By locator) { - this.VerifyElementShown(locator, null); + VerifyElementShown(locator, null); } /// @@ -131,7 +131,7 @@ public void VerifyElementShown(By locator, TimeSpan? timeout) { try { - if (this.Element.FindElement(locator) == null) + if (Element.FindElement(locator) == null) { throw new ElementNotShownException(locator.ToString()); } @@ -143,7 +143,7 @@ public void VerifyElementShown(By locator, TimeSpan? timeout) } else { - var wait = new WebDriverWait(this.Element.WrappedDriver, timeout.Value); + var wait = new WebDriverWait(Element.WrappedDriver, timeout.Value); wait.Until(driver => driver.FindElement(locator) != null); } } @@ -157,7 +157,7 @@ public void VerifyElementShown(By locator, TimeSpan? timeout) /// Thrown when no elements are shown for the expected locator. public void VerifyElementsShown(By locator) { - this.VerifyElementsShown(locator, null); + VerifyElementsShown(locator, null); } /// @@ -174,14 +174,14 @@ public void VerifyElementsShown(By locator, TimeSpan? timeout) { if (timeout == null) { - if (this.Element.FindElements(locator).Count == 0) + if (Element.FindElements(locator).Count == 0) { throw new ElementsNotShownException(locator.ToString()); } } else { - var wait = new WebDriverWait(this.Element.WrappedDriver, timeout.Value); + var wait = new WebDriverWait(Element.WrappedDriver, timeout.Value); wait.Until(driver => driver.FindElements(locator).Count != 0); } } diff --git a/src/Legerity.Core/Exceptions/DriverLoadFailedException.cs b/src/Legerity.Core/Exceptions/DriverLoadFailedException.cs index 6da7f8ec..1ecc57a4 100644 --- a/src/Legerity.Core/Exceptions/DriverLoadFailedException.cs +++ b/src/Legerity.Core/Exceptions/DriverLoadFailedException.cs @@ -28,7 +28,7 @@ internal DriverLoadFailedException(AppManagerOptions opts) internal DriverLoadFailedException(AppManagerOptions opts, Exception innerException) : base($"The application driver could not be initialized with the specified app manager options: {opts}", innerException) { - this.AppManagerOptions = opts; + AppManagerOptions = opts; } /// diff --git a/src/Legerity.Core/Exceptions/ElementNotShownException.cs b/src/Legerity.Core/Exceptions/ElementNotShownException.cs index c233efe4..3f626048 100644 --- a/src/Legerity.Core/Exceptions/ElementNotShownException.cs +++ b/src/Legerity.Core/Exceptions/ElementNotShownException.cs @@ -28,7 +28,7 @@ public ElementNotShownException(string locator) public ElementNotShownException(string locator, Exception innerException) : base($"No element could be located using locator: {locator}", innerException) { - this.Locator = locator; + Locator = locator; } /// diff --git a/src/Legerity.Core/Exceptions/ElementShownException.cs b/src/Legerity.Core/Exceptions/ElementShownException.cs index bdb44c2a..2e0ab000 100644 --- a/src/Legerity.Core/Exceptions/ElementShownException.cs +++ b/src/Legerity.Core/Exceptions/ElementShownException.cs @@ -28,7 +28,7 @@ public ElementShownException(string locator) public ElementShownException(string locator, Exception innerException) : base($"An element was located using locator: {locator}", innerException) { - this.Locator = locator; + Locator = locator; } /// diff --git a/src/Legerity.Core/Exceptions/ElementsNotShownException.cs b/src/Legerity.Core/Exceptions/ElementsNotShownException.cs index 705402ba..0cd5d806 100644 --- a/src/Legerity.Core/Exceptions/ElementsNotShownException.cs +++ b/src/Legerity.Core/Exceptions/ElementsNotShownException.cs @@ -28,7 +28,7 @@ public ElementsNotShownException(string locator) public ElementsNotShownException(string locator, Exception innerException) : base($"No elements could be located using locator: {locator}", innerException) { - this.Locator = locator; + Locator = locator; } /// diff --git a/src/Legerity.Core/Exceptions/PageNotShownException.cs b/src/Legerity.Core/Exceptions/PageNotShownException.cs index 38f25a50..1e999081 100644 --- a/src/Legerity.Core/Exceptions/PageNotShownException.cs +++ b/src/Legerity.Core/Exceptions/PageNotShownException.cs @@ -14,7 +14,7 @@ public class PageNotShownException : LegerityException internal PageNotShownException(string pageName) : base($"No page could be located for page: {pageName}") { - this.PageName = pageName; + PageName = pageName; } /// diff --git a/src/Legerity.Core/IOS/IOSAppManagerOptions.cs b/src/Legerity.Core/IOS/IOSAppManagerOptions.cs index a2fab020..aaac2ca1 100644 --- a/src/Legerity.Core/IOS/IOSAppManagerOptions.cs +++ b/src/Legerity.Core/IOS/IOSAppManagerOptions.cs @@ -61,11 +61,11 @@ public IOSAppManagerOptions( string deviceId, params (string, object)[] additionalOptions) { - this.AppId = appId; - this.OSVersion = osVersion; - this.DeviceName = deviceName; - this.DeviceId = deviceId; - this.AdditionalOptions = additionalOptions; + AppId = appId; + OSVersion = osVersion; + DeviceName = deviceName; + DeviceId = deviceId; + AdditionalOptions = additionalOptions; } /// @@ -108,12 +108,12 @@ public override void Configure() { base.Configure(); - this.AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.PlatformName, "iOS"); - this.AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.PlatformVersion, this.OSVersion); - this.AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.DeviceName, this.DeviceName); - this.AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.Udid, this.DeviceId); - this.AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.App, this.AppId); - this.AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.AutomationName, this.AutomationName); + AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.PlatformName, "iOS"); + AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.PlatformVersion, OSVersion); + AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.DeviceName, DeviceName); + AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.Udid, DeviceId); + AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.App, AppId); + AppiumOptions.AddAdditionalAppiumOption(MobileCapabilityType.AutomationName, AutomationName); } /// @@ -124,39 +124,39 @@ public override void Configure() /// public void Configure((string, object)[] additionalOptions) { - this.AdditionalOptions = additionalOptions; - this.Configure(); + AdditionalOptions = additionalOptions; + Configure(); } /// Returns a string that represents the current object. /// A string that represents the current object. public override string ToString() { - return $"Platform [IOS], {base.ToString()}, {this.GetOptionDetails()}"; + return $"Platform [IOS], {base.ToString()}, {GetOptionDetails()}"; } private string GetOptionDetails() { var options = new List(); - if (!string.IsNullOrWhiteSpace(this.AppId)) + if (!string.IsNullOrWhiteSpace(AppId)) { - options.Add($"App ID [{this.AppId}]"); + options.Add($"App ID [{AppId}]"); } - if (!string.IsNullOrWhiteSpace(this.DeviceId)) + if (!string.IsNullOrWhiteSpace(DeviceId)) { - options.Add($"Device ID [{this.DeviceId}]"); + options.Add($"Device ID [{DeviceId}]"); } - if (!string.IsNullOrWhiteSpace(this.DeviceName)) + if (!string.IsNullOrWhiteSpace(DeviceName)) { - options.Add($"Device Name [{this.DeviceName}]"); + options.Add($"Device Name [{DeviceName}]"); } - if (this.AdditionalOptions != null) + if (AdditionalOptions != null) { - foreach ((string name, object value) in this.AdditionalOptions) + foreach ((string name, object value) in AdditionalOptions) { options.Add($"{name} [{value}]"); } diff --git a/src/Legerity.Core/LegerityTestClass.cs b/src/Legerity.Core/LegerityTestClass.cs index 4a807c7b..3c2f9276 100644 --- a/src/Legerity.Core/LegerityTestClass.cs +++ b/src/Legerity.Core/LegerityTestClass.cs @@ -15,7 +15,7 @@ namespace Legerity; /// public abstract class LegerityTestClass { - private readonly List apps = new(); + private readonly List _apps = new(); /// /// Initializes a new instance of the class. @@ -33,7 +33,7 @@ protected LegerityTestClass() /// The application launch options. protected LegerityTestClass(AppManagerOptions options) { - this.Options = options; + Options = options; } /// @@ -53,7 +53,7 @@ protected LegerityTestClass(AppManagerOptions options) /// /// This is useful for accessing drivers in parallelized tests. /// - protected IReadOnlyCollection Apps => this.apps; + protected IReadOnlyCollection Apps => _apps; /// /// Gets or sets the model that represents the configuration options for the . @@ -85,7 +85,7 @@ public virtual WebDriver StartApp( TimeSpan? waitUntilTimeout = default, int waitUntilRetries = 0) { - return this.StartApp(this.Options, waitUntil, waitUntilTimeout, waitUntilRetries); + return StartApp(Options, waitUntil, waitUntilTimeout, waitUntilRetries); } /// @@ -120,14 +120,14 @@ public virtual WebDriver StartApp( TimeSpan? waitUntilTimeout = default, int waitUntilRetries = 0) { - if (options != default && this.Options != options) + if (options != default && Options != options) { - this.Options = options; + Options = options; } - WebDriver app = AppManager.StartApp(this.Options, waitUntil, waitUntilTimeout, waitUntilRetries); - this.App = app; - this.apps.Add(app); + WebDriver app = AppManager.StartApp(Options, waitUntil, waitUntilTimeout, waitUntilRetries); + App = app; + _apps.Add(app); return app; } @@ -136,7 +136,7 @@ public virtual WebDriver StartApp( /// public virtual void StopApp() { - this.StopApp(true); + StopApp(true); } /// @@ -147,7 +147,7 @@ public virtual void StopApp() /// public virtual void StopApp(bool stopServer) { - this.StopApp(this.App, stopServer); + StopApp(App, stopServer); } /// @@ -161,7 +161,7 @@ public virtual void StopApp(bool stopServer) /// public virtual void StopApp(WebDriver app, bool stopServer = false) { - this.StopAppManagerApp(app, stopServer, true); + StopAppManagerApp(app, stopServer, true); } /// @@ -172,17 +172,17 @@ public virtual void StopApp(WebDriver app, bool stopServer = false) /// public virtual void StopApps(bool stopServer = true) { - this.apps.ForEach(app => this.StopAppManagerApp(app, stopServer, false)); - this.apps.Clear(); + _apps.ForEach(app => StopAppManagerApp(app, stopServer, false)); + _apps.Clear(); } private void StopAppManagerApp(WebDriver app, bool stopServer, bool removeApp) { if (removeApp) { - this.apps.Remove(app); + _apps.Remove(app); } AppManager.StopApp(app, stopServer); } -} \ No newline at end of file +} diff --git a/src/Legerity.Core/Pages/BasePage.cs b/src/Legerity.Core/Pages/BasePage.cs index 47be0ead..1c10a427 100644 --- a/src/Legerity.Core/Pages/BasePage.cs +++ b/src/Legerity.Core/Pages/BasePage.cs @@ -68,9 +68,9 @@ protected BasePage(TimeSpan? traitTimeout) /// Thrown when no element matches the expected locator. protected BasePage(WebDriver app, TimeSpan? traitTimeout) { - this.App = app; - this.WaitTimeout = traitTimeout ?? TimeSpan.FromSeconds(2); - this.VerifyPageShown(this.WaitTimeout); + App = app; + WaitTimeout = traitTimeout ?? TimeSpan.FromSeconds(2); + VerifyPageShown(WaitTimeout); } /// @@ -92,22 +92,22 @@ protected BasePage(WebDriver app, TimeSpan? traitTimeout) /// /// Gets the instance of the started Windows application. /// - protected WindowsDriver WindowsApp => this.App as WindowsDriver; + protected WindowsDriver WindowsApp => App as WindowsDriver; /// /// Gets the instance of the started Android application. /// - protected AndroidDriver AndroidApp => this.App as AndroidDriver; + protected AndroidDriver AndroidApp => App as AndroidDriver; /// /// Gets the instance of the started iOS application. /// - protected IOSDriver IOSApp => this.App as IOSDriver; + protected IOSDriver IOSApp => App as IOSDriver; /// /// Gets the instance of the started web application. /// - protected WebDriver WebApp => this.App; + protected WebDriver WebApp => App; /// /// Gets a given trait of the page to verify that the page is in view. @@ -122,7 +122,7 @@ protected BasePage(WebDriver app, TimeSpan? traitTimeout) /// Thrown when no element matches the expected locator. public WebElement FindElement(By locator) { - return this.App.FindWebElement(locator); + return App.FindWebElement(locator); } /// @@ -132,7 +132,7 @@ public WebElement FindElement(By locator) /// A readonly collection of . public ReadOnlyCollection FindElements(By locator) { - return this.App.FindWebElements(locator); + return App.FindWebElements(locator); } /// @@ -143,7 +143,7 @@ public ReadOnlyCollection FindElements(By locator) /// Thrown when no element matches the expected locator. public WebElement FindElementByXPath(string xpath) { - return this.App.FindElementByXPath(xpath); + return App.FindElementByXPath(xpath); } /// @@ -153,7 +153,7 @@ public WebElement FindElementByXPath(string xpath) /// A readonly collection of . public ReadOnlyCollection FindElementsByXPath(string xpath) { - return this.App.FindElementsByXPath(xpath); + return App.FindElementsByXPath(xpath); } /// @@ -164,7 +164,7 @@ public ReadOnlyCollection FindElementsByXPath(string xpath) /// Thrown when no element matches the expected locator. public WebElement FindElementById(string id) { - return this.App.FindElementById(id); + return App.FindElementById(id); } /// @@ -175,7 +175,7 @@ public WebElement FindElementById(string id) /// Thrown when no element matches the expected locator. public WebElement FindElementByName(string name) { - return this.App.FindElementByName(name); + return App.FindElementByName(name); } /// @@ -186,7 +186,7 @@ public WebElement FindElementByName(string name) /// Thrown when no element matches the expected locator. public void VerifyPageShown() { - this.VerifyPageShown(null); + VerifyPageShown(null); } /// @@ -200,7 +200,7 @@ public void VerifyPageShown() /// Thrown when no element matches the expected locator. public void VerifyPageShown(TimeSpan? timeout) { - if (this.App == null) + if (App == null) { throw new DriverNotInitializedException( $"An app driver has not been initialized. Call 'AppManager.StartApp()' with an instance of an {nameof(AppManagerOptions)} to setup for testing."); @@ -208,16 +208,16 @@ public void VerifyPageShown(TimeSpan? timeout) if (timeout == null) { - if (this.App != null && this.App.FindElement(this.Trait) == null) + if (App != null && App.FindElement(Trait) == null) { - throw new PageNotShownException(this.GetType().Name); + throw new PageNotShownException(GetType().Name); } } else { - if (this.App != null) + if (App != null) { - AttemptWaitForDriverElement(this.Trait, timeout.Value, this.App); + AttemptWaitForDriverElement(Trait, timeout.Value, App); } } } @@ -233,7 +233,7 @@ public void VerifyPageShown(TimeSpan? timeout) /// Thrown when no element matches the expected locator. public void VerifyElementShown(By locator) { - this.VerifyElementShown(locator, null); + VerifyElementShown(locator, null); } /// @@ -250,7 +250,7 @@ public void VerifyElementShown(By locator) /// Thrown when no element matches the expected locator. public void VerifyElementShown(By locator, TimeSpan? timeout) { - if (this.App == null) + if (App == null) { throw new DriverNotInitializedException( $"An app driver has not been initialized. Call 'AppManager.StartApp()' with an instance of an {nameof(AppManagerOptions)} to setup for testing."); @@ -258,16 +258,16 @@ public void VerifyElementShown(By locator, TimeSpan? timeout) if (timeout == null) { - if (this.App != null && this.App.FindElement(locator) == null) + if (App != null && App.FindElement(locator) == null) { throw new ElementNotShownException(locator.ToString()); } } else { - if (this.App != null) + if (App != null) { - AttemptWaitForDriverElement(locator, timeout.Value, this.App); + AttemptWaitForDriverElement(locator, timeout.Value, App); } } } @@ -281,7 +281,7 @@ public void VerifyElementShown(By locator, TimeSpan? timeout) /// Thrown when AppManager.StartApp() has not been called. public void VerifyElementNotShown(By locator) { - if (this.App == null) + if (App == null) { throw new DriverNotInitializedException( $"An app driver has not been initialized. Call 'AppManager.StartApp()' with an instance of an {nameof(AppManagerOptions)} to setup for testing."); @@ -289,7 +289,7 @@ public void VerifyElementNotShown(By locator) try { - this.VerifyElementShown(locator); + VerifyElementShown(locator); } catch (ElementNotShownException) { diff --git a/src/Legerity.Core/Web/WebAppManagerOptions.cs b/src/Legerity.Core/Web/WebAppManagerOptions.cs index aac6faac..21ed6ab6 100644 --- a/src/Legerity.Core/Web/WebAppManagerOptions.cs +++ b/src/Legerity.Core/Web/WebAppManagerOptions.cs @@ -22,8 +22,8 @@ public WebAppManagerOptions() /// The path to the web application driver directory. public WebAppManagerOptions(WebAppDriverType driverType, string driverDirectoryPath) { - this.DriverType = driverType; - this.DriverUri = driverDirectoryPath; + DriverType = driverType; + DriverUri = driverDirectoryPath; } /// @@ -56,16 +56,16 @@ public WebAppManagerOptions(WebAppDriverType driverType, string driverDirectoryP /// A string that represents the current object. public override string ToString() { - return $"Platform [{this.DriverType}], {base.ToString()}, {this.GetOptionDetails()}"; + return $"Platform [{DriverType}], {base.ToString()}, {GetOptionDetails()}"; } private string GetOptionDetails() { var options = new List(); - if (!string.IsNullOrWhiteSpace(this.Url)) + if (!string.IsNullOrWhiteSpace(Url)) { - options.Add($"URL [{this.Url}]"); + options.Add($"URL [{Url}]"); } return string.Join(", ", options); diff --git a/src/Legerity.Core/Windows/Exceptions/WinAppDriverLoadFailedException.cs b/src/Legerity.Core/Windows/Exceptions/WinAppDriverLoadFailedException.cs index 0f4a5760..0e60812a 100644 --- a/src/Legerity.Core/Windows/Exceptions/WinAppDriverLoadFailedException.cs +++ b/src/Legerity.Core/Windows/Exceptions/WinAppDriverLoadFailedException.cs @@ -15,7 +15,7 @@ public class WinAppDriverLoadFailedException : LegerityException internal WinAppDriverLoadFailedException(string path, Exception exception) : base($"The WinAppDriver could not be loaded at {path}.", exception) { - this.Path = path; + Path = path; } /// diff --git a/src/Legerity.Core/Windows/Exceptions/WinAppDriverNotFoundException.cs b/src/Legerity.Core/Windows/Exceptions/WinAppDriverNotFoundException.cs index 0aaa4c79..233e0104 100644 --- a/src/Legerity.Core/Windows/Exceptions/WinAppDriverNotFoundException.cs +++ b/src/Legerity.Core/Windows/Exceptions/WinAppDriverNotFoundException.cs @@ -12,7 +12,7 @@ public class WinAppDriverNotFoundException : LegerityException internal WinAppDriverNotFoundException(string path) : base($"The WinAppDriver could not be located at {path}. Please ensure it is installed first.") { - this.Path = path; + Path = path; } /// diff --git a/src/Legerity.Core/Windows/WindowsAppManagerOptions.cs b/src/Legerity.Core/Windows/WindowsAppManagerOptions.cs index 9eb6ca41..8c921651 100644 --- a/src/Legerity.Core/Windows/WindowsAppManagerOptions.cs +++ b/src/Legerity.Core/Windows/WindowsAppManagerOptions.cs @@ -38,8 +38,8 @@ public WindowsAppManagerOptions(string appId) /// public WindowsAppManagerOptions(string appId, params (string, object)[] additionalOptions) { - this.AppId = appId; - this.AdditionalOptions = additionalOptions; + AppId = appId; + AdditionalOptions = additionalOptions; } /// @@ -71,7 +71,7 @@ public WindowsAppManagerOptions(string appId, params (string, object)[] addition public override void Configure() { base.Configure(); - this.AppiumOptions.AddAdditionalAppiumOption("app", this.AppId); + AppiumOptions.AddAdditionalAppiumOption("app", AppId); } /// @@ -82,29 +82,29 @@ public override void Configure() /// public void Configure((string, object)[] additionalOptions) { - this.AdditionalOptions = additionalOptions; - this.Configure(); + AdditionalOptions = additionalOptions; + Configure(); } /// Returns a string that represents the current object. /// A string that represents the current object. public override string ToString() { - return $"Platform [Windows], {base.ToString()}, {this.GetOptionDetails()}"; + return $"Platform [Windows], {base.ToString()}, {GetOptionDetails()}"; } private string GetOptionDetails() { var options = new List(); - if (!string.IsNullOrWhiteSpace(this.AppId)) + if (!string.IsNullOrWhiteSpace(AppId)) { - options.Add($"App ID [{this.AppId}]"); + options.Add($"App ID [{AppId}]"); } - if (this.AdditionalOptions != null) + if (AdditionalOptions != null) { - foreach ((string name, object value) in this.AdditionalOptions) + foreach ((string name, object value) in AdditionalOptions) { options.Add($"{name} [{value}]"); } diff --git a/src/Legerity.IOS/Elements/Core/Slider.cs b/src/Legerity.IOS/Elements/Core/Slider.cs index cf9b346c..c03f4ac1 100644 --- a/src/Legerity.IOS/Elements/Core/Slider.cs +++ b/src/Legerity.IOS/Elements/Core/Slider.cs @@ -28,7 +28,7 @@ public Slider(WebElement element) /// /// Gets a value indicating whether the control is in a readonly state. /// - public virtual bool IsReadonly => !this.IsEnabled; + public virtual bool IsReadonly => !IsEnabled; /// /// Allows conversion of a to the without direct casting. @@ -55,13 +55,13 @@ public static implicit operator Slider(WebElement element) /// Thrown when an element is no longer valid in the document DOM. public virtual void SetValue(double value) { - this.Click(); + Click(); - double currentValue = this.Value; + double currentValue = Value; while (Math.Abs(currentValue - value) > double.Epsilon) { - this.Element.SendKeys(currentValue < value ? Keys.ArrowRight : Keys.ArrowLeft); - currentValue = this.Value; + Element.SendKeys(currentValue < value ? Keys.ArrowRight : Keys.ArrowLeft); + currentValue = Value; } } } \ No newline at end of file diff --git a/src/Legerity.IOS/Elements/Core/Switch.cs b/src/Legerity.IOS/Elements/Core/Switch.cs index 5c486e3b..91c94a7f 100644 --- a/src/Legerity.IOS/Elements/Core/Switch.cs +++ b/src/Legerity.IOS/Elements/Core/Switch.cs @@ -48,12 +48,12 @@ public static implicit operator Switch(WebElement element) /// Thrown when an element is no longer valid in the document DOM. public virtual void ToggleOn() { - if (this.IsOn) + if (IsOn) { return; } - this.Click(); + Click(); } /// @@ -64,11 +64,11 @@ public virtual void ToggleOn() /// Thrown when an element is no longer valid in the document DOM. public virtual void ToggleOff() { - if (!this.IsOn) + if (!IsOn) { return; } - this.Click(); + Click(); } } \ No newline at end of file diff --git a/src/Legerity.IOS/Elements/Core/TextField.cs b/src/Legerity.IOS/Elements/Core/TextField.cs index c4e3c754..6edb0cd2 100644 --- a/src/Legerity.IOS/Elements/Core/TextField.cs +++ b/src/Legerity.IOS/Elements/Core/TextField.cs @@ -27,7 +27,7 @@ public TextField(WebElement element) /// Gets the element associated with the clear text button, if shown. /// /// Thrown when no element matches the expected locator. - public virtual Button ClearTextButton => this.FindElement(IOSByExtras.Label("Clear text")); + public virtual Button ClearTextButton => FindElement(IOSByExtras.Label("Clear text")); /// /// Allows conversion of a to the without direct casting. @@ -52,8 +52,8 @@ public static implicit operator TextField(WebElement element) /// Thrown when an element is no longer valid in the document DOM. public virtual void SetText(string text) { - this.ClearText(); - this.AppendText(text); + ClearText(); + AppendText(text); } /// @@ -65,8 +65,8 @@ public virtual void SetText(string text) /// Thrown when an element is no longer valid in the document DOM. public virtual void AppendText(string text) { - this.Click(); - this.Element.SendKeys(text); + Click(); + Element.SendKeys(text); } /// @@ -77,7 +77,7 @@ public virtual void AppendText(string text) /// Thrown when an element is no longer valid in the document DOM. public virtual void ClearText() { - this.Click(); - this.Element.Clear(); + Click(); + Element.Clear(); } } \ No newline at end of file diff --git a/src/Legerity.IOS/Elements/IOSElementWrapper.cs b/src/Legerity.IOS/Elements/IOSElementWrapper.cs index 567e8a81..e91539be 100644 --- a/src/Legerity.IOS/Elements/IOSElementWrapper.cs +++ b/src/Legerity.IOS/Elements/IOSElementWrapper.cs @@ -24,7 +24,7 @@ public IOSElementWrapper(WebElement element) /// /// Gets the instance of the Appium driver for the iOS application. /// - public IOSDriver Driver => this.ElementDriver as IOSDriver; + public IOSDriver Driver => ElementDriver as IOSDriver; /// /// Allows conversion of a to the without direct casting. @@ -55,7 +55,7 @@ protected void VerifyDriverElementShown(By locator, TimeSpan? timeout) { try { - if (this.Driver.FindElement(locator) == null) + if (Driver.FindElement(locator) == null) { throw new ElementNotShownException(locator.ToString()); } @@ -67,7 +67,7 @@ protected void VerifyDriverElementShown(By locator, TimeSpan? timeout) } else { - var wait = new WebDriverWait(this.Driver, timeout.Value); + var wait = new WebDriverWait(Driver, timeout.Value); wait.Until(driver => driver.FindElement(locator) != null); } } @@ -86,14 +86,14 @@ protected void VerifyDriverElementsShown(By locator, TimeSpan? timeout) { if (timeout == null) { - if (this.Driver.FindElements(locator).Count == 0) + if (Driver.FindElements(locator).Count == 0) { throw new ElementsNotShownException(locator.ToString()); } } else { - var wait = new WebDriverWait(this.Driver, timeout.Value); + var wait = new WebDriverWait(Driver, timeout.Value); wait.Until(driver => driver.FindElements(locator).Count != 0); } } diff --git a/src/Legerity.MADE/DropDownList.cs b/src/Legerity.MADE/DropDownList.cs index 2096c7a4..54f56fe1 100644 --- a/src/Legerity.MADE/DropDownList.cs +++ b/src/Legerity.MADE/DropDownList.cs @@ -23,7 +23,7 @@ public DropDownList(WebElement element) /// Gets the element associated with the drop down content. /// /// Thrown when no element matches the expected locator. - public virtual ListView DropDown => this.FindElement(WindowsByExtras.AutomationId("DropDownContent")); + public virtual ListView DropDown => FindElement(WindowsByExtras.AutomationId("DropDownContent")); /// /// Allows conversion of a to the without direct casting. @@ -52,8 +52,8 @@ public static implicit operator DropDownList(WebElement element) /// Thrown when no elements are shown for the expected locator. public virtual void SelectItem(string name) { - this.OpenDropDown(); - this.DropDown.ClickItem(name); + OpenDropDown(); + DropDown.ClickItem(name); } /// @@ -67,8 +67,8 @@ public virtual void SelectItem(string name) /// Thrown when no elements are shown for the expected locator. public virtual void SelectItemByPartialName(string partialName) { - this.OpenDropDown(); - this.DropDown.ClickItemByPartialName(partialName); + OpenDropDown(); + DropDown.ClickItemByPartialName(partialName); } /// @@ -79,9 +79,9 @@ public virtual void SelectItemByPartialName(string partialName) /// Thrown when an element is no longer valid in the document DOM. public virtual void OpenDropDown() { - if (!this.IsDropDownOpen()) + if (!IsDropDownOpen()) { - this.Click(); + Click(); } } @@ -96,7 +96,7 @@ public virtual bool IsDropDownOpen() try { - isVisible = this.DropDown.IsVisible; + isVisible = DropDown.IsVisible; } catch (WebDriverException wde) when (wde.Message.Contains("element could not be located")) { diff --git a/src/Legerity.MADE/InputValidator.cs b/src/Legerity.MADE/InputValidator.cs index f0dbadc2..f74de48a 100644 --- a/src/Legerity.MADE/InputValidator.cs +++ b/src/Legerity.MADE/InputValidator.cs @@ -23,13 +23,13 @@ public InputValidator(WebElement element) /// /// Thrown when no element matches the expected locator. public virtual TextBlock ValidationFeedback => - this.FindElement(WindowsByExtras.AutomationId("ValidatorFeedbackMessage")); + FindElement(WindowsByExtras.AutomationId("ValidatorFeedbackMessage")); /// /// Gets the validation feedback message associated with the element. /// /// Thrown when an element is no longer valid in the document DOM. - public virtual string Message => this.ValidationFeedback?.Text; + public virtual string Message => ValidationFeedback?.Text; /// /// Allows conversion of a to the without direct casting. @@ -53,7 +53,7 @@ public static implicit operator InputValidator(WebElement element) /// Thrown when no element matches the expected locator. public WebElement Input(By locator) { - return this.FindElement(locator); + return FindElement(locator); } /// @@ -68,7 +68,7 @@ public virtual string FeedbackMessage() try { - message = this.ValidationFeedback.Text; + message = ValidationFeedback.Text; } catch (WebDriverException ex) when (ex.Message.Contains("element could not be located")) { diff --git a/src/Legerity.Telerik.Uwp/RadAutoCompleteBox.cs b/src/Legerity.Telerik.Uwp/RadAutoCompleteBox.cs index 53e7e780..635c59ce 100644 --- a/src/Legerity.Telerik.Uwp/RadAutoCompleteBox.cs +++ b/src/Legerity.Telerik.Uwp/RadAutoCompleteBox.cs @@ -26,13 +26,13 @@ public RadAutoCompleteBox(WebElement element) /// Gets the element associated with the text box. /// /// Thrown when no element matches the expected locator. - public virtual TextBox TextBox => this.FindElement(By.ClassName("TextBox")); + public virtual TextBox TextBox => FindElement(By.ClassName("TextBox")); /// /// Gets the value of the auto-suggest box. /// /// Thrown when an element is no longer valid in the document DOM. - public virtual string Text => this.TextBox.Text; + public virtual string Text => TextBox.Text; /// /// Allows conversion of a to the without direct casting. @@ -60,7 +60,7 @@ public static implicit operator RadAutoCompleteBox(WebElement element) /// Thrown when no elements are shown for the expected locator. public virtual void SelectSuggestion(string suggestion) { - this.SelectSuggestion(suggestion, suggestion); + SelectSuggestion(suggestion, suggestion); } /// @@ -76,11 +76,11 @@ public virtual void SelectSuggestion(string suggestion) /// Thrown when no elements are shown for the expected locator. public virtual void SelectSuggestion(string value, string suggestion) { - this.SetText(value); + SetText(value); - this.VerifyElementShown(this.suggestionsControlLocator, TimeSpan.FromSeconds(2)); + VerifyElementShown(suggestionsControlLocator, TimeSpan.FromSeconds(2)); - ListBox suggestionList = this.FindElement(this.suggestionsControlLocator); + ListBox suggestionList = FindElement(suggestionsControlLocator); suggestionList.ClickItem(suggestion); } @@ -97,11 +97,11 @@ public virtual void SelectSuggestion(string value, string suggestion) /// Thrown when no elements are shown for the expected locator. public virtual void SelectSuggestionByPartialSuggestion(string value, string partialSuggestion) { - this.SetText(value); + SetText(value); - this.VerifyElementShown(this.suggestionsControlLocator, TimeSpan.FromSeconds(2)); + VerifyElementShown(suggestionsControlLocator, TimeSpan.FromSeconds(2)); - ListBox suggestionList = this.FindElement(this.suggestionsControlLocator); + ListBox suggestionList = FindElement(suggestionsControlLocator); suggestionList.ClickItemByPartialName(partialSuggestion); } @@ -115,6 +115,6 @@ public virtual void SelectSuggestionByPartialSuggestion(string value, string par /// Thrown when an element is not visible. public virtual void SetText(string value) { - this.TextBox.SetText(value); + TextBox.SetText(value); } } \ No newline at end of file diff --git a/src/Legerity.Telerik.Uwp/RadBusyIndicator.cs b/src/Legerity.Telerik.Uwp/RadBusyIndicator.cs index af8a90c3..5c5074eb 100644 --- a/src/Legerity.Telerik.Uwp/RadBusyIndicator.cs +++ b/src/Legerity.Telerik.Uwp/RadBusyIndicator.cs @@ -22,7 +22,7 @@ public RadBusyIndicator(WebElement element) /// Gets a value indicating whether the busy indicator is on. /// /// Thrown when an element is no longer valid in the document DOM. - public virtual bool IsOn => this.GetAttribute("ItemStatus") == OnValue; + public virtual bool IsOn => GetAttribute("ItemStatus") == OnValue; /// /// Allows conversion of a to the without direct casting. diff --git a/src/Legerity.Telerik.Uwp/RadNumericBox.cs b/src/Legerity.Telerik.Uwp/RadNumericBox.cs index 49e5223c..5e2c98e9 100644 --- a/src/Legerity.Telerik.Uwp/RadNumericBox.cs +++ b/src/Legerity.Telerik.Uwp/RadNumericBox.cs @@ -54,19 +54,19 @@ public RadNumericBox(WebElement element) /// Gets the element associated with the increase button. /// /// Thrown when no element matches the expected locator. - public virtual Button Increase => this.FindElement(WindowsByExtras.AutomationId("PART_IncreaseButton")); + public virtual Button Increase => FindElement(WindowsByExtras.AutomationId("PART_IncreaseButton")); /// /// Gets the element associated with the decrease button. /// /// Thrown when no element matches the expected locator. - public virtual Button DecreaseButton => this.FindElement(WindowsByExtras.AutomationId("PART_DecreaseButton")); + public virtual Button DecreaseButton => FindElement(WindowsByExtras.AutomationId("PART_DecreaseButton")); /// /// Gets the element associated with the input text box. /// /// Thrown when no element matches the expected locator. - public virtual TextBox InputBox => this.FindElement(WindowsByExtras.AutomationId("PART_TextBox")); + public virtual TextBox InputBox => FindElement(WindowsByExtras.AutomationId("PART_TextBox")); /// /// Allows conversion of a to the without direct casting. @@ -97,10 +97,10 @@ public static implicit operator RadNumericBox(WebElement element) /// Thrown when no element matches the expected locator. public virtual void SetValue(double value) { - double min = this.Minimum; - double max = this.Maximum; + double min = Minimum; + double max = Maximum; - if (value < this.Minimum) + if (value < Minimum) { throw new ArgumentOutOfRangeException( nameof(value), @@ -108,7 +108,7 @@ public virtual void SetValue(double value) $"Value must be greater than or equal to the minimum value {min}"); } - if (value > this.Maximum) + if (value > Maximum) { throw new ArgumentOutOfRangeException( nameof(value), @@ -116,8 +116,8 @@ public virtual void SetValue(double value) $"Value must be less than or equal to the maximum value {max}"); } - this.InputBox.SetText(value.ToString()); - this.InputBox.Element.SendKeys(Keys.Enter); + InputBox.SetText(value.ToString()); + InputBox.Element.SendKeys(Keys.Enter); } /// @@ -129,7 +129,7 @@ public virtual void SetValue(double value) /// Thrown when an element is no longer valid in the document DOM. public virtual void Increment() { - this.Increase.Click(); + Increase.Click(); } /// @@ -141,6 +141,6 @@ public virtual void Increment() /// Thrown when an element is no longer valid in the document DOM. public virtual void Decrement() { - this.DecreaseButton.Click(); + DecreaseButton.Click(); } } \ No newline at end of file diff --git a/src/Legerity.WCT/BladeView.cs b/src/Legerity.WCT/BladeView.cs index 8d73e1c9..1252ece9 100644 --- a/src/Legerity.WCT/BladeView.cs +++ b/src/Legerity.WCT/BladeView.cs @@ -24,7 +24,7 @@ public BladeView(WebElement element) /// Gets the UI components associated with the child blades. /// public virtual IEnumerable Blades => - this.Element.FindElements(By.ClassName("BladeItem")) + Element.FindElements(By.ClassName("BladeItem")) .Select(element => new BladeViewItem(this, element as WebElement)); /// @@ -49,7 +49,7 @@ public static implicit operator BladeView(WebElement element) /// Thrown when an element is no longer valid in the document DOM. public virtual BladeViewItem GetBlade(string name) { - return this.Blades.FirstOrDefault(element => element.Element.VerifyNameOrAutomationIdEquals(name)); + return Blades.FirstOrDefault(element => element.Element.VerifyNameOrAutomationIdEquals(name)); } /// @@ -60,7 +60,7 @@ public virtual BladeViewItem GetBlade(string name) /// Thrown when an element is no longer valid in the document DOM. public virtual BladeViewItem GetBladeByPartialName(string partialName) { - return this.Blades.FirstOrDefault(element => element.Element.VerifyNameOrAutomationIdContains(partialName)); + return Blades.FirstOrDefault(element => element.Element.VerifyNameOrAutomationIdContains(partialName)); } /// @@ -73,7 +73,7 @@ public virtual BladeViewItem GetBladeByPartialName(string partialName) /// Thrown when an element is not visible. public virtual void CloseBlade(string name) { - BladeViewItem blade = this.GetBlade(name); + BladeViewItem blade = GetBlade(name); blade.Close(); } @@ -87,7 +87,7 @@ public virtual void CloseBlade(string name) /// Thrown when an element is not visible. public virtual void CloseBladeByPartialName(string partialName) { - BladeViewItem blade = this.GetBladeByPartialName(partialName); + BladeViewItem blade = GetBladeByPartialName(partialName); blade.Close(); } } \ No newline at end of file diff --git a/src/Legerity.WCT/BladeViewItem.cs b/src/Legerity.WCT/BladeViewItem.cs index 694cc61e..89e3e747 100644 --- a/src/Legerity.WCT/BladeViewItem.cs +++ b/src/Legerity.WCT/BladeViewItem.cs @@ -37,27 +37,27 @@ public BladeViewItem( { if (parentBladeView != null) { - this.parentBladeViewReference = new WeakReference(parentBladeView); + parentBladeViewReference = new WeakReference(parentBladeView); } } /// Gets the original parent reference object. public BladeView ParentMenuBar => - this.parentBladeViewReference is { IsAlive: true } - ? this.parentBladeViewReference.Target as BladeView + parentBladeViewReference is { IsAlive: true } + ? parentBladeViewReference.Target as BladeView : null; /// /// Gets the element associated with the blade enlarge option. /// /// Thrown when no element matches the expected locator. - public virtual Button EnlargeButton => this.FindElement(WindowsByExtras.AutomationId("EnlargeButton")); + public virtual Button EnlargeButton => FindElement(WindowsByExtras.AutomationId("EnlargeButton")); /// /// Gets the element associated with the blade close option. /// /// Thrown when no element matches the expected locator. - public virtual Button CloseButton => this.FindElement(WindowsByExtras.AutomationId("CloseButton")); + public virtual Button CloseButton => FindElement(WindowsByExtras.AutomationId("CloseButton")); /// /// Allows conversion of a to the without direct casting. @@ -82,6 +82,6 @@ public static implicit operator BladeViewItem(WebElement element) /// Thrown when an element is no longer valid in the document DOM. public virtual void Close() { - this.CloseButton.Click(); + CloseButton.Click(); } } \ No newline at end of file diff --git a/src/Legerity.WCT/Carousel.cs b/src/Legerity.WCT/Carousel.cs index 7ccb0dd6..e786e273 100644 --- a/src/Legerity.WCT/Carousel.cs +++ b/src/Legerity.WCT/Carousel.cs @@ -29,19 +29,19 @@ public Carousel(WebElement element) /// Gets the collection of items associated with the carousel. /// public virtual ReadOnlyCollection Items => - this.Element.FindElements(this.carouselItemLocator).Cast().ToList().AsReadOnly(); + Element.FindElements(carouselItemLocator).Cast().ToList().AsReadOnly(); /// /// Gets the element associated with the currently selected item. /// /// Thrown when an element is no longer valid in the document DOM. - public virtual WebElement SelectedItem => this.Items.FirstOrDefault(i => i.IsSelected()); + public virtual WebElement SelectedItem => Items.FirstOrDefault(i => i.IsSelected()); /// /// Gets the index of the element associated with the currently selected item. /// /// Thrown when an element is no longer valid in the document DOM. - public virtual int SelectedIndex => this.Items.IndexOf(this.SelectedItem); + public virtual int SelectedIndex => Items.IndexOf(SelectedItem); /// /// Allows conversion of a to the without direct casting. @@ -69,12 +69,12 @@ public static implicit operator Carousel(WebElement element) /// Thrown when an element is not visible. public virtual void SelectItem(string name) { - this.VerifyElementsShown(this.carouselItemLocator, TimeSpan.FromSeconds(2)); + VerifyElementsShown(carouselItemLocator, TimeSpan.FromSeconds(2)); - int index = this.Items.IndexOf(this.Items.FirstOrDefault(element => + int index = Items.IndexOf(Items.FirstOrDefault(element => element.VerifyNameOrAutomationIdEquals(name))); - this.SelectItemAtIndex(index); + SelectItemAtIndex(index); } /// @@ -89,12 +89,12 @@ public virtual void SelectItem(string name) /// Thrown when an element is not visible. public virtual void SelectItemByPartialName(string partialName) { - this.VerifyElementsShown(this.carouselItemLocator, TimeSpan.FromSeconds(2)); + VerifyElementsShown(carouselItemLocator, TimeSpan.FromSeconds(2)); - int index = this.Items.IndexOf(this.Items.FirstOrDefault(element => + int index = Items.IndexOf(Items.FirstOrDefault(element => element.VerifyNameOrAutomationIdContains(partialName))); - this.SelectItemAtIndex(index); + SelectItemAtIndex(index); } /// @@ -110,15 +110,15 @@ public virtual void SelectItemByPartialName(string partialName) /// Thrown when an element is not visible. public virtual void SelectItem(int index) { - this.VerifyElementsShown(this.carouselItemLocator, TimeSpan.FromSeconds(2)); + VerifyElementsShown(carouselItemLocator, TimeSpan.FromSeconds(2)); - if (index > this.Items.Count - 1) + if (index > Items.Count - 1) { throw new IndexOutOfRangeException( "Cannot select an element that is outside the range of items available."); } - this.SelectItemAtIndex(index); + SelectItemAtIndex(index); } /// Thrown when an element is no longer valid in the document DOM. @@ -126,11 +126,11 @@ public virtual void SelectItem(int index) /// Thrown when an element is not visible. private void SelectItemAtIndex(int index) { - int selectedIndex = this.SelectedIndex; + int selectedIndex = SelectedIndex; while (Math.Abs(index - selectedIndex) > double.Epsilon) { - this.Element.SendKeys(selectedIndex < index ? Keys.ArrowRight : Keys.ArrowLeft); - selectedIndex = this.SelectedIndex; + Element.SendKeys(selectedIndex < index ? Keys.ArrowRight : Keys.ArrowLeft); + selectedIndex = SelectedIndex; } } } \ No newline at end of file diff --git a/src/Legerity.WCT/Expander.cs b/src/Legerity.WCT/Expander.cs index 69861be6..e42819a4 100644 --- a/src/Legerity.WCT/Expander.cs +++ b/src/Legerity.WCT/Expander.cs @@ -29,7 +29,7 @@ public Expander(WebElement element) /// Gets the associated with the expander. /// /// Thrown when no element matches the expected locator. - public virtual ToggleButton ToggleButton => this.FindElement(WindowsByExtras.AutomationId("PART_ExpanderToggleButton")); + public virtual ToggleButton ToggleButton => FindElement(WindowsByExtras.AutomationId("PART_ExpanderToggleButton")); /// /// Allows conversion of a to the without direct casting. @@ -54,12 +54,12 @@ public static implicit operator Expander(WebElement element) /// Thrown when an element is no longer valid in the document DOM. public virtual void Expand() { - if (this.IsExpanded) + if (IsExpanded) { return; } - this.ToggleButton.Click(); + ToggleButton.Click(); } /// @@ -71,11 +71,11 @@ public virtual void Expand() /// Thrown when an element is no longer valid in the document DOM. public virtual void Collapse() { - if (!this.IsExpanded) + if (!IsExpanded) { return; } - this.ToggleButton.Click(); + ToggleButton.Click(); } } \ No newline at end of file diff --git a/src/Legerity.WCT/InAppNotification.cs b/src/Legerity.WCT/InAppNotification.cs index 6cf0ccef..b62a674a 100644 --- a/src/Legerity.WCT/InAppNotification.cs +++ b/src/Legerity.WCT/InAppNotification.cs @@ -24,7 +24,7 @@ public InAppNotification(WebElement element) /// Gets the dismiss button. /// /// Thrown when no element matches the expected locator. - public virtual Button DismissButton => this.FindElement(WindowsByExtras.AutomationId("PART_DismissButton")); + public virtual Button DismissButton => FindElement(WindowsByExtras.AutomationId("PART_DismissButton")); /// /// Gets the message displayed. @@ -33,7 +33,7 @@ public InAppNotification(WebElement element) /// /// /// Thrown when an element is no longer valid in the document DOM. - public virtual string Message => this.Element.FindElementsByClassName("TextBlock").FirstOrDefault()?.Text; + public virtual string Message => Element.FindElementsByClassName("TextBlock").FirstOrDefault()?.Text; /// /// Allows conversion of a to the without direct casting. @@ -58,6 +58,6 @@ public static implicit operator InAppNotification(WebElement element) /// Thrown when an element is no longer valid in the document DOM. public virtual void Dismiss() { - this.DismissButton.Click(); + DismissButton.Click(); } } \ No newline at end of file diff --git a/src/Legerity.WCT/RadialGauge.cs b/src/Legerity.WCT/RadialGauge.cs index 26c42e3a..882ae0c5 100644 --- a/src/Legerity.WCT/RadialGauge.cs +++ b/src/Legerity.WCT/RadialGauge.cs @@ -77,10 +77,10 @@ public static implicit operator RadialGauge(WebElement element) /// Thrown when an element is no longer valid in the document DOM. public virtual void SetValue(double value) { - double min = this.Minimum; - double max = this.Maximum; + double min = Minimum; + double max = Maximum; - if (value < this.Minimum) + if (value < Minimum) { throw new ArgumentOutOfRangeException( nameof(value), @@ -88,7 +88,7 @@ public virtual void SetValue(double value) $"Value must be greater than or equal to the minimum value {min}"); } - if (value > this.Maximum) + if (value > Maximum) { throw new ArgumentOutOfRangeException( nameof(value), @@ -96,13 +96,13 @@ public virtual void SetValue(double value) $"Value must be less than or equal to the maximum value {max}"); } - this.Click(); + Click(); - double currentValue = this.Value; + double currentValue = Value; while (Math.Abs(currentValue - value) > double.Epsilon) { - this.Element.SendKeys(currentValue < value ? Keys.ArrowRight : Keys.ArrowLeft); - currentValue = this.Value; + Element.SendKeys(currentValue < value ? Keys.ArrowRight : Keys.ArrowLeft); + currentValue = Value; } } } \ No newline at end of file diff --git a/src/Legerity.Web.Authentication/Pages/AzureAdLoginPage.cs b/src/Legerity.Web.Authentication/Pages/AzureAdLoginPage.cs index 8397470b..bdf08673 100644 --- a/src/Legerity.Web.Authentication/Pages/AzureAdLoginPage.cs +++ b/src/Legerity.Web.Authentication/Pages/AzureAdLoginPage.cs @@ -75,25 +75,25 @@ public AzureAdLoginPage(WebDriver app, TimeSpan? traitTimeout) /// Gets the input element for providing an email address. /// /// Thrown when no element matches the expected locator. - public virtual TextInput EmailInput => this.FindElement(WebByExtras.InputType("email")); + public virtual TextInput EmailInput => FindElement(WebByExtras.InputType("email")); /// /// Gets the input element for providing a password. /// /// Thrown when no element matches the expected locator. - public virtual TextInput PasswordInput => this.FindElement(WebByExtras.InputType("password")); + public virtual TextInput PasswordInput => FindElement(WebByExtras.InputType("password")); /// /// Gets the button element for continuing the sign-in flow through the Azure AD login UI. /// /// Thrown when no element matches the expected locator. - public virtual Button SignInButton => this.FindElement(By.Id("idSIButton9")); + public virtual Button SignInButton => FindElement(By.Id("idSIButton9")); /// /// Gets the optional "Use Password" button that appears when password-less authentication is enabled. /// /// Thrown when no element matches the expected locator. - public virtual Button UsePasswordButton => this.FindElement(By.Id("idA_PWD_SwitchToPassword")); + public virtual Button UsePasswordButton => FindElement(By.Id("idA_PWD_SwitchToPassword")); /// /// Gets a given trait of the page to verify that the page is in view. @@ -113,29 +113,29 @@ public AzureAdLoginPage(WebDriver app, TimeSpan? traitTimeout) public AzureAdLoginPage Login(string email, string password) { (bool hasEmailInput, AzureAdLoginPage _) = - this.TryWaitUntil(page => page.EmailInput.IsVisible, this.WaitTimeout); + this.TryWaitUntil(page => page.EmailInput.IsVisible, WaitTimeout); if (!hasEmailInput) { // Cannot login as email address input not shown (possibly logged in already?) return this; } - this.EmailInput.SetText(email); + EmailInput.SetText(email); // Azure AD login uses a 2-step process for email and password. - this.SignInButton.Click(); + SignInButton.Click(); // Check to ensure that the user is not authenticating with password-less authentication. (bool isNotPasswordLogin, AzureAdLoginPage _) = - this.TryWaitUntil(page => page.UsePasswordButton.IsVisible, this.WaitTimeout); + this.TryWaitUntil(page => page.UsePasswordButton.IsVisible, WaitTimeout); if (isNotPasswordLogin) { - this.UsePasswordButton.Click(); - this.TryWaitUntil(page => page.PasswordInput.IsVisible, this.WaitTimeout); + UsePasswordButton.Click(); + this.TryWaitUntil(page => page.PasswordInput.IsVisible, WaitTimeout); } - this.PasswordInput.SetText(password); - this.SignInButton.Click(); + PasswordInput.SetText(password); + SignInButton.Click(); return this; } diff --git a/src/Legerity.Web.Authentication/Pages/FacebookLoginPage.cs b/src/Legerity.Web.Authentication/Pages/FacebookLoginPage.cs index 701da0df..89faa460 100644 --- a/src/Legerity.Web.Authentication/Pages/FacebookLoginPage.cs +++ b/src/Legerity.Web.Authentication/Pages/FacebookLoginPage.cs @@ -75,19 +75,19 @@ public FacebookLoginPage(WebDriver app, TimeSpan? traitTimeout) /// Gets the input element for providing an email address. /// /// Thrown when no element matches the expected locator. - public virtual TextInput EmailInput => this.FindElement(By.Id("email")); + public virtual TextInput EmailInput => FindElement(By.Id("email")); /// /// Gets the input element for providing a password. /// /// Thrown when no element matches the expected locator. - public virtual TextInput PasswordInput => this.FindElement(WebByExtras.InputType("password")); + public virtual TextInput PasswordInput => FindElement(WebByExtras.InputType("password")); /// /// Gets the button element for continuing the sign-in flow through the Facebook login UI. /// /// Thrown when no element matches the expected locator. - public virtual Button SignInButton => this.FindElement(By.Id("loginbutton")); + public virtual Button SignInButton => FindElement(By.Id("loginbutton")); /// /// Gets a given trait of the page to verify that the page is in view. @@ -107,16 +107,16 @@ public FacebookLoginPage(WebDriver app, TimeSpan? traitTimeout) public FacebookLoginPage Login(string email, string password) { (bool hasEmailInput, FacebookLoginPage _) = - this.TryWaitUntil(page => page.EmailInput.IsVisible, this.WaitTimeout); + this.TryWaitUntil(page => page.EmailInput.IsVisible, WaitTimeout); if (!hasEmailInput) { // Cannot login as email address input not shown (possibly logged in already?) return this; } - this.EmailInput.SetText(email); - this.PasswordInput.SetText(password); - this.SignInButton.Click(); + EmailInput.SetText(email); + PasswordInput.SetText(password); + SignInButton.Click(); return this; } } \ No newline at end of file diff --git a/src/Legerity.Web.Authentication/Pages/GoogleLoginPage.cs b/src/Legerity.Web.Authentication/Pages/GoogleLoginPage.cs index dddc2196..3fa759d8 100644 --- a/src/Legerity.Web.Authentication/Pages/GoogleLoginPage.cs +++ b/src/Legerity.Web.Authentication/Pages/GoogleLoginPage.cs @@ -75,25 +75,25 @@ public GoogleLoginPage(WebDriver app, TimeSpan? traitTimeout) /// Gets the input element for providing an email address. /// /// Thrown when no element matches the expected locator. - public virtual TextInput EmailInput => this.FindElement(WebByExtras.InputType("email")); + public virtual TextInput EmailInput => FindElement(WebByExtras.InputType("email")); /// /// Gets the input element for providing a password. /// /// Thrown when no element matches the expected locator. - public virtual TextInput PasswordInput => this.FindElement(WebByExtras.InputType("password")); + public virtual TextInput PasswordInput => FindElement(WebByExtras.InputType("password")); /// /// Gets the button element for continuing the sign-in flow through the Google login UI. /// /// Thrown when no element matches the expected locator. - public virtual Button NextButton => this.FindElement(By.Id("identifierNext")); + public virtual Button NextButton => FindElement(By.Id("identifierNext")); /// /// Gets the button element for completing the sign-in flow through the Google login UI. /// /// Thrown when no element matches the expected locator. - public virtual Button SignInButton => this.FindElement(By.Id("passwordNext")); + public virtual Button SignInButton => FindElement(By.Id("passwordNext")); /// /// Gets a given trait of the page to verify that the page is in view. @@ -113,27 +113,27 @@ public GoogleLoginPage(WebDriver app, TimeSpan? traitTimeout) public GoogleLoginPage Login(string email, string password) { (bool hasEmailInput, GoogleLoginPage _) = - this.TryWaitUntil(page => page.EmailInput.IsVisible, this.WaitTimeout); + this.TryWaitUntil(page => page.EmailInput.IsVisible, WaitTimeout); if (!hasEmailInput) { // Cannot login as email address input not shown (possibly logged in already?) return this; } - this.EmailInput.SetText(email); + EmailInput.SetText(email); // Google login uses a 2-step process for email and password. - this.NextButton.Click(); + NextButton.Click(); (bool isPasswordInputVisible, GoogleLoginPage _) = - this.TryWaitUntil(page => page.PasswordInput.IsVisible, this.WaitTimeout); + this.TryWaitUntil(page => page.PasswordInput.IsVisible, WaitTimeout); if (!isPasswordInputVisible) { return this; } - this.PasswordInput.SetText(password); - this.SignInButton.Click(); + PasswordInput.SetText(password); + SignInButton.Click(); return this; } diff --git a/src/Legerity.Web/Elements/Core/CheckBox.cs b/src/Legerity.Web/Elements/Core/CheckBox.cs index 0ba719ca..4c05bc3c 100644 --- a/src/Legerity.Web/Elements/Core/CheckBox.cs +++ b/src/Legerity.Web/Elements/Core/CheckBox.cs @@ -33,7 +33,7 @@ public CheckBox(WebElement element) /// Gets a value indicating whether the check box is in the checked state. /// /// Thrown when an element is no longer valid in the document DOM. - public virtual bool IsChecked => this.Element.Selected; + public virtual bool IsChecked => Element.Selected; /// /// Allows conversion of a to the without direct casting. @@ -57,12 +57,12 @@ public static implicit operator CheckBox(WebElement element) /// Thrown when an element is no longer valid in the document DOM. public virtual void CheckOn() { - if (this.IsChecked) + if (IsChecked) { return; } - this.Click(); + Click(); } /// @@ -73,11 +73,11 @@ public virtual void CheckOn() /// Thrown when an element is no longer valid in the document DOM. public virtual void CheckOff() { - if (!this.IsChecked) + if (!IsChecked) { return; } - this.Click(); + Click(); } } \ No newline at end of file diff --git a/src/Legerity.Web/Elements/Core/DateInput.cs b/src/Legerity.Web/Elements/Core/DateInput.cs index 6eeb1731..d39c622a 100644 --- a/src/Legerity.Web/Elements/Core/DateInput.cs +++ b/src/Legerity.Web/Elements/Core/DateInput.cs @@ -40,7 +40,7 @@ public DateInput(WebElement element) /// /// Gets the value of the date picker as a . /// - public virtual DateTime? SelectedDate => this.GetSelectedDate(); + public virtual DateTime? SelectedDate => GetSelectedDate(); /// /// Allows conversion of a to the without direct casting. @@ -63,15 +63,15 @@ public static implicit operator DateInput(WebElement element) /// Thrown when this instance does not implement . public virtual void SetDate(DateTime date) { - this.ElementDriver.ExecuteJavaScript( + ElementDriver.ExecuteJavaScript( "arguments[0].setAttribute('value', arguments[1])", - this.Element, + Element, date.ToString("yyyy-MM-dd")); } private DateTime? GetSelectedDate() { - string value = this.Value; + string value = Value; return string.IsNullOrEmpty(value) ? default : DateTime.TryParse(value, out DateTime date) ? date : default(DateTime?); } diff --git a/src/Legerity.Web/Elements/Core/FileInput.cs b/src/Legerity.Web/Elements/Core/FileInput.cs index c8dcb1cc..6c951099 100644 --- a/src/Legerity.Web/Elements/Core/FileInput.cs +++ b/src/Legerity.Web/Elements/Core/FileInput.cs @@ -59,8 +59,8 @@ public static implicit operator FileInput(WebElement element) /// Thrown when an element is no longer valid in the document DOM. public virtual void SetAbsoluteFilePath(string filePath) { - this.ClearFile(); - this.Element.SendKeys(filePath); + ClearFile(); + Element.SendKeys(filePath); } /// @@ -69,6 +69,6 @@ public virtual void SetAbsoluteFilePath(string filePath) /// Thrown when an element is no longer valid in the document DOM. public virtual void ClearFile() { - this.Element.Clear(); + Element.Clear(); } } \ No newline at end of file diff --git a/src/Legerity.Web/Elements/Core/Image.cs b/src/Legerity.Web/Elements/Core/Image.cs index cde827fd..47dea4c6 100644 --- a/src/Legerity.Web/Elements/Core/Image.cs +++ b/src/Legerity.Web/Elements/Core/Image.cs @@ -34,13 +34,13 @@ public Image(WebElement element) /// Gets the source URI of the image. /// /// Thrown when an element is no longer valid in the document DOM. - public virtual string Source => this.GetAttribute("src"); + public virtual string Source => GetAttribute("src"); /// /// Gets the alt text of the image. /// /// Thrown when an element is no longer valid in the document DOM. - public virtual string AltText => this.GetAttribute("alt"); + public virtual string AltText => GetAttribute("alt"); /// /// Gets the width of the image. diff --git a/src/Legerity.Web/Elements/Core/List.cs b/src/Legerity.Web/Elements/Core/List.cs index 0cd44bcc..d3d06530 100644 --- a/src/Legerity.Web/Elements/Core/List.cs +++ b/src/Legerity.Web/Elements/Core/List.cs @@ -33,7 +33,7 @@ public List(WebElement element) /// /// Gets the collection of items associated with the list. /// - public virtual ReadOnlyCollection Items => this.Element.FindElements(WebByExtras.ListItem()); + public virtual ReadOnlyCollection Items => Element.FindElements(WebByExtras.ListItem()); /// /// Allows conversion of a to the without direct casting. diff --git a/src/Legerity.Web/Elements/Core/NumberInput.cs b/src/Legerity.Web/Elements/Core/NumberInput.cs index 6af2468c..361a8cf5 100644 --- a/src/Legerity.Web/Elements/Core/NumberInput.cs +++ b/src/Legerity.Web/Elements/Core/NumberInput.cs @@ -46,7 +46,7 @@ public NumberInput(WebElement element) /// Gets the value of the NumberBox. /// /// Thrown when an element is no longer valid in the document DOM. - public virtual double Value => double.TryParse(this.Text, out double val) ? val : 0; + public virtual double Value => double.TryParse(Text, out double val) ? val : 0; /// /// Allows conversion of a to the without direct casting. @@ -76,10 +76,10 @@ public static implicit operator NumberInput(WebElement element) /// Thrown when an element is not visible. public virtual void SetValue(double value) { - double min = this.Minimum; - double max = this.Maximum; + double min = Minimum; + double max = Maximum; - if (value < this.Minimum) + if (value < Minimum) { throw new ArgumentOutOfRangeException( nameof(value), @@ -87,7 +87,7 @@ public virtual void SetValue(double value) $"Value must be greater than or equal to the minimum value {min}"); } - if (value > this.Maximum) + if (value > Maximum) { throw new ArgumentOutOfRangeException( nameof(value), @@ -95,7 +95,7 @@ public virtual void SetValue(double value) $"Value must be less than or equal to the maximum value {max}"); } - this.SetText(value.ToString()); + SetText(value.ToString()); } /// @@ -106,7 +106,7 @@ public virtual void SetValue(double value) /// Thrown when an element is no longer valid in the document DOM. public virtual void Increment() { - this.Element.SendKeys(Keys.ArrowUp); + Element.SendKeys(Keys.ArrowUp); } /// @@ -117,6 +117,6 @@ public virtual void Increment() /// Thrown when an element is no longer valid in the document DOM. public virtual void Decrement() { - this.Element.SendKeys(Keys.ArrowDown); + Element.SendKeys(Keys.ArrowDown); } } \ No newline at end of file diff --git a/src/Legerity.Web/Elements/Core/Option.cs b/src/Legerity.Web/Elements/Core/Option.cs index 1b7c9f9b..971626a8 100644 --- a/src/Legerity.Web/Elements/Core/Option.cs +++ b/src/Legerity.Web/Elements/Core/Option.cs @@ -40,13 +40,13 @@ public Option(WebElement element) /// Gets the display value of the option. /// /// Thrown when an element is no longer valid in the document DOM. - public virtual string DisplayValue => this.Element.Text; + public virtual string DisplayValue => Element.Text; /// /// Gets a value indicating whether the option is selected. /// /// Thrown when an element is no longer valid in the document DOM. - public virtual bool IsSelected => this.Element.Selected; + public virtual bool IsSelected => Element.Selected; /// /// Allows conversion of a to the without direct casting. @@ -70,6 +70,6 @@ public static implicit operator Option(WebElement element) /// Thrown when an element is not visible. public virtual void Select() { - this.Click(); + Click(); } } \ No newline at end of file diff --git a/src/Legerity.Web/Elements/Core/RadioButton.cs b/src/Legerity.Web/Elements/Core/RadioButton.cs index ed656234..58d8da90 100644 --- a/src/Legerity.Web/Elements/Core/RadioButton.cs +++ b/src/Legerity.Web/Elements/Core/RadioButton.cs @@ -33,7 +33,7 @@ public RadioButton(WebElement element) /// Gets a value indicating whether the radio button is selected. /// /// Thrown when an element is no longer valid in the document DOM. - public virtual bool IsSelected => this.Element.Selected; + public virtual bool IsSelected => Element.Selected; /// /// Gets the name of the group for the radio button. diff --git a/src/Legerity.Web/Elements/Core/RangeInput.cs b/src/Legerity.Web/Elements/Core/RangeInput.cs index 14c43da6..3771085f 100644 --- a/src/Legerity.Web/Elements/Core/RangeInput.cs +++ b/src/Legerity.Web/Elements/Core/RangeInput.cs @@ -46,7 +46,7 @@ public RangeInput(WebElement element) /// Gets the value of the range input. /// /// Thrown when an element is no longer valid in the document DOM. - public virtual double Value => double.TryParse(this.Text, out double val) ? val : 0; + public virtual double Value => double.TryParse(Text, out double val) ? val : 0; /// /// Allows conversion of a to the without direct casting. @@ -76,10 +76,10 @@ public static implicit operator RangeInput(WebElement element) /// Thrown when an element is no longer valid in the document DOM. public virtual void SetValue(double value) { - double min = this.Minimum; - double max = this.Maximum; + double min = Minimum; + double max = Maximum; - if (value < this.Minimum) + if (value < Minimum) { throw new ArgumentOutOfRangeException( nameof(value), @@ -87,7 +87,7 @@ public virtual void SetValue(double value) $"Value must be greater than or equal to the minimum value {min}"); } - if (value > this.Maximum) + if (value > Maximum) { throw new ArgumentOutOfRangeException( nameof(value), @@ -95,13 +95,13 @@ public virtual void SetValue(double value) $"Value must be less than or equal to the maximum value {max}"); } - this.Click(); + Click(); - double currentValue = this.Value; + double currentValue = Value; while (Math.Abs(currentValue - value) > double.Epsilon) { - this.Element.SendKeys(currentValue < value ? Keys.ArrowRight : Keys.ArrowLeft); - currentValue = this.Value; + Element.SendKeys(currentValue < value ? Keys.ArrowRight : Keys.ArrowLeft); + currentValue = Value; } } @@ -113,7 +113,7 @@ public virtual void SetValue(double value) /// Thrown when an element is no longer valid in the document DOM. public virtual void Increment() { - this.Element.SendKeys(Keys.ArrowUp); + Element.SendKeys(Keys.ArrowUp); } /// @@ -124,6 +124,6 @@ public virtual void Increment() /// Thrown when an element is no longer valid in the document DOM. public virtual void Decrement() { - this.Element.SendKeys(Keys.ArrowDown); + Element.SendKeys(Keys.ArrowDown); } } \ No newline at end of file diff --git a/src/Legerity.Web/Elements/Core/Select.cs b/src/Legerity.Web/Elements/Core/Select.cs index 2618cefc..227d49d8 100644 --- a/src/Legerity.Web/Elements/Core/Select.cs +++ b/src/Legerity.Web/Elements/Core/Select.cs @@ -38,25 +38,25 @@ public Select(WebElement element) /// Gets a value indicating whether multiple items can be selected. /// /// Thrown when an element is no longer valid in the document DOM. - public virtual bool IsMultiple => this.GetIsMultiple(); + public virtual bool IsMultiple => GetIsMultiple(); /// /// Gets the collection of items associated with the select. /// public virtual IEnumerable