diff --git a/MauiTests/Client.Android.UITests/AppiumSetup.cs b/MauiTests/Client.Android.UITests/AppiumSetup.cs
index 2be30f1f..24a50165 100644
--- a/MauiTests/Client.Android.UITests/AppiumSetup.cs
+++ b/MauiTests/Client.Android.UITests/AppiumSetup.cs
@@ -61,7 +61,7 @@ private static AndroidSdkManager InstallSoftware()
{
sdk.AvdManager.Create(AvdName, avdSdkId, "pixel", force: true);
}
-
+
return sdk;
}
@@ -74,7 +74,7 @@ private string GetApp()
#endif
const string testsPath = $@"Client.Android.UITests\bin\{configuration}\net8.0";
var solutionPath = Environment.CurrentDirectory.Replace(testsPath, string.Empty);
- var path = $@"{solutionPath}MauiTests\Client\bin\{configuration}\net8.0-android\{PackageName}-Signed.apk";
+ var path = $@"{solutionPath}Client\bin\{configuration}\net8.0-android\{PackageName}-Signed.apk";
testOutputHelper.WriteLine(path);
return path;
}
diff --git a/MauiTests/Client.Android.UITests/snapshots/Android/AppLaunches.png b/MauiTests/Client.Android.UITests/snapshots/Android/AppLaunches.png
index d89564ae..48497187 100644
Binary files a/MauiTests/Client.Android.UITests/snapshots/Android/AppLaunches.png and b/MauiTests/Client.Android.UITests/snapshots/Android/AppLaunches.png differ
diff --git a/MauiTests/Client.MacCatalyst.UITests/AppiumSetup.cs b/MauiTests/Client.MacCatalyst.UITests/AppiumSetup.cs
index 6f222e79..c4ebb58f 100644
--- a/MauiTests/Client.MacCatalyst.UITests/AppiumSetup.cs
+++ b/MauiTests/Client.MacCatalyst.UITests/AppiumSetup.cs
@@ -43,7 +43,7 @@ private string GetApp()
#endif
const string testsPath = $@"Client.MacCatalyst.UITests\bin\{configuration}\net8.0";
var solutionPath = Environment.CurrentDirectory.Replace(testsPath, string.Empty);
- var path = $@"{solutionPath}MauiTests\Client\bin\{configuration}\net8.0-maccatalyst\maccatalyst-x64\Client.app";
+ var path = $@"{solutionPath}Client\bin\{configuration}\net8.0-maccatalyst\maccatalyst-x64\Client.app";
testOutputHelper.WriteLine(path);
return path;
}
diff --git a/MauiTests/Client.Shared.UITests/BaseTest.cs b/MauiTests/Client.Shared.UITests/BaseTest.cs
index 7ce7e828..a79431b4 100644
--- a/MauiTests/Client.Shared.UITests/BaseTest.cs
+++ b/MauiTests/Client.Shared.UITests/BaseTest.cs
@@ -38,14 +38,15 @@ public Task DisposeAsync()
return Task.CompletedTask;
}
- protected void VerifyScreenshot(string name)
+ protected async Task VerifyScreenshot(string name)
{
if (App.PlatformName == "Windows")
{
var handle = App.CurrentWindowHandle;
MoveWindow(IntPtr.Parse(handle[2..], NumberStyles.HexNumber), 0, 0, 800, 600, true);
+ await Task.Delay(1000);
}
-
+
var screenshotPngBytes = App.GetScreenshot().AsByteArray;
var actualImage = new ImageSnapshot(screenshotPngBytes, ImageSnapshotFormat.PNG);
diff --git a/MauiTests/Client.Shared.UITests/LoginPageTests.cs b/MauiTests/Client.Shared.UITests/MainPageTests.cs
similarity index 79%
rename from MauiTests/Client.Shared.UITests/LoginPageTests.cs
rename to MauiTests/Client.Shared.UITests/MainPageTests.cs
index 41377ae9..3e630e3c 100644
--- a/MauiTests/Client.Shared.UITests/LoginPageTests.cs
+++ b/MauiTests/Client.Shared.UITests/MainPageTests.cs
@@ -1,6 +1,6 @@
namespace Client.UITests;
-public class LoginPageTests(ITestOutputHelper testOutputHelper) : BaseTest(testOutputHelper)
+public class MainPageTests(ITestOutputHelper testOutputHelper) : BaseTest(testOutputHelper)
{
[AllowOnPlatformFact(
RuntimePlatform.WindowsAndroid,
@@ -12,8 +12,7 @@ public class LoginPageTests(ITestOutputHelper testOutputHelper) : BaseTest(testO
)]
public async Task AppLaunches()
{
- await Task.Delay(2000);
- VerifyScreenshot($"{nameof(AppLaunches)}");
+ await VerifyScreenshot($"{nameof(AppLaunches)}");
}
[AllowOnPlatformFact(
@@ -24,7 +23,7 @@ public async Task AppLaunches()
RuntimePlatform.WindowsWindows,
RuntimePlatform.OsxTizen
)]
- public async Task LoginBtnTest()
+ public async Task CounterBtnTest()
{
// Arrange
var element = FindUiElement("CounterBtn");
diff --git a/MauiTests/Client.Tizen.UITests/AppiumSetup.cs b/MauiTests/Client.Tizen.UITests/AppiumSetup.cs
index 29854d98..fa1b1abe 100644
--- a/MauiTests/Client.Tizen.UITests/AppiumSetup.cs
+++ b/MauiTests/Client.Tizen.UITests/AppiumSetup.cs
@@ -41,7 +41,7 @@ private string GetApp()
#endif
const string testsPath = $@"Client.Tizen.UITests\bin\{configuration}\net8.0";
var solutionPath = Environment.CurrentDirectory.Replace(testsPath, string.Empty);
- var path = $@"{solutionPath}MauiTests\Client\bin\{configuration}\\net8.0-tizen\tizen-x86\com.vladislavantonyuk.client-1.0.0.tpk";
+ var path = $@"{solutionPath}Client\bin\{configuration}\\net8.0-tizen\tizen-x86\com.vladislavantonyuk.client-1.0.0.tpk";
testOutputHelper.WriteLine(path);
return path;
}
diff --git a/MauiTests/Client.Windows.UITests/AppiumSetup.cs b/MauiTests/Client.Windows.UITests/AppiumSetup.cs
index b3367c3a..8826033a 100644
--- a/MauiTests/Client.Windows.UITests/AppiumSetup.cs
+++ b/MauiTests/Client.Windows.UITests/AppiumSetup.cs
@@ -47,7 +47,7 @@ private string GetApp()
#endif
const string testsPath = $@"Client.Windows.UITests\bin\{configuration}\net8.0";
var solutionPath = Environment.CurrentDirectory.Replace(testsPath, string.Empty);
- var path = $@"{solutionPath}MauiTests\Client\bin\{configuration}\\net8.0-windows10.0.19041.0\\win10-x64\\Client.exe";
+ var path = $@"{solutionPath}Client\bin\{configuration}\net8.0-windows10.0.19041.0\win10-x64\Client.exe";
testOutputHelper.WriteLine(path);
return path;
}
diff --git a/MauiTests/Client.Windows.UITests/snapshots/Windows/AppLaunches.png b/MauiTests/Client.Windows.UITests/snapshots/Windows/AppLaunches.png
index c333142a..068cc875 100644
Binary files a/MauiTests/Client.Windows.UITests/snapshots/Windows/AppLaunches.png and b/MauiTests/Client.Windows.UITests/snapshots/Windows/AppLaunches.png differ
diff --git a/MauiTests/Client.iOS.UITests/AppiumSetup.cs b/MauiTests/Client.iOS.UITests/AppiumSetup.cs
index 567ca7ac..0372172c 100644
--- a/MauiTests/Client.iOS.UITests/AppiumSetup.cs
+++ b/MauiTests/Client.iOS.UITests/AppiumSetup.cs
@@ -43,7 +43,7 @@ private string GetApp()
#endif
const string testsPath = $@"Client.iOS.UITests\bin\{configuration}\net8.0";
var solutionPath = Environment.CurrentDirectory.Replace(testsPath, string.Empty);
- var path = $@"{solutionPath}MauiTests\Client\bin\{configuration}\net8.0-ios\iossimulator-x64\Client.app";
+ var path = $@"{solutionPath}Client\bin\{configuration}\net8.0-ios\iossimulator-x64\Client.app";
testOutputHelper.WriteLine(path);
return path;
}
diff --git a/MauiTests/Client/MainPage.xaml b/MauiTests/Client/MainPage.xaml
index 85ad5388..03db91d5 100644
--- a/MauiTests/Client/MainPage.xaml
+++ b/MauiTests/Client/MainPage.xaml
@@ -26,7 +26,8 @@
diff --git a/MauiTests/Client/Platforms/Windows/Package.appxmanifest b/MauiTests/Client/Platforms/Windows/Package.appxmanifest
index 004fb3ab..d0e96ab9 100644
--- a/MauiTests/Client/Platforms/Windows/Package.appxmanifest
+++ b/MauiTests/Client/Platforms/Windows/Package.appxmanifest
@@ -6,41 +6,46 @@
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap rescap">
-
-
-
-
-
- $placeholder$
- User Name
- $placeholder$.png
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+ $placeholder$
+ User Name
+ $placeholder$.png
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MauiTests/README.md b/MauiTests/README.md
new file mode 100644
index 00000000..1275e5a6
--- /dev/null
+++ b/MauiTests/README.md
@@ -0,0 +1,7 @@
+# MauiTests
+
+[![Buy Me A Coffee](https://ik.imagekit.io/VladislavAntonyuk/vladislavantonyuk/misc/bmc-button.png)](https://www.buymeacoffee.com/vlad.antonyuk)
+
+Article: https://vladislavantonyuk.github.io/articles/Testing-.NET-MAUI-Application-using-Appium-and-xUnit
+
+[![Stand With Ukraine](https://img.shields.io/badge/made_in-ukraine-ffd700.svg?labelColor=0057b7)](https://stand-with-ukraine.pp.ua)
\ No newline at end of file
diff --git a/README.md b/README.md
index ca34a750..94e0750d 100644
--- a/README.md
+++ b/README.md
@@ -75,4 +75,6 @@ The development guide can be found at [SETUP.md](./SETUP.md).
1. [MauiTaskListApp](Database/MauiTaskListApp) - Cross-platform .NET MAUI app using MVVM development architecture performing CRUD operations with EF Core InMemory.
+1. [MauiTests](MauiTests) - Testing .NET MAUI application using Appium and xUnit.
+
[![Stand With Ukraine](https://img.shields.io/badge/made_in-ukraine-ffd700.svg?labelColor=0057b7)](https://stand-with-ukraine.pp.ua)
\ No newline at end of file