Skip to content

Commit a94b582

Browse files
committed
Add GitHub actions to build and package.
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.
1 parent b46eced commit a94b582

File tree

17 files changed

+181
-198
lines changed

17 files changed

+181
-198
lines changed

.github/workflows/build.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
11+
build:
12+
13+
runs-on: windows-latest
14+
15+
env:
16+
Configuration: Release
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Setup .NET
25+
uses: actions/setup-dotnet@v4
26+
with:
27+
dotnet-version: 6.0.x
28+
29+
- name: Restore dependencies
30+
run: dotnet restore
31+
working-directory: ./src
32+
33+
- name: Build
34+
run: dotnet build --no-restore --configuration $env:Configuration
35+
working-directory: ./src
36+
37+
- name: Test
38+
run: dotnet test --no-build --configuration $env:Configuration --verbosity normal
39+
working-directory: ./src
40+
41+
# Unfortunately, --no-build does not seem to work when we publish a specific project, so we use --no-restore instead
42+
- name: Publish
43+
run: dotnet publish FlaUI.WebDriver/FlaUI.WebDriver.csproj --no-restore --configuration $env:Configuration --self-contained
44+
working-directory: ./src
45+
46+
- name: Upload build artifacts
47+
uses: actions/upload-artifact@v3
48+
with:
49+
name: package
50+
path: ./src/FlaUI.WebDriver/bin/Release/win-x64/publish

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# FlaUI.WebDriver
22

