Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base structure of a ui bindings project #149

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Behavioral.Automation.Interfaces.UI/Abstractions/IBrowser.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Behavioral.Automation.Interfaces.UI.Abstractions;

public interface IBrowser
{
public Task<IPage> OpenNewPageAsync();
public Task CloseAsync();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Behavioral.Automation.Interfaces.UI.Abstractions;

public interface IButtonElement : IWebElement
{
public Task ClickAsync();
}
9 changes: 9 additions & 0 deletions Behavioral.Automation.Interfaces.UI/Abstractions/IPage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Behavioral.Automation.Interfaces.UI.Abstractions;

public interface IPage
{
public Task GoToUrlAsync(string url);
public Task GoToApplicationUrlAsync();
public Task HaveTitleAsync(string title);
public Task ScreenshotAsync(string path);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Behavioral.Automation.Interfaces.UI.Abstractions;

public interface IWebElement
{
public string? Description { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Behavioral.Automation.Interfaces.UI.Abstractions;

public interface IWebElementStorageService
{
static readonly Dictionary<Type, Type> RegisteredElements = new();

static void RegisterWebElementImplementationAs<TType, TInterface>() where TType : class, TInterface
{
RegisteredElements.Add(typeof(TInterface), typeof(TType));
}

T Get<T>(string locatorKey) where T : IWebElement;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>AnyCPU</Platforms>
<RootNamespace>Behavioral.Automation.Interfaces.UI</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SpecFlow" Version="3.9.74" />
</ItemGroup>



</Project>
1 change: 1 addition & 0 deletions Behavioral.Automation.Interfaces.UI/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TBD
1 change: 1 addition & 0 deletions Behavioral.Automation.Interfaces.UI/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TBD
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Selenium.Support" Version="4.3.0" />
<PackageReference Include="Selenium.WebDriver" Version="4.7.0" />
<PackageReference Include="Selenium.Support" Version="4.17.0" />
<PackageReference Include="Selenium.WebDriver" Version="4.17.0" />
<PackageReference Include="SpecFlow" Version="3.9.69" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="108.0.5359.7100" />
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="121.0.6167.18400" />
<PackageReference Include="SpecFlow" Version="3.9.69" />
<PackageReference Include="SpecFlow.NUnit" Version="3.9.69" />
<PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="3.9.69" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ The whole automation code is divided into the following parts:
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="Selenium.Support" Version="4.3.0" />
<PackageReference Include="Selenium.WebDriver" Version="4.7.0" />
<PackageReference Include="Selenium.Support" Version="4.17.0" />
<PackageReference Include="Selenium.WebDriver" Version="4.17.0" />
<PackageReference Include="SpecFlow" Version="3.9.69" />
<PackageReference Include="Teronis.MSBuild.Packaging.ProjectBuildInPackage" Version="1.0.0">
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ public string MakeScreenShot()
var fileName = new string(TestContext.CurrentContext.Test.Name
.Where(x => !Path.GetInvalidFileNameChars().Contains(x))
.ToArray()) + ".png";
Screenshot screenshot = ((ITakesScreenshot)Driver).GetScreenshot();
screenshot.SaveAsFile(fileName, ScreenshotImageFormat.Png);
var screenshot = ((ITakesScreenshot)Driver).GetScreenshot();
screenshot.SaveAsFile(fileName);
return fileName;
}

Expand Down
9 changes: 9 additions & 0 deletions Behavioral.Automation.sln
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UITests", "Behavioral.Autom
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{FA8E07DE-0779-44A0-AFF2-2C2573DD6611}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Behavioral.Automation.Interfaces.UI", "Behavioral.Automation.Interfaces.UI\Behavioral.Automation.Interfaces.UI.csproj", "{DB675416-81CA-40EA-A1D9-F45E75248F74}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Behavioral.Automation.Interfaces.UI", "Behavioral.Automation.Interfaces.UI", "{C6D1A214-4D90-4973-83A0-4D1D1EA5DE30}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -64,6 +68,10 @@ Global
{1498E9EA-13DE-4C6A-AB63-960D226F6FCE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1498E9EA-13DE-4C6A-AB63-960D226F6FCE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1498E9EA-13DE-4C6A-AB63-960D226F6FCE}.Release|Any CPU.Build.0 = Release|Any CPU
{DB675416-81CA-40EA-A1D9-F45E75248F74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DB675416-81CA-40EA-A1D9-F45E75248F74}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DB675416-81CA-40EA-A1D9-F45E75248F74}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DB675416-81CA-40EA-A1D9-F45E75248F74}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -77,6 +85,7 @@ Global
{BB7AC02C-03FD-4F17-B4A9-CDECC1A63DA5} = {430C8D20-03B9-4268-A6BC-F008F4DC2CD1}
{FA8E07DE-0779-44A0-AFF2-2C2573DD6611} = {2A26C467-6A03-4942-9F9B-62F77F992F70}
{1498E9EA-13DE-4C6A-AB63-960D226F6FCE} = {FA8E07DE-0779-44A0-AFF2-2C2573DD6611}
{DB675416-81CA-40EA-A1D9-F45E75248F74} = {C6D1A214-4D90-4973-83A0-4D1D1EA5DE30}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {724FD185-E1F2-44BD-89EA-DFD1DBF6453A}
Expand Down
Loading