Broganab/white box test conversion (#7600)

* LYN-8773 WhiteBox refactor python automation

Signed-off-by: Broganab <broganab@amazon.com>
This commit is contained in:
Andrea
2022-02-18 15:21:55 -06:00
committed by GitHub
parent 445385e146
commit 1f4b62dc72
12 changed files with 17 additions and 563 deletions
@@ -9,27 +9,17 @@ SPDX-License-Identifier: Apache-2.0 OR MIT
# This suite consists of all test cases that are passing and have been verified.
import pytest
import sys
import os
from ly_test_tools import LAUNCHERS
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../automatedtesting_shared')
from base import TestAutomationBase
from ly_test_tools.o3de.editor_test import EditorTestSuite, EditorSharedTest
@pytest.mark.SUITE_main
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
@pytest.mark.parametrize("project", ["AutomatedTesting"])
class TestAutomation(TestAutomationBase):
def test_WhiteBox_AddComponentToEntity(self, request, workspace, editor, launcher_platform):
class TestAutomation(EditorTestSuite):
class test_WhiteBox_AddComponentToEntity(EditorSharedTest):
from .tests import WhiteBox_AddComponentToEntity as test_module
self._run_test(request, workspace, editor, test_module)
def test_WhiteBox_SetDefaultShape(self, request, workspace, editor, launcher_platform):
class test_WhiteBox_SetDefaultShape(EditorSharedTest):
from .tests import WhiteBox_SetDefaultShape as test_module
self._run_test(request, workspace, editor, test_module)
def test_WhiteBox_SetInvisible(self, request, workspace, editor, launcher_platform):
class test_WhiteBox_SetInvisible(EditorSharedTest):
from .tests import WhiteBox_SetInvisible as test_module
self._run_test(request, workspace, editor, test_module)
@@ -18,21 +18,17 @@ class Tests():
def C28798177_WhiteBox_AddComponentToEntity():
import os
import sys
import WhiteBoxInit as init
import editor_python_test_tools.hydra_editor_utils as hydra
import azlmbr.bus as bus
import azlmbr.editor as editor
import azlmbr.legacy.general as general
from editor_python_test_tools.utils import Report
import WhiteBoxInit as init
from editor_python_test_tools.utils import TestHelper as helper
from editor_python_test_tools.utils import Report
# open level
helper.init_idle()
helper.open_level("WhiteBox", "EmptyLevel", no_prompt=False)
hydra.open_base_level()
# create white box entity and attach component
white_box_entity = init.create_white_box_entity()
@@ -46,10 +42,6 @@ def C28798177_WhiteBox_AddComponentToEntity():
component_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', white_box_mesh_component)
Report.result(Tests.white_box_component_enabled, component_enabled)
# close editor
helper.close_editor()
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(C28798177_WhiteBox_AddComponentToEntity)
@@ -22,17 +22,13 @@ class Tests():
critical_shape_check = ("Default shape has more than 0 sides", "default shape has 0 sides")
def C29279329_WhiteBox_SetDefaultShape():
import os
import sys
import azlmbr.bus as bus
import editor_python_test_tools.hydra_editor_utils as hydra
import WhiteBoxInit as init
import azlmbr.whitebox.api as api
import azlmbr.bus as bus
import azlmbr.legacy.general as general
from editor_python_test_tools.utils import Report
from editor_python_test_tools.utils import TestHelper as helper
def check_shape_result(success_fail_tuple, condition):
result = Report.result(success_fail_tuple, condition)
@@ -53,8 +49,7 @@ def C29279329_WhiteBox_SetDefaultShape():
}
# open level
helper.init_idle()
helper.open_level("WhiteBox", "EmptyLevel", no_prompt=False)
hydra.open_base_level()
# create white box entity and attach component
white_box_entity = init.create_white_box_entity()
@@ -95,10 +90,6 @@ def C29279329_WhiteBox_SetDefaultShape():
Tests.default_shape_sphere,
white_box_handle.MeshFaceCount() == expected_results.get(shape_types.SPHERE))
# close editor
helper.close_editor()
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(C29279329_WhiteBox_SetDefaultShape)
@@ -21,25 +21,16 @@ def C28798205_WhiteBox_SetInvisible():
# note: This automated test does not fully replicate the test case in Test Rail as it's
# not currently possible using the Hydra API to get an EntityComponentIdPair at runtime,
# in future game_mode will be activated and a runtime White Box Component queried
import os
import sys
import WhiteBoxInit as init
import editor_python_test_tools.hydra_editor_utils as hydra
import azlmbr.whitebox.api as api
import azlmbr.whitebox
import azlmbr.bus as bus
import azlmbr.editor as editor
import azlmbr.entity as entity
import azlmbr.legacy.general as general
import editor_python_test_tools.hydra_editor_utils as hydra
import WhiteBoxInit as init
from editor_python_test_tools.utils import Report
from editor_python_test_tools.utils import TestHelper as helper
# open level
helper.init_idle()
helper.open_level("WhiteBox", "EmptyLevel", no_prompt=False)
hydra.open_base_level()
white_box_entity_name = 'WhiteBox-Visibility'
white_box_visibility_path = 'White Box Material|Visible'
@@ -57,9 +48,6 @@ def C28798205_WhiteBox_SetInvisible():
visible_property = hydra.get_component_property_value(white_box_mesh_component, white_box_visibility_path)
Report.result(Tests.white_box_set_to_invisible, not visible_property)
helper.close_editor()
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(C28798205_WhiteBox_SetInvisible)