File tree Expand file tree Collapse file tree 1 file changed +0
-22
lines changed
Packages/com.unity.multiplayer.samples.coop/Utilities/Testing Expand file tree Collapse file tree 1 file changed +0
-22
lines changed Original file line number Diff line number Diff line change 2
2
using UnityEngine ;
3
3
using NUnit . Framework ;
4
4
using Unity . Netcode ;
5
- using UnityEngine . EventSystems ;
6
5
using UnityEngine . SceneManagement ;
7
- using UnityEngine . UI ;
8
6
9
7
namespace Unity . Multiplayer . Samples . Utilities
10
8
{
11
9
public abstract class TestUtilities
12
10
{
13
11
const float k_MaxSceneLoadDuration = 10f ;
14
12
15
- /// <summary>
16
- /// Finds an active Button GameObject by name. If Button component is present on GameObject, it will be clicked.
17
- /// </summary>
18
- /// <param name="name"> Name of Button GameObject </param>
19
- public static void ClickButtonByName ( string name )
20
- {
21
- var buttonGameObject = GameObject . Find ( name ) ;
22
-
23
- Assert . IsNotNull ( buttonGameObject ,
24
- $ "Button GameObject with name { name } not found in scene!") ;
25
-
26
- EventSystem . current . SetSelectedGameObject ( buttonGameObject ) ;
27
-
28
- var buttonComponent = buttonGameObject . GetComponent < Button > ( ) ;
29
-
30
- Assert . IsNotNull ( buttonComponent , $ "Button component not found on { buttonGameObject . name } !") ;
31
-
32
- buttonComponent . onClick . Invoke ( ) ;
33
- }
34
-
35
13
/// <summary>
36
14
/// Helper wrapper method for asserting the completion of a scene load to be used inside Playmode tests. A scene
37
15
/// is either loaded successfully, or the loading process has timed out.
You can’t perform that action at this time.
0 commit comments