Skip to content

Commit

Permalink
Add GitHub actions to build and package.
Browse files Browse the repository at this point in the history
Based on https://github.com/actions/starter-workflows/blob/main/ci/dotnet.yml.

This requires the WpfApplication to be converted to a .NET 6 project and
added to the UITests project dependencies so that it is built before it
is used in the tests.
  • Loading branch information
aristotelos committed Mar 21, 2024
1 parent b46eced commit 4f2f785
Show file tree
Hide file tree
Showing 20 changed files with 169 additions and 411 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: .NET

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build:

runs-on: windows-latest

env:
Configuration: Release

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x

- name: Restore dependencies
run: dotnet restore --configuration $env:Configuration
working-directory: ./src

- name: Build
run: dotnet build --no-restore --configuration $env:Configuration
working-directory: ./src

- name: Test
run: dotnet test --no-build --configuration $env:Configuration --verbosity normal
working-directory: ./src

- name: Publish
run: dotnet publish FlaUI.WebDriver/FlaUI.WebDriver.csproj --no-build --configuration $env:Configuration --self-contained
working-directory: ./src

- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: package
path: ./src/FlaUI.WebDriver/bin/Release/win-x64/publish
4 changes: 2 additions & 2 deletions src/FlaUI.WebDriver.UITests/ElementTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ public void GetElementRect_Default_IsSupported()
var size = element.Size;

