Futile.Specflow.Actions.FlaUI
1.0.0
See the version list below for details.
dotnet add package Futile.Specflow.Actions.FlaUI --version 1.0.0
NuGet\Install-Package Futile.Specflow.Actions.FlaUI -Version 1.0.0
<PackageReference Include="Futile.Specflow.Actions.FlaUI" Version="1.0.0" />
paket add Futile.Specflow.Actions.FlaUI --version 1.0.0
#r "nuget: Futile.Specflow.Actions.FlaUI, 1.0.0"
// Install Futile.Specflow.Actions.FlaUI as a Cake Addin #addin nuget:?package=Futile.Specflow.Actions.FlaUI&version=1.0.0 // Install Futile.Specflow.Actions.FlaUI as a Cake Tool #tool nuget:?package=Futile.Specflow.Actions.FlaUI&version=1.0.0
Futile.SpecFlow.Actions.FlaUI
This SpecFlow.Action will help you use FlaUI together with SpecFlow.
Futile?
Work on Specflow has been discontinued and the successor is reqnroll (status May 2024). This nuget package is an addition to a fork.
Included Features
- Lifetime handling of the application being tested
- Configuration via
specflow.actions.json
- Launch of executables and Windows Store Apps (e.g. Calculator)
Configuration
You can configure this plugin via the specflow.actions.json
.
{
"flaui": {
"settings": {
"uia": "UIA2"
},
"profiles": {
"Calculator.exe with Hello FlaUI": {
"app": "[path]\Calculator.exe",
"arguments": "Hello FlaUI",
"launch": "Exe"
},
"Windows 11 Calculator": {
"app": "Microsoft.WindowsCalculator_8wekyb3d8bbwe!App",
"launch": "StoreApp"
}
}
}
}
uia
Supported values:
UIA2
UIA3
app
filename of the executable or the name of the Windows App. The Windows App names can be found in can be found as folder in %userprofile%\AppData\Local\Packages
.
arguments
Optional list of arguments.
launch
Supported values:
Exe
StoreApp
How to use it
The application is started automatically when you try to use it for the first time. It is closed after the scenario ends. You can use constructor and/or parameter injection to inject dependencies into your classes, this way the class instances are managed automatically.
Elements object
Wraps the FlaUI access to the application.
public class CalculatorMainWindowElements
{
private readonly FlaUIDriver _driver;
public CalculatorMainWindowElements(FlaUIDriver driver)
{
_driver = driver;
}
public TextBox FirstNumberTextBox => _driver.Current.FindFirstDescendant("TextBoxFirst").AsTextBox();
public TextBox SecondNumberTextBox => _driver.Current.FindFirstDescendant("TextBoxSecond").AsTextBox();
public TextBox ResultTextBox => _driver.Current.FindFirstDescendant("TextBoxResult").AsTextBox();
public Button AddButton => _driver.Current.FindFirstDescendant("ButtonAdd").AsButton();
}
Proxy object
Represents the application under test.
public class CalculatorProxy
{
private readonly FlaUIDriver _driver;
private readonly CalculatorMainWindowElements _elements;
public CalculatorProxy(FlaUIDriver driver)
{
_driver = driver;
_elements = new CalculatorMainWindowElements(driver);
}
public void EnterFirstNumber(string number)
{
_elements.FirstNumberTextBox.Text += number;
}
public void EnterSecondNumber(string number)
{
_elements.SecondNumberTextBox.Text += number;
}
public void ClickAdd()
{
_elements.AddButton.Click();
}
public string GetResult()
{
return _elements.ResultTextBox.Text;
}
}
Step definitions
[Binding]
public sealed class CalculatorStepDefinitions
{
private readonly CalculatorProxy _proxy;
public CalculatorStepDefinitions(CalculatorProxy proxy)
{
_proxy = proxy;
}
[Given("the first number is (.*)")]
public void GivenTheFirstNumberIs(int number)
{
_proxy.EnterFirstNumber(number.ToString());
}
}
How to get it
Add the latest version of the Futile.SpecFlow.Actions.FlaUI
NuGet Package to your project.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0-windows7.0 is compatible. net7.0-windows was computed. net8.0-windows was computed. |
.NET Framework | net48 is compatible. net481 was computed. |
-
.NETFramework 4.8
- FlaUI.UIA2 (>= 4.0.0)
- FlaUI.UIA3 (>= 4.0.0)
- Futile.Specflow.Actions.Configuration (>= 0.1.350.5)
- Newtonsoft.Json (>= 13.0.3)
- SpecFlow (>= 3.9.74)
- System.Drawing.Common (>= 8.0.6)
-
net6.0-windows7.0
- FlaUI.UIA2 (>= 4.0.0)
- FlaUI.UIA3 (>= 4.0.0)
- Futile.Specflow.Actions.Configuration (>= 0.1.350.5)
- Newtonsoft.Json (>= 13.0.3)
- SpecFlow (>= 3.9.74)
- System.Drawing.Common (>= 8.0.6)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.