Merge pull request #6113 from aws-lumberyard-dev/scspaldi_basic_networking_automation_test

Basic networking automation test
This commit is contained in:
Gene Walters
2022-02-02 07:16:06 -08:00
committed by GitHub
5 changed files with 782 additions and 1 deletions
@@ -31,11 +31,15 @@ class TestAutomation(TestAutomationBase):
def test_Multiplayer_AutoComponent_NetworkInput(self, request, workspace, editor, launcher_platform):
from .tests import Multiplayer_AutoComponent_NetworkInput as test_module
self._run_prefab_test(request, workspace, editor, test_module)
def test_Multiplayer_AutoComponent_RPC(self, request, workspace, editor, launcher_platform):
from .tests import Multiplayer_AutoComponent_RPC as test_module
self._run_prefab_test(request, workspace, editor, test_module)
def test_Multiplayer_BasicConnectivity_Connects(self, request, workspace, editor, launcher_platform):
from .tests import Multiplayer_BasicConnectivity_Connects as test_module
self._run_prefab_test(request, workspace, editor, test_module)
def test_Multiplayer_SimpleNetworkLevelEntity(self, request, workspace, editor, launcher_platform):
from .tests import Multiplayer_SimpleNetworkLevelEntity as test_module
self._run_prefab_test(request, workspace, editor, test_module)
@@ -0,0 +1,66 @@
"""
Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
# Test Case Title : Check that the basic client connect test works
# fmt: off
class TestConstants:
enter_game_mode = ("Entered game mode", "Failed to enter game mode")
exit_game_mode = ("Exited game mode", "Couldn't exit game mode")
find_network_player = ("Found network player", "Couldn't find network player")
# fmt: on
def Multiplayer_BasicConnectivity_Connects():
r"""
Summary:
Runs a test to make sure that a networked player can be spawned
Level Description:
- Dynamic
1. Although the level is empty, when the server and editor connect the server will spawn the player prefab.
- Static
1. This is an empty level.
Expected Outcome:
We should see the player connect and spawn with no errors.
:return:
"""
import azlmbr.legacy.general as general
from editor_python_test_tools.utils import Report
from editor_python_test_tools.utils import Tracer
from editor_python_test_tools.utils import TestHelper as helper
level_name = "BasicConnectivity_Connects"
player_prefab_name = "Player"
player_prefab_path = f"levels/multiplayer/{level_name}/{player_prefab_name}.network.spawnable"
helper.init_idle()
# 1) Open Level
helper.open_level("Multiplayer", level_name)
with Tracer() as section_tracer:
# 2) Enter game mode
helper.multiplayer_enter_game_mode(TestConstants.enter_game_mode, player_prefab_path.lower())
# 3) Make sure the network player was spawned
player_id = general.find_game_entity(player_prefab_name)
Report.critical_result(TestConstants.find_network_player, player_id.IsValid())
# Exit game mode
helper.exit_game_mode(TestConstants.exit_game_mode)
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(Multiplayer_BasicConnectivity_Connects)