From b5d54450d8511893da4663d84c93f4e95c9eb7ca Mon Sep 17 00:00:00 2001 From: catdo Date: Mon, 10 May 2021 15:55:31 -0700 Subject: [PATCH 1/5] added prefabnautomated test --- .../PrefabLevel_OpensLevelWithEntities.py | 78 ++++++++ .../PythonTests/prefab/TestSuite_Active.py | 39 ++++ .../Gem/PythonTests/prefab/__init__.py | 10 + .../PrefabLevel_OpensLevelWithEntities.prefab | 171 ++++++++++++++++++ .../tags.txt | 12 ++ 5 files changed, 310 insertions(+) create mode 100644 AutomatedTesting/Gem/PythonTests/prefab/PrefabLevel_OpensLevelWithEntities.py create mode 100644 AutomatedTesting/Gem/PythonTests/prefab/TestSuite_Active.py create mode 100644 AutomatedTesting/Gem/PythonTests/prefab/__init__.py create mode 100644 AutomatedTesting/Levels/Prefab/PrefabLevel_OpensLevelWithEntities/PrefabLevel_OpensLevelWithEntities.prefab create mode 100644 AutomatedTesting/Levels/Prefab/PrefabLevel_OpensLevelWithEntities/tags.txt diff --git a/AutomatedTesting/Gem/PythonTests/prefab/PrefabLevel_OpensLevelWithEntities.py b/AutomatedTesting/Gem/PythonTests/prefab/PrefabLevel_OpensLevelWithEntities.py new file mode 100644 index 0000000000..45f44474e1 --- /dev/null +++ b/AutomatedTesting/Gem/PythonTests/prefab/PrefabLevel_OpensLevelWithEntities.py @@ -0,0 +1,78 @@ +""" +All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +its licensors. + +For complete copyright and license terms please see the LICENSE at the root of this +distribution (the "License"). All use of this software is governed by the License, +or, if provided, by the license below or the license accompanying this file. Do not +remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +""" + + +# fmt:off +class Tests (): + find_empty_entity = ("Entity: 'EmptyEntity' found", "Entity: 'EmptyEntity' *not* found in level") + empty_entity_pos = ( + "'EmptyEntity' position is at the expected position", "'EmptyEntity' position is *not* at the expected position") + find_pxentity = ("Entity: 'EntityWithPxCollider' found", "Entity: 'EntityWithPxCollider' *not* found in level") + pxentity_component = ( + "Entity: 'EntityWithPxCollider' has a Physx Collider", "Entity: 'EntityWithPxCollider' has *not* a Physx Collider") + +# fmt:on + +def PrefabLevel_OpensLevelWithEntities (): + """ + Opens the level that contains 2 entities, "EmptyEntity" and "EntityWithPxCollider". + This test makes sure that both entities exist after openning the level and that: + - EmptyEntity is at Position: (10, 20, 30) + - EntityWithPxCollider has a PhysXCollider component + """ + + import os + import sys + + from editor_python_test_tools.utils import Report + from editor_python_test_tools.utils import TestHelper as helper + + import editor_python_test_tools.hydra_editor_utils as hydra + + import azlmbr.legacy.general as general + import azlmbr.bus + from azlmbr.math import Vector3 + + EXPECTED_EMPTY_ENTITY_POS = Vector3 (10.00, 20.0, 30.0) + + helper.init_idle () + helper.open_level ("prefab", "PrefabLevel_OpensLevelWithEntities") + + class EmptyEntity (): + value = None + + def find_empty_entity (): + EmptyEntity.value = general.find_editor_entity ("EmptyEntity") + return EmptyEntity.value.IsValid () + + helper.wait_for_condition (find_empty_entity, 5.0) + Report.result (Tests.find_empty_entity, EmptyEntity.value.IsValid ()) + + empty_entity_pos = azlmbr.components.TransformBus (azlmbr.bus.Event, "GetWorldTranslation", EmptyEntity.value) + is_at_position = empty_entity_pos.IsClose (EXPECTED_EMPTY_ENTITY_POS) + Report.result (Tests.empty_entity_pos, is_at_position) + if not is_at_position: + Report.info (f'Expected position: {EXPECTED_EMPTY_ENTITY_POS.ToString ()}, actual position: {empty_entity_pos.ToString ()}') + + pxentity = general.find_editor_entity ("EntityWithPxCollider") + Report.result (Tests.find_pxentity, pxentity.IsValid ()) + + pxcollider_id = hydra.get_component_type_id ("PhysX Collider") + hasComponent = azlmbr.editor.EditorComponentAPIBus (azlmbr.bus.Broadcast, 'HasComponentOfType', pxentity, + pxcollider_id) + Report.result (Tests.pxentity_component, hasComponent) + + +if __name__ == "__main__": + + from editor_python_test_tools.utils import Report + Report.start_test (PrefabLevel_OpensLevelWithEntities) + PrefabLevel_OpensLevelWithEntities () \ No newline at end of file diff --git a/AutomatedTesting/Gem/PythonTests/prefab/TestSuite_Active.py b/AutomatedTesting/Gem/PythonTests/prefab/TestSuite_Active.py new file mode 100644 index 0000000000..3cd0a0d43d --- /dev/null +++ b/AutomatedTesting/Gem/PythonTests/prefab/TestSuite_Active.py @@ -0,0 +1,39 @@ +""" + All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or + its licensors. + + For complete copyright and license terms please see the LICENSE at the root of this + distribution (the "License"). All use of this software is governed by the License, + or, if provided, by the license below or the license accompanying this file. Do not + remove or modify any license notices. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + + """ + +# This suite consists of all test cases that are passing and have been verified. + +import pytest +import os +import sys + +from ly_test_tools import LAUNCHERS + +sys.path.append (os.path.dirname (os.path.abspath (__file__)) + '/../automatedtesting_shared') + +from base import TestAutomationBase + + +@pytest.mark.SUITE_main +@pytest.mark.parametrize ("launcher_platform", ['windows_editor']) +@pytest.mark.parametrize ("project", ["AutomatedTesting"]) +class TestAutomation (TestAutomationBase): + + def _run_prefab_test (self, request, workspace, editor, test_module): + self._run_test (request, workspace, editor, test_module, + ["--regset=/Amazon/Preferences/EnablePrefabSystem=true"]) + + def test_PrefabLevel_OpensLevelWithEntities (self, request, workspace, editor, launcher_platform): + from . import PrefabLevel_OpensLevelWithEntities as test_module + + + self._run_prefab_test (request, workspace, editor, test_module) \ No newline at end of file diff --git a/AutomatedTesting/Gem/PythonTests/prefab/__init__.py b/AutomatedTesting/Gem/PythonTests/prefab/__init__.py new file mode 100644 index 0000000000..6ed3dc4bda --- /dev/null +++ b/AutomatedTesting/Gem/PythonTests/prefab/__init__.py @@ -0,0 +1,10 @@ +""" +All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +its licensors. + +For complete copyright and license terms please see the LICENSE at the root of this +distribution (the "License"). All use of this software is governed by the License, +or, if provided, by the license below or the license accompanying this file. Do not +remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +""" \ No newline at end of file diff --git a/AutomatedTesting/Levels/Prefab/PrefabLevel_OpensLevelWithEntities/PrefabLevel_OpensLevelWithEntities.prefab b/AutomatedTesting/Levels/Prefab/PrefabLevel_OpensLevelWithEntities/PrefabLevel_OpensLevelWithEntities.prefab new file mode 100644 index 0000000000..0776f25935 --- /dev/null +++ b/AutomatedTesting/Levels/Prefab/PrefabLevel_OpensLevelWithEntities/PrefabLevel_OpensLevelWithEntities.prefab @@ -0,0 +1,171 @@ +{ + "Source": "Levels/PrefabLevel_OpensLevelWithEntities/PrefabLevel_OpensLevelWithEntities.prefab", + "ContainerEntity": { + "Id": "Entity_[403811863694]", + "Name": "Level", + "Components": { + "Component_[10582285743525614098]": { + "$type": "SelectionComponent", + "Id": 10582285743525614098 + }, + "Component_[12253783095375428046]": { + "$type": "EditorInspectorComponent", + "Id": 12253783095375428046 + }, + "Component_[13764860261821571747]": { + "$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent", + "Id": 13764860261821571747, + "Parent Entity": "" + }, + "Component_[15844324401733835865]": { + "$type": "EditorEntitySortComponent", + "Id": 15844324401733835865 + }, + "Component_[1605854641405361768]": { + "$type": "EditorLockComponent", + "Id": 1605854641405361768 + }, + "Component_[17698173984524983803]": { + "$type": "EditorOnlyEntityComponent", + "Id": 17698173984524983803 + }, + "Component_[3444251662966224826]": { + "$type": "EditorPendingCompositionComponent", + "Id": 3444251662966224826 + }, + "Component_[4231768881195179982]": { + "$type": "EditorVisibilityComponent", + "Id": 4231768881195179982 + }, + "Component_[4722360315410084479]": { + "$type": "EditorDisabledCompositionComponent", + "Id": 4722360315410084479 + }, + "Component_[7614719100624882952]": { + "$type": "EditorPrefabComponent", + "Id": 7614719100624882952 + }, + "Component_[9585901769691795481]": { + "$type": "EditorEntityIconComponent", + "Id": 9585901769691795481 + } + }, + "IsDependencyReady": true + }, + "Entities": { + "Entity_[438171602062]": { + "Id": "Entity_[438171602062]", + "Name": "EntityWithPxCollider", + "Components": { + "Component_[11161653124805884473]": { + "$type": "EditorPendingCompositionComponent", + "Id": 11161653124805884473 + }, + "Component_[13116773315299882093]": { + "$type": "EditorOnlyEntityComponent", + "Id": 13116773315299882093 + }, + "Component_[15820915681461536711]": { + "$type": "EditorVisibilityComponent", + "Id": 15820915681461536711 + }, + "Component_[2222061938345834243]": { + "$type": "SelectionComponent", + "Id": 2222061938345834243 + }, + "Component_[3861913165076405600]": { + "$type": "EditorEntitySortComponent", + "Id": 3861913165076405600 + }, + "Component_[7118587015611303204]": { + "$type": "EditorLockComponent", + "Id": 7118587015611303204 + }, + "Component_[7751174327125555504]": { + "$type": "EditorDisabledCompositionComponent", + "Id": 7751174327125555504 + }, + "Component_[8304730147756374057]": { + "$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent", + "Id": 8304730147756374057, + "Parent Entity": "Entity_[403811863694]", + "Transform Data": { + "Translate": [ + 0.0, + 20.0, + 34.0 + ] + } + }, + "Component_[8866353210615920259]": { + "$type": "EditorEntityIconComponent", + "Id": 8866353210615920259 + }, + "Component_[8988181228601932779]": { + "$type": "EditorInspectorComponent", + "Id": 8988181228601932779 + }, + "Component_[7103333782129541775]": { + "$type": "EditorColliderComponent", + "Id": 7103333782129541775 + } + }, + "IsDependencyReady": true + }, + "Entity_[532660882574]": { + "Id": "Entity_[532660882574]", + "Name": "EmptyEntity", + "Components": { + "Component_[16437814751543997955]": { + "$type": "EditorEntitySortComponent", + "Id": 16437814751543997955 + }, + "Component_[16751517102089557119]": { + "$type": "EditorPendingCompositionComponent", + "Id": 16751517102089557119 + }, + "Component_[16773275259304187949]": { + "$type": "EditorInspectorComponent", + "Id": 16773275259304187949 + }, + "Component_[17283539636910567200]": { + "$type": "SelectionComponent", + "Id": 17283539636910567200 + }, + "Component_[250004123617033400]": { + "$type": "EditorLockComponent", + "Id": 250004123617033400 + }, + "Component_[2791138963683667073]": { + "$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent", + "Id": 2791138963683667073, + "Parent Entity": "Entity_[403811863694]", + "Transform Data": { + "Translate": [ + 10.0, + 20.0, + 30.0 + ] + } + }, + "Component_[3296942400051129145]": { + "$type": "EditorEntityIconComponent", + "Id": 3296942400051129145 + }, + "Component_[3422076964671342434]": { + "$type": "EditorOnlyEntityComponent", + "Id": 3422076964671342434 + }, + "Component_[3431895414183121731]": { + "$type": "EditorVisibilityComponent", + "Id": 3431895414183121731 + }, + "Component_[7072085777705148766]": { + "$type": "EditorDisabledCompositionComponent", + "Id": 7072085777705148766 + } + }, + "IsDependencyReady": true + } + } +} \ No newline at end of file diff --git a/AutomatedTesting/Levels/Prefab/PrefabLevel_OpensLevelWithEntities/tags.txt b/AutomatedTesting/Levels/Prefab/PrefabLevel_OpensLevelWithEntities/tags.txt new file mode 100644 index 0000000000..0d6c1880e7 --- /dev/null +++ b/AutomatedTesting/Levels/Prefab/PrefabLevel_OpensLevelWithEntities/tags.txt @@ -0,0 +1,12 @@ +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 From 333fe5232c6c3d77fa6ed92018616cf6b6192857 Mon Sep 17 00:00:00 2001 From: catdo Date: Mon, 10 May 2021 15:59:12 -0700 Subject: [PATCH 2/5] added prefab to cmakelists --- AutomatedTesting/Gem/PythonTests/CMakeLists.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt index 31afab87ed..b3d74055f9 100644 --- a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt +++ b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt @@ -122,6 +122,22 @@ endif() # ) #endif() +## Prefab ## + if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) + ly_add_pytest( + NAME AutomatedTesting::PrefabTests + TEST_SUITE main + TEST_SERIAL + PATH ${CMAKE_CURRENT_LIST_DIR}/prefab/TestSuite_Active.py + TIMEOUT 3600 + RUNTIME_DEPENDENCIES + Legacy::Editor + Legacy::CryRenderNULL + AZ::AssetProcessor + AutomatedTesting.Assets + ) + endif() + ## Editor Python Bindings ## if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) ly_add_pytest( From a2a315a6cd4d2e6bf4d9ade57e753c4e8b34528d Mon Sep 17 00:00:00 2001 From: catdo Date: Tue, 11 May 2021 16:29:26 -0700 Subject: [PATCH 3/5] Fixed all nits and took out the general module and its usage --- .../Gem/PythonTests/CMakeLists.txt | 5 +- .../PrefabLevel_OpensLevelWithEntities.py | 62 +++++++++---------- ...{TestSuite_Active.py => TestSuite_Main.py} | 18 +++--- .../Gem/PythonTests/prefab/__init__.py | 2 +- 4 files changed, 39 insertions(+), 48 deletions(-) rename AutomatedTesting/Gem/PythonTests/prefab/{TestSuite_Active.py => TestSuite_Main.py} (61%) diff --git a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt index e4b68b6120..86bcb967ab 100644 --- a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt +++ b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt @@ -129,11 +129,10 @@ endif() NAME AutomatedTesting::PrefabTests TEST_SUITE main TEST_SERIAL - PATH ${CMAKE_CURRENT_LIST_DIR}/prefab/TestSuite_Active.py - TIMEOUT 3600 + PATH ${CMAKE_CURRENT_LIST_DIR}/prefab/TestSuite_Main.py + TIMEOUT 1500 RUNTIME_DEPENDENCIES Legacy::Editor - Legacy::CryRenderNULL AZ::AssetProcessor AutomatedTesting.Assets ) diff --git a/AutomatedTesting/Gem/PythonTests/prefab/PrefabLevel_OpensLevelWithEntities.py b/AutomatedTesting/Gem/PythonTests/prefab/PrefabLevel_OpensLevelWithEntities.py index 45f44474e1..ca59bbc2f8 100644 --- a/AutomatedTesting/Gem/PythonTests/prefab/PrefabLevel_OpensLevelWithEntities.py +++ b/AutomatedTesting/Gem/PythonTests/prefab/PrefabLevel_OpensLevelWithEntities.py @@ -9,22 +9,19 @@ remove or modify any license notices. This file is distributed on an "AS IS" BAS WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. """ - # fmt:off -class Tests (): +class Tests(): find_empty_entity = ("Entity: 'EmptyEntity' found", "Entity: 'EmptyEntity' *not* found in level") - empty_entity_pos = ( - "'EmptyEntity' position is at the expected position", "'EmptyEntity' position is *not* at the expected position") + empty_entity_pos = ("'EmptyEntity' position is at the expected position", "'EmptyEntity' position is *not* at the expected position") find_pxentity = ("Entity: 'EntityWithPxCollider' found", "Entity: 'EntityWithPxCollider' *not* found in level") - pxentity_component = ( - "Entity: 'EntityWithPxCollider' has a Physx Collider", "Entity: 'EntityWithPxCollider' has *not* a Physx Collider") + pxentity_component = ("Entity: 'EntityWithPxCollider' has a Physx Collider", "Entity: 'EntityWithPxCollider' has *not* a Physx Collider") # fmt:on -def PrefabLevel_OpensLevelWithEntities (): +def PrefabLevel_OpensLevelWithEntities(): """ Opens the level that contains 2 entities, "EmptyEntity" and "EntityWithPxCollider". - This test makes sure that both entities exist after openning the level and that: + This test makes sure that both entities exist after opening the level and that: - EmptyEntity is at Position: (10, 20, 30) - EntityWithPxCollider has a PhysXCollider component """ @@ -37,42 +34,41 @@ def PrefabLevel_OpensLevelWithEntities (): import editor_python_test_tools.hydra_editor_utils as hydra - import azlmbr.legacy.general as general - import azlmbr.bus + import azlmbr.entity as entity + import azlmbr.bus as bus from azlmbr.math import Vector3 - EXPECTED_EMPTY_ENTITY_POS = Vector3 (10.00, 20.0, 30.0) + EXPECTED_EMPTY_ENTITY_POS = Vector3(10.00, 20.0, 30.0) - helper.init_idle () - helper.open_level ("prefab", "PrefabLevel_OpensLevelWithEntities") + helper.init_idle() + helper.open_level("prefab", "PrefabLevel_OpensLevelWithEntities") - class EmptyEntity (): - value = None + def find_entity(entity_name): + searchFilter = entity.SearchFilter() + searchFilter.names = [entity_name] + entityIds = entity.SearchBus(bus.Broadcast, 'SearchEntities', searchFilter) + if entityIds[0].IsValid(): + return entityIds[0] + return None - def find_empty_entity (): - EmptyEntity.value = general.find_editor_entity ("EmptyEntity") - return EmptyEntity.value.IsValid () + helper.wait_for_condition(lambda: find_entity("EmptyEntity").IsValid(), 5.0) + empty_entity_id = find_entity("EmptyEntity") + Report.result(Tests.find_empty_entity, empty_entity_id.IsValid()) - helper.wait_for_condition (find_empty_entity, 5.0) - Report.result (Tests.find_empty_entity, EmptyEntity.value.IsValid ()) - - empty_entity_pos = azlmbr.components.TransformBus (azlmbr.bus.Event, "GetWorldTranslation", EmptyEntity.value) - is_at_position = empty_entity_pos.IsClose (EXPECTED_EMPTY_ENTITY_POS) - Report.result (Tests.empty_entity_pos, is_at_position) + empty_entity_pos = azlmbr.components.TransformBus(azlmbr.bus.Event, "GetWorldTranslation", empty_entity_id) + is_at_position = empty_entity_pos.IsClose(EXPECTED_EMPTY_ENTITY_POS) + Report.result(Tests.empty_entity_pos, is_at_position) if not is_at_position: - Report.info (f'Expected position: {EXPECTED_EMPTY_ENTITY_POS.ToString ()}, actual position: {empty_entity_pos.ToString ()}') + Report.info(f'Expected position: {EXPECTED_EMPTY_ENTITY_POS.ToString()}, actual position: {empty_entity_pos.ToString()}') - pxentity = general.find_editor_entity ("EntityWithPxCollider") - Report.result (Tests.find_pxentity, pxentity.IsValid ()) - - pxcollider_id = hydra.get_component_type_id ("PhysX Collider") - hasComponent = azlmbr.editor.EditorComponentAPIBus (azlmbr.bus.Broadcast, 'HasComponentOfType', pxentity, - pxcollider_id) - Report.result (Tests.pxentity_component, hasComponent) + pxentity = find_entity("EntityWithPxCollider") + Report.result(Tests.find_pxentity, pxentity.IsValid()) + pxcollider_id = hydra.get_component_type_id("PhysX Collider") + hasComponent = azlmbr.editor.EditorComponentAPIBus(azlmbr.bus.Broadcast, 'HasComponentOfType', pxentity, pxcollider_id) + Report.result(Tests.pxentity_component, hasComponent) if __name__ == "__main__": from editor_python_test_tools.utils import Report Report.start_test (PrefabLevel_OpensLevelWithEntities) - PrefabLevel_OpensLevelWithEntities () \ No newline at end of file diff --git a/AutomatedTesting/Gem/PythonTests/prefab/TestSuite_Active.py b/AutomatedTesting/Gem/PythonTests/prefab/TestSuite_Main.py similarity index 61% rename from AutomatedTesting/Gem/PythonTests/prefab/TestSuite_Active.py rename to AutomatedTesting/Gem/PythonTests/prefab/TestSuite_Main.py index 3cd0a0d43d..51c78a99e2 100644 --- a/AutomatedTesting/Gem/PythonTests/prefab/TestSuite_Active.py +++ b/AutomatedTesting/Gem/PythonTests/prefab/TestSuite_Main.py @@ -22,18 +22,14 @@ sys.path.append (os.path.dirname (os.path.abspath (__file__)) + '/../automatedte from base import TestAutomationBase - @pytest.mark.SUITE_main -@pytest.mark.parametrize ("launcher_platform", ['windows_editor']) -@pytest.mark.parametrize ("project", ["AutomatedTesting"]) -class TestAutomation (TestAutomationBase): +@pytest.mark.parametrize("launcher_platform", ['windows_editor']) +@pytest.mark.parametrize("project", ["AutomatedTesting"]) +class TestAutomation(TestAutomationBase): - def _run_prefab_test (self, request, workspace, editor, test_module): - self._run_test (request, workspace, editor, test_module, - ["--regset=/Amazon/Preferences/EnablePrefabSystem=true"]) + def _run_prefab_test(self, request, workspace, editor, test_module): + self._run_test(request, workspace, editor, test_module, ["--regset=/Amazon/Preferences/EnablePrefabSystem=true"]) - def test_PrefabLevel_OpensLevelWithEntities (self, request, workspace, editor, launcher_platform): + def test_PrefabLevel_OpensLevelWithEntities(self, request, workspace, editor, launcher_platform): from . import PrefabLevel_OpensLevelWithEntities as test_module - - - self._run_prefab_test (request, workspace, editor, test_module) \ No newline at end of file + self._run_prefab_test(request, workspace, editor, test_module) diff --git a/AutomatedTesting/Gem/PythonTests/prefab/__init__.py b/AutomatedTesting/Gem/PythonTests/prefab/__init__.py index 6ed3dc4bda..79f8fa4422 100644 --- a/AutomatedTesting/Gem/PythonTests/prefab/__init__.py +++ b/AutomatedTesting/Gem/PythonTests/prefab/__init__.py @@ -7,4 +7,4 @@ distribution (the "License"). All use of this software is governed by the Licens or, if provided, by the license below or the license accompanying this file. Do not remove or modify any license notices. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -""" \ No newline at end of file +""" From 2787e5053d8514afd470df38881da916d231bb39 Mon Sep 17 00:00:00 2001 From: catdo Date: Wed, 12 May 2021 13:18:32 -0700 Subject: [PATCH 4/5] addressed some nits and added comments --- .../prefab/PrefabLevel_OpensLevelWithEntities.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/prefab/PrefabLevel_OpensLevelWithEntities.py b/AutomatedTesting/Gem/PythonTests/prefab/PrefabLevel_OpensLevelWithEntities.py index ca59bbc2f8..3401c6a0a9 100644 --- a/AutomatedTesting/Gem/PythonTests/prefab/PrefabLevel_OpensLevelWithEntities.py +++ b/AutomatedTesting/Gem/PythonTests/prefab/PrefabLevel_OpensLevelWithEntities.py @@ -14,7 +14,7 @@ class Tests(): find_empty_entity = ("Entity: 'EmptyEntity' found", "Entity: 'EmptyEntity' *not* found in level") empty_entity_pos = ("'EmptyEntity' position is at the expected position", "'EmptyEntity' position is *not* at the expected position") find_pxentity = ("Entity: 'EntityWithPxCollider' found", "Entity: 'EntityWithPxCollider' *not* found in level") - pxentity_component = ("Entity: 'EntityWithPxCollider' has a Physx Collider", "Entity: 'EntityWithPxCollider' has *not* a Physx Collider") + pxentity_component = ("Entity: 'EntityWithPxCollider' has a Physx Collider", "Entity: 'EntityWithPxCollider' does *not* have a Physx Collider") # fmt:on @@ -50,17 +50,19 @@ def PrefabLevel_OpensLevelWithEntities(): if entityIds[0].IsValid(): return entityIds[0] return None - +#Checks for an entity called "EmptyEntity" helper.wait_for_condition(lambda: find_entity("EmptyEntity").IsValid(), 5.0) empty_entity_id = find_entity("EmptyEntity") Report.result(Tests.find_empty_entity, empty_entity_id.IsValid()) +# Checks if the EmptyEntity is in the correct position and if it fails, it will provide the expected postion and the actual postion of the entity in the Editor log empty_entity_pos = azlmbr.components.TransformBus(azlmbr.bus.Event, "GetWorldTranslation", empty_entity_id) is_at_position = empty_entity_pos.IsClose(EXPECTED_EMPTY_ENTITY_POS) Report.result(Tests.empty_entity_pos, is_at_position) if not is_at_position: Report.info(f'Expected position: {EXPECTED_EMPTY_ENTITY_POS.ToString()}, actual position: {empty_entity_pos.ToString()}') +#Checks for an entity called "EntityWithPxCollider" and if it has the PhysX Collider component pxentity = find_entity("EntityWithPxCollider") Report.result(Tests.find_pxentity, pxentity.IsValid()) From 7633ec9a83035d9bc543070f055840a086180d02 Mon Sep 17 00:00:00 2001 From: catdo Date: Wed, 12 May 2021 16:27:51 -0700 Subject: [PATCH 5/5] removed spacings in CMakeList and removed the tags.txt file in the prefab level --- .../Gem/PythonTests/CMakeLists.txt | 26 +++++++++---------- .../tags.txt | 12 --------- 2 files changed, 13 insertions(+), 25 deletions(-) delete mode 100644 AutomatedTesting/Levels/Prefab/PrefabLevel_OpensLevelWithEntities/tags.txt diff --git a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt index 86bcb967ab..3f0827f995 100644 --- a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt +++ b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt @@ -124,19 +124,19 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) endif() ## Prefab ## - if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) - ly_add_pytest( - NAME AutomatedTesting::PrefabTests - TEST_SUITE main - TEST_SERIAL - PATH ${CMAKE_CURRENT_LIST_DIR}/prefab/TestSuite_Main.py - TIMEOUT 1500 - RUNTIME_DEPENDENCIES - Legacy::Editor - AZ::AssetProcessor - AutomatedTesting.Assets - ) - endif() +if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) + ly_add_pytest( + NAME AutomatedTesting::PrefabTests + TEST_SUITE main + TEST_SERIAL + PATH ${CMAKE_CURRENT_LIST_DIR}/prefab/TestSuite_Main.py + TIMEOUT 1500 + RUNTIME_DEPENDENCIES + Legacy::Editor + AZ::AssetProcessor + AutomatedTesting.Assets + ) +endif() ## Editor Python Bindings ## if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) diff --git a/AutomatedTesting/Levels/Prefab/PrefabLevel_OpensLevelWithEntities/tags.txt b/AutomatedTesting/Levels/Prefab/PrefabLevel_OpensLevelWithEntities/tags.txt deleted file mode 100644 index 0d6c1880e7..0000000000 --- a/AutomatedTesting/Levels/Prefab/PrefabLevel_OpensLevelWithEntities/tags.txt +++ /dev/null @@ -1,12 +0,0 @@ -0,0,0,0,0,0 -0,0,0,0,0,0 -0,0,0,0,0,0 -0,0,0,0,0,0 -0,0,0,0,0,0 -0,0,0,0,0,0 -0,0,0,0,0,0 -0,0,0,0,0,0 -0,0,0,0,0,0 -0,0,0,0,0,0 -0,0,0,0,0,0 -0,0,0,0,0,0