test_DynamicSliceInstanceSpawner.py 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. """
  2. All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
  3. its licensors.
  4. For complete copyright and license terms please see the LICENSE at the root of this
  5. distribution (the "License"). All use of this software is governed by the License,
  6. or, if provided, by the license below or the license accompanying this file. Do not
  7. remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. """
  10. import os
  11. import pytest
  12. import logging
  13. # Bail on the test if ly_test_tools doesn't exist.
  14. pytest.importorskip('ly_test_tools')
  15. import ly_test_tools.environment.file_system as file_system
  16. import automatedtesting_shared.hydra_test_utils as hydra
  17. from ly_remote_console.remote_console_commands import RemoteConsole as RemoteConsole
  18. logger = logging.getLogger(__name__)
  19. test_directory = os.path.join(os.path.dirname(__file__), 'EditorScripts')
  20. @pytest.mark.parametrize('project', ['AutomatedTesting'])
  21. @pytest.mark.parametrize('level', ['tmp_level'])
  22. @pytest.mark.usefixtures("automatic_process_killer")
  23. class TestDynamicSliceInstanceSpawner(object):
  24. @pytest.fixture
  25. def remote_console_instance(self, request):
  26. console = RemoteConsole()
  27. def teardown():
  28. if console.connected:
  29. console.stop()
  30. request.addfinalizer(teardown)
  31. return console
  32. @pytest.mark.test_case_id("C28851763")
  33. @pytest.mark.SUITE_main
  34. @pytest.mark.parametrize("launcher_platform", ['windows_editor'])
  35. def test_DynamicSliceInstanceSpawner_DynamicSliceSpawnerWorks(self, request, editor, level, workspace, project,
  36. launcher_platform):
  37. # Ensure temp level does not already exist
  38. file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
  39. cfg_args = [level]
  40. expected_lines = [
  41. "DynamicSliceInstanceSpawner: test started",
  42. "DynamicSliceInstanceSpawner: test finished",
  43. "DynamicSliceInstanceSpawner: result=SUCCESS"
  44. ]
  45. hydra.launch_and_validate_results(request, test_directory, editor,
  46. 'DynamicSliceInstanceSpawner_DynamicSliceSpawnerWorks.py',
  47. expected_lines=expected_lines, cfg_args=cfg_args)
  48. # Cleanup our temp level
  49. file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
  50. @pytest.mark.test_case_id('C2574330')
  51. @pytest.mark.BAT
  52. @pytest.mark.SUITE_periodic
  53. @pytest.mark.parametrize("launcher_platform", ['windows_editor'])
  54. def test_DynamicSliceInstanceSpawner_Embedded_E2E_Editor(self, workspace, request, editor, level, project,
  55. launcher_platform):
  56. # Ensure temp level does not already exist
  57. file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
  58. expected_lines = [
  59. "'Instance Spawner' created",
  60. "'Planting Surface' created",
  61. "DynamicSliceInstanceSpawnerEmbeddedEditor: Expected 400 instances - Found 400 instances",
  62. "DynamicSliceInstanceSpawnerEmbeddedEditor: result=SUCCESS"
  63. ]
  64. hydra.launch_and_validate_results(request, test_directory, editor, "DynamicSliceInstanceSpawner_Embedded_E2E.py",
  65. expected_lines, cfg_args=[level])
  66. @pytest.mark.test_case_id('C2574330')
  67. @pytest.mark.BAT
  68. @pytest.mark.SUITE_periodic
  69. @pytest.mark.parametrize("launcher_platform", ['windows'])
  70. @pytest.mark.skip # ATOM-14703
  71. def test_DynamicSliceInstanceSpawner_Embedded_E2E_Launcher(self, workspace, launcher, level,
  72. remote_console_instance, project, launcher_platform):
  73. expected_lines = [
  74. "Instances found in area = 400"
  75. ]
  76. hydra.launch_and_validate_results_launcher(launcher, level, remote_console_instance, expected_lines)
  77. # Cleanup our temp level
  78. file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
  79. @pytest.mark.test_case_id('C4762367')
  80. @pytest.mark.SUITE_periodic
  81. @pytest.mark.parametrize("launcher_platform", ['windows_editor'])
  82. def test_DynamicSliceInstanceSpawner_External_E2E_Editor(self, workspace, request, editor, level, project,
  83. launcher_platform):
  84. # Ensure temp level does not already exist
  85. file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
  86. expected_lines = [
  87. "Spawner entity created",
  88. "'Planting Surface' created",
  89. "DynamicSliceInstanceSpawnerExternalEditor: Expected 400 instances - Found 400 instances",
  90. "DynamicSliceInstanceSpawnerExternalEditor: result=SUCCESS"
  91. ]
  92. hydra.launch_and_validate_results(request, test_directory, editor, "DynamicSliceInstanceSpawner_External_E2E.py",
  93. expected_lines, cfg_args=[level])
  94. @pytest.mark.test_case_id('C4762367')
  95. @pytest.mark.SUITE_periodic
  96. @pytest.mark.parametrize("launcher_platform", ['windows'])
  97. @pytest.mark.skip # ATOM-14703
  98. def test_DynamicSliceInstanceSpawner_External_E2E_Launcher(self, workspace, launcher, level,
  99. remote_console_instance, project, launcher_platform):
  100. expected_lines = [
  101. "Instances found in area = 400"
  102. ]
  103. hydra.launch_and_validate_results_launcher(launcher, level, remote_console_instance, expected_lines)
  104. # Cleanup our temp level
  105. file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)