From d9a090dfdee585adeeed738de117abe0ccbbd73f Mon Sep 17 00:00:00 2001 From: MpakobecEx Date: Wed, 21 Oct 2026 16:41:44 +0500 Subject: [PATCH] Add Unity playmode bootstrap smoke test --- .gitignore | 1 + client/Assets/Vanguard/Tests/PlayMode.meta | 8 ++++ .../PlayMode/AppBootstrapPlayModeTests.cs | 47 +++++++++++++++++++ .../AppBootstrapPlayModeTests.cs.meta | 2 + .../PlayMode/Vanguard.Tests.PlayMode.asmdef | 19 ++++++++ .../Vanguard.Tests.PlayMode.asmdef.meta | 7 +++ 6 files changed, 84 insertions(+) create mode 100644 client/Assets/Vanguard/Tests/PlayMode.meta create mode 100644 client/Assets/Vanguard/Tests/PlayMode/AppBootstrapPlayModeTests.cs create mode 100644 client/Assets/Vanguard/Tests/PlayMode/AppBootstrapPlayModeTests.cs.meta create mode 100644 client/Assets/Vanguard/Tests/PlayMode/Vanguard.Tests.PlayMode.asmdef create mode 100644 client/Assets/Vanguard/Tests/PlayMode/Vanguard.Tests.PlayMode.asmdef.meta diff --git a/.gitignore b/.gitignore index b84cd53..dafdd4e 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,7 @@ client/.idea/ client/Assets/AddressableAssetsData/*.bin client/Assets/StreamingAssets/aa/* client/*.log +client/TestResults*.xml # --- Unity прочее --- *.unitypackage diff --git a/client/Assets/Vanguard/Tests/PlayMode.meta b/client/Assets/Vanguard/Tests/PlayMode.meta new file mode 100644 index 0000000..4458380 --- /dev/null +++ b/client/Assets/Vanguard/Tests/PlayMode.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e6bec1f0a4db28b4ea6abf6bff71cb76 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/client/Assets/Vanguard/Tests/PlayMode/AppBootstrapPlayModeTests.cs b/client/Assets/Vanguard/Tests/PlayMode/AppBootstrapPlayModeTests.cs new file mode 100644 index 0000000..08a4d9b --- /dev/null +++ b/client/Assets/Vanguard/Tests/PlayMode/AppBootstrapPlayModeTests.cs @@ -0,0 +1,47 @@ +using System.Collections; +using NUnit.Framework; +using UnityEngine; +using UnityEngine.EventSystems; +using UnityEngine.TestTools; +using Vanguard.App; + +namespace Vanguard.Tests +{ + public sealed class AppBootstrapPlayModeTests + { + [UnityTest] + public IEnumerator App_Bootstraps_And_Shows_Login() + { + if (Object.FindAnyObjectByType() == null) + { + var go = new GameObject("Test App"); + go.AddComponent(); + } + + yield return null; + yield return null; + + Assert.IsNotNull(Object.FindAnyObjectByType()); + Assert.IsNotNull(GameObject.Find("Vanguard Canvas")); + Assert.IsNotNull(GameObject.Find("LoginScreen")); + + Cleanup(); + yield return null; + } + + private static void Cleanup() + { + var app = Object.FindAnyObjectByType(); + if (app != null) + Object.Destroy(app.gameObject); + + var canvas = GameObject.Find("Vanguard Canvas"); + if (canvas != null) + Object.Destroy(canvas); + + var eventSystem = Object.FindAnyObjectByType(); + if (eventSystem != null) + Object.Destroy(eventSystem.gameObject); + } + } +} diff --git a/client/Assets/Vanguard/Tests/PlayMode/AppBootstrapPlayModeTests.cs.meta b/client/Assets/Vanguard/Tests/PlayMode/AppBootstrapPlayModeTests.cs.meta new file mode 100644 index 0000000..a810c07 --- /dev/null +++ b/client/Assets/Vanguard/Tests/PlayMode/AppBootstrapPlayModeTests.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: b8e1375853da4264f80f4fd944176ac4 \ No newline at end of file diff --git a/client/Assets/Vanguard/Tests/PlayMode/Vanguard.Tests.PlayMode.asmdef b/client/Assets/Vanguard/Tests/PlayMode/Vanguard.Tests.PlayMode.asmdef new file mode 100644 index 0000000..db84e10 --- /dev/null +++ b/client/Assets/Vanguard/Tests/PlayMode/Vanguard.Tests.PlayMode.asmdef @@ -0,0 +1,19 @@ +{ + "name": "Vanguard.Tests.PlayMode", + "rootNamespace": "Vanguard.Tests", + "references": [ + "Vanguard.Runtime" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": false, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false, + "optionalUnityReferences": [ + "TestAssemblies" + ] +} diff --git a/client/Assets/Vanguard/Tests/PlayMode/Vanguard.Tests.PlayMode.asmdef.meta b/client/Assets/Vanguard/Tests/PlayMode/Vanguard.Tests.PlayMode.asmdef.meta new file mode 100644 index 0000000..4d19767 --- /dev/null +++ b/client/Assets/Vanguard/Tests/PlayMode/Vanguard.Tests.PlayMode.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 199ad6dea713aef4cb50a4d8d01c9ca4 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: