test_GeneralGraphFunctionality.py 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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. """
  11. C2735988 - Landscape Canvas tool can be opened/closed
  12. C13815862 - New graph can be created
  13. C13767840 - New root entity is created when a new graph is created through Landscape Canvas
  14. """
  15. import os
  16. import pytest
  17. # Bail on the test if ly_test_tools doesn't exist.
  18. pytest.importorskip("ly_test_tools")
  19. import ly_test_tools.environment.file_system as file_system
  20. import automatedtesting_shared.hydra_test_utils as hydra
  21. test_directory = os.path.join(os.path.dirname(__file__), "EditorScripts")
  22. @pytest.mark.parametrize("project", ["AutomatedTesting"])
  23. @pytest.mark.parametrize("level", ["tmp_level"])
  24. @pytest.mark.usefixtures("automatic_process_killer")
  25. @pytest.mark.parametrize("launcher_platform", ['windows_editor'])
  26. class TestGeneralGraphFunctionality(object):
  27. @pytest.fixture(autouse=True)
  28. def setup_teardown(self, request, workspace, project, level):
  29. def teardown():
  30. file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
  31. file_system.delete([os.path.join(workspace.paths.engine_root(), project, "slices", "TestSlice.slice")], True, True)
  32. request.addfinalizer(teardown)
  33. file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
  34. file_system.delete([os.path.join(workspace.paths.engine_root(), project, "slices", "TestSlice.slice")], True, True)
  35. @pytest.mark.test_case_id("C2735988", "C13815862", "C13767840")
  36. @pytest.mark.SUITE_periodic
  37. def test_LandscapeCanvas_NewGraph_CreatedSuccessfully(self, request, editor, level, launcher_platform):
  38. cfg_args = [level]
  39. expected_lines = [
  40. "Landscape Canvas pane is open",
  41. "New graph created",
  42. "Graph registered with Landscape Canvas",
  43. "Root entity has Landscape Canvas component",
  44. "Landscape Canvas pane is closed",
  45. "CreateNewGraph: result=SUCCESS",
  46. ]
  47. hydra.launch_and_validate_results(
  48. request,
  49. test_directory,
  50. editor,
  51. "CreateNewGraph.py",
  52. expected_lines,
  53. cfg_args=cfg_args
  54. )
  55. @pytest.mark.test_case_id("C2735990")
  56. @pytest.mark.SUITE_periodic
  57. def test_LandscapeCanvas_Component_AddedRemoved(self, request, editor, level, launcher_platform):
  58. cfg_args = [level]
  59. expected_lines = [
  60. "Landscape Canvas Component added to Entity",
  61. "Landscape Canvas Component removed from Entity",
  62. "LandscapeCanvasComponentAddedRemoved: result=SUCCESS",
  63. ]
  64. hydra.launch_and_validate_results(
  65. request,
  66. test_directory,
  67. editor,
  68. "LandscapeCanvasComponent_AddedRemoved.py",
  69. expected_lines,
  70. cfg_args=cfg_args
  71. )
  72. @pytest.mark.test_case_id("C14212352")
  73. @pytest.mark.SUITE_periodic
  74. def test_LandscapeCanvas_GraphClosed_OnLevelChange(self, request, editor, level, launcher_platform):
  75. cfg_args = [level]
  76. expected_lines = [
  77. "Landscape Canvas pane is open",
  78. "New graph created",
  79. "Graph registered with Landscape Canvas",
  80. "Graph is no longer open in Landscape Canvas",
  81. "GraphClosedOnLevelChange: result=SUCCESS",
  82. ]
  83. hydra.launch_and_validate_results(
  84. request,
  85. test_directory,
  86. editor,
  87. "GraphClosed_OnLevelChange.py",
  88. expected_lines,
  89. cfg_args=cfg_args
  90. )
  91. @pytest.mark.test_case_id("C17488412")
  92. @pytest.mark.SUITE_periodic
  93. def test_LandscapeCanvas_GraphClosed_OnEntityDelete(self, request, editor, level, launcher_platform):
  94. cfg_args = [level]
  95. expected_lines = [
  96. "Landscape Canvas pane is open",
  97. "Graph registered with Landscape Canvas",
  98. "The graph is no longer open after deleting the Entity",
  99. "GraphClosedOnEntityDelete: result=SUCCESS",
  100. ]
  101. hydra.launch_and_validate_results(
  102. request,
  103. test_directory,
  104. editor,
  105. "GraphClosed_OnEntityDelete.py",
  106. expected_lines,
  107. cfg_args=cfg_args
  108. )
  109. @pytest.mark.test_case_id("C15167461")
  110. @pytest.mark.SUITE_periodic
  111. def test_LandscapeCanvas_GraphClosed_TabbedGraphClosesIndependently(self, request, editor, level,
  112. launcher_platform):
  113. cfg_args = [level]
  114. expected_lines = [
  115. "Landscape Canvas pane is open",
  116. "New graph created",
  117. "2nd new graph created",
  118. "3rd new graph created",
  119. "Graphs registered with Landscape Canvas",
  120. "Graph 2 was successfully closed",
  121. "GraphClosedTabbedGraph: result=SUCCESS",
  122. ]
  123. hydra.launch_and_validate_results(
  124. request,
  125. test_directory,
  126. editor,
  127. "GraphClosed_TabbedGraph.py",
  128. expected_lines,
  129. cfg_args=cfg_args
  130. )
  131. @pytest.mark.test_case_id("C22602016")
  132. @pytest.mark.SUITE_periodic
  133. def test_LandscapeCanvas_SliceCreateInstantiate(self, request, editor, level, workspace, launcher_platform):
  134. cfg_args = [level]
  135. expected_lines = [
  136. "LandscapeCanvas_SliceCreateInstantiate: test started",
  137. "landscape_canvas_entity Entity successfully created",
  138. "LandscapeCanvas_SliceCreateInstantiate: Slice has been created successfully: True",
  139. "LandscapeCanvas_SliceCreateInstantiate: Slice instantiated: True",
  140. "LandscapeCanvas_SliceCreateInstantiate: result=SUCCESS",
  141. ]
  142. hydra.launch_and_validate_results(
  143. request,
  144. test_directory,
  145. editor,
  146. "LandscapeCanvas_SliceCreateInstantiate.py",
  147. expected_lines=expected_lines,
  148. cfg_args=cfg_args
  149. )