From 1c5f2f675b1b782bcc776ca1523285d4eb725c0a Mon Sep 17 00:00:00 2001 From: Teodor Nikolov Date: Sun, 19 Nov 2023 23:09:00 +0000 Subject: [PATCH 01/32] updated Appium in desktop module --- .../Bellatrix.Desktop.csproj | 2 +- .../Core/Component.DefaultActions.cs | 6 +++--- .../plugins/execution/AppLifecyclePlugin.cs | 4 +--- .../execution/Attributes/AppAttribute.cs | 4 +--- .../services/WrappedWebDriverCreateService.cs | 21 +++++++++++-------- .../settings/AppInitializationInfo.cs | 4 ++-- 6 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/Bellatrix.Desktop/Bellatrix.Desktop.csproj b/src/Bellatrix.Desktop/Bellatrix.Desktop.csproj index a2a5df1d6..ed96c97b8 100644 --- a/src/Bellatrix.Desktop/Bellatrix.Desktop.csproj +++ b/src/Bellatrix.Desktop/Bellatrix.Desktop.csproj @@ -3,11 +3,11 @@ + - diff --git a/src/Bellatrix.Desktop/components/Core/Component.DefaultActions.cs b/src/Bellatrix.Desktop/components/Core/Component.DefaultActions.cs index 4f415b956..fb5b7e9e0 100644 --- a/src/Bellatrix.Desktop/components/Core/Component.DefaultActions.cs +++ b/src/Bellatrix.Desktop/components/Core/Component.DefaultActions.cs @@ -15,8 +15,7 @@ using Bellatrix.Desktop.Contracts; using Bellatrix.Desktop.Events; using Bellatrix.Layout; -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; +using OpenQA.Selenium.Interactions; namespace Bellatrix.Desktop; @@ -35,7 +34,8 @@ internal virtual void Hover(EventHandler hovering, Eve { hovering?.Invoke(this, new ComponentActionEventArgs(this)); - WrappedDriver.Mouse.MouseMove(WrappedElement.Coordinates); + var action = new Actions(WrappedDriver); + action.MoveToElement(WrappedElement).Perform(); hovered?.Invoke(this, new ComponentActionEventArgs(this)); } diff --git a/src/Bellatrix.Desktop/plugins/execution/AppLifecyclePlugin.cs b/src/Bellatrix.Desktop/plugins/execution/AppLifecyclePlugin.cs index 1677c7164..aec4e38dd 100644 --- a/src/Bellatrix.Desktop/plugins/execution/AppLifecyclePlugin.cs +++ b/src/Bellatrix.Desktop/plugins/execution/AppLifecyclePlugin.cs @@ -14,7 +14,6 @@ using System; using System.Collections.Generic; using System.Drawing; -using System.Linq; using System.Reflection; using System.Runtime.InteropServices; using Bellatrix.Desktop.Configuration; @@ -23,7 +22,6 @@ using Bellatrix.Plugins; using Bellatrix.Utilities; using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Remote; namespace Bellatrix.Desktop.Plugins; @@ -167,7 +165,7 @@ private AppInitializationInfo GetCurrentAppConfiguration(MemberInfo memberInfo, AppPath = ConfigurationService.GetSection().ExecutionSettings.DefaultAppPath, Lifecycle = currentLifecycle, Size = currentAppSize, - AppiumOptions = new DesiredCapabilities(), + AppiumOptions = new AppiumOptions(), ClassFullName = testClassType.FullName, }; diff --git a/src/Bellatrix.Desktop/plugins/execution/Attributes/AppAttribute.cs b/src/Bellatrix.Desktop/plugins/execution/Attributes/AppAttribute.cs index 2af22cc46..e1f5870e8 100644 --- a/src/Bellatrix.Desktop/plugins/execution/Attributes/AppAttribute.cs +++ b/src/Bellatrix.Desktop/plugins/execution/Attributes/AppAttribute.cs @@ -12,12 +12,10 @@ // Anton Angelov // https://bellatrix.solutions/ using System; -using System.Collections.Generic; using System.Drawing; using Bellatrix.Desktop.Configuration; using Bellatrix.Desktop.Services; using OpenQA.Selenium.Appium; -using OpenQA.Selenium.Remote; namespace Bellatrix.Desktop; @@ -30,7 +28,7 @@ public AppAttribute(string appPath, Lifecycle lifecycle = Lifecycle.NotSet) AppConfiguration.AppPath = appPath; AppConfiguration.Lifecycle = lifecycle; AppConfiguration.Size = default; - AppConfiguration.AppiumOptions = new DesiredCapabilities(); + AppConfiguration.AppiumOptions = new AppiumOptions(); } public AppAttribute(string appPath, int width, int height, Lifecycle behavior = Lifecycle.NotSet) diff --git a/src/Bellatrix.Desktop/services/WrappedWebDriverCreateService.cs b/src/Bellatrix.Desktop/services/WrappedWebDriverCreateService.cs index 465211546..fc32876e0 100644 --- a/src/Bellatrix.Desktop/services/WrappedWebDriverCreateService.cs +++ b/src/Bellatrix.Desktop/services/WrappedWebDriverCreateService.cs @@ -16,7 +16,9 @@ using System.Drawing; using System.IO; using Bellatrix.Desktop.Configuration; +using OpenQA.Selenium.Appium; using OpenQA.Selenium.Appium.Windows; +using OpenQA.Selenium.Interactions; using OpenQA.Selenium.Remote; namespace Bellatrix.Desktop.Services; @@ -32,19 +34,19 @@ static WrappedWebDriverCreateService() public static WindowsDriver Create(AppInitializationInfo appConfiguration, ServicesCollection childContainer) { - var driverOptions = childContainer.Resolve(appConfiguration.ClassFullName) ?? childContainer.Resolve() ?? appConfiguration.AppiumOptions; - driverOptions.SetCapability("app", appConfiguration.AppPath); - driverOptions.SetCapability("deviceName", "WindowsPC"); - driverOptions.SetCapability("platformName", "Windows"); + var driverOptions = childContainer.Resolve(appConfiguration.ClassFullName) ?? childContainer.Resolve() ?? appConfiguration.AppiumOptions; + driverOptions.PlatformName = "Windows"; + driverOptions.AddAdditionalCapability("deviceName", "WindowsPC"); + driverOptions.AddAdditionalCapability("app", appConfiguration.AppPath); string workingDir = Path.GetDirectoryName(appConfiguration.AppPath); - driverOptions.SetCapability("appWorkingDir", workingDir); - driverOptions.SetCapability("createSessionTimeout", ConfigurationService.GetSection().TimeoutSettings.CreateSessionTimeout); - driverOptions.SetCapability("ms:waitForAppLaunch", ConfigurationService.GetSection().TimeoutSettings.WaitForAppLaunchTimeout); + driverOptions.AddAdditionalCapability("appWorkingDir", workingDir); + driverOptions.AddAdditionalCapability("createSessionTimeout", ConfigurationService.GetSection().TimeoutSettings.CreateSessionTimeout); + driverOptions.AddAdditionalCapability("ms:waitForAppLaunch", ConfigurationService.GetSection().TimeoutSettings.WaitForAppLaunchTimeout); var additionalCapabilities = ServicesCollection.Main.Resolve>($"caps-{appConfiguration.ClassFullName}") ?? new Dictionary(); foreach (var additionalCapability in additionalCapabilities) { - driverOptions.SetCapability(additionalCapability.Key, additionalCapability.Value); + driverOptions.AddAdditionalCapability(additionalCapability.Key, additionalCapability.Value); } var wrappedWebDriver = new WindowsDriver(new Uri(_serviceUrl), driverOptions); @@ -56,7 +58,8 @@ public static WindowsDriver Create(AppInitializationInfo appConf try { var closeButton = wrappedWebDriver.FindElementByAccessibilityId("Close"); - wrappedWebDriver.Mouse.MouseMove(closeButton.Coordinates); + var action = new Actions(wrappedWebDriver); + action.MoveToElement(closeButton).Perform(); } catch (Exception e) { diff --git a/src/Bellatrix.Desktop/settings/AppInitializationInfo.cs b/src/Bellatrix.Desktop/settings/AppInitializationInfo.cs index b079a8b22..b41ab1d50 100644 --- a/src/Bellatrix.Desktop/settings/AppInitializationInfo.cs +++ b/src/Bellatrix.Desktop/settings/AppInitializationInfo.cs @@ -29,7 +29,7 @@ public AppInitializationInfo() { } - public AppInitializationInfo(string appPath, Lifecycle lifecycle, Size size, string classFullName, DesiredCapabilities appiumOptions = null) + public AppInitializationInfo(string appPath, Lifecycle lifecycle, Size size, string classFullName, AppiumOptions appiumOptions = null) { AppPath = appPath; Lifecycle = lifecycle; @@ -46,7 +46,7 @@ public AppInitializationInfo(string appPath, Lifecycle lifecycle, Size size, str public string AppPath { get => NormalizeAppPath(); set => _appPath = value; } - public DesiredCapabilities AppiumOptions { get; set; } + public AppiumOptions AppiumOptions { get; set; } public bool Equals(AppInitializationInfo other) { From 3901b9aabb779cdc917f0c6b346590e9e651ab52 Mon Sep 17 00:00:00 2001 From: Teodor Nikolov Date: Sun, 19 Nov 2023 23:09:30 +0000 Subject: [PATCH 02/32] fixed warning messages in IDE --- .../plugins/execution/BrowserLifecyclePlugin.cs | 2 +- templates/Bellatrix.API.GettingStarted/Models/Albums.cs | 4 ++-- templates/Bellatrix.API.Tests/Models/Albums.cs | 8 ++++---- tests/Bellatrix.API.Tests/Models/Albums.cs | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Bellatrix.Web/plugins/execution/BrowserLifecyclePlugin.cs b/src/Bellatrix.Web/plugins/execution/BrowserLifecyclePlugin.cs index 926f32519..a18b53daf 100644 --- a/src/Bellatrix.Web/plugins/execution/BrowserLifecyclePlugin.cs +++ b/src/Bellatrix.Web/plugins/execution/BrowserLifecyclePlugin.cs @@ -238,7 +238,7 @@ private BrowserConfiguration GetCurrentBrowserConfiguration(Bellatrix.Plugins.Pl string testName = e.TestFullName != null ? e.TestFullName.Replace(" ", string.Empty).Replace("(", string.Empty).Replace(")", string.Empty).Replace(",", string.Empty).Replace("\"", string.Empty) : e.TestClassType.FullName; InitializeGridOptionsFromConfiguration(options, e.TestClassType, testName); InitializeCustomCodeOptions(options, e.TestClassType); - var browserConfiguration = new BrowserConfiguration(executionType, currentLifecycle, currentBrowserType, currentBrowserSize, fullClassName, shouldCaptureHttpTraffic: false, shouldDisableJavaScript: false, shouldAutomaticallyScrollToVisible, options); + var browserConfiguration = new BrowserConfiguration(executionType, currentLifecycle, currentBrowserType, currentBrowserSize, fullClassName, false, false, shouldAutomaticallyScrollToVisible, options); e.Container.RegisterInstance(browserConfiguration, "_currentBrowserConfiguration"); return browserConfiguration; diff --git a/templates/Bellatrix.API.GettingStarted/Models/Albums.cs b/templates/Bellatrix.API.GettingStarted/Models/Albums.cs index 7ae2e3bad..6db206d9e 100644 --- a/templates/Bellatrix.API.GettingStarted/Models/Albums.cs +++ b/templates/Bellatrix.API.GettingStarted/Models/Albums.cs @@ -4,9 +4,7 @@ namespace Bellatrix.API.GettingStarted.Models; -#pragma warning disable CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() public class Albums : IEquatable -#pragma warning restore CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() { public Albums() => Tracks = new HashSet(); @@ -24,5 +22,7 @@ public class Albums : IEquatable public bool Equals(Albums other) => AlbumId.Equals(other.AlbumId); +#pragma warning disable CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() public override bool Equals(object obj) => Equals(obj as Albums); +#pragma warning restore CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() } diff --git a/templates/Bellatrix.API.Tests/Models/Albums.cs b/templates/Bellatrix.API.Tests/Models/Albums.cs index 36a006cb4..1ca9253e9 100644 --- a/templates/Bellatrix.API.Tests/Models/Albums.cs +++ b/templates/Bellatrix.API.Tests/Models/Albums.cs @@ -4,9 +4,7 @@ namespace Bellatrix.API.MSTest.Tests.Models; -#pragma warning disable CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() public class Albums : IEquatable -#pragma warning restore CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() { public Albums() => Tracks = new HashSet(); @@ -22,7 +20,9 @@ public class Albums : IEquatable [JsonProperty(Required = Required.AllowNull)] public ICollection Tracks { get; set; } - public bool Equals(Albums other) => AlbumId.Equals(other.AlbumId); - + public bool Equals(Albums other) => AlbumId.Equals(other?.AlbumId); + +#pragma warning disable CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode( public override bool Equals(object obj) => Equals(obj as Albums); +#pragma warning restore CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() } diff --git a/tests/Bellatrix.API.Tests/Models/Albums.cs b/tests/Bellatrix.API.Tests/Models/Albums.cs index b0bf74a5a..0c199c84b 100644 --- a/tests/Bellatrix.API.Tests/Models/Albums.cs +++ b/tests/Bellatrix.API.Tests/Models/Albums.cs @@ -17,9 +17,7 @@ namespace MediaStore.Demo.API.Models; -#pragma warning disable CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() public class Albums : IEquatable -#pragma warning restore CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() { public Albums() => Tracks = new HashSet(); @@ -37,5 +35,7 @@ public class Albums : IEquatable public bool Equals(Albums other) => AlbumId.Equals(other.AlbumId); +#pragma warning disable CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() public override bool Equals(object obj) => Equals(obj as Albums); +#pragma warning restore CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() } From f7a056cf2ba166b4de9b0d8480f5dfa27f0ac091 Mon Sep 17 00:00:00 2001 From: Teodor Nikolov Date: Tue, 13 Feb 2024 18:59:07 +0200 Subject: [PATCH 03/32] Desktop Module Update --- .../Bellatrix.Desktop.csproj | 4 -- .../Core/Component.DefaultActions.cs | 20 ++++-- .../components/Core/ComponentsList.cs | 2 +- src/Bellatrix.Desktop/infrastructure/App.cs | 66 +++++++++--------- .../infrastructure/TestExecutionEngine.cs | 2 +- .../plugins/execution/AppLifecyclePlugin.cs | 65 +++++++++++------- .../execution/Attributes/AppAttribute.cs | 12 ++-- .../services/WrappedWebDriverCreateService.cs | 68 ++++++++++++++----- .../settings/AppInitializationInfo.cs | 11 ++- .../settings/ExecutionSettings.cs | 3 +- src/Bellatrix.Web/Bellatrix.Web.csproj | 2 +- src/Bellatrix.Web/services/DevToolsService.cs | 18 ++--- .../Models/Albums.cs | 4 +- .../Bellatrix.API.Tests/Models/Albums.cs | 6 +- .../testFrameworkSettings.Debug.json | 2 +- tests/Bellatrix.API.Tests/Models/Albums.cs | 4 +- tests/Bellatrix.Desktop.Tests/Categories.cs | 6 +- tests/Bellatrix.Desktop.Tests/Constants.cs | 4 +- .../Button/ButtonControlEventsTests.cs | 1 + .../Button/ButtonControlTestsUniversal.cs | 1 + .../Button/ButtonControlTestsWinForms.cs | 1 + .../Controls/Button/ButtonControlTestsWpf.cs | 1 + ...alidateExtensionsExceptionMessagesTests.cs | 1 + .../ButtonControlValidaterExtensionsTests.cs | 1 + .../Calendar/CalendarControlEventsTests.cs | 1 + .../Calendar/CalendarControlTestsUniversal.cs | 1 + .../Calendar/CalendarControlTestsWinForms.cs | 1 + .../Calendar/CalendarControlTestsWpf.cs | 1 + ...alidateExtensionsExceptionMessagesTests.cs | 1 + .../CheckBox/CheckBoxControlTestsUniversal.cs | 1 + .../CheckBox/CheckBoxControlTestsWinForms.cs | 1 + .../CheckBox/CheckBoxControlTestsWpf.cs | 1 + .../ComboBox/ComboBoxControlTestsUniversal.cs | 1 + .../ComboBox/ComboBoxControlTestsWinForms.cs | 1 + .../ComboBox/ComboBoxControlTestsWpf.cs | 1 + .../DatePickerControlTestsUniversal.cs | 1 + .../DatePickerControlTestsWinForms.cs | 1 + .../DatePicker/DatePickerControlTestsWpf.cs | 1 + .../Element/ElementControlTestsUniversal.cs | 1 + .../Element/ElementControlTestsWinforms.cs | 1 + .../Element/ElementControlTestsWpf.cs | 1 + .../Expander/ExpanderControlTestsWpf.cs | 1 + .../Image/ImageControlTestsWinForms.cs | 1 + .../Controls/Image/ImageControlTestsWpf.cs | 1 + .../Label/LabelControlTestsUniversal.cs | 1 + .../Label/LabelControlTestsWinForms.cs | 1 + .../Controls/Label/LabelControlTestsWpf.cs | 1 + .../ListBox/ListBoxControlTestsUniversal.cs | 1 + .../ListBox/ListBoxControlTestsWinForms.cs | 1 + .../ListBox/ListBoxControlTestsWpf.cs | 1 + .../Pasword/PasswordControlTestsUniversal.cs | 1 + .../Pasword/PasswordControlTestsWpf.cs | 1 + .../Progress/ProgressControlTestsUniversal.cs | 1 + .../Progress/ProgressControlTestsWinForms.cs | 1 + .../Progress/ProgressControlTestsWpf.cs | 1 + .../Radio/RadioControlTestsUniversal.cs | 1 + .../Radio/RadioControlTestsWinForms.cs | 1 + .../Controls/Radio/RadioControlTestsWpf.cs | 1 + .../Controls/Tabs/TabsControlTestsWinForms.cs | 1 + .../Controls/Tabs/TabsControlTestsWpf.cs | 1 + .../TextArea/TextAreaControlTestsWinForms.cs | 1 + .../TextArea/TextAreaControlTestsWpf.cs | 1 + .../TextFieldControlTestsUniversal.cs | 1 + .../TextFieldControlTestsWinForms.cs | 1 + .../TextField/TextFieldControlTestsWpf.cs | 1 + .../Time/TimePickerControlTestsUniversal.cs | 1 + .../TestsInitialize.cs | 4 +- .../ImageRecognitionTests.cs | 2 +- 68 files changed, 239 insertions(+), 114 deletions(-) diff --git a/src/Bellatrix.Desktop/Bellatrix.Desktop.csproj b/src/Bellatrix.Desktop/Bellatrix.Desktop.csproj index ed96c97b8..34c42fc53 100644 --- a/src/Bellatrix.Desktop/Bellatrix.Desktop.csproj +++ b/src/Bellatrix.Desktop/Bellatrix.Desktop.csproj @@ -2,16 +2,12 @@ - - - - diff --git a/src/Bellatrix.Desktop/components/Core/Component.DefaultActions.cs b/src/Bellatrix.Desktop/components/Core/Component.DefaultActions.cs index fb5b7e9e0..9511f71ee 100644 --- a/src/Bellatrix.Desktop/components/Core/Component.DefaultActions.cs +++ b/src/Bellatrix.Desktop/components/Core/Component.DefaultActions.cs @@ -11,11 +11,13 @@ // // Anton Angelov // https://bellatrix.solutions/ + using System; +using System.Collections.Generic; using Bellatrix.Desktop.Contracts; using Bellatrix.Desktop.Events; using Bellatrix.Layout; -using OpenQA.Selenium.Interactions; +using OpenQA.Selenium.Support.Extensions; namespace Bellatrix.Desktop; @@ -24,8 +26,12 @@ public partial class Component : IComponentVisible, IComponent, ILayoutComponent internal virtual void Click(EventHandler clicking, EventHandler clicked) { clicking?.Invoke(this, new ComponentActionEventArgs(this)); - - WrappedElement.Click(); + + WrappedDriver.ExecuteScript("windows: click", new Dictionary + { + { "elementId", WrappedElement.Id }, + { "durationMs", 0 } + }); clicked?.Invoke(this, new ComponentActionEventArgs(this)); } @@ -34,8 +40,12 @@ internal virtual void Hover(EventHandler hovering, Eve { hovering?.Invoke(this, new ComponentActionEventArgs(this)); - var action = new Actions(WrappedDriver); - action.MoveToElement(WrappedElement).Perform(); + WrappedDriver.ExecuteScript("windows: hover", new Dictionary + { + { "startElementId", WrappedElement.Id }, + { "endElementId", WrappedElement.Id }, + { "durationMs", 0 } + }); hovered?.Invoke(this, new ComponentActionEventArgs(this)); } diff --git a/src/Bellatrix.Desktop/components/Core/ComponentsList.cs b/src/Bellatrix.Desktop/components/Core/ComponentsList.cs index ca9ff5e4f..97a9628ac 100644 --- a/src/Bellatrix.Desktop/components/Core/ComponentsList.cs +++ b/src/Bellatrix.Desktop/components/Core/ComponentsList.cs @@ -79,7 +79,7 @@ public int Count() } var nativeElements = WaitWebDriverElements(); - return nativeElements.Count(); + return nativeElements.Count; } public void ForEach(Action action) diff --git a/src/Bellatrix.Desktop/infrastructure/App.cs b/src/Bellatrix.Desktop/infrastructure/App.cs index 82ce737d7..e178cba2a 100644 --- a/src/Bellatrix.Desktop/infrastructure/App.cs +++ b/src/Bellatrix.Desktop/infrastructure/App.cs @@ -28,19 +28,16 @@ using Bellatrix.DynamicTestCases; using Bellatrix.Plugins; using Bellatrix.Utilities; +using OpenQA.Selenium.Appium.Service; +using OpenQA.Selenium.Appium.Service.Options; namespace Bellatrix.Desktop; public class App : IDisposable { // TODO: Change to be ThreadLocal. - private static bool _shouldStartLocalService; - private static Process _winAppDriverProcess; - - public App() - { - _shouldStartLocalService = ConfigurationService.GetSection().ExecutionSettings.ShouldStartLocalService; - } + private static readonly bool ShouldStartLocalService = ConfigurationService.GetSection().ExecutionSettings.ShouldStartLocalService; + private static Process _appiumServerProcess; public AppService AppService => ServicesCollection.Current.Resolve(); public ComponentWaitService Wait => ServicesCollection.Current.Resolve(); @@ -52,39 +49,46 @@ public App() public AWSServicesFactory AWS => ServicesCollection.Current.Resolve(); public IAssert Assert => ServicesCollection.Current.Resolve(); - public static void StartWinAppDriver() + public static void StartAppiumServer() { - if (_shouldStartLocalService) + if (!ShouldStartLocalService) { - int port = int.Parse(ConfigurationService.GetSection().ExecutionSettings.Url.Split(':').Last()); + return; + } - // Anton(06.09.2018): maybe we can kill WinAppDriver every time - if (ProcessProvider.IsProcessWithNameRunning("WinAppDriver") || ProcessProvider.IsPortBusy(port)) - { - return; - } + var uri = new Uri(ConfigurationService.GetSection().ExecutionSettings.Url); - string winAppDriverPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Windows Application Driver"); - if (!Directory.Exists(winAppDriverPath)) - { - throw new ArgumentException("Windows Application Driver is not installed on the machine. To use BELLATRIX Desktop libraries you need to install it first. You can download it from here: https://github.com/Microsoft/WinAppDriver/releases"); - } + // Anton(06.09.2018): maybe we can kill WinAppDriver every time + if (ProcessProvider.IsProcessWithNameRunning("WinAppDriver") || ProcessProvider.IsPortBusy(uri.Port)) + { + return; + } - string winAppDriverExePath = Path.Combine(winAppDriverPath, "WinAppDriver.exe"); - _winAppDriverProcess = ProcessProvider.StartProcess(winAppDriverExePath, winAppDriverPath, $"{ConfigurationService.GetSection().ExecutionSettings.Url}", true); - ProcessProvider.WaitPortToGetBusy(port); + var winAppDriverPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Windows Application Driver"); + if (!Directory.Exists(winAppDriverPath)) + { + throw new ArgumentException("Windows Application Driver is not installed on the machine. To use BELLATRIX Desktop libraries you need to install it first. You can download it from here: https://github.com/Microsoft/WinAppDriver/releases"); + } + + var appiumPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "npm"); + if (!Directory.Exists(appiumPath)) + { + throw new ArgumentException("Node.js is not installed on the machine. To use BELLATRIX Desktop libraries you need to install it first. You can download it from here: https://nodejs.org/en/download"); } + + var appiumPs1Path = Path.Combine(appiumPath, "appium.ps1"); + _appiumServerProcess = ProcessProvider.StartProcess( + "powershell.exe", + Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), + $"-NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File \"{appiumPs1Path}\" -a {uri.Host} -p {uri.Port}", + true); + + ProcessProvider.WaitPortToGetBusy(uri.Port); } - public static void StopWinAppDriver() + public static void StopAppiumServer() { - if (_shouldStartLocalService) - { - if (ProcessProvider.IsProcessWithNameRunning("WinAppDriver")) - { - ProcessProvider.CloseProcess(_winAppDriverProcess); - } - } + ProcessProvider.CloseProcess(_appiumServerProcess); } public void AddAdditionalCapability(string name, object value) diff --git a/src/Bellatrix.Desktop/infrastructure/TestExecutionEngine.cs b/src/Bellatrix.Desktop/infrastructure/TestExecutionEngine.cs index 129b0053e..05ad794a4 100644 --- a/src/Bellatrix.Desktop/infrastructure/TestExecutionEngine.cs +++ b/src/Bellatrix.Desktop/infrastructure/TestExecutionEngine.cs @@ -26,7 +26,7 @@ public void StartApp(AppInitializationInfo appConfiguration, ServicesCollection try { var wrappedWebDriver = WrappedWebDriverCreateService.Create(appConfiguration, childContainer); - childContainer.RegisterInstance>(wrappedWebDriver); + childContainer.RegisterInstance(wrappedWebDriver); ////childContainer.RegisterInstance(new AppService(wrappedWebDriver)); ////childContainer.RegisterInstance(new ComponentCreateService()); childContainer.RegisterNull(); diff --git a/src/Bellatrix.Desktop/plugins/execution/AppLifecyclePlugin.cs b/src/Bellatrix.Desktop/plugins/execution/AppLifecyclePlugin.cs index aec4e38dd..1698661e7 100644 --- a/src/Bellatrix.Desktop/plugins/execution/AppLifecyclePlugin.cs +++ b/src/Bellatrix.Desktop/plugins/execution/AppLifecyclePlugin.cs @@ -106,7 +106,10 @@ private void RestartApp(ServicesCollection container) { var currentAppConfiguration = container.Resolve("_currentAppConfiguration"); - ShutdownApp(container); + if (currentAppConfiguration.AppPath != "Root") + { + ShutdownApp(container); + } // Register the ExecutionEngine that should be used for the current run. Will be used in the next test as PreviousEngineType. var testExecutionEngine = new TestExecutionEngine(); @@ -216,58 +219,74 @@ private void InitializeCustomCodeOptions(dynamic options, Type testClassType) private void InitializeGridOptionsFromConfiguration(dynamic options, Type testClassType) { - if (ConfigurationService.GetSection().ExecutionSettings.Arguments == null) + var executionSettings = ConfigurationService.GetSection().ExecutionSettings; + + if (executionSettings.Arguments == null) + { + return; + } + + if (executionSettings.Arguments.Count <= 0) { return; } - if (ConfigurationService.GetSection().ExecutionSettings.Arguments[0].Count > 0) + if (executionSettings.Arguments[0].Count <= 0) { - foreach (var item in ConfigurationService.GetSection().ExecutionSettings.Arguments[0]) + return; + } + + foreach (var item in executionSettings.Arguments[0]) + { + if (!string.IsNullOrEmpty(item.Key) && item.Value != null) { - if (!string.IsNullOrEmpty(item.Key) && !string.IsNullOrEmpty(item.Value)) - { - options.AddAdditionalCapability(item.Key, FormatGridOptions(item.Value, testClassType)); - } + options.AddAdditionalCapability(item.Key, FormatGridOptions(item.Value, testClassType)); } } } - private dynamic FormatGridOptions(string option, Type testClassType) + private dynamic FormatGridOptions(object option, Type testClassType) { - if (bool.TryParse(option, out bool result)) + if (option is not string) + { + return option; + } + + if (bool.TryParse((string)option, out bool result)) { return result; } - else if (int.TryParse(option, out int resultNumber)) + + if (int.TryParse((string)option, out int resultNumber)) { return resultNumber; } - else if (option.StartsWith("env_") || option.StartsWith("vault_")) + + if (((string)option).StartsWith("env_") || ((string)option).StartsWith("vault_")) { - return SecretsResolver.GetSecret(() => option); + return SecretsResolver.GetSecret(() => (string)option); } - else if (double.TryParse(option, out double resultRealNumber)) + + if (double.TryParse((string)option, out double resultRealNumber)) { return resultRealNumber; } - else if (option.StartsWith("AssemblyFolder", StringComparison.Ordinal)) + + if (((string)option).StartsWith("AssemblyFolder", StringComparison.Ordinal)) { var executionFolder = ExecutionDirectoryResolver.GetDriverExecutablePath(); - option = option.Replace("AssemblyFolder", executionFolder); + option = ((string)option).Replace("AssemblyFolder", executionFolder); if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { - option = option.Replace('\\', '/'); + option = ((string)option).Replace('\\', '/'); } return option; } - else - { - var runName = testClassType.Assembly.GetName().Name; - var timestamp = $"{DateTime.Now:yyyyMMdd.HHmm}"; - return option.Replace("{runName}", timestamp).Replace("{runName}", runName); - } + + var runName = testClassType.Assembly.GetName().Name; + var timestamp = $"{DateTime.Now:yyyyMMdd.HHmm}"; + return ((string)option).Replace("{runName}", timestamp).Replace("{runName}", runName); } } diff --git a/src/Bellatrix.Desktop/plugins/execution/Attributes/AppAttribute.cs b/src/Bellatrix.Desktop/plugins/execution/Attributes/AppAttribute.cs index e1f5870e8..030a5d3e5 100644 --- a/src/Bellatrix.Desktop/plugins/execution/Attributes/AppAttribute.cs +++ b/src/Bellatrix.Desktop/plugins/execution/Attributes/AppAttribute.cs @@ -24,11 +24,13 @@ public class AppAttribute : Attribute { public AppAttribute(string appPath, Lifecycle lifecycle = Lifecycle.NotSet) { - AppConfiguration = new AppInitializationInfo(); - AppConfiguration.AppPath = appPath; - AppConfiguration.Lifecycle = lifecycle; - AppConfiguration.Size = default; - AppConfiguration.AppiumOptions = new AppiumOptions(); + AppConfiguration = new AppInitializationInfo + { + AppPath = appPath, + Lifecycle = lifecycle, + Size = default, + AppiumOptions = new AppiumOptions() + }; } public AppAttribute(string appPath, int width, int height, Lifecycle behavior = Lifecycle.NotSet) diff --git a/src/Bellatrix.Desktop/services/WrappedWebDriverCreateService.cs b/src/Bellatrix.Desktop/services/WrappedWebDriverCreateService.cs index fc32876e0..9b6bbba2c 100644 --- a/src/Bellatrix.Desktop/services/WrappedWebDriverCreateService.cs +++ b/src/Bellatrix.Desktop/services/WrappedWebDriverCreateService.cs @@ -18,48 +18,80 @@ using Bellatrix.Desktop.Configuration; using OpenQA.Selenium.Appium; using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Interactions; -using OpenQA.Selenium.Remote; namespace Bellatrix.Desktop.Services; public class WrappedWebDriverCreateService { - private static readonly string _serviceUrl; + private static readonly string ServiceUrl; + + private const string CloseButtonXPath = "//Button[contains(translate(@AutomationId, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), 'close') or contains(translate(@Name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), 'close')]"; static WrappedWebDriverCreateService() { - _serviceUrl = ConfigurationService.GetSection().ExecutionSettings.Url; + ServiceUrl = ConfigurationService.GetSection().ExecutionSettings.Url; } public static WindowsDriver Create(AppInitializationInfo appConfiguration, ServicesCollection childContainer) { var driverOptions = childContainer.Resolve(appConfiguration.ClassFullName) ?? childContainer.Resolve() ?? appConfiguration.AppiumOptions; + + var appiumOptions = new Dictionary + { + { "automationName", "Windows" }, + { "appWorkingDir", Path.GetDirectoryName(appConfiguration.AppPath) }, + { "createSessionTimeout", ConfigurationService.GetSection().TimeoutSettings.CreateSessionTimeout }, + { "ms:waitForAppLaunch", ConfigurationService.GetSection().TimeoutSettings.WaitForAppLaunchTimeout }, + { "ms:experimental-webdriver", true } + }; + + if (appConfiguration.AppPath == "Root") + { + if (appConfiguration.WindowHandle == null) + { + appiumOptions.Add("app", appConfiguration.AppPath); + } + else + { + appiumOptions.Add("appTopLevelWindow", appConfiguration.WindowHandle); + } + } + else + { + appiumOptions.Add("app", appConfiguration.AppPath); + } + + var appiumCapabilities = ServicesCollection.Main.Resolve>($"caps-{appConfiguration.ClassFullName}"); + driverOptions.PlatformName = "Windows"; - driverOptions.AddAdditionalCapability("deviceName", "WindowsPC"); - driverOptions.AddAdditionalCapability("app", appConfiguration.AppPath); - string workingDir = Path.GetDirectoryName(appConfiguration.AppPath); - driverOptions.AddAdditionalCapability("appWorkingDir", workingDir); - driverOptions.AddAdditionalCapability("createSessionTimeout", ConfigurationService.GetSection().TimeoutSettings.CreateSessionTimeout); - driverOptions.AddAdditionalCapability("ms:waitForAppLaunch", ConfigurationService.GetSection().TimeoutSettings.WaitForAppLaunchTimeout); - - var additionalCapabilities = ServicesCollection.Main.Resolve>($"caps-{appConfiguration.ClassFullName}") ?? new Dictionary(); + driverOptions.AddAdditionalCapability("appium:options", appiumOptions); + var additionalCapabilities = appiumCapabilities ?? new Dictionary(); foreach (var additionalCapability in additionalCapabilities) { driverOptions.AddAdditionalCapability(additionalCapability.Key, additionalCapability.Value); } - var wrappedWebDriver = new WindowsDriver(new Uri(_serviceUrl), driverOptions); + var wrappedWebDriver = new WindowsDriver(new Uri(ServiceUrl), driverOptions); wrappedWebDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(ConfigurationService.GetSection().TimeoutSettings.ImplicitWaitTimeout); - ChangeWindowSize(appConfiguration.Size, wrappedWebDriver); - wrappedWebDriver.SwitchTo().Window(wrappedWebDriver.CurrentWindowHandle); + if (!appiumOptions.TryGetValue("app", out var app) || app as string == "Root") + { + return wrappedWebDriver; + } + try { - var closeButton = wrappedWebDriver.FindElementByAccessibilityId("Close"); - var action = new Actions(wrappedWebDriver); - action.MoveToElement(closeButton).Perform(); + var closeButton = wrappedWebDriver.FindElementByXPath(CloseButtonXPath); + + wrappedWebDriver.ExecuteScript("windows: hover", new Dictionary + { + { "startElementId", closeButton.Id }, + { "endElementId", closeButton.Id }, + { "durationMs", 0 } + }); + + wrappedWebDriver.SwitchTo().Window(wrappedWebDriver.CurrentWindowHandle); } catch (Exception e) { diff --git a/src/Bellatrix.Desktop/settings/AppInitializationInfo.cs b/src/Bellatrix.Desktop/settings/AppInitializationInfo.cs index b41ab1d50..1db60b30a 100644 --- a/src/Bellatrix.Desktop/settings/AppInitializationInfo.cs +++ b/src/Bellatrix.Desktop/settings/AppInitializationInfo.cs @@ -45,6 +45,8 @@ public AppInitializationInfo(string appPath, Lifecycle lifecycle, Size size, str public string ClassFullName { get; set; } public string AppPath { get => NormalizeAppPath(); set => _appPath = value; } + + public string WindowHandle { get; set; } public AppiumOptions AppiumOptions { get; set; } @@ -64,11 +66,18 @@ private string NormalizeAppPath() { return _appPath; } - else if (_appPath.StartsWith("AssemblyFolder", StringComparison.Ordinal)) + + if (_appPath.StartsWith("AssemblyFolder", StringComparison.Ordinal)) { var executionFolder = ExecutionDirectoryResolver.GetDriverExecutablePath(); _appPath = _appPath.Replace("AssemblyFolder", executionFolder); } + + if (_appPath.StartsWith("UserFolder", StringComparison.Ordinal)) + { + var executionFolder = ExecutionDirectoryResolver.GetDriverExecutablePath(); + _appPath = _appPath.Replace("UserFolder", Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)); + } return _appPath; } diff --git a/src/Bellatrix.Desktop/settings/ExecutionSettings.cs b/src/Bellatrix.Desktop/settings/ExecutionSettings.cs index 869ba9550..3b7f5678b 100644 --- a/src/Bellatrix.Desktop/settings/ExecutionSettings.cs +++ b/src/Bellatrix.Desktop/settings/ExecutionSettings.cs @@ -23,6 +23,7 @@ public class ExecutionSettings public string Resolution { get; set; } public bool ShouldStartLocalService { get; set; } = true; public string Url { get; set; } - public List> Arguments { get; set; } + public List> Arguments { get; set; } + public bool IsCloudRun { get; set; } } \ No newline at end of file diff --git a/src/Bellatrix.Web/Bellatrix.Web.csproj b/src/Bellatrix.Web/Bellatrix.Web.csproj index 17fa053fe..ada8c9668 100644 --- a/src/Bellatrix.Web/Bellatrix.Web.csproj +++ b/src/Bellatrix.Web/Bellatrix.Web.csproj @@ -15,7 +15,7 @@ - + diff --git a/src/Bellatrix.Web/services/DevToolsService.cs b/src/Bellatrix.Web/services/DevToolsService.cs index 26526a0c1..7d8a2fbf8 100644 --- a/src/Bellatrix.Web/services/DevToolsService.cs +++ b/src/Bellatrix.Web/services/DevToolsService.cs @@ -1,19 +1,19 @@ using Bellatrix.Assertions; using OpenQA.Selenium; using OpenQA.Selenium.DevTools; -using OpenQA.Selenium.DevTools.V107.Console; -using OpenQA.Selenium.DevTools.V107.DOMSnapshot; -using OpenQA.Selenium.DevTools.V107.Emulation; -using OpenQA.Selenium.DevTools.V107.Network; -using OpenQA.Selenium.DevTools.V107.Performance; -using OpenQA.Selenium.DevTools.V107.Security; +using OpenQA.Selenium.DevTools.V119.Console; +using OpenQA.Selenium.DevTools.V119.DOMSnapshot; +using OpenQA.Selenium.DevTools.V119.Emulation; +using OpenQA.Selenium.DevTools.V119.Network; +using OpenQA.Selenium.DevTools.V119.Performance; +using OpenQA.Selenium.DevTools.V119.Security; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using DevToolsSessionDomains = OpenQA.Selenium.DevTools.V107.DevToolsSessionDomains; -using EnableCommandSettings = OpenQA.Selenium.DevTools.V107.Network.EnableCommandSettings; -using SetUserAgentOverrideCommandSettings = OpenQA.Selenium.DevTools.V107.Network.SetUserAgentOverrideCommandSettings; +using DevToolsSessionDomains = OpenQA.Selenium.DevTools.V119.DevToolsSessionDomains; +using EnableCommandSettings = OpenQA.Selenium.DevTools.V119.Network.EnableCommandSettings; +using SetUserAgentOverrideCommandSettings = OpenQA.Selenium.DevTools.V119.Network.SetUserAgentOverrideCommandSettings; namespace Bellatrix.Web; diff --git a/templates/Bellatrix.API.GettingStarted/Models/Albums.cs b/templates/Bellatrix.API.GettingStarted/Models/Albums.cs index 6db206d9e..fa39226d2 100644 --- a/templates/Bellatrix.API.GettingStarted/Models/Albums.cs +++ b/templates/Bellatrix.API.GettingStarted/Models/Albums.cs @@ -4,6 +4,7 @@ namespace Bellatrix.API.GettingStarted.Models; +#pragma warning disable CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() public class Albums : IEquatable { public Albums() => Tracks = new HashSet(); @@ -22,7 +23,6 @@ public class Albums : IEquatable public bool Equals(Albums other) => AlbumId.Equals(other.AlbumId); -#pragma warning disable CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() public override bool Equals(object obj) => Equals(obj as Albums); -#pragma warning restore CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() } +#pragma warning restore CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() \ No newline at end of file diff --git a/templates/Bellatrix.API.Tests/Models/Albums.cs b/templates/Bellatrix.API.Tests/Models/Albums.cs index 1ca9253e9..1c3d55dee 100644 --- a/templates/Bellatrix.API.Tests/Models/Albums.cs +++ b/templates/Bellatrix.API.Tests/Models/Albums.cs @@ -4,6 +4,7 @@ namespace Bellatrix.API.MSTest.Tests.Models; +#pragma warning disable CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() public class Albums : IEquatable { public Albums() => Tracks = new HashSet(); @@ -21,8 +22,7 @@ public class Albums : IEquatable public ICollection Tracks { get; set; } public bool Equals(Albums other) => AlbumId.Equals(other?.AlbumId); - -#pragma warning disable CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode( + public override bool Equals(object obj) => Equals(obj as Albums); -#pragma warning restore CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() } +#pragma warning restore CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() \ No newline at end of file diff --git a/templates/Bellatrix.Desktop.Tests/testFrameworkSettings.Debug.json b/templates/Bellatrix.Desktop.Tests/testFrameworkSettings.Debug.json index fcb09dc10..18f8e9ce0 100644 --- a/templates/Bellatrix.Desktop.Tests/testFrameworkSettings.Debug.json +++ b/templates/Bellatrix.Desktop.Tests/testFrameworkSettings.Debug.json @@ -23,7 +23,7 @@ "shouldStartLocalService": "false", "resolution": "", "defaultAppPath": "AssemblyFolder\\Demos\\Wpf\\WPFSampleApp.exe", - "url": "http://127.0.0.1:4722", + "url": "http://127.0.0.1:4723", "arguments": [ { //"name": "{runName}", diff --git a/tests/Bellatrix.API.Tests/Models/Albums.cs b/tests/Bellatrix.API.Tests/Models/Albums.cs index 0c199c84b..383b7987c 100644 --- a/tests/Bellatrix.API.Tests/Models/Albums.cs +++ b/tests/Bellatrix.API.Tests/Models/Albums.cs @@ -17,6 +17,7 @@ namespace MediaStore.Demo.API.Models; +#pragma warning disable CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() public class Albums : IEquatable { public Albums() => Tracks = new HashSet(); @@ -35,7 +36,6 @@ public class Albums : IEquatable public bool Equals(Albums other) => AlbumId.Equals(other.AlbumId); -#pragma warning disable CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() public override bool Equals(object obj) => Equals(obj as Albums); -#pragma warning restore CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() } +#pragma warning restore CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() \ No newline at end of file diff --git a/tests/Bellatrix.Desktop.Tests/Categories.cs b/tests/Bellatrix.Desktop.Tests/Categories.cs index 2dd9723d4..d24040bbe 100644 --- a/tests/Bellatrix.Desktop.Tests/Categories.cs +++ b/tests/Bellatrix.Desktop.Tests/Categories.cs @@ -13,9 +13,13 @@ // https://bellatrix.solutions/ namespace Bellatrix.Desktop.Tests; -public class Categories +public static class Categories { public const string CI = "CI"; public const string Layout = "Layout"; public const string Desktop = "Desktop"; + + public const string WPF = "WPF"; + public const string WinForms = "WinForms"; + public const string Universal = "Universal"; } diff --git a/tests/Bellatrix.Desktop.Tests/Constants.cs b/tests/Bellatrix.Desktop.Tests/Constants.cs index 1b67e49f3..23dd4318d 100644 --- a/tests/Bellatrix.Desktop.Tests/Constants.cs +++ b/tests/Bellatrix.Desktop.Tests/Constants.cs @@ -13,9 +13,9 @@ // https://bellatrix.solutions/ namespace Bellatrix.Desktop.Tests; -public class Constants +public static class Constants { public const string WpfAppPath = @"AssemblyFolder\Demos\Wpf\WPFSampleApp.exe"; public const string WinFormsAppPath = @"AssemblyFolder\Demos\WinForms\WindowsFormsSampleApp.exe"; - public const string UniversalAppPath = @"369ede42-bebe-41ea-a02a-0da04991478e_hkj3ysbfh4b9w!App"; + public const string UniversalAppPath = "369ede42-bebe-41ea-a02a-0da04991478e_hkj3ysbfh4b9w!App"; } \ No newline at end of file diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlEventsTests.cs b/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlEventsTests.cs index 3fed8980f..4ac908371 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlEventsTests.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlEventsTests.cs @@ -21,6 +21,7 @@ namespace Bellatrix.Desktop.Tests; [AllureSuite("Button Control")] [AllureFeature("Control Events")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class ButtonControlEventsTests : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlTestsUniversal.cs b/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlTestsUniversal.cs index ca49e8cbd..df45680fc 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlTestsUniversal.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlTestsUniversal.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.UniversalAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Button Control")] [AllureTag("Universal")] +[TestCategory(Categories.Universal)] public class ButtonControlTestsUniversal : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlTestsWinForms.cs b/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlTestsWinForms.cs index 642d06acb..3658fa7cd 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlTestsWinForms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlTestsWinForms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Button Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class ButtonControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlTestsWpf.cs index cbf19ca92..c377f2f33 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Button Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class ButtonControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlValidateExtensionsExceptionMessagesTests.cs b/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlValidateExtensionsExceptionMessagesTests.cs index 9299aa9f8..4dbb118d4 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlValidateExtensionsExceptionMessagesTests.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlValidateExtensionsExceptionMessagesTests.cs @@ -21,6 +21,7 @@ namespace Bellatrix.Desktop.Tests; [AllureSuite("Button Control")] [AllureFeature("ValidateExtensionsExceptionMessages")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class ButtonControlValidateExtensionsExceptionMessagesTests : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlValidaterExtensionsTests.cs b/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlValidaterExtensionsTests.cs index e2e5d65d5..19346c909 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlValidaterExtensionsTests.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlValidaterExtensionsTests.cs @@ -20,6 +20,7 @@ namespace Bellatrix.Desktop.Tests; [AllureSuite("Button Control")] [AllureFeature("ValidateExtensions")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class ButtonControlValidateExtensionsTests : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlEventsTests.cs b/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlEventsTests.cs index a95e2fd95..86efc5f36 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlEventsTests.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlEventsTests.cs @@ -21,6 +21,7 @@ namespace Bellatrix.Desktop.Tests; [AllureSuite("Calendar Control")] [AllureFeature("Control Events")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class CalendarControlEventsTests : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlTestsUniversal.cs b/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlTestsUniversal.cs index 849f2f8cf..7cfe87161 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlTestsUniversal.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlTestsUniversal.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.UniversalAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Calendar Control")] [AllureTag("Universal")] +[TestCategory(Categories.Universal)] public class CalendarControlTestsUniversal : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlTestsWinForms.cs b/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlTestsWinForms.cs index 8ae9c54b3..55f62e140 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlTestsWinForms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlTestsWinForms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Calendar Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class CalendarControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlTestsWpf.cs index dd851da79..7522d8e2e 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Calendar Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class CalendarControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlValidateExtensionsExceptionMessagesTests.cs b/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlValidateExtensionsExceptionMessagesTests.cs index 12c3479da..c86d3032e 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlValidateExtensionsExceptionMessagesTests.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlValidateExtensionsExceptionMessagesTests.cs @@ -21,6 +21,7 @@ namespace Bellatrix.Desktop.Tests; [AllureSuite("Calendar Control")] [AllureFeature("ValidateExtensionsExceptionMessages")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class CalendarControlValidateExtensionsExceptionMessagesTests : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/CheckBox/CheckBoxControlTestsUniversal.cs b/tests/Bellatrix.Desktop.Tests/Controls/CheckBox/CheckBoxControlTestsUniversal.cs index 88321425e..322128044 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/CheckBox/CheckBoxControlTestsUniversal.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/CheckBox/CheckBoxControlTestsUniversal.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.UniversalAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("CheckBox Control")] [AllureTag("Universal")] +[TestCategory(Categories.Universal)] public class CheckBoxControlTestsUniversal : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/CheckBox/CheckBoxControlTestsWinForms.cs b/tests/Bellatrix.Desktop.Tests/Controls/CheckBox/CheckBoxControlTestsWinForms.cs index 1b214dbcb..69b62f1dd 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/CheckBox/CheckBoxControlTestsWinForms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/CheckBox/CheckBoxControlTestsWinForms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("CheckBox Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class CheckBoxControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/CheckBox/CheckBoxControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/CheckBox/CheckBoxControlTestsWpf.cs index eeb40491e..2fdaa8b87 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/CheckBox/CheckBoxControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/CheckBox/CheckBoxControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("CheckBox Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class CheckBoxControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/ComboBox/ComboBoxControlTestsUniversal.cs b/tests/Bellatrix.Desktop.Tests/Controls/ComboBox/ComboBoxControlTestsUniversal.cs index e8ca9e2ff..a58fc7ff2 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/ComboBox/ComboBoxControlTestsUniversal.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/ComboBox/ComboBoxControlTestsUniversal.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.UniversalAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("ComboBox Control")] [AllureTag("Universal")] +[TestCategory(Categories.Universal)] public class ComboBoxControlTestsUniversal : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/ComboBox/ComboBoxControlTestsWinForms.cs b/tests/Bellatrix.Desktop.Tests/Controls/ComboBox/ComboBoxControlTestsWinForms.cs index 8f89b2ffb..65af82711 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/ComboBox/ComboBoxControlTestsWinForms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/ComboBox/ComboBoxControlTestsWinForms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("ComboBox Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class ComboBoxControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/ComboBox/ComboBoxControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/ComboBox/ComboBoxControlTestsWpf.cs index f0432d821..df6ca9b5d 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/ComboBox/ComboBoxControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/ComboBox/ComboBoxControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("ComboBox Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class ComboBoxControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/DatePicker/DatePickerControlTestsUniversal.cs b/tests/Bellatrix.Desktop.Tests/Controls/DatePicker/DatePickerControlTestsUniversal.cs index 7c34bb8ad..e7db9a587 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/DatePicker/DatePickerControlTestsUniversal.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/DatePicker/DatePickerControlTestsUniversal.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.UniversalAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("DatePicker Control")] [AllureTag("Universal")] +[TestCategory(Categories.Universal)] public class DatePickerControlTestsUniversal : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/DatePicker/DatePickerControlTestsWinForms.cs b/tests/Bellatrix.Desktop.Tests/Controls/DatePicker/DatePickerControlTestsWinForms.cs index 88e0d7e04..9b16a60d4 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/DatePicker/DatePickerControlTestsWinForms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/DatePicker/DatePickerControlTestsWinForms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("DatePicker Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class DatePickerControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/DatePicker/DatePickerControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/DatePicker/DatePickerControlTestsWpf.cs index 4df87b995..33b3d2c6a 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/DatePicker/DatePickerControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/DatePicker/DatePickerControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("DatePicker Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class DatePickerControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Element/ElementControlTestsUniversal.cs b/tests/Bellatrix.Desktop.Tests/Controls/Element/ElementControlTestsUniversal.cs index 1074b385f..163dec9b0 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Element/ElementControlTestsUniversal.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Element/ElementControlTestsUniversal.cs @@ -20,6 +20,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.UniversalAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Element Control")] [AllureTag("Universal")] +[TestCategory(Categories.Universal)] public class ElementControlTestsUniversal : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Element/ElementControlTestsWinforms.cs b/tests/Bellatrix.Desktop.Tests/Controls/Element/ElementControlTestsWinforms.cs index 103016786..ce377c60e 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Element/ElementControlTestsWinforms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Element/ElementControlTestsWinforms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Element Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class ElementControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Element/ElementControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/Element/ElementControlTestsWpf.cs index afa32334d..4d16e040b 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Element/ElementControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Element/ElementControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Element Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class ElementControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Expander/ExpanderControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/Expander/ExpanderControlTestsWpf.cs index da93f0ac2..220a924a3 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Expander/ExpanderControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Expander/ExpanderControlTestsWpf.cs @@ -21,6 +21,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Expander Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class ExpanderControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Image/ImageControlTestsWinForms.cs b/tests/Bellatrix.Desktop.Tests/Controls/Image/ImageControlTestsWinForms.cs index d798036d2..b8d885138 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Image/ImageControlTestsWinForms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Image/ImageControlTestsWinForms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Image Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class ImageControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Image/ImageControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/Image/ImageControlTestsWpf.cs index 2ac4406aa..368cd2d82 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Image/ImageControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Image/ImageControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Image Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class ImageControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Label/LabelControlTestsUniversal.cs b/tests/Bellatrix.Desktop.Tests/Controls/Label/LabelControlTestsUniversal.cs index c45f0e166..2d852da53 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Label/LabelControlTestsUniversal.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Label/LabelControlTestsUniversal.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.UniversalAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Label Control")] [AllureTag("Universal")] +[TestCategory(Categories.Universal)] public class LabelControlTestsUniversal : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Label/LabelControlTestsWinForms.cs b/tests/Bellatrix.Desktop.Tests/Controls/Label/LabelControlTestsWinForms.cs index 58d73a3c3..916688887 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Label/LabelControlTestsWinForms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Label/LabelControlTestsWinForms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Label Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class LabelControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Label/LabelControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/Label/LabelControlTestsWpf.cs index 15ba854b9..e6cbdb6c1 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Label/LabelControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Label/LabelControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Label Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class LabelControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/ListBox/ListBoxControlTestsUniversal.cs b/tests/Bellatrix.Desktop.Tests/Controls/ListBox/ListBoxControlTestsUniversal.cs index 705c8a6be..bdf5a4c24 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/ListBox/ListBoxControlTestsUniversal.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/ListBox/ListBoxControlTestsUniversal.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.UniversalAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("ListBox Control")] [AllureTag("Universal")] +[TestCategory(Categories.Universal)] public class ListBoxControlTestsUniversal : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/ListBox/ListBoxControlTestsWinForms.cs b/tests/Bellatrix.Desktop.Tests/Controls/ListBox/ListBoxControlTestsWinForms.cs index b9a24675d..4d99a8f8c 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/ListBox/ListBoxControlTestsWinForms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/ListBox/ListBoxControlTestsWinForms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("ListBox Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class ListBoxControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/ListBox/ListBoxControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/ListBox/ListBoxControlTestsWpf.cs index f276f0e60..f85f1e050 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/ListBox/ListBoxControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/ListBox/ListBoxControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("ListBox Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class ListBoxControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Pasword/PasswordControlTestsUniversal.cs b/tests/Bellatrix.Desktop.Tests/Controls/Pasword/PasswordControlTestsUniversal.cs index 1864f454a..50b045355 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Pasword/PasswordControlTestsUniversal.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Pasword/PasswordControlTestsUniversal.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.UniversalAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Password Control")] [AllureTag("Universal")] +[TestCategory(Categories.Universal)] public class PasswordControlTestsUniversal : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Pasword/PasswordControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/Pasword/PasswordControlTestsWpf.cs index dcf4784ac..a50cff5dd 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Pasword/PasswordControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Pasword/PasswordControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Password Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class PasswordControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Progress/ProgressControlTestsUniversal.cs b/tests/Bellatrix.Desktop.Tests/Controls/Progress/ProgressControlTestsUniversal.cs index 4a5298055..068548b65 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Progress/ProgressControlTestsUniversal.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Progress/ProgressControlTestsUniversal.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.UniversalAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Progress Control")] [AllureTag("Universal")] +[TestCategory(Categories.Universal)] public class ProgressControlTestsUniversal : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Progress/ProgressControlTestsWinForms.cs b/tests/Bellatrix.Desktop.Tests/Controls/Progress/ProgressControlTestsWinForms.cs index c45119b3b..0721484f1 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Progress/ProgressControlTestsWinForms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Progress/ProgressControlTestsWinForms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Progress Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class ProgressControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Progress/ProgressControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/Progress/ProgressControlTestsWpf.cs index c73b57d6d..78b75e9d5 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Progress/ProgressControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Progress/ProgressControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Progress Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class ProgressControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Radio/RadioControlTestsUniversal.cs b/tests/Bellatrix.Desktop.Tests/Controls/Radio/RadioControlTestsUniversal.cs index 8089e5a50..dc86c9dc7 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Radio/RadioControlTestsUniversal.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Radio/RadioControlTestsUniversal.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.UniversalAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Radio Control")] [AllureTag("Universal")] +[TestCategory(Categories.Universal)] public class RadioControlTestsUniversal : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Radio/RadioControlTestsWinForms.cs b/tests/Bellatrix.Desktop.Tests/Controls/Radio/RadioControlTestsWinForms.cs index 1f0010583..1b42c2c36 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Radio/RadioControlTestsWinForms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Radio/RadioControlTestsWinForms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Radio Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class RadioControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Radio/RadioControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/Radio/RadioControlTestsWpf.cs index 0ad5aaab2..33e0321f6 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Radio/RadioControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Radio/RadioControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Radio Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class RadioControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Tabs/TabsControlTestsWinForms.cs b/tests/Bellatrix.Desktop.Tests/Controls/Tabs/TabsControlTestsWinForms.cs index 727710996..4d5b0f605 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Tabs/TabsControlTestsWinForms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Tabs/TabsControlTestsWinForms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Tabs Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class TabsControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Tabs/TabsControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/Tabs/TabsControlTestsWpf.cs index 682009f2e..9bd85893d 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Tabs/TabsControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Tabs/TabsControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Tabs Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class TabsControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/TextArea/TextAreaControlTestsWinForms.cs b/tests/Bellatrix.Desktop.Tests/Controls/TextArea/TextAreaControlTestsWinForms.cs index 550caefb4..0e1749c99 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/TextArea/TextAreaControlTestsWinForms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/TextArea/TextAreaControlTestsWinForms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("TextArea Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class TextAreaControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/TextArea/TextAreaControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/TextArea/TextAreaControlTestsWpf.cs index c712823ca..50ca6131f 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/TextArea/TextAreaControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/TextArea/TextAreaControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("TextArea Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class TextAreaControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/TextField/TextFieldControlTestsUniversal.cs b/tests/Bellatrix.Desktop.Tests/Controls/TextField/TextFieldControlTestsUniversal.cs index 41383308e..2547fc662 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/TextField/TextFieldControlTestsUniversal.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/TextField/TextFieldControlTestsUniversal.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.UniversalAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("TextField Control")] [AllureTag("Universal")] +[TestCategory(Categories.Universal)] public class TextFieldControlTestsUniversal : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/TextField/TextFieldControlTestsWinForms.cs b/tests/Bellatrix.Desktop.Tests/Controls/TextField/TextFieldControlTestsWinForms.cs index 201bfb0fd..fa6af9931 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/TextField/TextFieldControlTestsWinForms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/TextField/TextFieldControlTestsWinForms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("TextField Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class TextFieldControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/TextField/TextFieldControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/TextField/TextFieldControlTestsWpf.cs index 808df812f..5e329a2a2 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/TextField/TextFieldControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/TextField/TextFieldControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("TextField Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class TextFieldControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Time/TimePickerControlTestsUniversal.cs b/tests/Bellatrix.Desktop.Tests/Controls/Time/TimePickerControlTestsUniversal.cs index 79b8b7af2..9865c5011 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Time/TimePickerControlTestsUniversal.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Time/TimePickerControlTestsUniversal.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.UniversalAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("TimePicker Control")] [AllureTag("Universal")] +[TestCategory(Categories.Universal)] public class TimePickerControlTestsUniversal : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/TestsInitialize.cs b/tests/Bellatrix.Desktop.Tests/TestsInitialize.cs index 13210780e..f6960059e 100644 --- a/tests/Bellatrix.Desktop.Tests/TestsInitialize.cs +++ b/tests/Bellatrix.Desktop.Tests/TestsInitialize.cs @@ -22,7 +22,7 @@ public class TestsInitialize public static void AssemblyInitialize(TestContext testContext) { AllurePlugin.Add(); - App.StartWinAppDriver(); + ////App.StartWinAppDriver(); } [AssemblyCleanup] @@ -30,6 +30,6 @@ public static void AssemblyCleanUp() { var app = ServicesCollection.Current.Resolve(); app.Dispose(); - App.StopWinAppDriver(); + ////App.StopWinAppDriver(); } } diff --git a/tests/Bellatrix.Web.Tests/Image Recognition/ImageRecognitionTests.cs b/tests/Bellatrix.Web.Tests/Image Recognition/ImageRecognitionTests.cs index 93d3dd53f..dc1530e48 100644 --- a/tests/Bellatrix.Web.Tests/Image Recognition/ImageRecognitionTests.cs +++ b/tests/Bellatrix.Web.Tests/Image Recognition/ImageRecognitionTests.cs @@ -5,7 +5,7 @@ namespace Bellatrix.Web.Demos; [TestClass] -[Browser(BrowserType.Chrome, Lifecycle.ReuseIfStarted)] +[Browser(BrowserType.Edge, Lifecycle.ReuseIfStarted)] public class ImageRecognitionTests : MSTest.WebTest { [TestMethod] From b61128dbe331dc3ba051299cf986897f11ca2e41 Mon Sep 17 00:00:00 2001 From: Teodor Nikolov Date: Fri, 12 Apr 2024 14:42:22 +0000 Subject: [PATCH 04/32] Updates to the desktop module --- .../Bellatrix.Desktop.csproj | 4 - .../Core/Component.DefaultActions.cs | 18 +++- .../components/Core/ComponentsList.cs | 2 +- src/Bellatrix.Desktop/components/Window.cs | 96 +++++++++++++++++++ src/Bellatrix.Desktop/infrastructure/App.cs | 66 +++++++------ .../infrastructure/TestExecutionEngine.cs | 2 +- .../plugins/execution/AppLifecyclePlugin.cs | 65 ++++++++----- .../execution/Attributes/AppAttribute.cs | 12 ++- .../services/ComponentsRepository.cs | 12 +-- .../services/WrappedWebDriverCreateService.cs | 68 +++++++++---- .../settings/AppInitializationInfo.cs | 11 ++- .../settings/ExecutionSettings.cs | 2 +- src/Bellatrix.ImageRecognition/Screen.cs | 13 ++- src/Bellatrix.Web/Bellatrix.Web.csproj | 2 +- src/Bellatrix.Web/services/DevToolsService.cs | 18 ++-- .../Models/Albums.cs | 4 +- .../Bellatrix.API.Tests/Models/Albums.cs | 6 +- .../testFrameworkSettings.Debug.json | 2 +- tests/Bellatrix.API.Tests/Models/Albums.cs | 4 +- tests/Bellatrix.Desktop.Tests/Categories.cs | 6 +- tests/Bellatrix.Desktop.Tests/Constants.cs | 4 +- .../Button/ButtonControlEventsTests.cs | 1 + .../Button/ButtonControlTestsUniversal.cs | 1 + .../Button/ButtonControlTestsWinForms.cs | 1 + .../Controls/Button/ButtonControlTestsWpf.cs | 1 + ...alidateExtensionsExceptionMessagesTests.cs | 1 + .../ButtonControlValidaterExtensionsTests.cs | 1 + .../Calendar/CalendarControlEventsTests.cs | 1 + .../Calendar/CalendarControlTestsUniversal.cs | 1 + .../Calendar/CalendarControlTestsWinForms.cs | 1 + .../Calendar/CalendarControlTestsWpf.cs | 1 + ...alidateExtensionsExceptionMessagesTests.cs | 1 + .../CheckBox/CheckBoxControlTestsUniversal.cs | 1 + .../CheckBox/CheckBoxControlTestsWinForms.cs | 1 + .../CheckBox/CheckBoxControlTestsWpf.cs | 1 + .../ComboBox/ComboBoxControlTestsUniversal.cs | 1 + .../ComboBox/ComboBoxControlTestsWinForms.cs | 1 + .../ComboBox/ComboBoxControlTestsWpf.cs | 1 + .../DatePickerControlTestsUniversal.cs | 1 + .../DatePickerControlTestsWinForms.cs | 1 + .../DatePicker/DatePickerControlTestsWpf.cs | 1 + .../Element/ElementControlTestsUniversal.cs | 1 + .../Element/ElementControlTestsWinforms.cs | 1 + .../Element/ElementControlTestsWpf.cs | 1 + .../Expander/ExpanderControlTestsWpf.cs | 1 + .../Image/ImageControlTestsWinForms.cs | 1 + .../Controls/Image/ImageControlTestsWpf.cs | 1 + .../Label/LabelControlTestsUniversal.cs | 1 + .../Label/LabelControlTestsWinForms.cs | 1 + .../Controls/Label/LabelControlTestsWpf.cs | 1 + .../ListBox/ListBoxControlTestsUniversal.cs | 1 + .../ListBox/ListBoxControlTestsWinForms.cs | 1 + .../ListBox/ListBoxControlTestsWpf.cs | 1 + .../Pasword/PasswordControlTestsUniversal.cs | 1 + .../Pasword/PasswordControlTestsWpf.cs | 1 + .../Progress/ProgressControlTestsUniversal.cs | 1 + .../Progress/ProgressControlTestsWinForms.cs | 1 + .../Progress/ProgressControlTestsWpf.cs | 1 + .../Radio/RadioControlTestsUniversal.cs | 1 + .../Radio/RadioControlTestsWinForms.cs | 1 + .../Controls/Radio/RadioControlTestsWpf.cs | 1 + .../Controls/Tabs/TabsControlTestsWinForms.cs | 1 + .../Controls/Tabs/TabsControlTestsWpf.cs | 1 + .../TextArea/TextAreaControlTestsWinForms.cs | 1 + .../TextArea/TextAreaControlTestsWpf.cs | 1 + .../TextFieldControlTestsUniversal.cs | 1 + .../TextFieldControlTestsWinForms.cs | 1 + .../TextField/TextFieldControlTestsWpf.cs | 1 + .../Time/TimePickerControlTestsUniversal.cs | 1 + .../TestsInitialize.cs | 4 +- .../ImageRecognitionTests.cs | 2 +- 71 files changed, 350 insertions(+), 121 deletions(-) create mode 100644 src/Bellatrix.Desktop/components/Window.cs diff --git a/src/Bellatrix.Desktop/Bellatrix.Desktop.csproj b/src/Bellatrix.Desktop/Bellatrix.Desktop.csproj index ed96c97b8..34c42fc53 100644 --- a/src/Bellatrix.Desktop/Bellatrix.Desktop.csproj +++ b/src/Bellatrix.Desktop/Bellatrix.Desktop.csproj @@ -2,16 +2,12 @@ - - - - diff --git a/src/Bellatrix.Desktop/components/Core/Component.DefaultActions.cs b/src/Bellatrix.Desktop/components/Core/Component.DefaultActions.cs index fb5b7e9e0..3f8a1fe1b 100644 --- a/src/Bellatrix.Desktop/components/Core/Component.DefaultActions.cs +++ b/src/Bellatrix.Desktop/components/Core/Component.DefaultActions.cs @@ -11,11 +11,13 @@ // // Anton Angelov // https://bellatrix.solutions/ + using System; +using System.Collections.Generic; using Bellatrix.Desktop.Contracts; using Bellatrix.Desktop.Events; using Bellatrix.Layout; -using OpenQA.Selenium.Interactions; +using OpenQA.Selenium.Support.Extensions; namespace Bellatrix.Desktop; @@ -25,6 +27,12 @@ internal virtual void Click(EventHandler clicking, Eve { clicking?.Invoke(this, new ComponentActionEventArgs(this)); + ////WrappedDriver.ExecuteScript("windows: click", new Dictionary + ////{ + //// { "elementId", WrappedElement.Id }, + //// { "durationMs", 0 } + ////}); + WrappedElement.Click(); clicked?.Invoke(this, new ComponentActionEventArgs(this)); @@ -34,8 +42,12 @@ internal virtual void Hover(EventHandler hovering, Eve { hovering?.Invoke(this, new ComponentActionEventArgs(this)); - var action = new Actions(WrappedDriver); - action.MoveToElement(WrappedElement).Perform(); + WrappedDriver.ExecuteScript("windows: hover", new Dictionary + { + { "startElementId", WrappedElement.Id }, + { "endElementId", WrappedElement.Id }, + { "durationMs", 0 } + }); hovered?.Invoke(this, new ComponentActionEventArgs(this)); } diff --git a/src/Bellatrix.Desktop/components/Core/ComponentsList.cs b/src/Bellatrix.Desktop/components/Core/ComponentsList.cs index ca9ff5e4f..97a9628ac 100644 --- a/src/Bellatrix.Desktop/components/Core/ComponentsList.cs +++ b/src/Bellatrix.Desktop/components/Core/ComponentsList.cs @@ -79,7 +79,7 @@ public int Count() } var nativeElements = WaitWebDriverElements(); - return nativeElements.Count(); + return nativeElements.Count; } public void ForEach(Action action) diff --git a/src/Bellatrix.Desktop/components/Window.cs b/src/Bellatrix.Desktop/components/Window.cs new file mode 100644 index 000000000..3deee0f51 --- /dev/null +++ b/src/Bellatrix.Desktop/components/Window.cs @@ -0,0 +1,96 @@ +// +// Copyright 2022 Automate The Planet Ltd. +// Licensed under the Apache License, Version 2.0 (the "License"); +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Anton Angelov +// https://bellatrix.solutions/ +using System; +using System.Diagnostics; +using Bellatrix.Desktop.Configuration; +using Bellatrix.Desktop.Contracts; +using Bellatrix.Desktop.Events; +using Bellatrix.Desktop.Services; +using OpenQA.Selenium.Appium.Windows; + +namespace Bellatrix.Desktop; + +public class Window : Component +{ + public static event EventHandler Attaching; + public static event EventHandler Attached; + + private string _windowHandle; + + public string WindowHandle + { + get + { + if (_windowHandle != null) + { + return _windowHandle; + } + + try + { + var windowHandleStr = WrappedElement.GetAttribute("NativeWindowHandle"); + var windowHandleInt = int.Parse(windowHandleStr); + var windowHandleHex = "0x" + windowHandleInt.ToString("X6"); + + _windowHandle = windowHandleHex; + } + catch + { + return null; + } + + + return _windowHandle; + } + } + + public virtual void Attach() + { + Attaching?.Invoke(this, new ComponentActionEventArgs(this)); + + this.ToExists().WaitToBe(); + + var currentAppConfiguration = + ServicesCollection.Current.Resolve("_currentAppConfiguration"); + currentAppConfiguration.WindowHandle = WindowHandle; + var driver = WrappedWebDriverCreateService.Create(currentAppConfiguration, ServicesCollection.Current); + + WrappedDriver.Quit(); + ServicesCollection.Current.UnregisterSingleInstance>(); + ServicesCollection.Current.RegisterInstance(driver); + + Attached?.Invoke(this, new ComponentActionEventArgs(this)); + } + + public virtual void Detach() + { + Attaching?.Invoke(this, new ComponentActionEventArgs(this)); + + var currentAppConfiguration = ServicesCollection.Current.Resolve("_currentAppConfiguration"); + + if (currentAppConfiguration.WindowHandle != WindowHandle) + { + throw new InvalidOperationException($"This window ({WindowHandle}) is not currently attached. Currently attached window: {currentAppConfiguration.WindowHandle}"); + } + + currentAppConfiguration.WindowHandle = null; + var driver = WrappedWebDriverCreateService.Create(currentAppConfiguration, ServicesCollection.Current); + + WrappedDriver.Quit(); + ServicesCollection.Current.UnregisterSingleInstance>(); + ServicesCollection.Current.RegisterInstance(driver); + + Attached?.Invoke(this, new ComponentActionEventArgs(this)); + } +} \ No newline at end of file diff --git a/src/Bellatrix.Desktop/infrastructure/App.cs b/src/Bellatrix.Desktop/infrastructure/App.cs index 82ce737d7..e178cba2a 100644 --- a/src/Bellatrix.Desktop/infrastructure/App.cs +++ b/src/Bellatrix.Desktop/infrastructure/App.cs @@ -28,19 +28,16 @@ using Bellatrix.DynamicTestCases; using Bellatrix.Plugins; using Bellatrix.Utilities; +using OpenQA.Selenium.Appium.Service; +using OpenQA.Selenium.Appium.Service.Options; namespace Bellatrix.Desktop; public class App : IDisposable { // TODO: Change to be ThreadLocal. - private static bool _shouldStartLocalService; - private static Process _winAppDriverProcess; - - public App() - { - _shouldStartLocalService = ConfigurationService.GetSection().ExecutionSettings.ShouldStartLocalService; - } + private static readonly bool ShouldStartLocalService = ConfigurationService.GetSection().ExecutionSettings.ShouldStartLocalService; + private static Process _appiumServerProcess; public AppService AppService => ServicesCollection.Current.Resolve(); public ComponentWaitService Wait => ServicesCollection.Current.Resolve(); @@ -52,39 +49,46 @@ public App() public AWSServicesFactory AWS => ServicesCollection.Current.Resolve(); public IAssert Assert => ServicesCollection.Current.Resolve(); - public static void StartWinAppDriver() + public static void StartAppiumServer() { - if (_shouldStartLocalService) + if (!ShouldStartLocalService) { - int port = int.Parse(ConfigurationService.GetSection().ExecutionSettings.Url.Split(':').Last()); + return; + } - // Anton(06.09.2018): maybe we can kill WinAppDriver every time - if (ProcessProvider.IsProcessWithNameRunning("WinAppDriver") || ProcessProvider.IsPortBusy(port)) - { - return; - } + var uri = new Uri(ConfigurationService.GetSection().ExecutionSettings.Url); - string winAppDriverPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Windows Application Driver"); - if (!Directory.Exists(winAppDriverPath)) - { - throw new ArgumentException("Windows Application Driver is not installed on the machine. To use BELLATRIX Desktop libraries you need to install it first. You can download it from here: https://github.com/Microsoft/WinAppDriver/releases"); - } + // Anton(06.09.2018): maybe we can kill WinAppDriver every time + if (ProcessProvider.IsProcessWithNameRunning("WinAppDriver") || ProcessProvider.IsPortBusy(uri.Port)) + { + return; + } - string winAppDriverExePath = Path.Combine(winAppDriverPath, "WinAppDriver.exe"); - _winAppDriverProcess = ProcessProvider.StartProcess(winAppDriverExePath, winAppDriverPath, $"{ConfigurationService.GetSection().ExecutionSettings.Url}", true); - ProcessProvider.WaitPortToGetBusy(port); + var winAppDriverPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Windows Application Driver"); + if (!Directory.Exists(winAppDriverPath)) + { + throw new ArgumentException("Windows Application Driver is not installed on the machine. To use BELLATRIX Desktop libraries you need to install it first. You can download it from here: https://github.com/Microsoft/WinAppDriver/releases"); + } + + var appiumPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "npm"); + if (!Directory.Exists(appiumPath)) + { + throw new ArgumentException("Node.js is not installed on the machine. To use BELLATRIX Desktop libraries you need to install it first. You can download it from here: https://nodejs.org/en/download"); } + + var appiumPs1Path = Path.Combine(appiumPath, "appium.ps1"); + _appiumServerProcess = ProcessProvider.StartProcess( + "powershell.exe", + Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), + $"-NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File \"{appiumPs1Path}\" -a {uri.Host} -p {uri.Port}", + true); + + ProcessProvider.WaitPortToGetBusy(uri.Port); } - public static void StopWinAppDriver() + public static void StopAppiumServer() { - if (_shouldStartLocalService) - { - if (ProcessProvider.IsProcessWithNameRunning("WinAppDriver")) - { - ProcessProvider.CloseProcess(_winAppDriverProcess); - } - } + ProcessProvider.CloseProcess(_appiumServerProcess); } public void AddAdditionalCapability(string name, object value) diff --git a/src/Bellatrix.Desktop/infrastructure/TestExecutionEngine.cs b/src/Bellatrix.Desktop/infrastructure/TestExecutionEngine.cs index 129b0053e..05ad794a4 100644 --- a/src/Bellatrix.Desktop/infrastructure/TestExecutionEngine.cs +++ b/src/Bellatrix.Desktop/infrastructure/TestExecutionEngine.cs @@ -26,7 +26,7 @@ public void StartApp(AppInitializationInfo appConfiguration, ServicesCollection try { var wrappedWebDriver = WrappedWebDriverCreateService.Create(appConfiguration, childContainer); - childContainer.RegisterInstance>(wrappedWebDriver); + childContainer.RegisterInstance(wrappedWebDriver); ////childContainer.RegisterInstance(new AppService(wrappedWebDriver)); ////childContainer.RegisterInstance(new ComponentCreateService()); childContainer.RegisterNull(); diff --git a/src/Bellatrix.Desktop/plugins/execution/AppLifecyclePlugin.cs b/src/Bellatrix.Desktop/plugins/execution/AppLifecyclePlugin.cs index aec4e38dd..1698661e7 100644 --- a/src/Bellatrix.Desktop/plugins/execution/AppLifecyclePlugin.cs +++ b/src/Bellatrix.Desktop/plugins/execution/AppLifecyclePlugin.cs @@ -106,7 +106,10 @@ private void RestartApp(ServicesCollection container) { var currentAppConfiguration = container.Resolve("_currentAppConfiguration"); - ShutdownApp(container); + if (currentAppConfiguration.AppPath != "Root") + { + ShutdownApp(container); + } // Register the ExecutionEngine that should be used for the current run. Will be used in the next test as PreviousEngineType. var testExecutionEngine = new TestExecutionEngine(); @@ -216,58 +219,74 @@ private void InitializeCustomCodeOptions(dynamic options, Type testClassType) private void InitializeGridOptionsFromConfiguration(dynamic options, Type testClassType) { - if (ConfigurationService.GetSection().ExecutionSettings.Arguments == null) + var executionSettings = ConfigurationService.GetSection().ExecutionSettings; + + if (executionSettings.Arguments == null) + { + return; + } + + if (executionSettings.Arguments.Count <= 0) { return; } - if (ConfigurationService.GetSection().ExecutionSettings.Arguments[0].Count > 0) + if (executionSettings.Arguments[0].Count <= 0) { - foreach (var item in ConfigurationService.GetSection().ExecutionSettings.Arguments[0]) + return; + } + + foreach (var item in executionSettings.Arguments[0]) + { + if (!string.IsNullOrEmpty(item.Key) && item.Value != null) { - if (!string.IsNullOrEmpty(item.Key) && !string.IsNullOrEmpty(item.Value)) - { - options.AddAdditionalCapability(item.Key, FormatGridOptions(item.Value, testClassType)); - } + options.AddAdditionalCapability(item.Key, FormatGridOptions(item.Value, testClassType)); } } } - private dynamic FormatGridOptions(string option, Type testClassType) + private dynamic FormatGridOptions(object option, Type testClassType) { - if (bool.TryParse(option, out bool result)) + if (option is not string) + { + return option; + } + + if (bool.TryParse((string)option, out bool result)) { return result; } - else if (int.TryParse(option, out int resultNumber)) + + if (int.TryParse((string)option, out int resultNumber)) { return resultNumber; } - else if (option.StartsWith("env_") || option.StartsWith("vault_")) + + if (((string)option).StartsWith("env_") || ((string)option).StartsWith("vault_")) { - return SecretsResolver.GetSecret(() => option); + return SecretsResolver.GetSecret(() => (string)option); } - else if (double.TryParse(option, out double resultRealNumber)) + + if (double.TryParse((string)option, out double resultRealNumber)) { return resultRealNumber; } - else if (option.StartsWith("AssemblyFolder", StringComparison.Ordinal)) + + if (((string)option).StartsWith("AssemblyFolder", StringComparison.Ordinal)) { var executionFolder = ExecutionDirectoryResolver.GetDriverExecutablePath(); - option = option.Replace("AssemblyFolder", executionFolder); + option = ((string)option).Replace("AssemblyFolder", executionFolder); if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { - option = option.Replace('\\', '/'); + option = ((string)option).Replace('\\', '/'); } return option; } - else - { - var runName = testClassType.Assembly.GetName().Name; - var timestamp = $"{DateTime.Now:yyyyMMdd.HHmm}"; - return option.Replace("{runName}", timestamp).Replace("{runName}", runName); - } + + var runName = testClassType.Assembly.GetName().Name; + var timestamp = $"{DateTime.Now:yyyyMMdd.HHmm}"; + return ((string)option).Replace("{runName}", timestamp).Replace("{runName}", runName); } } diff --git a/src/Bellatrix.Desktop/plugins/execution/Attributes/AppAttribute.cs b/src/Bellatrix.Desktop/plugins/execution/Attributes/AppAttribute.cs index e1f5870e8..030a5d3e5 100644 --- a/src/Bellatrix.Desktop/plugins/execution/Attributes/AppAttribute.cs +++ b/src/Bellatrix.Desktop/plugins/execution/Attributes/AppAttribute.cs @@ -24,11 +24,13 @@ public class AppAttribute : Attribute { public AppAttribute(string appPath, Lifecycle lifecycle = Lifecycle.NotSet) { - AppConfiguration = new AppInitializationInfo(); - AppConfiguration.AppPath = appPath; - AppConfiguration.Lifecycle = lifecycle; - AppConfiguration.Size = default; - AppConfiguration.AppiumOptions = new AppiumOptions(); + AppConfiguration = new AppInitializationInfo + { + AppPath = appPath, + Lifecycle = lifecycle, + Size = default, + AppiumOptions = new AppiumOptions() + }; } public AppAttribute(string appPath, int width, int height, Lifecycle behavior = Lifecycle.NotSet) diff --git a/src/Bellatrix.Desktop/services/ComponentsRepository.cs b/src/Bellatrix.Desktop/services/ComponentsRepository.cs index 0105609e3..abd0d6e88 100644 --- a/src/Bellatrix.Desktop/services/ComponentsRepository.cs +++ b/src/Bellatrix.Desktop/services/ComponentsRepository.cs @@ -20,29 +20,29 @@ namespace Bellatrix.Desktop.Services; -internal class ComponentsRepository +public class ComponentsRepository { - public dynamic CreateComponentWithParent(FindStrategy by, WindowsElement parenTComponent, Type newElementType) + public dynamic CreateComponentWithParent(FindStrategy by, WindowsElement parentElement, Type newElementType) { DetermineComponentAttributes(out var elementName, out var pageName); dynamic element = Activator.CreateInstance(newElementType); element.By = by; - element.ParentWrappedElement = parenTComponent; - element.ElementName = string.IsNullOrEmpty(elementName) ? $"control ({by})" : elementName; + element.ParentWrappedElement = parentElement; + ////element.ElementName = string.IsNullOrEmpty(elementName) ? $"control ({by})" : elementName; // temporary, revert element.PageName = pageName ?? string.Empty; return element; } - public TComponentType CreateComponentWithParent(FindStrategy by, WindowsElement parenTComponent, WindowsElement foundElement, int elementsIndex) + public TComponentType CreateComponentWithParent(FindStrategy by, WindowsElement parentElement, WindowsElement foundElement, int elementsIndex) where TComponentType : Component { DetermineComponentAttributes(out var elementName, out var pageName); var element = Activator.CreateInstance(); element.By = by; - element.ParentWrappedElement = parenTComponent; + element.ParentWrappedElement = parentElement; element.WrappedElement = foundElement; element.FoundWrappedElement = foundElement; element.ElementIndex = elementsIndex; diff --git a/src/Bellatrix.Desktop/services/WrappedWebDriverCreateService.cs b/src/Bellatrix.Desktop/services/WrappedWebDriverCreateService.cs index fc32876e0..9b6bbba2c 100644 --- a/src/Bellatrix.Desktop/services/WrappedWebDriverCreateService.cs +++ b/src/Bellatrix.Desktop/services/WrappedWebDriverCreateService.cs @@ -18,48 +18,80 @@ using Bellatrix.Desktop.Configuration; using OpenQA.Selenium.Appium; using OpenQA.Selenium.Appium.Windows; -using OpenQA.Selenium.Interactions; -using OpenQA.Selenium.Remote; namespace Bellatrix.Desktop.Services; public class WrappedWebDriverCreateService { - private static readonly string _serviceUrl; + private static readonly string ServiceUrl; + + private const string CloseButtonXPath = "//Button[contains(translate(@AutomationId, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), 'close') or contains(translate(@Name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), 'close')]"; static WrappedWebDriverCreateService() { - _serviceUrl = ConfigurationService.GetSection().ExecutionSettings.Url; + ServiceUrl = ConfigurationService.GetSection().ExecutionSettings.Url; } public static WindowsDriver Create(AppInitializationInfo appConfiguration, ServicesCollection childContainer) { var driverOptions = childContainer.Resolve(appConfiguration.ClassFullName) ?? childContainer.Resolve() ?? appConfiguration.AppiumOptions; + + var appiumOptions = new Dictionary + { + { "automationName", "Windows" }, + { "appWorkingDir", Path.GetDirectoryName(appConfiguration.AppPath) }, + { "createSessionTimeout", ConfigurationService.GetSection().TimeoutSettings.CreateSessionTimeout }, + { "ms:waitForAppLaunch", ConfigurationService.GetSection().TimeoutSettings.WaitForAppLaunchTimeout }, + { "ms:experimental-webdriver", true } + }; + + if (appConfiguration.AppPath == "Root") + { + if (appConfiguration.WindowHandle == null) + { + appiumOptions.Add("app", appConfiguration.AppPath); + } + else + { + appiumOptions.Add("appTopLevelWindow", appConfiguration.WindowHandle); + } + } + else + { + appiumOptions.Add("app", appConfiguration.AppPath); + } + + var appiumCapabilities = ServicesCollection.Main.Resolve>($"caps-{appConfiguration.ClassFullName}"); + driverOptions.PlatformName = "Windows"; - driverOptions.AddAdditionalCapability("deviceName", "WindowsPC"); - driverOptions.AddAdditionalCapability("app", appConfiguration.AppPath); - string workingDir = Path.GetDirectoryName(appConfiguration.AppPath); - driverOptions.AddAdditionalCapability("appWorkingDir", workingDir); - driverOptions.AddAdditionalCapability("createSessionTimeout", ConfigurationService.GetSection().TimeoutSettings.CreateSessionTimeout); - driverOptions.AddAdditionalCapability("ms:waitForAppLaunch", ConfigurationService.GetSection().TimeoutSettings.WaitForAppLaunchTimeout); - - var additionalCapabilities = ServicesCollection.Main.Resolve>($"caps-{appConfiguration.ClassFullName}") ?? new Dictionary(); + driverOptions.AddAdditionalCapability("appium:options", appiumOptions); + var additionalCapabilities = appiumCapabilities ?? new Dictionary(); foreach (var additionalCapability in additionalCapabilities) { driverOptions.AddAdditionalCapability(additionalCapability.Key, additionalCapability.Value); } - var wrappedWebDriver = new WindowsDriver(new Uri(_serviceUrl), driverOptions); + var wrappedWebDriver = new WindowsDriver(new Uri(ServiceUrl), driverOptions); wrappedWebDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(ConfigurationService.GetSection().TimeoutSettings.ImplicitWaitTimeout); - ChangeWindowSize(appConfiguration.Size, wrappedWebDriver); - wrappedWebDriver.SwitchTo().Window(wrappedWebDriver.CurrentWindowHandle); + if (!appiumOptions.TryGetValue("app", out var app) || app as string == "Root") + { + return wrappedWebDriver; + } + try { - var closeButton = wrappedWebDriver.FindElementByAccessibilityId("Close"); - var action = new Actions(wrappedWebDriver); - action.MoveToElement(closeButton).Perform(); + var closeButton = wrappedWebDriver.FindElementByXPath(CloseButtonXPath); + + wrappedWebDriver.ExecuteScript("windows: hover", new Dictionary + { + { "startElementId", closeButton.Id }, + { "endElementId", closeButton.Id }, + { "durationMs", 0 } + }); + + wrappedWebDriver.SwitchTo().Window(wrappedWebDriver.CurrentWindowHandle); } catch (Exception e) { diff --git a/src/Bellatrix.Desktop/settings/AppInitializationInfo.cs b/src/Bellatrix.Desktop/settings/AppInitializationInfo.cs index b41ab1d50..1db60b30a 100644 --- a/src/Bellatrix.Desktop/settings/AppInitializationInfo.cs +++ b/src/Bellatrix.Desktop/settings/AppInitializationInfo.cs @@ -45,6 +45,8 @@ public AppInitializationInfo(string appPath, Lifecycle lifecycle, Size size, str public string ClassFullName { get; set; } public string AppPath { get => NormalizeAppPath(); set => _appPath = value; } + + public string WindowHandle { get; set; } public AppiumOptions AppiumOptions { get; set; } @@ -64,11 +66,18 @@ private string NormalizeAppPath() { return _appPath; } - else if (_appPath.StartsWith("AssemblyFolder", StringComparison.Ordinal)) + + if (_appPath.StartsWith("AssemblyFolder", StringComparison.Ordinal)) { var executionFolder = ExecutionDirectoryResolver.GetDriverExecutablePath(); _appPath = _appPath.Replace("AssemblyFolder", executionFolder); } + + if (_appPath.StartsWith("UserFolder", StringComparison.Ordinal)) + { + var executionFolder = ExecutionDirectoryResolver.GetDriverExecutablePath(); + _appPath = _appPath.Replace("UserFolder", Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)); + } return _appPath; } diff --git a/src/Bellatrix.Desktop/settings/ExecutionSettings.cs b/src/Bellatrix.Desktop/settings/ExecutionSettings.cs index 869ba9550..20d45088e 100644 --- a/src/Bellatrix.Desktop/settings/ExecutionSettings.cs +++ b/src/Bellatrix.Desktop/settings/ExecutionSettings.cs @@ -23,6 +23,6 @@ public class ExecutionSettings public string Resolution { get; set; } public bool ShouldStartLocalService { get; set; } = true; public string Url { get; set; } - public List> Arguments { get; set; } + public List> Arguments { get; set; } public bool IsCloudRun { get; set; } } \ No newline at end of file diff --git a/src/Bellatrix.ImageRecognition/Screen.cs b/src/Bellatrix.ImageRecognition/Screen.cs index 39d23f9ae..5ee08efe8 100644 --- a/src/Bellatrix.ImageRecognition/Screen.cs +++ b/src/Bellatrix.ImageRecognition/Screen.cs @@ -45,8 +45,15 @@ public bool Exists(string imagePath, double? similarity = null, double? timeoutI similarity = InitializeSimilarity(similarity); IImage image = ImageFactory.FromFile(imagePath, similarity); timeoutInSeconds = InitializeTimeout(timeoutInSeconds); - _runtime.Run(image.ToSikuliScript("exists", timeoutInSeconds), timeoutInSeconds); - return true; + try + { + _runtime.Run(image.ToSikuliScript("exists", timeoutInSeconds), timeoutInSeconds); + return true; + } + catch + { + return false; + } } public void Click(string imagePath, double? similarity = null, double? timeoutInSeconds = null) @@ -204,4 +211,4 @@ private void InitializeRuntime() { return defaultSimilarity ?? _defaultSimilarity; } -} +} \ No newline at end of file diff --git a/src/Bellatrix.Web/Bellatrix.Web.csproj b/src/Bellatrix.Web/Bellatrix.Web.csproj index 17fa053fe..ada8c9668 100644 --- a/src/Bellatrix.Web/Bellatrix.Web.csproj +++ b/src/Bellatrix.Web/Bellatrix.Web.csproj @@ -15,7 +15,7 @@ - + diff --git a/src/Bellatrix.Web/services/DevToolsService.cs b/src/Bellatrix.Web/services/DevToolsService.cs index 26526a0c1..7d8a2fbf8 100644 --- a/src/Bellatrix.Web/services/DevToolsService.cs +++ b/src/Bellatrix.Web/services/DevToolsService.cs @@ -1,19 +1,19 @@ using Bellatrix.Assertions; using OpenQA.Selenium; using OpenQA.Selenium.DevTools; -using OpenQA.Selenium.DevTools.V107.Console; -using OpenQA.Selenium.DevTools.V107.DOMSnapshot; -using OpenQA.Selenium.DevTools.V107.Emulation; -using OpenQA.Selenium.DevTools.V107.Network; -using OpenQA.Selenium.DevTools.V107.Performance; -using OpenQA.Selenium.DevTools.V107.Security; +using OpenQA.Selenium.DevTools.V119.Console; +using OpenQA.Selenium.DevTools.V119.DOMSnapshot; +using OpenQA.Selenium.DevTools.V119.Emulation; +using OpenQA.Selenium.DevTools.V119.Network; +using OpenQA.Selenium.DevTools.V119.Performance; +using OpenQA.Selenium.DevTools.V119.Security; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using DevToolsSessionDomains = OpenQA.Selenium.DevTools.V107.DevToolsSessionDomains; -using EnableCommandSettings = OpenQA.Selenium.DevTools.V107.Network.EnableCommandSettings; -using SetUserAgentOverrideCommandSettings = OpenQA.Selenium.DevTools.V107.Network.SetUserAgentOverrideCommandSettings; +using DevToolsSessionDomains = OpenQA.Selenium.DevTools.V119.DevToolsSessionDomains; +using EnableCommandSettings = OpenQA.Selenium.DevTools.V119.Network.EnableCommandSettings; +using SetUserAgentOverrideCommandSettings = OpenQA.Selenium.DevTools.V119.Network.SetUserAgentOverrideCommandSettings; namespace Bellatrix.Web; diff --git a/templates/Bellatrix.API.GettingStarted/Models/Albums.cs b/templates/Bellatrix.API.GettingStarted/Models/Albums.cs index 6db206d9e..fa39226d2 100644 --- a/templates/Bellatrix.API.GettingStarted/Models/Albums.cs +++ b/templates/Bellatrix.API.GettingStarted/Models/Albums.cs @@ -4,6 +4,7 @@ namespace Bellatrix.API.GettingStarted.Models; +#pragma warning disable CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() public class Albums : IEquatable { public Albums() => Tracks = new HashSet(); @@ -22,7 +23,6 @@ public class Albums : IEquatable public bool Equals(Albums other) => AlbumId.Equals(other.AlbumId); -#pragma warning disable CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() public override bool Equals(object obj) => Equals(obj as Albums); -#pragma warning restore CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() } +#pragma warning restore CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() \ No newline at end of file diff --git a/templates/Bellatrix.API.Tests/Models/Albums.cs b/templates/Bellatrix.API.Tests/Models/Albums.cs index 1ca9253e9..1c3d55dee 100644 --- a/templates/Bellatrix.API.Tests/Models/Albums.cs +++ b/templates/Bellatrix.API.Tests/Models/Albums.cs @@ -4,6 +4,7 @@ namespace Bellatrix.API.MSTest.Tests.Models; +#pragma warning disable CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() public class Albums : IEquatable { public Albums() => Tracks = new HashSet(); @@ -21,8 +22,7 @@ public class Albums : IEquatable public ICollection Tracks { get; set; } public bool Equals(Albums other) => AlbumId.Equals(other?.AlbumId); - -#pragma warning disable CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode( + public override bool Equals(object obj) => Equals(obj as Albums); -#pragma warning restore CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() } +#pragma warning restore CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() \ No newline at end of file diff --git a/templates/Bellatrix.Desktop.Tests/testFrameworkSettings.Debug.json b/templates/Bellatrix.Desktop.Tests/testFrameworkSettings.Debug.json index fcb09dc10..18f8e9ce0 100644 --- a/templates/Bellatrix.Desktop.Tests/testFrameworkSettings.Debug.json +++ b/templates/Bellatrix.Desktop.Tests/testFrameworkSettings.Debug.json @@ -23,7 +23,7 @@ "shouldStartLocalService": "false", "resolution": "", "defaultAppPath": "AssemblyFolder\\Demos\\Wpf\\WPFSampleApp.exe", - "url": "http://127.0.0.1:4722", + "url": "http://127.0.0.1:4723", "arguments": [ { //"name": "{runName}", diff --git a/tests/Bellatrix.API.Tests/Models/Albums.cs b/tests/Bellatrix.API.Tests/Models/Albums.cs index 0c199c84b..383b7987c 100644 --- a/tests/Bellatrix.API.Tests/Models/Albums.cs +++ b/tests/Bellatrix.API.Tests/Models/Albums.cs @@ -17,6 +17,7 @@ namespace MediaStore.Demo.API.Models; +#pragma warning disable CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() public class Albums : IEquatable { public Albums() => Tracks = new HashSet(); @@ -35,7 +36,6 @@ public class Albums : IEquatable public bool Equals(Albums other) => AlbumId.Equals(other.AlbumId); -#pragma warning disable CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() public override bool Equals(object obj) => Equals(obj as Albums); -#pragma warning restore CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() } +#pragma warning restore CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() \ No newline at end of file diff --git a/tests/Bellatrix.Desktop.Tests/Categories.cs b/tests/Bellatrix.Desktop.Tests/Categories.cs index 2dd9723d4..d24040bbe 100644 --- a/tests/Bellatrix.Desktop.Tests/Categories.cs +++ b/tests/Bellatrix.Desktop.Tests/Categories.cs @@ -13,9 +13,13 @@ // https://bellatrix.solutions/ namespace Bellatrix.Desktop.Tests; -public class Categories +public static class Categories { public const string CI = "CI"; public const string Layout = "Layout"; public const string Desktop = "Desktop"; + + public const string WPF = "WPF"; + public const string WinForms = "WinForms"; + public const string Universal = "Universal"; } diff --git a/tests/Bellatrix.Desktop.Tests/Constants.cs b/tests/Bellatrix.Desktop.Tests/Constants.cs index 1b67e49f3..23dd4318d 100644 --- a/tests/Bellatrix.Desktop.Tests/Constants.cs +++ b/tests/Bellatrix.Desktop.Tests/Constants.cs @@ -13,9 +13,9 @@ // https://bellatrix.solutions/ namespace Bellatrix.Desktop.Tests; -public class Constants +public static class Constants { public const string WpfAppPath = @"AssemblyFolder\Demos\Wpf\WPFSampleApp.exe"; public const string WinFormsAppPath = @"AssemblyFolder\Demos\WinForms\WindowsFormsSampleApp.exe"; - public const string UniversalAppPath = @"369ede42-bebe-41ea-a02a-0da04991478e_hkj3ysbfh4b9w!App"; + public const string UniversalAppPath = "369ede42-bebe-41ea-a02a-0da04991478e_hkj3ysbfh4b9w!App"; } \ No newline at end of file diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlEventsTests.cs b/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlEventsTests.cs index 3fed8980f..4ac908371 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlEventsTests.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlEventsTests.cs @@ -21,6 +21,7 @@ namespace Bellatrix.Desktop.Tests; [AllureSuite("Button Control")] [AllureFeature("Control Events")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class ButtonControlEventsTests : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlTestsUniversal.cs b/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlTestsUniversal.cs index ca49e8cbd..df45680fc 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlTestsUniversal.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlTestsUniversal.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.UniversalAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Button Control")] [AllureTag("Universal")] +[TestCategory(Categories.Universal)] public class ButtonControlTestsUniversal : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlTestsWinForms.cs b/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlTestsWinForms.cs index 642d06acb..3658fa7cd 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlTestsWinForms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlTestsWinForms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Button Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class ButtonControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlTestsWpf.cs index cbf19ca92..c377f2f33 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Button Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class ButtonControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlValidateExtensionsExceptionMessagesTests.cs b/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlValidateExtensionsExceptionMessagesTests.cs index 9299aa9f8..4dbb118d4 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlValidateExtensionsExceptionMessagesTests.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlValidateExtensionsExceptionMessagesTests.cs @@ -21,6 +21,7 @@ namespace Bellatrix.Desktop.Tests; [AllureSuite("Button Control")] [AllureFeature("ValidateExtensionsExceptionMessages")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class ButtonControlValidateExtensionsExceptionMessagesTests : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlValidaterExtensionsTests.cs b/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlValidaterExtensionsTests.cs index e2e5d65d5..19346c909 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlValidaterExtensionsTests.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Button/ButtonControlValidaterExtensionsTests.cs @@ -20,6 +20,7 @@ namespace Bellatrix.Desktop.Tests; [AllureSuite("Button Control")] [AllureFeature("ValidateExtensions")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class ButtonControlValidateExtensionsTests : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlEventsTests.cs b/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlEventsTests.cs index a95e2fd95..86efc5f36 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlEventsTests.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlEventsTests.cs @@ -21,6 +21,7 @@ namespace Bellatrix.Desktop.Tests; [AllureSuite("Calendar Control")] [AllureFeature("Control Events")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class CalendarControlEventsTests : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlTestsUniversal.cs b/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlTestsUniversal.cs index 849f2f8cf..7cfe87161 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlTestsUniversal.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlTestsUniversal.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.UniversalAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Calendar Control")] [AllureTag("Universal")] +[TestCategory(Categories.Universal)] public class CalendarControlTestsUniversal : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlTestsWinForms.cs b/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlTestsWinForms.cs index 8ae9c54b3..55f62e140 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlTestsWinForms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlTestsWinForms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Calendar Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class CalendarControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlTestsWpf.cs index dd851da79..7522d8e2e 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Calendar Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class CalendarControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlValidateExtensionsExceptionMessagesTests.cs b/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlValidateExtensionsExceptionMessagesTests.cs index 12c3479da..c86d3032e 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlValidateExtensionsExceptionMessagesTests.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Calendar/CalendarControlValidateExtensionsExceptionMessagesTests.cs @@ -21,6 +21,7 @@ namespace Bellatrix.Desktop.Tests; [AllureSuite("Calendar Control")] [AllureFeature("ValidateExtensionsExceptionMessages")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class CalendarControlValidateExtensionsExceptionMessagesTests : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/CheckBox/CheckBoxControlTestsUniversal.cs b/tests/Bellatrix.Desktop.Tests/Controls/CheckBox/CheckBoxControlTestsUniversal.cs index 88321425e..322128044 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/CheckBox/CheckBoxControlTestsUniversal.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/CheckBox/CheckBoxControlTestsUniversal.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.UniversalAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("CheckBox Control")] [AllureTag("Universal")] +[TestCategory(Categories.Universal)] public class CheckBoxControlTestsUniversal : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/CheckBox/CheckBoxControlTestsWinForms.cs b/tests/Bellatrix.Desktop.Tests/Controls/CheckBox/CheckBoxControlTestsWinForms.cs index 1b214dbcb..69b62f1dd 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/CheckBox/CheckBoxControlTestsWinForms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/CheckBox/CheckBoxControlTestsWinForms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("CheckBox Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class CheckBoxControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/CheckBox/CheckBoxControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/CheckBox/CheckBoxControlTestsWpf.cs index eeb40491e..2fdaa8b87 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/CheckBox/CheckBoxControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/CheckBox/CheckBoxControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("CheckBox Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class CheckBoxControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/ComboBox/ComboBoxControlTestsUniversal.cs b/tests/Bellatrix.Desktop.Tests/Controls/ComboBox/ComboBoxControlTestsUniversal.cs index e8ca9e2ff..a58fc7ff2 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/ComboBox/ComboBoxControlTestsUniversal.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/ComboBox/ComboBoxControlTestsUniversal.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.UniversalAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("ComboBox Control")] [AllureTag("Universal")] +[TestCategory(Categories.Universal)] public class ComboBoxControlTestsUniversal : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/ComboBox/ComboBoxControlTestsWinForms.cs b/tests/Bellatrix.Desktop.Tests/Controls/ComboBox/ComboBoxControlTestsWinForms.cs index 8f89b2ffb..65af82711 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/ComboBox/ComboBoxControlTestsWinForms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/ComboBox/ComboBoxControlTestsWinForms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("ComboBox Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class ComboBoxControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/ComboBox/ComboBoxControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/ComboBox/ComboBoxControlTestsWpf.cs index f0432d821..df6ca9b5d 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/ComboBox/ComboBoxControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/ComboBox/ComboBoxControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("ComboBox Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class ComboBoxControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/DatePicker/DatePickerControlTestsUniversal.cs b/tests/Bellatrix.Desktop.Tests/Controls/DatePicker/DatePickerControlTestsUniversal.cs index 7c34bb8ad..e7db9a587 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/DatePicker/DatePickerControlTestsUniversal.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/DatePicker/DatePickerControlTestsUniversal.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.UniversalAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("DatePicker Control")] [AllureTag("Universal")] +[TestCategory(Categories.Universal)] public class DatePickerControlTestsUniversal : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/DatePicker/DatePickerControlTestsWinForms.cs b/tests/Bellatrix.Desktop.Tests/Controls/DatePicker/DatePickerControlTestsWinForms.cs index 88e0d7e04..9b16a60d4 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/DatePicker/DatePickerControlTestsWinForms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/DatePicker/DatePickerControlTestsWinForms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("DatePicker Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class DatePickerControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/DatePicker/DatePickerControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/DatePicker/DatePickerControlTestsWpf.cs index 4df87b995..33b3d2c6a 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/DatePicker/DatePickerControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/DatePicker/DatePickerControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("DatePicker Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class DatePickerControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Element/ElementControlTestsUniversal.cs b/tests/Bellatrix.Desktop.Tests/Controls/Element/ElementControlTestsUniversal.cs index 1074b385f..163dec9b0 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Element/ElementControlTestsUniversal.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Element/ElementControlTestsUniversal.cs @@ -20,6 +20,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.UniversalAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Element Control")] [AllureTag("Universal")] +[TestCategory(Categories.Universal)] public class ElementControlTestsUniversal : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Element/ElementControlTestsWinforms.cs b/tests/Bellatrix.Desktop.Tests/Controls/Element/ElementControlTestsWinforms.cs index 103016786..ce377c60e 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Element/ElementControlTestsWinforms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Element/ElementControlTestsWinforms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Element Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class ElementControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Element/ElementControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/Element/ElementControlTestsWpf.cs index afa32334d..4d16e040b 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Element/ElementControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Element/ElementControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Element Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class ElementControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Expander/ExpanderControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/Expander/ExpanderControlTestsWpf.cs index da93f0ac2..220a924a3 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Expander/ExpanderControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Expander/ExpanderControlTestsWpf.cs @@ -21,6 +21,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Expander Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class ExpanderControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Image/ImageControlTestsWinForms.cs b/tests/Bellatrix.Desktop.Tests/Controls/Image/ImageControlTestsWinForms.cs index d798036d2..b8d885138 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Image/ImageControlTestsWinForms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Image/ImageControlTestsWinForms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Image Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class ImageControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Image/ImageControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/Image/ImageControlTestsWpf.cs index 2ac4406aa..368cd2d82 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Image/ImageControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Image/ImageControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Image Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class ImageControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Label/LabelControlTestsUniversal.cs b/tests/Bellatrix.Desktop.Tests/Controls/Label/LabelControlTestsUniversal.cs index c45f0e166..2d852da53 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Label/LabelControlTestsUniversal.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Label/LabelControlTestsUniversal.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.UniversalAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Label Control")] [AllureTag("Universal")] +[TestCategory(Categories.Universal)] public class LabelControlTestsUniversal : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Label/LabelControlTestsWinForms.cs b/tests/Bellatrix.Desktop.Tests/Controls/Label/LabelControlTestsWinForms.cs index 58d73a3c3..916688887 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Label/LabelControlTestsWinForms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Label/LabelControlTestsWinForms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Label Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class LabelControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Label/LabelControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/Label/LabelControlTestsWpf.cs index 15ba854b9..e6cbdb6c1 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Label/LabelControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Label/LabelControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Label Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class LabelControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/ListBox/ListBoxControlTestsUniversal.cs b/tests/Bellatrix.Desktop.Tests/Controls/ListBox/ListBoxControlTestsUniversal.cs index 705c8a6be..bdf5a4c24 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/ListBox/ListBoxControlTestsUniversal.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/ListBox/ListBoxControlTestsUniversal.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.UniversalAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("ListBox Control")] [AllureTag("Universal")] +[TestCategory(Categories.Universal)] public class ListBoxControlTestsUniversal : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/ListBox/ListBoxControlTestsWinForms.cs b/tests/Bellatrix.Desktop.Tests/Controls/ListBox/ListBoxControlTestsWinForms.cs index b9a24675d..4d99a8f8c 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/ListBox/ListBoxControlTestsWinForms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/ListBox/ListBoxControlTestsWinForms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("ListBox Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class ListBoxControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/ListBox/ListBoxControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/ListBox/ListBoxControlTestsWpf.cs index f276f0e60..f85f1e050 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/ListBox/ListBoxControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/ListBox/ListBoxControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("ListBox Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class ListBoxControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Pasword/PasswordControlTestsUniversal.cs b/tests/Bellatrix.Desktop.Tests/Controls/Pasword/PasswordControlTestsUniversal.cs index 1864f454a..50b045355 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Pasword/PasswordControlTestsUniversal.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Pasword/PasswordControlTestsUniversal.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.UniversalAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Password Control")] [AllureTag("Universal")] +[TestCategory(Categories.Universal)] public class PasswordControlTestsUniversal : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Pasword/PasswordControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/Pasword/PasswordControlTestsWpf.cs index dcf4784ac..a50cff5dd 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Pasword/PasswordControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Pasword/PasswordControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Password Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class PasswordControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Progress/ProgressControlTestsUniversal.cs b/tests/Bellatrix.Desktop.Tests/Controls/Progress/ProgressControlTestsUniversal.cs index 4a5298055..068548b65 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Progress/ProgressControlTestsUniversal.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Progress/ProgressControlTestsUniversal.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.UniversalAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Progress Control")] [AllureTag("Universal")] +[TestCategory(Categories.Universal)] public class ProgressControlTestsUniversal : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Progress/ProgressControlTestsWinForms.cs b/tests/Bellatrix.Desktop.Tests/Controls/Progress/ProgressControlTestsWinForms.cs index c45119b3b..0721484f1 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Progress/ProgressControlTestsWinForms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Progress/ProgressControlTestsWinForms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Progress Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class ProgressControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Progress/ProgressControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/Progress/ProgressControlTestsWpf.cs index c73b57d6d..78b75e9d5 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Progress/ProgressControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Progress/ProgressControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Progress Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class ProgressControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Radio/RadioControlTestsUniversal.cs b/tests/Bellatrix.Desktop.Tests/Controls/Radio/RadioControlTestsUniversal.cs index 8089e5a50..dc86c9dc7 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Radio/RadioControlTestsUniversal.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Radio/RadioControlTestsUniversal.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.UniversalAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Radio Control")] [AllureTag("Universal")] +[TestCategory(Categories.Universal)] public class RadioControlTestsUniversal : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Radio/RadioControlTestsWinForms.cs b/tests/Bellatrix.Desktop.Tests/Controls/Radio/RadioControlTestsWinForms.cs index 1f0010583..1b42c2c36 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Radio/RadioControlTestsWinForms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Radio/RadioControlTestsWinForms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Radio Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class RadioControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Radio/RadioControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/Radio/RadioControlTestsWpf.cs index 0ad5aaab2..33e0321f6 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Radio/RadioControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Radio/RadioControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Radio Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class RadioControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Tabs/TabsControlTestsWinForms.cs b/tests/Bellatrix.Desktop.Tests/Controls/Tabs/TabsControlTestsWinForms.cs index 727710996..4d5b0f605 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Tabs/TabsControlTestsWinForms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Tabs/TabsControlTestsWinForms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Tabs Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class TabsControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Tabs/TabsControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/Tabs/TabsControlTestsWpf.cs index 682009f2e..9bd85893d 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Tabs/TabsControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Tabs/TabsControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("Tabs Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class TabsControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/TextArea/TextAreaControlTestsWinForms.cs b/tests/Bellatrix.Desktop.Tests/Controls/TextArea/TextAreaControlTestsWinForms.cs index 550caefb4..0e1749c99 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/TextArea/TextAreaControlTestsWinForms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/TextArea/TextAreaControlTestsWinForms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("TextArea Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class TextAreaControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/TextArea/TextAreaControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/TextArea/TextAreaControlTestsWpf.cs index c712823ca..50ca6131f 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/TextArea/TextAreaControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/TextArea/TextAreaControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("TextArea Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class TextAreaControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/TextField/TextFieldControlTestsUniversal.cs b/tests/Bellatrix.Desktop.Tests/Controls/TextField/TextFieldControlTestsUniversal.cs index 41383308e..2547fc662 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/TextField/TextFieldControlTestsUniversal.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/TextField/TextFieldControlTestsUniversal.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.UniversalAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("TextField Control")] [AllureTag("Universal")] +[TestCategory(Categories.Universal)] public class TextFieldControlTestsUniversal : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/TextField/TextFieldControlTestsWinForms.cs b/tests/Bellatrix.Desktop.Tests/Controls/TextField/TextFieldControlTestsWinForms.cs index 201bfb0fd..fa6af9931 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/TextField/TextFieldControlTestsWinForms.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/TextField/TextFieldControlTestsWinForms.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WinFormsAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("TextField Control")] [AllureTag("WinForms")] +[TestCategory(Categories.WinForms)] public class TextFieldControlTestsWinForms : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/TextField/TextFieldControlTestsWpf.cs b/tests/Bellatrix.Desktop.Tests/Controls/TextField/TextFieldControlTestsWpf.cs index 808df812f..5e329a2a2 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/TextField/TextFieldControlTestsWpf.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/TextField/TextFieldControlTestsWpf.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("TextField Control")] [AllureTag("WPF")] +[TestCategory(Categories.WPF)] public class TextFieldControlTestsWpf : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/Controls/Time/TimePickerControlTestsUniversal.cs b/tests/Bellatrix.Desktop.Tests/Controls/Time/TimePickerControlTestsUniversal.cs index 79b8b7af2..9865c5011 100644 --- a/tests/Bellatrix.Desktop.Tests/Controls/Time/TimePickerControlTestsUniversal.cs +++ b/tests/Bellatrix.Desktop.Tests/Controls/Time/TimePickerControlTestsUniversal.cs @@ -19,6 +19,7 @@ namespace Bellatrix.Desktop.Tests; [App(Constants.UniversalAppPath, Lifecycle.RestartEveryTime)] [AllureSuite("TimePicker Control")] [AllureTag("Universal")] +[TestCategory(Categories.Universal)] public class TimePickerControlTestsUniversal : MSTest.DesktopTest { [TestMethod] diff --git a/tests/Bellatrix.Desktop.Tests/TestsInitialize.cs b/tests/Bellatrix.Desktop.Tests/TestsInitialize.cs index 13210780e..f6960059e 100644 --- a/tests/Bellatrix.Desktop.Tests/TestsInitialize.cs +++ b/tests/Bellatrix.Desktop.Tests/TestsInitialize.cs @@ -22,7 +22,7 @@ public class TestsInitialize public static void AssemblyInitialize(TestContext testContext) { AllurePlugin.Add(); - App.StartWinAppDriver(); + ////App.StartWinAppDriver(); } [AssemblyCleanup] @@ -30,6 +30,6 @@ public static void AssemblyCleanUp() { var app = ServicesCollection.Current.Resolve(); app.Dispose(); - App.StopWinAppDriver(); + ////App.StopWinAppDriver(); } } diff --git a/tests/Bellatrix.Web.Tests/Image Recognition/ImageRecognitionTests.cs b/tests/Bellatrix.Web.Tests/Image Recognition/ImageRecognitionTests.cs index 93d3dd53f..dc1530e48 100644 --- a/tests/Bellatrix.Web.Tests/Image Recognition/ImageRecognitionTests.cs +++ b/tests/Bellatrix.Web.Tests/Image Recognition/ImageRecognitionTests.cs @@ -5,7 +5,7 @@ namespace Bellatrix.Web.Demos; [TestClass] -[Browser(BrowserType.Chrome, Lifecycle.ReuseIfStarted)] +[Browser(BrowserType.Edge, Lifecycle.ReuseIfStarted)] public class ImageRecognitionTests : MSTest.WebTest { [TestMethod] From cb102c4b7c121206780ce597be768e8de460ac22 Mon Sep 17 00:00:00 2001 From: Teodor Nikolov Date: Fri, 12 Apr 2024 14:48:02 +0000 Subject: [PATCH 05/32] reverted click default action --- .../components/Core/Component.DefaultActions.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Bellatrix.Desktop/components/Core/Component.DefaultActions.cs b/src/Bellatrix.Desktop/components/Core/Component.DefaultActions.cs index ed32ad542..8b14d42ce 100644 --- a/src/Bellatrix.Desktop/components/Core/Component.DefaultActions.cs +++ b/src/Bellatrix.Desktop/components/Core/Component.DefaultActions.cs @@ -31,6 +31,7 @@ internal virtual void Click(EventHandler clicking, Eve //// { "elementId", WrappedElement.Id }, //// { "durationMs", 0 } ////}); + WrappedElement.Click(); clicked?.Invoke(this, new ComponentActionEventArgs(this)); } From c29358e71d7550aa285e3e4136285558759d9293 Mon Sep 17 00:00:00 2001 From: Teodor Nikolov Date: Fri, 12 Apr 2024 18:21:30 +0300 Subject: [PATCH 06/32] updated azure dependencies --- .../Bellatrix.CognitiveServices.csproj | 2 +- src/Bellatrix.Core/Bellatrix.Core.csproj | 2 +- src/Bellatrix.KeyVault/Bellatrix.KeyVault.csproj | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Bellatrix.CognitiveServices/Bellatrix.CognitiveServices.csproj b/src/Bellatrix.CognitiveServices/Bellatrix.CognitiveServices.csproj index cb07fa537..cc457c980 100644 --- a/src/Bellatrix.CognitiveServices/Bellatrix.CognitiveServices.csproj +++ b/src/Bellatrix.CognitiveServices/Bellatrix.CognitiveServices.csproj @@ -1,7 +1,7 @@  - + diff --git a/src/Bellatrix.Core/Bellatrix.Core.csproj b/src/Bellatrix.Core/Bellatrix.Core.csproj index ccf74ad1a..e76615191 100644 --- a/src/Bellatrix.Core/Bellatrix.Core.csproj +++ b/src/Bellatrix.Core/Bellatrix.Core.csproj @@ -22,7 +22,7 @@ - + diff --git a/src/Bellatrix.KeyVault/Bellatrix.KeyVault.csproj b/src/Bellatrix.KeyVault/Bellatrix.KeyVault.csproj index 88e324265..5dbed57d3 100644 --- a/src/Bellatrix.KeyVault/Bellatrix.KeyVault.csproj +++ b/src/Bellatrix.KeyVault/Bellatrix.KeyVault.csproj @@ -1,8 +1,8 @@  - - + + From 7766b3f38739ebe9b648354079e6baf52273eddb Mon Sep 17 00:00:00 2001 From: Teodor Nikolov Date: Thu, 18 Apr 2024 19:50:29 +0300 Subject: [PATCH 07/32] added SelectOption method to Menu component --- src/Bellatrix.Desktop/components/Menu.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Bellatrix.Desktop/components/Menu.cs b/src/Bellatrix.Desktop/components/Menu.cs index 05ef9f0b5..7af6f390e 100644 --- a/src/Bellatrix.Desktop/components/Menu.cs +++ b/src/Bellatrix.Desktop/components/Menu.cs @@ -12,6 +12,7 @@ // Anton Angelov // https://bellatrix.solutions/ using System; +using System.Linq; using Bellatrix.Desktop.Events; namespace Bellatrix.Desktop; @@ -25,4 +26,9 @@ public virtual void Hover() { Hover(Hovering, Hovered); } + + public void SelectOption(string option) + { + this.CreateAllByClass")); + Assert.Contains("", anchorElement.InnerHtml); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/Anchor/AnchorControlTestsChromeHeadless.cs b/src/Bellatrix.Playwright.Tests/Controls/Anchor/AnchorControlTestsChromeHeadless.cs index 03d34174c..0b1e06c39 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Anchor/AnchorControlTestsChromeHeadless.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Anchor/AnchorControlTestsChromeHeadless.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -72,7 +72,7 @@ public void ReturnButtonHtml_When_InnerHtml_ChromeHeadless() { var anchorElement = App.Components.CreateById("myAnchor4"); - Assert.IsTrue(anchorElement.InnerHtml.Contains("")); + Assert.Contains("", anchorElement.InnerHtml); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/Anchor/AnchorControlTestsEdge.cs b/src/Bellatrix.Playwright.Tests/Controls/Anchor/AnchorControlTestsEdge.cs index 3839f5674..546629921 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Anchor/AnchorControlTestsEdge.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Anchor/AnchorControlTestsEdge.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -83,7 +83,7 @@ public void ReturnButtonHtml_When_InnerHtml_Edge() { var anchorElement = App.Components.CreateById("myAnchor4"); - Assert.IsTrue(anchorElement.InnerHtml.Contains("")); + Assert.Contains("", anchorElement.InnerHtml); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/Anchor/AnchorControlTestsFirefox.cs b/src/Bellatrix.Playwright.Tests/Controls/Anchor/AnchorControlTestsFirefox.cs index 4833e89a1..02efec2cf 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Anchor/AnchorControlTestsFirefox.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Anchor/AnchorControlTestsFirefox.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -75,7 +75,7 @@ public void ReturnButtonHtml_When_InnerHtml_Firefox() { var anchorElement = App.Components.CreateById("myAnchor4"); - Assert.IsTrue(anchorElement.InnerHtml.Contains("")); + Assert.Contains("", anchorElement.InnerHtml); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/Anchor/AnchorControlTestsFirefoxHeadless.cs b/src/Bellatrix.Playwright.Tests/Controls/Anchor/AnchorControlTestsFirefoxHeadless.cs index ca60775ad..8620d3740 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Anchor/AnchorControlTestsFirefoxHeadless.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Anchor/AnchorControlTestsFirefoxHeadless.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -72,7 +72,7 @@ public void ReturnButtonHtml_When_InnerHtml_FirefoxHeadless() { var anchorElement = App.Components.CreateById("myAnchor4"); - Assert.IsTrue(anchorElement.InnerHtml.Contains("")); + Assert.Contains("", anchorElement.InnerHtml); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/Anchor/AnchorControlTestsSafari.cs b/src/Bellatrix.Playwright.Tests/Controls/Anchor/AnchorControlTestsSafari.cs index 77d3f76ba..5f850c800 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Anchor/AnchorControlTestsSafari.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Anchor/AnchorControlTestsSafari.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -71,7 +71,7 @@ public void ReturnButtonHtml_When_InnerHtml_Safari() { var anchorElement = App.Components.CreateById("myAnchor4"); - Assert.IsTrue(anchorElement.InnerHtml.Contains("")); + Assert.Contains("", anchorElement.InnerHtml); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/Anchor/AnchorControlValidateExtensionsExceptionMessagesTests.cs b/src/Bellatrix.Playwright.Tests/Controls/Anchor/AnchorControlValidateExtensionsExceptionMessagesTests.cs index c0772765d..d6430a844 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Anchor/AnchorControlValidateExtensionsExceptionMessagesTests.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Anchor/AnchorControlValidateExtensionsExceptionMessagesTests.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -44,7 +44,7 @@ public void CorrectExceptionMessageSet_When_ValidateStyleIsThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's style should be 'color: blue;' but was 'color: red;'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -63,7 +63,7 @@ public void CorrectExceptionMessageSet_When_ValidateStyleContainsThrowsException catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's style should contains 'color: blue;' but it is 'color: red;'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -82,7 +82,7 @@ public void CorrectExceptionMessageSet_When_ValidateStyleNotContainsThrowsExcept catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's style should not contains 'color: red;' but it was 'color: red;'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -99,7 +99,7 @@ public void CorrectExceptionMessageSet_When_ValidateInnerTextIsThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's inner text should be 'Bellatrix' but was 'Automate The Planet'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -116,7 +116,7 @@ public void CorrectExceptionMessageSet_When_ValidateInnerHtmlIsIsThrowsException catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's inner HTML should be ' +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -42,7 +42,7 @@ public void CorrectExceptionMessageSet_When_ValidateIsNotDisabledThrowsException catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control should NOT be disabled but it was. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -59,7 +59,7 @@ public void CorrectExceptionMessageSet_When_ValidateIsDisabledThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control should be disabled but it was NOT. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -76,7 +76,7 @@ public void CorrectExceptionMessageSet_When_ValidateValueIsThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's value should be 'Start' but was 'Stop'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -93,7 +93,7 @@ public void CorrectExceptionMessageSet_When_ValidateValueIsNullThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's value should be null but was 'Start'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } } \ No newline at end of file diff --git a/src/Bellatrix.Playwright.Tests/Controls/CheckBox/CheckBoxControlTestsChrome.cs b/src/Bellatrix.Playwright.Tests/Controls/CheckBox/CheckBoxControlTestsChrome.cs index e33f5f803..8ad87d509 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/CheckBox/CheckBoxControlTestsChrome.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/CheckBox/CheckBoxControlTestsChrome.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ public void Unchecked_When_UseCheckMethod_Chrome() checkBoxElement.Check(); - Assert.AreEqual(false, checkBoxElement.IsChecked); + Assert.IsFalse(checkBoxElement.IsChecked); } [TestMethod] @@ -41,7 +41,7 @@ public void Unchecked_When_UseUncheckMethod_Chrome() checkBoxElement.Uncheck(); - Assert.AreEqual(false, checkBoxElement.IsChecked); + Assert.IsFalse(checkBoxElement.IsChecked); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/CheckBox/CheckBoxControlTestsEdge.cs b/src/Bellatrix.Playwright.Tests/Controls/CheckBox/CheckBoxControlTestsEdge.cs index da1557c11..18d8d218b 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/CheckBox/CheckBoxControlTestsEdge.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/CheckBox/CheckBoxControlTestsEdge.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ public void Unchecked_When_UseCheckMethod_Edge() checkBoxElement.Check(); - Assert.AreEqual(false, checkBoxElement.IsChecked); + Assert.IsFalse(checkBoxElement.IsChecked); } [TestMethod] @@ -44,7 +44,7 @@ public void Unchecked_When_UseUncheckMethod_Edge() checkBoxElement.Uncheck(); - Assert.AreEqual(false, checkBoxElement.IsChecked); + Assert.IsFalse(checkBoxElement.IsChecked); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/CheckBox/CheckBoxControlTestsFirefox.cs b/src/Bellatrix.Playwright.Tests/Controls/CheckBox/CheckBoxControlTestsFirefox.cs index df6eff793..ca0833903 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/CheckBox/CheckBoxControlTestsFirefox.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/CheckBox/CheckBoxControlTestsFirefox.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ public void Unchecked_When_UseCheckMethod_Firefox() checkBoxElement.Check(); - Assert.AreEqual(false, checkBoxElement.IsChecked); + Assert.IsFalse(checkBoxElement.IsChecked); } [TestMethod] @@ -41,7 +41,7 @@ public void Unchecked_When_UseUncheckMethod_Firefox() checkBoxElement.Uncheck(); - Assert.AreEqual(false, checkBoxElement.IsChecked); + Assert.IsFalse(checkBoxElement.IsChecked); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/CheckBox/CheckBoxControlTestsSafari.cs b/src/Bellatrix.Playwright.Tests/Controls/CheckBox/CheckBoxControlTestsSafari.cs index 279f20687..15c044373 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/CheckBox/CheckBoxControlTestsSafari.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/CheckBox/CheckBoxControlTestsSafari.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ public void Unchecked_When_UseCheckMethod_Safari() checkBoxElement.Check(); - Assert.AreEqual(false, checkBoxElement.IsChecked); + Assert.IsFalse(checkBoxElement.IsChecked); } [TestMethod] @@ -41,7 +41,7 @@ public void Unchecked_When_UseUncheckMethod_Safari() checkBoxElement.Uncheck(); - Assert.AreEqual(false, checkBoxElement.IsChecked); + Assert.IsFalse(checkBoxElement.IsChecked); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/CheckBox/CheckBoxControlValidateExtensionsExceptionMessagesTests.cs b/src/Bellatrix.Playwright.Tests/Controls/CheckBox/CheckBoxControlValidateExtensionsExceptionMessagesTests.cs index 0c78703b8..8972607b8 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/CheckBox/CheckBoxControlValidateExtensionsExceptionMessagesTests.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/CheckBox/CheckBoxControlValidateExtensionsExceptionMessagesTests.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -44,7 +44,7 @@ public void CorrectExceptionMessageSet_When_ValidateCheckedThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control should be checked but was NOT. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -62,7 +62,7 @@ public void CorrectExceptionMessageSet_When_ValidateNotCheckedThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control should be not checked but it WAS. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } } \ No newline at end of file diff --git a/src/Bellatrix.Playwright.Tests/Controls/Color/ColorControlTestsChrome.cs b/src/Bellatrix.Playwright.Tests/Controls/Color/ColorControlTestsChrome.cs index 6693581b5..a1cd7a212 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Color/ColorControlTestsChrome.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Color/ColorControlTestsChrome.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -77,7 +77,7 @@ public void GetRequiredReturnsFalse_When_RequiredAttributeIsNotPresent_Chrome() { var colorElement = App.Components.CreateById("myColor4"); - Assert.AreEqual(false, colorElement.IsRequired); + Assert.IsFalse(colorElement.IsRequired); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/Color/ColorControlTestsEdge.cs b/src/Bellatrix.Playwright.Tests/Controls/Color/ColorControlTestsEdge.cs index ac99a0861..3ec6ea57c 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Color/ColorControlTestsEdge.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Color/ColorControlTestsEdge.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -84,7 +84,7 @@ public void GetRequiredReturnsFalse_When_RequiredAttributeIsNotPresent_Edge() { var colorElement = App.Components.CreateById("myColor4"); - Assert.AreEqual(false, colorElement.IsRequired); + Assert.IsFalse(colorElement.IsRequired); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/Color/ColorControlTestsFirefox.cs b/src/Bellatrix.Playwright.Tests/Controls/Color/ColorControlTestsFirefox.cs index c86af57b5..857815281 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Color/ColorControlTestsFirefox.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Color/ColorControlTestsFirefox.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -77,7 +77,7 @@ public void GetRequiredReturnsFalse_When_RequiredAttributeIsNotPresent_Firefox() { var colorElement = App.Components.CreateById("myColor4"); - Assert.AreEqual(false, colorElement.IsRequired); + Assert.IsFalse(colorElement.IsRequired); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/Color/ColorControlTestsSafari.cs b/src/Bellatrix.Playwright.Tests/Controls/Color/ColorControlTestsSafari.cs index c1e5d1136..b79daa4cd 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Color/ColorControlTestsSafari.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Color/ColorControlTestsSafari.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -76,7 +76,7 @@ public void GetRequiredReturnsFalse_When_RequiredAttributeIsNotPresent_Safari() { var colorElement = App.Components.CreateById("myColor4"); - Assert.AreEqual(false, colorElement.IsRequired); + Assert.IsFalse(colorElement.IsRequired); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/Color/ColorControlValidateExtensionsExceptionMessagesTests.cs b/src/Bellatrix.Playwright.Tests/Controls/Color/ColorControlValidateExtensionsExceptionMessagesTests.cs index 4bd9bd109..9d99a389f 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Color/ColorControlValidateExtensionsExceptionMessagesTests.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Color/ColorControlValidateExtensionsExceptionMessagesTests.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -44,7 +44,7 @@ public void CorrectExceptionMessageSet_When_ValidateColorIsThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's color should be '#f00031' but was '#f00030'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -61,7 +61,7 @@ public void CorrectExceptionMessageSet_When_ValidateAutoCompleteOffThrowsExcepti catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control autocomplete should be OFF but was not. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -78,7 +78,7 @@ public void CorrectExceptionMessageSet_When_ValidateAutoCompleteOnThrowsExceptio catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control autocomplete should be ON but was not. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -95,7 +95,7 @@ public void CorrectExceptionMessageSet_When_ValidateNotRequiredThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control should be NOT required but was NOT. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -112,7 +112,7 @@ public void CorrectExceptionMessageSet_When_ValidateRequiredThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control should be required but was NOT. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -129,7 +129,7 @@ public void CorrectExceptionMessageSet_When_ValidateListIsNullThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's list should be null but was 'tickmarks'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -146,7 +146,7 @@ public void CorrectExceptionMessageSet_When_ValidateListIsThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's list should be 'tickmarks' but was ''. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } } \ No newline at end of file diff --git a/src/Bellatrix.Playwright.Tests/Controls/Date/DateControlTestsChrome.cs b/src/Bellatrix.Playwright.Tests/Controls/Date/DateControlTestsChrome.cs index d2c66c623..5a62fa33e 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Date/DateControlTestsChrome.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Date/DateControlTestsChrome.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -108,7 +108,7 @@ public void GetReadonlyReturnsFalse_When_ReadonlyAttributeIsNotPresent_Chrome() { var dateElement = App.Components.CreateById("myDate4"); - Assert.AreEqual(false, dateElement.IsReadonly); + Assert.IsFalse(dateElement.IsReadonly); } [TestMethod] @@ -117,7 +117,7 @@ public void GetReadonlyReturnsTrue_When_ReadonlyAttributeIsPresent_Chrome() { var dateElement = App.Components.CreateById("myDate5"); - Assert.AreEqual(true, dateElement.IsReadonly); + Assert.IsTrue(dateElement.IsReadonly); } [TestMethod] @@ -182,7 +182,7 @@ public void GetRequiredReturnsFalse_When_RequiredAttributeIsNotPresent_Chrome() { var dateElement = App.Components.CreateById("myDate4"); - Assert.AreEqual(false, dateElement.IsRequired); + Assert.IsFalse(dateElement.IsRequired); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/Date/DateControlTestsEdge.cs b/src/Bellatrix.Playwright.Tests/Controls/Date/DateControlTestsEdge.cs index b1cee0a17..fe8d0cd38 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Date/DateControlTestsEdge.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Date/DateControlTestsEdge.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -118,7 +118,7 @@ public void GetReadonlyReturnsFalse_When_ReadonlyAttributeIsNotPresent_Edge() { var dateElement = App.Components.CreateById("myDate4"); - Assert.AreEqual(false, dateElement.IsReadonly); + Assert.IsFalse(dateElement.IsReadonly); } [TestMethod] @@ -128,7 +128,7 @@ public void GetReadonlyReturnsTrue_When_ReadonlyAttributeIsPresent_Edge() { var dateElement = App.Components.CreateById("myDate5"); - Assert.AreEqual(true, dateElement.IsReadonly); + Assert.IsTrue(dateElement.IsReadonly); } [TestMethod] @@ -200,7 +200,7 @@ public void GetRequiredReturnsFalse_When_RequiredAttributeIsNotPresent_Edge() { var dateElement = App.Components.CreateById("myDate4"); - Assert.AreEqual(false, dateElement.IsRequired); + Assert.IsFalse(dateElement.IsRequired); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/Date/DateControlTestsFirefox.cs b/src/Bellatrix.Playwright.Tests/Controls/Date/DateControlTestsFirefox.cs index 44d9160c7..8bf0b06e0 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Date/DateControlTestsFirefox.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Date/DateControlTestsFirefox.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -108,7 +108,7 @@ public void GetReadonlyReturnsFalse_When_ReadonlyAttributeIsNotPresent_Firefox() { var dateElement = App.Components.CreateById("myDate4"); - Assert.AreEqual(false, dateElement.IsReadonly); + Assert.IsFalse(dateElement.IsReadonly); } [TestMethod] @@ -117,7 +117,7 @@ public void GetReadonlyReturnsTrue_When_ReadonlyAttributeIsPresent_Firefox() { var dateElement = App.Components.CreateById("myDate5"); - Assert.AreEqual(true, dateElement.IsReadonly); + Assert.IsTrue(dateElement.IsReadonly); } [TestMethod] @@ -182,7 +182,7 @@ public void GetRequiredReturnsFalse_When_RequiredAttributeIsNotPresent_Firefox() { var dateElement = App.Components.CreateById("myDate4"); - Assert.AreEqual(false, dateElement.IsRequired); + Assert.IsFalse(dateElement.IsRequired); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/Date/DateControlTestsSafari.cs b/src/Bellatrix.Playwright.Tests/Controls/Date/DateControlTestsSafari.cs index 39db51960..e6a4584db 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Date/DateControlTestsSafari.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Date/DateControlTestsSafari.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -108,7 +108,7 @@ public void GetReadonlyReturnsFalse_When_ReadonlyAttributeIsNotPresent_Safari() { var dateElement = App.Components.CreateById("myDate4"); - Assert.AreEqual(false, dateElement.IsReadonly); + Assert.IsFalse(dateElement.IsReadonly); } [TestMethod] @@ -117,7 +117,7 @@ public void GetReadonlyReturnsTrue_When_ReadonlyAttributeIsPresent_Safari() { var dateElement = App.Components.CreateById("myDate5"); - Assert.AreEqual(true, dateElement.IsReadonly); + Assert.IsTrue(dateElement.IsReadonly); } [TestMethod] @@ -182,7 +182,7 @@ public void GetRequiredReturnsFalse_When_RequiredAttributeIsNotPresent_Safari() { var dateElement = App.Components.CreateById("myDate4"); - Assert.AreEqual(false, dateElement.IsRequired); + Assert.IsFalse(dateElement.IsRequired); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/Date/DateControlValidateExtensionsExceptionMessagesTests.cs b/src/Bellatrix.Playwright.Tests/Controls/Date/DateControlValidateExtensionsExceptionMessagesTests.cs index cf71a0551..21af24e41 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Date/DateControlValidateExtensionsExceptionMessagesTests.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Date/DateControlValidateExtensionsExceptionMessagesTests.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -44,7 +44,7 @@ public void CorrectExceptionMessageSet_When_ValidateDateIsThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's date should be '2017-07-05' but was '2017-07-06'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -61,7 +61,7 @@ public void CorrectExceptionMessageSet_When_ValidateNotReadonlyThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control should be NOT readonly but was NOT. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -78,7 +78,7 @@ public void CorrectExceptionMessageSet_When_ValidateReadonlyThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control should be readonly but was NOT. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -95,7 +95,7 @@ public void CorrectExceptionMessageSet_When_ValidateMaxTextIsNullThrowsException catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's max should be null but was '2032-12-01'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -112,7 +112,7 @@ public void CorrectExceptionMessageSet_When_ValidateMinTextIsNullThrowsException catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's min should be null but was '1900-01-01'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -129,7 +129,7 @@ public void CorrectExceptionMessageSet_When_ValidateStepIsNullThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's step should be null but was '2'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -146,7 +146,7 @@ public void CorrectExceptionMessageSet_When_ValidateMaxTextIsThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's max should be '2032-12-02' but was '2032-12-01'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -163,7 +163,7 @@ public void CorrectExceptionMessageSet_When_ValidateMinTextIsThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's min should be '1900-01-02' but was '1900-01-01'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -180,7 +180,7 @@ public void CorrectExceptionMessageSet_When_ValidateStepIsThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's step should be '3' but was '2'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } } \ No newline at end of file diff --git a/src/Bellatrix.Playwright.Tests/Controls/Date/DateControlValidationTests.cs b/src/Bellatrix.Playwright.Tests/Controls/Date/DateControlValidationTests.cs index faeb8907a..d0cdfee04 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Date/DateControlValidationTests.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Date/DateControlValidationTests.cs @@ -30,7 +30,7 @@ public void DateSetThrowsArgumentException_When_Month0_Edge() { var dateElement = App.Components.CreateById("myDate"); - Assert.ThrowsException(() => dateElement.SetDate(2017, 0, 1)); + Assert.Throws(() => dateElement.SetDate(2017, 0, 1)); } [TestMethod] @@ -40,7 +40,7 @@ public void DateSetThrowsArgumentException_When_MonthMinus1_Edge() { var dateElement = App.Components.CreateById("myDate"); - Assert.ThrowsException(() => dateElement.SetDate(2017, -1, 1)); + Assert.Throws(() => dateElement.SetDate(2017, -1, 1)); } [TestMethod] @@ -50,7 +50,7 @@ public void DateSetThrowsArgumentException_When_YearMinus1_Edge() { var dateElement = App.Components.CreateById("myDate"); - Assert.ThrowsException(() => dateElement.SetDate(-1, 2, 1)); + Assert.Throws(() => dateElement.SetDate(-1, 2, 1)); } [TestMethod] @@ -60,7 +60,7 @@ public void DateSetThrowsArgumentException_When_Year0_Edge() { var dateElement = App.Components.CreateById("myDate"); - Assert.ThrowsException(() => dateElement.SetDate(0, 1, 1)); + Assert.Throws(() => dateElement.SetDate(0, 1, 1)); } [TestMethod] @@ -70,7 +70,7 @@ public void DateSetThrowsArgumentException_When_DayMinus1_Edge() { var dateElement = App.Components.CreateById("myDate"); - Assert.ThrowsException(() => dateElement.SetDate(2017, 1, -1)); + Assert.Throws(() => dateElement.SetDate(2017, 1, -1)); } [TestMethod] @@ -80,7 +80,7 @@ public void DateSetThrowsArgumentException_When_Day0_Edge() { var dateElement = App.Components.CreateById("myDate"); - Assert.ThrowsException(() => dateElement.SetDate(2007, 2, 0)); + Assert.Throws(() => dateElement.SetDate(2007, 2, 0)); } [TestMethod] @@ -90,6 +90,6 @@ public void DateSetThrowsArgumentException_When_Day32_Edge() { var dateElement = App.Components.CreateById("myDate"); - Assert.ThrowsException(() => dateElement.SetDate(2007, 1, 32)); + Assert.Throws(() => dateElement.SetDate(2007, 1, 32)); } } \ No newline at end of file diff --git a/src/Bellatrix.Playwright.Tests/Controls/DateTimeLocal/DateTimeLocalControlTestsChrome.cs b/src/Bellatrix.Playwright.Tests/Controls/DateTimeLocal/DateTimeLocalControlTestsChrome.cs index 4dd511c98..3cda30495 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/DateTimeLocal/DateTimeLocalControlTestsChrome.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/DateTimeLocal/DateTimeLocalControlTestsChrome.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -76,7 +76,7 @@ public void GetReadonlyReturnsFalse_When_ReadonlyAttributeIsNotPresent_Chrome() { var timeElement = App.Components.CreateById("myTime4"); - Assert.AreEqual(false, timeElement.IsReadonly); + Assert.IsFalse(timeElement.IsReadonly); } [TestMethod] @@ -85,7 +85,7 @@ public void GetReadonlyReturnsTrue_When_ReadonlyAttributeIsPresent_Chrome() { var timeElement = App.Components.CreateById("myTime5"); - Assert.AreEqual(true, timeElement.IsReadonly); + Assert.IsTrue(timeElement.IsReadonly); } [TestMethod] @@ -150,7 +150,7 @@ public void GetRequiredReturnsFalse_When_RequiredAttributeIsNotPresent_Chrome() { var timeElement = App.Components.CreateById("myTime4"); - Assert.AreEqual(false, timeElement.IsRequired); + Assert.IsFalse(timeElement.IsRequired); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/DateTimeLocal/DateTimeLocalControlTestsEdge.cs b/src/Bellatrix.Playwright.Tests/Controls/DateTimeLocal/DateTimeLocalControlTestsEdge.cs index cf9b30a39..3d8209970 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/DateTimeLocal/DateTimeLocalControlTestsEdge.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/DateTimeLocal/DateTimeLocalControlTestsEdge.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -83,7 +83,7 @@ public void GetReadonlyReturnsFalse_When_ReadonlyAttributeIsNotPresent_Edge() { var timeElement = App.Components.CreateById("myTime4"); - Assert.AreEqual(false, timeElement.IsReadonly); + Assert.IsFalse(timeElement.IsReadonly); } [TestMethod] @@ -93,7 +93,7 @@ public void GetReadonlyReturnsTrue_When_ReadonlyAttributeIsPresent_Edge() { var timeElement = App.Components.CreateById("myTime5"); - Assert.AreEqual(true, timeElement.IsReadonly); + Assert.IsTrue(timeElement.IsReadonly); } [TestMethod] @@ -165,7 +165,7 @@ public void GetRequiredReturnsFalse_When_RequiredAttributeIsNotPresent_Edge() { var timeElement = App.Components.CreateById("myTime4"); - Assert.AreEqual(false, timeElement.IsRequired); + Assert.IsFalse(timeElement.IsRequired); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/DateTimeLocal/DateTimeLocalControlTestsSafari.cs b/src/Bellatrix.Playwright.Tests/Controls/DateTimeLocal/DateTimeLocalControlTestsSafari.cs index 174d0e08c..5805111ab 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/DateTimeLocal/DateTimeLocalControlTestsSafari.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/DateTimeLocal/DateTimeLocalControlTestsSafari.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -76,7 +76,7 @@ public void GetReadonlyReturnsFalse_When_ReadonlyAttributeIsNotPresent_Safari() { var timeElement = App.Components.CreateById("myTime4"); - Assert.AreEqual(false, timeElement.IsReadonly); + Assert.IsFalse(timeElement.IsReadonly); } [TestMethod] @@ -85,7 +85,7 @@ public void GetReadonlyReturnsTrue_When_ReadonlyAttributeIsPresent_Safari() { var timeElement = App.Components.CreateById("myTime5"); - Assert.AreEqual(true, timeElement.IsReadonly); + Assert.IsTrue(timeElement.IsReadonly); } [TestMethod] @@ -150,7 +150,7 @@ public void GetRequiredReturnsFalse_When_RequiredAttributeIsNotPresent_Safari() { var timeElement = App.Components.CreateById("myTime4"); - Assert.AreEqual(false, timeElement.IsRequired); + Assert.IsFalse(timeElement.IsRequired); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/DateTimeLocal/DateTimeLocalControlValidateExtensionsExceptionMessagesTests.cs b/src/Bellatrix.Playwright.Tests/Controls/DateTimeLocal/DateTimeLocalControlValidateExtensionsExceptionMessagesTests.cs index 0b6337ebf..bffe4b96d 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/DateTimeLocal/DateTimeLocalControlValidateExtensionsExceptionMessagesTests.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/DateTimeLocal/DateTimeLocalControlValidateExtensionsExceptionMessagesTests.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -45,7 +45,7 @@ public void CorrectExceptionMessageSet_When_ValidateTimeIsThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's time should be '1989-10-28T23:22' but was '1989-10-28T23:23'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } } \ No newline at end of file diff --git a/src/Bellatrix.Playwright.Tests/Controls/Element/ElementControlTestsChrome.cs b/src/Bellatrix.Playwright.Tests/Controls/Element/ElementControlTestsChrome.cs index e58b012d1..bfe5a2217 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Element/ElementControlTestsChrome.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Element/ElementControlTestsChrome.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -182,7 +182,7 @@ public void ReturnsNull_When_StyleAttributeIsNotPresent_Chrome() string style = element.GetStyle(); - Assert.AreEqual(null, style); + Assert.IsNull(style); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/Element/ElementControlTestsEdge.cs b/src/Bellatrix.Playwright.Tests/Controls/Element/ElementControlTestsEdge.cs index 1c896fbdc..43dee2da0 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Element/ElementControlTestsEdge.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Element/ElementControlTestsEdge.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -203,7 +203,7 @@ public void ReturnsNull_When_StyleAttributeIsNotPresent_Edge() string style = element.GetStyle(); - Assert.AreEqual(null, style); + Assert.IsNull(style); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/Element/ElementControlTestsFirefox.cs b/src/Bellatrix.Playwright.Tests/Controls/Element/ElementControlTestsFirefox.cs index 4643c8c05..38b49cceb 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Element/ElementControlTestsFirefox.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Element/ElementControlTestsFirefox.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -181,7 +181,7 @@ public void ReturnsNull_When_StyleAttributeIsNotPresent_Firefox() string style = element.GetStyle(); - Assert.AreEqual(null, style); + Assert.IsNull(style); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/Element/ElementControlTestsSafari.cs b/src/Bellatrix.Playwright.Tests/Controls/Element/ElementControlTestsSafari.cs index be374f6bb..6777534f4 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Element/ElementControlTestsSafari.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Element/ElementControlTestsSafari.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -181,7 +181,7 @@ public void ReturnsNull_When_StyleAttributeIsNotPresent_Safari() string style = element.GetStyle(); - Assert.AreEqual(null, style); + Assert.IsNull(style); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/Element/ElementControlValidateExtensionsExceptionMessagesTests.cs b/src/Bellatrix.Playwright.Tests/Controls/Element/ElementControlValidateExtensionsExceptionMessagesTests.cs index ce5565361..33b901df1 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Element/ElementControlValidateExtensionsExceptionMessagesTests.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Element/ElementControlValidateExtensionsExceptionMessagesTests.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -42,7 +42,7 @@ public void CorrectExceptionMessageSet_When_ValidateIsVisibleThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control should be visible but was NOT. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -59,7 +59,7 @@ public void CorrectExceptionMessageSet_When_ValidateIsNotVisibleThrowsException( catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control should be NOT visible but was NOT. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -78,7 +78,7 @@ public void CorrectExceptionMessageSet_When_ValidateCssClassIsThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's CSS class should be 'myTestClass2' but was 'myTestClass1'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -95,7 +95,7 @@ public void CorrectExceptionMessageSet_When_ValidateCssClassIsNullThrowsExceptio catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's CSS class should be null but was 'myTestClass'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -112,7 +112,7 @@ public void CorrectExceptionMessageSet_When_ValidateTitleIsThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's title should be 'bellatrix.solutions1' but was 'bellatrix.solutions'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -129,7 +129,7 @@ public void CorrectExceptionMessageSet_When_ValidateTitleIsNotNullThrowsExceptio catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's title shouldn't be null but was. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -146,7 +146,7 @@ public void CorrectExceptionMessageSet_When_ValidateTitleIsNullThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's title should be null but was 'bellatrix.solutions'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -163,7 +163,7 @@ public void CorrectExceptionMessageSet_When_ValidateTabIndexIsThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's tabindex should be '2' but was '1'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -180,7 +180,7 @@ public void CorrectExceptionMessageSet_When_ValidateStyleIsNullThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's style should be null but was 'color: green;'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -197,7 +197,7 @@ public void CorrectExceptionMessageSet_When_ValidateDirIsThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's dir should be 'rtl1' but was 'rtl'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -214,7 +214,7 @@ public void CorrectExceptionMessageSet_When_ValidateDirIsNullThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's dir should be null but was 'rtl'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -231,7 +231,7 @@ public void CorrectExceptionMessageSet_When_ValidateLangIsThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's lang should be 'bg' but was 'en'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -248,7 +248,7 @@ public void CorrectExceptionMessageSet_When_ValidateLangIsNullThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's lang should be null but was 'en'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } } \ No newline at end of file diff --git a/src/Bellatrix.Playwright.Tests/Controls/Email/EmailControlTestsChrome.cs b/src/Bellatrix.Playwright.Tests/Controls/Email/EmailControlTestsChrome.cs index 258a08135..5dc52e4c5 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Email/EmailControlTestsChrome.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Email/EmailControlTestsChrome.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -48,7 +48,7 @@ public void AutoCompleteReturnsFalse_When_NoAutoCompleteAttributeIsPresent_Chrom { var emailElement = App.Components.CreateById("myEmail"); - Assert.AreEqual(false, emailElement.IsAutoComplete); + Assert.IsFalse(emailElement.IsAutoComplete); } [TestMethod] @@ -57,7 +57,7 @@ public void AutoCompleteReturnsFalse_When_AutoCompleteAttributeExistsAndIsSetToO { var emailElement = App.Components.CreateById("myEmail5"); - Assert.AreEqual(false, emailElement.IsAutoComplete); + Assert.IsFalse(emailElement.IsAutoComplete); } [TestMethod] @@ -66,7 +66,7 @@ public void AutoCompleteReturnsTrue_When_AutoCompleteAttributeExistsAndIsSetToOn { var emailElement = App.Components.CreateById("myEmail4"); - Assert.AreEqual(true, emailElement.IsAutoComplete); + Assert.IsTrue(emailElement.IsAutoComplete); } [TestMethod] @@ -75,7 +75,7 @@ public void GetReadonlyReturnsFalse_When_ReadonlyAttributeIsNotPresent_Chrome() { var emailElement = App.Components.CreateById("myEmail4"); - Assert.AreEqual(false, emailElement.IsReadonly); + Assert.IsFalse(emailElement.IsReadonly); } [TestMethod] @@ -84,7 +84,7 @@ public void GetReadonlyReturnsTrue_When_ReadonlyAttributeIsPresent_Chrome() { var emailElement = App.Components.CreateById("myEmail6"); - Assert.AreEqual(true, emailElement.IsReadonly); + Assert.IsTrue(emailElement.IsReadonly); } [TestMethod] @@ -150,7 +150,7 @@ public void GetRequiredReturnsFalse_When_RequiredAttributeIsNotPresent_Chrome() { var emailElement = App.Components.CreateById("myEmail4"); - Assert.AreEqual(false, emailElement.IsRequired); + Assert.IsFalse(emailElement.IsRequired); } [TestMethod] @@ -159,7 +159,7 @@ public void GetRequiredReturnsTrue_When_RequiredAttributeIsPresent_Chrome() { var emailElement = App.Components.CreateById("myEmail7"); - Assert.AreEqual(true, emailElement.IsRequired); + Assert.IsTrue(emailElement.IsRequired); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/Email/EmailControlTestsEdge.cs b/src/Bellatrix.Playwright.Tests/Controls/Email/EmailControlTestsEdge.cs index 502cd897f..8dbcacc89 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Email/EmailControlTestsEdge.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Email/EmailControlTestsEdge.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -52,7 +52,7 @@ public void AutoCompleteReturnsFalse_When_NoAutoCompleteAttributeIsPresent_Edge( { var emailElement = App.Components.CreateById("myEmail"); - Assert.AreEqual(false, emailElement.IsAutoComplete); + Assert.IsFalse(emailElement.IsAutoComplete); } [TestMethod] @@ -62,7 +62,7 @@ public void AutoCompleteReturnsFalse_When_AutoCompleteAttributeExistsAndIsSetToO { var emailElement = App.Components.CreateById("myEmail5"); - Assert.AreEqual(false, emailElement.IsAutoComplete); + Assert.IsFalse(emailElement.IsAutoComplete); } [TestMethod] @@ -72,7 +72,7 @@ public void AutoCompleteReturnsTrue_When_AutoCompleteAttributeExistsAndIsSetToOn { var emailElement = App.Components.CreateById("myEmail4"); - Assert.AreEqual(true, emailElement.IsAutoComplete); + Assert.IsTrue(emailElement.IsAutoComplete); } [TestMethod] @@ -82,7 +82,7 @@ public void GetReadonlyReturnsFalse_When_ReadonlyAttributeIsNotPresent_Edge() { var emailElement = App.Components.CreateById("myEmail4"); - Assert.AreEqual(false, emailElement.IsReadonly); + Assert.IsFalse(emailElement.IsReadonly); } [TestMethod] @@ -92,7 +92,7 @@ public void GetReadonlyReturnsTrue_When_ReadonlyAttributeIsPresent_Edge() { var emailElement = App.Components.CreateById("myEmail6"); - Assert.AreEqual(true, emailElement.IsReadonly); + Assert.IsTrue(emailElement.IsReadonly); } [TestMethod] @@ -165,7 +165,7 @@ public void GetRequiredReturnsFalse_When_RequiredAttributeIsNotPresent_Edge() { var emailElement = App.Components.CreateById("myEmail4"); - Assert.AreEqual(false, emailElement.IsRequired); + Assert.IsFalse(emailElement.IsRequired); } [TestMethod] @@ -175,7 +175,7 @@ public void GetRequiredReturnsTrue_When_RequiredAttributeIsPresent_Edge() { var emailElement = App.Components.CreateById("myEmail7"); - Assert.AreEqual(true, emailElement.IsRequired); + Assert.IsTrue(emailElement.IsRequired); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/Email/EmailControlTestsFirefox.cs b/src/Bellatrix.Playwright.Tests/Controls/Email/EmailControlTestsFirefox.cs index 621a64eea..a679261a0 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Email/EmailControlTestsFirefox.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Email/EmailControlTestsFirefox.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -48,7 +48,7 @@ public void AutoCompleteReturnsFalse_When_NoAutoCompleteAttributeIsPresent_Firef { var emailElement = App.Components.CreateById("myEmail"); - Assert.AreEqual(false, emailElement.IsAutoComplete); + Assert.IsFalse(emailElement.IsAutoComplete); } [TestMethod] @@ -57,7 +57,7 @@ public void AutoCompleteReturnsFalse_When_AutoCompleteAttributeExistsAndIsSetToO { var emailElement = App.Components.CreateById("myEmail5"); - Assert.AreEqual(false, emailElement.IsAutoComplete); + Assert.IsFalse(emailElement.IsAutoComplete); } [TestMethod] @@ -66,7 +66,7 @@ public void AutoCompleteReturnsTrue_When_AutoCompleteAttributeExistsAndIsSetToOn { var emailElement = App.Components.CreateById("myEmail4"); - Assert.AreEqual(true, emailElement.IsAutoComplete); + Assert.IsTrue(emailElement.IsAutoComplete); } [TestMethod] @@ -75,7 +75,7 @@ public void GetReadonlyReturnsFalse_When_ReadonlyAttributeIsNotPresent_Firefox() { var emailElement = App.Components.CreateById("myEmail4"); - Assert.AreEqual(false, emailElement.IsReadonly); + Assert.IsFalse(emailElement.IsReadonly); } [TestMethod] @@ -84,7 +84,7 @@ public void GetReadonlyReturnsTrue_When_ReadonlyAttributeIsPresent_Firefox() { var emailElement = App.Components.CreateById("myEmail6"); - Assert.AreEqual(true, emailElement.IsReadonly); + Assert.IsTrue(emailElement.IsReadonly); } [TestMethod] @@ -150,7 +150,7 @@ public void GetRequiredReturnsFalse_When_RequiredAttributeIsNotPresent_Firefox() { var emailElement = App.Components.CreateById("myEmail4"); - Assert.AreEqual(false, emailElement.IsRequired); + Assert.IsFalse(emailElement.IsRequired); } [TestMethod] @@ -159,7 +159,7 @@ public void GetRequiredReturnsTrue_When_RequiredAttributeIsPresent_Firefox() { var emailElement = App.Components.CreateById("myEmail7"); - Assert.AreEqual(true, emailElement.IsRequired); + Assert.IsTrue(emailElement.IsRequired); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/Email/EmailControlTestsSafari.cs b/src/Bellatrix.Playwright.Tests/Controls/Email/EmailControlTestsSafari.cs index e7026c1d9..b4a51184e 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Email/EmailControlTestsSafari.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Email/EmailControlTestsSafari.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -48,7 +48,7 @@ public void AutoCompleteReturnsFalse_When_NoAutoCompleteAttributeIsPresent_Safar { var emailElement = App.Components.CreateById("myEmail"); - Assert.AreEqual(false, emailElement.IsAutoComplete); + Assert.IsFalse(emailElement.IsAutoComplete); } [TestMethod] @@ -57,7 +57,7 @@ public void AutoCompleteReturnsFalse_When_AutoCompleteAttributeExistsAndIsSetToO { var emailElement = App.Components.CreateById("myEmail5"); - Assert.AreEqual(false, emailElement.IsAutoComplete); + Assert.IsFalse(emailElement.IsAutoComplete); } [TestMethod] @@ -66,7 +66,7 @@ public void AutoCompleteReturnsTrue_When_AutoCompleteAttributeExistsAndIsSetToOn { var emailElement = App.Components.CreateById("myEmail4"); - Assert.AreEqual(true, emailElement.IsAutoComplete); + Assert.IsTrue(emailElement.IsAutoComplete); } [TestMethod] @@ -75,7 +75,7 @@ public void GetReadonlyReturnsFalse_When_ReadonlyAttributeIsNotPresent_Safari() { var emailElement = App.Components.CreateById("myEmail4"); - Assert.AreEqual(false, emailElement.IsReadonly); + Assert.IsFalse(emailElement.IsReadonly); } [TestMethod] @@ -84,7 +84,7 @@ public void GetReadonlyReturnsTrue_When_ReadonlyAttributeIsPresent_Safari() { var emailElement = App.Components.CreateById("myEmail6"); - Assert.AreEqual(true, emailElement.IsReadonly); + Assert.IsTrue(emailElement.IsReadonly); } [TestMethod] @@ -150,7 +150,7 @@ public void GetRequiredReturnsFalse_When_RequiredAttributeIsNotPresent_Safari() { var emailElement = App.Components.CreateById("myEmail4"); - Assert.AreEqual(false, emailElement.IsRequired); + Assert.IsFalse(emailElement.IsRequired); } [TestMethod] @@ -159,7 +159,7 @@ public void GetRequiredReturnsTrue_When_RequiredAttributeIsPresent_Safari() { var emailElement = App.Components.CreateById("myEmail7"); - Assert.AreEqual(true, emailElement.IsRequired); + Assert.IsTrue(emailElement.IsRequired); } [TestMethod] diff --git a/src/Bellatrix.Playwright.Tests/Controls/Email/EmailControlValidateExtensionsExceptionMessagesTests.cs b/src/Bellatrix.Playwright.Tests/Controls/Email/EmailControlValidateExtensionsExceptionMessagesTests.cs index 3fd4ef6a0..74b8e0b81 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Email/EmailControlValidateExtensionsExceptionMessagesTests.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Email/EmailControlValidateExtensionsExceptionMessagesTests.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -44,7 +44,7 @@ public void CorrectExceptionMessageSet_When_ValidateEmailIsThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's email should be 'aangelov@bellatrix.solutions1' but was 'aangelov@bellatrix.solutions'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -61,7 +61,7 @@ public void CorrectExceptionMessageSet_When_ValidateMaxLengthIsNullThrowsExcepti catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's maxlength should be null but was '80'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -78,7 +78,7 @@ public void CorrectExceptionMessageSet_When_ValidateMinLengthIsNullThrowsExcepti catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's minlength should be null but was '10'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -95,7 +95,7 @@ public void CorrectExceptionMessageSet_When_ValidateSizeIsThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's size should be '19' but was '20'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -112,7 +112,7 @@ public void CorrectExceptionMessageSet_When_ValidateMaxLengthIsThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's maxlength should be '79' but was '80'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -129,7 +129,7 @@ public void CorrectExceptionMessageSet_When_ValidateMinLengthIsThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's minlength should be '9' but was '10'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -146,7 +146,7 @@ public void CorrectExceptionMessageSet_When_ValidatePlaceholderIsThrowsException catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's placeholder should be 'your email term goes here1' but was 'your email term goes here'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -163,7 +163,7 @@ public void CorrectExceptionMessageSet_When_ValidatePlaceholderIsNullThrowsExcep catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's placeholder should be null but was 'your email term goes here'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } } \ No newline at end of file diff --git a/src/Bellatrix.Playwright.Tests/Controls/Grid/GridControlTestsChrome.cs b/src/Bellatrix.Playwright.Tests/Controls/Grid/GridControlTestsChrome.cs index 197ae5fe3..135790927 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Grid/GridControlTestsChrome.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Grid/GridControlTestsChrome.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Bellatrix.Playwright.Assertions; using Bellatrix.Playwright.Services; @@ -201,7 +201,7 @@ public void ReturnRows_When_GetRows_Chrome() { var rows = _testGrid.GetRows().ToList(); - Assert.AreEqual(3, rows.Count); + Assert.HasCount(3, rows); } [TestMethod] @@ -269,7 +269,7 @@ public void ReturnColumnCells_When_GetColumnByIndex_Chrome() { var column = _testGrid.GetColumn(0); - Assert.AreEqual(3, column.Count); + Assert.HasCount(3, column); Assert.IsTrue(column.Select(c => c.Column).All(v => v == 0)); } diff --git a/src/Bellatrix.Playwright.Tests/Controls/Image/ImageControlValidateExtensionsExceptionMessagesTests.cs b/src/Bellatrix.Playwright.Tests/Controls/Image/ImageControlValidateExtensionsExceptionMessagesTests.cs index 8fd233fd6..ac472e28c 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Image/ImageControlValidateExtensionsExceptionMessagesTests.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Image/ImageControlValidateExtensionsExceptionMessagesTests.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -42,7 +42,7 @@ public void CorrectExceptionMessageSet_When_ValidateSrcIsThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's src should be 'https://bellatrix.solutions/assets/uploads/2017/09/logo.png1' but was 'https://bellatrix.solutions/assets/uploads/2017/09/logo.png'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -59,7 +59,7 @@ public void CorrectExceptionMessageSet_When_ValidateSrcIsNotNullThrowsException( catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's src shouldn't be null but was. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -76,7 +76,7 @@ public void CorrectExceptionMessageSet_When_ValidateSrcIsNullThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's src should be null but was 'https://bellatrix.solutions/assets/uploads/2017/09/logo.png'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -93,7 +93,7 @@ public void CorrectExceptionMessageSet_When_ValidateAltIsThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's alt should be 'MDN1' but was 'MDN'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -110,7 +110,7 @@ public void CorrectExceptionMessageSet_When_ValidateAltIsNullThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's alt should be null but was 'MDN'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -127,7 +127,7 @@ public void CorrectExceptionMessageSet_When_ValidateSrcSetIsThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's srcset should be 'mdn-logo-HD.png 2' but was 'mdn-logo-HD.png 2x'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -144,7 +144,7 @@ public void CorrectExceptionMessageSet_When_ValidateSrcSetIsNullThrowsException( catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's srcset should be null but was 'clock-demo-thumb-200.png 200w,clock-demo-thumb-400.png 400w'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -161,7 +161,7 @@ public void CorrectExceptionMessageSet_When_ValidateSizesIsThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's sizes should be 'min' but was '(min-width: 600px) 200px, 50vw'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } @@ -178,7 +178,7 @@ public void CorrectExceptionMessageSet_When_ValidateSizesIsNullThrowsException() catch (ComponentPropertyValidateException e) { string expectedExceptionMessage = $"The control's sizes should be null but was '(min-width: 600px) 200px, 50vw'. The test failed on URL:"; - Assert.AreEqual(true, e.Message.Contains(expectedExceptionMessage), $"Should be {expectedExceptionMessage} but was {e.Message}"); + Assert.Contains(expectedExceptionMessage, e.Message, $"Should be {expectedExceptionMessage} but was {e.Message}"); } } } \ No newline at end of file diff --git a/src/Bellatrix.Playwright.Tests/Controls/Label/LabelControlTestsChrome.cs b/src/Bellatrix.Playwright.Tests/Controls/Label/LabelControlTestsChrome.cs index a5059a637..a5069dc4b 100644 --- a/src/Bellatrix.Playwright.Tests/Controls/Label/LabelControlTestsChrome.cs +++ b/src/Bellatrix.Playwright.Tests/Controls/Label/LabelControlTestsChrome.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2025 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. @@ -75,7 +75,7 @@ public void ReturnButtonHtml_When_InnerHtmlSet_Chrome() { var labelElement = App.Components.CreateById