var windowLocation = driver.Manage().Window.Position;
Assert.That(location.X, Is.InRange(windowLocation.X + 254, windowLocation.X + 256));
Assert.That(location.Y, Is.InRange(windowLocation.Y + 133, windowLocation.Y + 135));
Assert.That(location.X, Is.InRange(windowLocation.X + 253, windowLocation.X + 257));
Assert.That(location.Y, Is.InRange(windowLocation.Y + 132, windowLocation.Y + 136));
Assert.That(size.Width, Is.EqualTo(120));
Assert.That(size.Height, Is.EqualTo(22));
}
Expand Down
5 changes: 5 additions & 0 deletions src/FlaUI.WebDriver.UITests/FlaUI.WebDriver.UITests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,9 @@
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\FlaUI.WebDriver\FlaUI.WebDriver.csproj" />
<ProjectReference Include="..\TestApplications\WpfApplication\WpfApplication.csproj" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/FlaUI.WebDriver.UITests/TestUtil/FlaUIDriverOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace FlaUI.WebDriver.UITests.TestUtil
{
internal class FlaUIDriverOptions : DriverOptions
{
public const string TestAppPath = "..\\..\\..\\TestApplications\\WpfApplication\\bin\\WpfApplication.exe";
public const string TestAppPath = "..\\..\\..\\TestApplications\\WpfApplication\\bin\\Release\\WpfApplication.exe";

public override ICapabilities ToCapabilities()
{
Expand Down
2 changes: 1 addition & 1 deletion src/FlaUI.WebDriver.UITests/TestUtil/TestAppProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace FlaUI.WebDriver.UITests.TestUtil
{
public class TestAppProcess : IDisposable
{
private const string TestAppPath = "..\\..\\..\\..\\TestApplications\\WpfApplication\\bin\\WpfApplication.exe";
private const string TestAppPath = "..\\..\\..\\..\\TestApplications\\WpfApplication\\bin\\Release\\WpfApplication.exe";
private readonly Process _process;

public TestAppProcess()
Expand Down
2 changes: 1 addition & 1 deletion src/FlaUI.WebDriver.UITests/WebDriverFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace FlaUI.WebDriver.UITests
[SetUpFixture]
public class WebDriverFixture
{
public static readonly Uri WebDriverUrl = new Uri("http://localhost:4723/");
public static readonly Uri WebDriverUrl = new Uri("http://localhost:9723/");

private Process _webDriverProcess;

Expand Down
70 changes: 63 additions & 7 deletions src/FlaUI.WebDriver.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,93 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{3DFE78D4
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestApplications", "TestApplications", "{00BCF82A-388A-4DC9-A1E2-6D6D983BAEE3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfApplication", "TestApplications\WpfApplication\WpfApplication.csproj", "{C8276299-FA43-409B-A969-EF030AB56224}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlaUI.WebDriver", "FlaUI.WebDriver\FlaUI.WebDriver.csproj", "{07FE5EE9-0104-42CE-A79D-88FD7D79B542}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlaUI.WebDriver.UITests", "FlaUI.WebDriver.UITests\FlaUI.WebDriver.UITests.csproj", "{5315D9CF-DDA4-49AE-BA92-AB5814E61901}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WpfApplication", "TestApplications\WpfApplication\WpfApplication.csproj", "{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|ARM = Debug|ARM
Debug|ARM64 = Debug|ARM64
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|ARM = Release|ARM
Release|ARM64 = Release|ARM64
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C8276299-FA43-409B-A969-EF030AB56224}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C8276299-FA43-409B-A969-EF030AB56224}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C8276299-FA43-409B-A969-EF030AB56224}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C8276299-FA43-409B-A969-EF030AB56224}.Release|Any CPU.Build.0 = Release|Any CPU
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Debug|Any CPU.Build.0 = Debug|Any CPU
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Debug|ARM.ActiveCfg = Debug|Any CPU
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Debug|ARM.Build.0 = Debug|Any CPU
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Debug|ARM64.Build.0 = Debug|Any CPU
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Debug|x64.ActiveCfg = Debug|Any CPU
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Debug|x64.Build.0 = Debug|Any CPU
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Debug|x86.ActiveCfg = Debug|Any CPU
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Debug|x86.Build.0 = Debug|Any CPU
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Release|Any CPU.ActiveCfg = Release|Any CPU
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Release|Any CPU.Build.0 = Release|Any CPU
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Release|ARM.ActiveCfg = Release|Any CPU
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Release|ARM.Build.0 = Release|Any CPU
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Release|ARM64.ActiveCfg = Release|Any CPU
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Release|ARM64.Build.0 = Release|Any CPU
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Release|x64.ActiveCfg = Release|Any CPU
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Release|x64.Build.0 = Release|Any CPU
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Release|x86.ActiveCfg = Release|Any CPU
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Release|x86.Build.0 = Release|Any CPU
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Debug|ARM.ActiveCfg = Debug|Any CPU
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Debug|ARM.Build.0 = Debug|Any CPU
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Debug|ARM64.Build.0 = Debug|Any CPU
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Debug|x64.ActiveCfg = Debug|Any CPU
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Debug|x64.Build.0 = Debug|Any CPU
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Debug|x86.ActiveCfg = Debug|Any CPU
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Debug|x86.Build.0 = Debug|Any CPU
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Release|Any CPU.Build.0 = Release|Any CPU
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Release|ARM.ActiveCfg = Release|Any CPU
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Release|ARM.Build.0 = Release|Any CPU
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Release|ARM64.ActiveCfg = Release|Any CPU
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Release|ARM64.Build.0 = Release|Any CPU
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Release|x64.ActiveCfg = Release|Any CPU
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Release|x64.Build.0 = Release|Any CPU
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Release|x86.ActiveCfg = Release|Any CPU
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Release|x86.Build.0 = Release|Any CPU
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Debug|ARM.ActiveCfg = Debug|Any CPU
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Debug|ARM.Build.0 = Debug|Any CPU
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Debug|ARM64.Build.0 = Debug|Any CPU
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Debug|x64.ActiveCfg = Debug|Any CPU
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Debug|x64.Build.0 = Debug|Any CPU
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Debug|x86.ActiveCfg = Debug|Any CPU
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Debug|x86.Build.0 = Debug|Any CPU
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Release|Any CPU.Build.0 = Release|Any CPU
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Release|ARM.ActiveCfg = Release|Any CPU
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Release|ARM.Build.0 = Release|Any CPU
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Release|ARM64.ActiveCfg = Release|Any CPU
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Release|ARM64.Build.0 = Release|Any CPU
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Release|x64.ActiveCfg = Release|Any CPU
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Release|x64.Build.0 = Release|Any CPU
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Release|x86.ActiveCfg = Release|Any CPU
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{C8276299-FA43-409B-A969-EF030AB56224} = {00BCF82A-388A-4DC9-A1E2-6D6D983BAEE3}
{5315D9CF-DDA4-49AE-BA92-AB5814E61901} = {3DFE78D4-89EB-4CEE-A5D1-F5FDDED10959}
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0} = {00BCF82A-388A-4DC9-A1E2-6D6D983BAEE3}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F2B64231-45B2-4129-960A-9F26AFFD16AE}
Expand Down
12 changes: 12 additions & 0 deletions src/FlaUI.WebDriver/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "8.0.3",
"commands": [
"dotnet-ef"
]
}
}
}
7 changes: 7 additions & 0 deletions src/FlaUI.WebDriver/FlaUI.WebDriver.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
<ImplicitUsings>disable</ImplicitUsings>
<LangVersion>preview</LangVersion>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
<PublishSingleFile>true</PublishSingleFile>
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
</PropertyGroup>

<PropertyGroup>
<StartupObject>FlaUI.WebDriver.Program</StartupObject>
</PropertyGroup>

<ItemGroup>
Expand Down
6 changes: 0 additions & 6 deletions src/TestApplications/WpfApplication/App.config

This file was deleted.

1 change: 1 addition & 0 deletions src/TestApplications/WpfApplication/App.xaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Application x:Class="WpfApplication.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfApplication"
StartupUri="MainWindow.xaml">
<Application.Resources>

Expand Down
9 changes: 7 additions & 2 deletions src/TestApplications/WpfApplication/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
namespace WpfApplication
using System.Configuration;
using System.Data;
using System.Windows;

namespace WpfApp1
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App
public partial class App : Application
{
}

}
10 changes: 10 additions & 0 deletions src/TestApplications/WpfApplication/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
55 changes: 0 additions & 55 deletions src/TestApplications/WpfApplication/Properties/AssemblyInfo.cs

This file was deleted.

This file was deleted.

Loading

0 comments on commit 4f2f785

Please sign in to comment.