Multiplayer_BasicConnectivity_Connects.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. """
  2. Copyright (c) Contributors to the Open 3D Engine Project.
  3. For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. SPDX-License-Identifier: Apache-2.0 OR MIT
  5. """
  6. # Test Case Title : Check that the basic client connect test works
  7. # fmt: off
  8. class TestConstants:
  9. enter_game_mode = ("Entered game mode", "Failed to enter game mode")
  10. exit_game_mode = ("Exited game mode", "Couldn't exit game mode")
  11. find_network_player = ("Found network player", "Couldn't find network player")
  12. # fmt: on
  13. def Multiplayer_BasicConnectivity_Connects():
  14. r"""
  15. Summary:
  16. Runs a test to make sure that a networked player can be spawned
  17. Level Description:
  18. - Dynamic
  19. 1. Although the level is empty, when the server and editor connect the server will spawn the player prefab.
  20. - Static
  21. 1. This is an empty level.
  22. Expected Outcome:
  23. We should see the player connect and spawn with no errors.
  24. :return:
  25. """
  26. import azlmbr.legacy.general as general
  27. from editor_python_test_tools.utils import Report
  28. from editor_python_test_tools.utils import TestHelper as helper
  29. level_name = "BasicConnectivity_Connects"
  30. helper.init_idle()
  31. # 1) Open Level
  32. helper.open_level("Multiplayer", level_name)
  33. general.set_cvar_integer('editorsv_port', 33454)
  34. # 2) Enter game mode
  35. helper.multiplayer_enter_game_mode(TestConstants.enter_game_mode, helper.EditorServerMode.DEDICATED_SERVER)
  36. # 3) Make sure the network player was spawned
  37. player_id = general.find_game_entity("Player")
  38. Report.critical_result(TestConstants.find_network_player, player_id.IsValid())
  39. # Exit game mode
  40. helper.exit_game_mode(TestConstants.exit_game_mode)
  41. if __name__ == "__main__":
  42. from editor_python_test_tools.utils import Report
  43. Report.start_test(Multiplayer_BasicConnectivity_Connects)