3+
[![build](https://github.com/FlaUI/FlaUI.WebDriver/actions/workflows/build.yml/badge.svg)](https://github.com/FlaUI/FlaUI.WebDriver/actions/workflows/build.yml)
4+
35
FlaUI.WebDriver is a [W3C WebDriver2](https://www.w3.org/TR/webdriver2/) implementation using FlaUI's automation. It currently only supports UIA3.
46

57
> [!IMPORTANT]

src/FlaUI.WebDriver.UITests/ElementTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ public void GetElementRect_Default_IsSupported()
142142
var size = element.Size;
143143

144144
var windowLocation = driver.Manage().Window.Position;
145-
Assert.That(location.X, Is.InRange(windowLocation.X + 254, windowLocation.X + 256));
146-
Assert.That(location.Y, Is.InRange(windowLocation.Y + 133, windowLocation.Y + 135));
145+
Assert.That(location.X, Is.InRange(windowLocation.X + 253, windowLocation.X + 257));
146+
Assert.That(location.Y, Is.InRange(windowLocation.Y + 132, windowLocation.Y + 136));
147147
Assert.That(size.Width, Is.EqualTo(120));
148148
Assert.That(size.Height, Is.EqualTo(22));
149149
}

src/FlaUI.WebDriver.UITests/FlaUI.WebDriver.UITests.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,9 @@
1818
</PackageReference>
1919
</ItemGroup>
2020

21+
<ItemGroup>
22+
<ProjectReference Include="..\FlaUI.WebDriver\FlaUI.WebDriver.csproj" />
23+
<ProjectReference Include="..\TestApplications\WpfApplication\WpfApplication.csproj" />
24+
</ItemGroup>
25+
2126
</Project>

src/FlaUI.WebDriver.UITests/TestUtil/FlaUIDriverOptions.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@ namespace FlaUI.WebDriver.UITests.TestUtil
55
{
66
internal class FlaUIDriverOptions : DriverOptions
77
{
8-
public const string TestAppPath = "..\\..\\..\\TestApplications\\WpfApplication\\bin\\WpfApplication.exe";
9-
108
public override ICapabilities ToCapabilities()
119
{
1210
return GenerateDesiredCapabilities(true);
1311
}
1412

15-
public static FlaUIDriverOptions TestApp() => App(TestAppPath);
13+
public static FlaUIDriverOptions TestApp() => App(TestApplication.FullPath);
1614

1715
public static DriverOptions RootApp() => App("Root");
1816

src/FlaUI.WebDriver.UITests/TestUtil/TestAppProcess.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ namespace FlaUI.WebDriver.UITests.TestUtil
55
{
66
public class TestAppProcess : IDisposable
77
{
8-
private const string TestAppPath = "..\\..\\..\\..\\TestApplications\\WpfApplication\\bin\\WpfApplication.exe";
98
private readonly Process _process;
109

1110
public TestAppProcess()
1211
{
13-
_process = Process.Start(TestAppPath);
12+
_process = Process.Start(TestApplication.FullPath);
1413
while (_process.MainWindowHandle == IntPtr.Zero)
1514
{
1615
System.Threading.Thread.Sleep(100);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System.IO;
2+
3+
namespace FlaUI.WebDriver.UITests.TestUtil
4+
{
5+
public static class TestApplication
6+
{
7+
public static string FullPath => Path.GetFullPath("..\\..\\..\\..\\TestApplications\\WpfApplication\\bin\\Release\\WpfApplication.exe");
8+
}
9+
}

src/FlaUI.WebDriver.UITests/WebDriverFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace FlaUI.WebDriver.UITests
99
[SetUpFixture]
1010
public class WebDriverFixture
1111
{
12-
public static readonly Uri WebDriverUrl = new Uri("http://localhost:4723/");
12+
public static readonly Uri WebDriverUrl = new Uri("http://localhost:9723/");
1313

1414
private Process _webDriverProcess;
1515

src/FlaUI.WebDriver.sln

Lines changed: 63 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,93 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{3DFE78D4
77
EndProject
88
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestApplications", "TestApplications", "{00BCF82A-388A-4DC9-A1E2-6D6D983BAEE3}"
99
EndProject
10-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfApplication", "TestApplications\WpfApplication\WpfApplication.csproj", "{C8276299-FA43-409B-A969-EF030AB56224}"
11-
EndProject
1210
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlaUI.WebDriver", "FlaUI.WebDriver\FlaUI.WebDriver.csproj", "{07FE5EE9-0104-42CE-A79D-88FD7D79B542}"
1311
EndProject
1412
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlaUI.WebDriver.UITests", "FlaUI.WebDriver.UITests\FlaUI.WebDriver.UITests.csproj", "{5315D9CF-DDA4-49AE-BA92-AB5814E61901}"
1513
EndProject
14+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WpfApplication", "TestApplications\WpfApplication\WpfApplication.csproj", "{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}"
15+
EndProject
1616
Global
1717
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1818
Debug|Any CPU = Debug|Any CPU
19+
Debug|ARM = Debug|ARM
20+
Debug|ARM64 = Debug|ARM64
21+
Debug|x64 = Debug|x64
22+
Debug|x86 = Debug|x86
1923
Release|Any CPU = Release|Any CPU
24+
Release|ARM = Release|ARM
25+
Release|ARM64 = Release|ARM64
26+
Release|x64 = Release|x64
27+
Release|x86 = Release|x86
2028
EndGlobalSection
2129
GlobalSection(ProjectConfigurationPlatforms) = postSolution
22-
{C8276299-FA43-409B-A969-EF030AB56224}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23-
{C8276299-FA43-409B-A969-EF030AB56224}.Debug|Any CPU.Build.0 = Debug|Any CPU
24-
{C8276299-FA43-409B-A969-EF030AB56224}.Release|Any CPU.ActiveCfg = Release|Any CPU
25-
{C8276299-FA43-409B-A969-EF030AB56224}.Release|Any CPU.Build.0 = Release|Any CPU
2630
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2731
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Debug|Any CPU.Build.0 = Debug|Any CPU
32+
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Debug|ARM.ActiveCfg = Debug|Any CPU
33+
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Debug|ARM.Build.0 = Debug|Any CPU
34+
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Debug|ARM64.ActiveCfg = Debug|Any CPU
35+
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Debug|ARM64.Build.0 = Debug|Any CPU
36+
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Debug|x64.ActiveCfg = Debug|Any CPU
37+
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Debug|x64.Build.0 = Debug|Any CPU
38+
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Debug|x86.ActiveCfg = Debug|Any CPU
39+
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Debug|x86.Build.0 = Debug|Any CPU
2840
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Release|Any CPU.ActiveCfg = Release|Any CPU
2941
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Release|Any CPU.Build.0 = Release|Any CPU
42+
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Release|ARM.ActiveCfg = Release|Any CPU
43+
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Release|ARM.Build.0 = Release|Any CPU
44+
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Release|ARM64.ActiveCfg = Release|Any CPU
45+
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Release|ARM64.Build.0 = Release|Any CPU
46+
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Release|x64.ActiveCfg = Release|Any CPU
47+
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Release|x64.Build.0 = Release|Any CPU
48+
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Release|x86.ActiveCfg = Release|Any CPU
49+
{07FE5EE9-0104-42CE-A79D-88FD7D79B542}.Release|x86.Build.0 = Release|Any CPU
3050
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
3151
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Debug|Any CPU.Build.0 = Debug|Any CPU
52+
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Debug|ARM.ActiveCfg = Debug|Any CPU
53+
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Debug|ARM.Build.0 = Debug|Any CPU
54+
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Debug|ARM64.ActiveCfg = Debug|Any CPU
55+
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Debug|ARM64.Build.0 = Debug|Any CPU
56+
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Debug|x64.ActiveCfg = Debug|Any CPU
57+
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Debug|x64.Build.0 = Debug|Any CPU
58+
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Debug|x86.ActiveCfg = Debug|Any CPU
59+
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Debug|x86.Build.0 = Debug|Any CPU
3260
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Release|Any CPU.ActiveCfg = Release|Any CPU
3361
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Release|Any CPU.Build.0 = Release|Any CPU
62+
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Release|ARM.ActiveCfg = Release|Any CPU
63+
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Release|ARM.Build.0 = Release|Any CPU
64+
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Release|ARM64.ActiveCfg = Release|Any CPU
65+
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Release|ARM64.Build.0 = Release|Any CPU
66+
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Release|x64.ActiveCfg = Release|Any CPU
67+
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Release|x64.Build.0 = Release|Any CPU
68+
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Release|x86.ActiveCfg = Release|Any CPU
69+
{5315D9CF-DDA4-49AE-BA92-AB5814E61901}.Release|x86.Build.0 = Release|Any CPU
70+
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
71+
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
72+
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Debug|ARM.ActiveCfg = Debug|Any CPU
73+
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Debug|ARM.Build.0 = Debug|Any CPU
74+
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Debug|ARM64.ActiveCfg = Debug|Any CPU
75+
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Debug|ARM64.Build.0 = Debug|Any CPU
76+
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Debug|x64.ActiveCfg = Debug|Any CPU
77+
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Debug|x64.Build.0 = Debug|Any CPU
78+
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Debug|x86.ActiveCfg = Debug|Any CPU
79+
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Debug|x86.Build.0 = Debug|Any CPU
80+
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
81+
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Release|Any CPU.Build.0 = Release|Any CPU
82+
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Release|ARM.ActiveCfg = Release|Any CPU
83+
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Release|ARM.Build.0 = Release|Any CPU
84+
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Release|ARM64.ActiveCfg = Release|Any CPU
85+
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Release|ARM64.Build.0 = Release|Any CPU
86+
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Release|x64.ActiveCfg = Release|Any CPU
87+
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Release|x64.Build.0 = Release|Any CPU
88+
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Release|x86.ActiveCfg = Release|Any CPU
89+
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}.Release|x86.Build.0 = Release|Any CPU
3490
EndGlobalSection
3591
GlobalSection(SolutionProperties) = preSolution
3692
HideSolutionNode = FALSE
3793
EndGlobalSection
3894
GlobalSection(NestedProjects) = preSolution
39-
{C8276299-FA43-409B-A969-EF030AB56224} = {00BCF82A-388A-4DC9-A1E2-6D6D983BAEE3}
4095
{5315D9CF-DDA4-49AE-BA92-AB5814E61901} = {3DFE78D4-89EB-4CEE-A5D1-F5FDDED10959}
96+
{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0} = {00BCF82A-388A-4DC9-A1E2-6D6D983BAEE3}
4197
EndGlobalSection
4298
GlobalSection(ExtensibilityGlobals) = postSolution
4399
SolutionGuid = {F2B64231-45B2-4129-960A-9F26AFFD16AE}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"dotnet-ef": {
6+
"version": "8.0.3",
7+
"commands": [
8+
"dotnet-ef"
9+
]
10+
}
11+
}
12+
}

0 commit comments

Comments
 (0)