Adds Atom component tests into the new parallel + batched test approach (#4039)

* create PoC for starting point for parallel + batched Atom tests

Signed-off-by: jromnoa <jromnoa@amazon.com>

* CMakeLists.txt update

Signed-off-by: jromnoa <jromnoa@amazon.com>

* saving progress on re-factor for parallel and batched tests, added Tracer(), added Report(), and added new exit code validation method but code is unfinished still

Signed-off-by: jromnoa <jromnoa@amazon.com>

* finalize conversion of component tests into new optimized test setup for batched/parallel runs

Signed-off-by: jromnoa <jromnoa@amazon.com>

* fix REDO deletion check, remove class referencing a test not yet added to parallel runs

Signed-off-by: jromnoa <jromnoa@amazon.com>

* revert hydra_AtomEditorComponents_AddedToEntity.py back to its original version

Signed-off-by: jromnoa <jromnoa@amazon.com>

* re-add the DepthOfField component to expected_lines for non-optimized main suite (removed on accident)

Signed-off-by: jromnoa <jromnoa@amazon.com>

* remove test comments from legal header, add EditorEntity() class, remove hydra calls - updated for Decal component, but the next commit will get the rest

Signed-off-by: jromnoa <jromnoa@amazon.com>

* saving progress on converting over fully to using EditorEntity() per PR comments - almost done, will finish tomorrow

Signed-off-by: jromnoa <jromnoa@amazon.com>

* add new test setup docstring, fix the create entity test step wording, re-add accidental removal of string text from editor_entity_utils.py

Signed-off-by: jromnoa <jromnoa@amazon.com>

* finalize PR concerns, use EditorEntity object for most/all calls, tests pass when run

Signed-off-by: jromnoa <jromnoa@amazon.com>

* remove accidental change

Signed-off-by: jromnoa <jromnoa@amazon.com>

* update helper.open_level() call to not include 'Physics' in path, remove unnecessary f-string calls

Signed-off-by: jromnoa <jromnoa@amazon.com>

* editor_python_test_tools.asset_utils.Asset.find_asset_by_path(), add is_hidden() and is_visible() to editor_python_test_tools to use for verification, clean up UNDO/REDO comments, fix test order in file to match the order of the test files

Signed-off-by: jromnoa <jromnoa@amazon.com>
This commit is contained in:
jromnoa
2021-09-16 10:59:23 -07:00
committed by GitHub
parent 58c227ceb1
commit 47a8dbc1d0
17 changed files with 1450 additions and 26 deletions
@@ -20,6 +20,7 @@ import azlmbr.legacy.general as general
# Helper file Imports
from editor_python_test_tools.utils import Report
class EditorComponent:
"""
EditorComponent class used to set and get the component property value using path
@@ -28,7 +29,6 @@ class EditorComponent:
which also assigns self.id and self.type_id to the EditorComponent object.
"""
# Methods
def get_component_name(self) -> str:
"""
Used to get name of component
@@ -87,6 +87,13 @@ class EditorComponent:
outcome.IsSuccess()
), f"Failure: Could not set value to '{self.get_component_name()}' : '{component_property_path}'"
def is_enabled(self):
"""
Used to verify if the component is enabled.
:return: True if enabled, otherwise False.
"""
return editor.EditorComponentAPIBus(bus.Broadcast, "IsComponentEnabled", self.id)
@staticmethod
def get_type_ids(component_names: list) -> list:
"""
@@ -254,7 +261,7 @@ class EditorEntity:
def get_components_of_type(self, component_names: list) -> List[EditorComponent]:
"""
Used to get components of type component_name that already exists on Entity
:param component_name: Name to component to check
:param component_names: List of names of components to check
:return: List of Entity Component objects of given component name
"""
component_list = []
@@ -318,3 +325,39 @@ class EditorEntity:
editor.EditorEntityAPIBus(bus.Event, "SetStartStatus", self.id, status_to_set)
set_status = self.get_start_status()
assert set_status == status_to_set, f"Failed to set start status of {desired_start_status} to {self.get_name}"
def delete(self) -> None:
"""
Used to delete the Entity.
:return: None
"""
editor.ToolsApplicationRequestBus(bus.Broadcast, "DeleteEntityById", self.id)
def set_visibility_state(self, is_visible: bool) -> None:
"""
Sets the visibility state on the object to visible or not visible.
:param is_visible: True for making visible, False to make not visible.
:return: None
"""
editor.EditorEntityAPIBus(bus.Event, "SetVisibilityState", self.id, is_visible)
def exists(self) -> bool:
"""
Used to verify if the Entity exists.
:return: True if the Entity exists, False otherwise.
"""
return editor.ToolsApplicationRequestBus(bus.Broadcast, "EntityExists", self.id)
def is_hidden(self) -> bool:
"""
Gets the "isHidden" value from the Entity.
:return: True if "isHidden" is enabled, False otherwise.
"""
return editor.EditorEntityInfoRequestBus(bus.Event, "IsHidden", self.id)
def is_visible(self) -> bool:
"""
Gets the "isVisible" value from the Entity.
:return: True if "isVisible" is enabled, False otherwise.
"""
return editor.EditorEntityInfoRequestBus(bus.Event, "IsVisible", self.id)