Merge branch 'main' into script_canvas

This commit is contained in:
darapan
2021-05-11 01:39:52 -07:00
845 changed files with 16459 additions and 67596 deletions
@@ -10,7 +10,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Test case ID: T92569013
Test Case Title: Script Event file can be created
URL of the test case: https://testrail.agscollab.com/index.php?/tests/view/92569013
"""
@@ -12,7 +12,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Test case ID: T92568942
Test Case Title: Clicking the "+" button and selecting "New Script Event" opens the
Asset Editor with a new Script Event asset
URL of the test case: https://testrail.agscollab.com/index.php?/tests/view/92568942
"""
from PySide2 import QtWidgets
@@ -11,7 +11,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Test case ID: T92568856
Test Case Title: Multiple Entities can be targeted in the Debugger tool
URLs of the test case: https://testrail.agscollab.com/index.php?/tests/view/92568856
"""
@@ -11,7 +11,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Test case ID: T92569137
Test Case Title: Multiple Graphs can be targeted in the Debugger tool
URLs of the test case: https://testrail.agscollab.com/index.php?/tests/view/92569137
"""
@@ -10,7 +10,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Test case ID: C1702824
Test Case Title: Docking
URLs of the test case: https://testrail.agscollab.com/index.php?/cases/view/1702824
"""
@@ -11,10 +11,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Test case ID: T92569049
Test Case Title: Edit > Undo undoes the last action
URL of the test case: https://testrail.agscollab.com/index.php?/tests/view/92569049
Test case ID: T92569051
Test Case Title: Edit > Redo redoes the last undone action
URL of the test case: https://testrail.agscollab.com/index.php?/tests/view/92569051
"""
@@ -10,7 +10,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Test case ID: T92562978
Test Case Title: Script Canvas Component can be added to an entity
URL of the test case: https://testrail.agscollab.com/index.php?/tests/view/92562978
"""
@@ -11,10 +11,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Test case ID: T92569037
Test Case Title: File > New Script creates a new script
URL of the test case: https://testrail.agscollab.com/index.php?/tests/view/92569037
Test case ID: T92569039
Test Case Title: File > Open opens the Open... dialog
URL of the test case: https://testrail.agscollab.com/index.php?/tests/view/92569039
"""
import os
@@ -11,11 +11,9 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Test case ID: T92563070
Test Case Title: Graphs can be closed by clicking X on the Graph name tab
URL of the test case: https://testrail.agscollab.com/index.php?/tests/view/92563070
Test case ID: T92563068
Test Case Title: Save Prompt: User is prompted to save a graph on close after
creating a new graph
URL of the test case: https://testrail.agscollab.com/index.php?/tests/view/92563068
"""
import os
@@ -11,10 +11,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Test case ID: T92569079
Test Case Title: View > Zoom In zooms the graph in
URL of the test case: https://testrail.agscollab.com/index.php?/tests/view/92569079
Test case ID: T92569081
Test Case Title: View > Zoom In zooms the graph out
URL of the test case: https://testrail.agscollab.com/index.php?/tests/view/92569081
"""
@@ -9,9 +9,9 @@ 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.
"""
def init():
import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../automatedtesting_shared')
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../EditorPythonTestTools/editor_python_test_tools')
@@ -0,0 +1,128 @@
"""
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.
Test case ID: T92562988
Test Case Title: Left-click/double click expands and collapses node categories
"""
# fmt: off
class Tests():
pane_open = ("Script Canvas pane successfully opened", "Script Canvas pane failed to open")
click_expand = ("Category expanded on left click", "Category failed to expand on left click")
click_collapse = ("Category collapsed on left click", "Category failed to collapse on left click")
dClick_expand = ("Category expanded on double click", "Category failed to expand on double click")
dClick_collapse = ("Category collapsed on double click", "Category failed to collapse on double click")
# fmt: on
def NodeCategory_ExpandOnClick():
"""
Summary:
Verifying the expand/collapse functionality on node categories
Expected Behavior:
The node category should expand when double clicked or when the drop down indicator is
left-clicked. Once expanded, it should be collapsed via the same actions.
Test Steps:
1) Open Script Canvas pane
2) Get the SC window objects
3) Ensure all categories are collapsed for a clean state
4) Left-Click on a node category arrow to expand it
5) Verify it expanded
6) Left-Click on a node category arrow to collapse it
7) Verify it collapsed
8) Double-Click on a node category to expand it
9) Verify it expanded
10) Double-Click on a node category to collapse it
11) Verify it collapsed
Note:
- This test file must be called from the Open 3D Engine Editor command terminal
- Any passed and failed tests are written to the Editor.log file.
Parsing the file or running a log_monitor are required to observe the test results.
:return: None
"""
from utils import Report
from PySide2 import QtCore, QtWidgets, QtTest
from PySide2.QtTest import QTest
import pyside_utils
import azlmbr.legacy.general as general
def left_click_arrow(item_view, index):
original_state = item_view.isExpanded(index)
rect_center_y = item_view.visualRect(index).center().y()
rect_left_x = item_view.visualRect(index).left()
for i in range(5): # this range can be increased for safe side
QtTest.QTest.mouseClick(
item_view.viewport(),
QtCore.Qt.LeftButton,
QtCore.Qt.NoModifier,
QtCore.QPoint(rect_left_x - i, rect_center_y),
)
if item_view.isExpanded(index) != original_state:
break
def double_click(item_view, index):
item_index_center = item_view.visualRect(index).center()
# Left click on the item before trying to double click, will otherwise fail to expand
# as first click would highlight and second click would be a 'single click'
pyside_utils.item_view_index_mouse_click(item_view, index)
QTest.mouseDClick(item_view.viewport(), QtCore.Qt.LeftButton, QtCore.Qt.NoModifier, item_index_center)
# 1) Open Script Canvas pane
general.open_pane("Script Canvas")
Report.critical_result(Tests.pane_open, general.is_pane_visible("Script Canvas"))
# 2) Get the SC window objects
editor_window = pyside_utils.get_editor_main_window()
sc = editor_window.findChild(QtWidgets.QDockWidget, "Script Canvas")
if sc.findChild(QtWidgets.QDockWidget, "NodePalette") is None:
action = pyside_utils.find_child_by_pattern(sc, {"text": "Node Palette", "type": QtWidgets.QAction})
action.trigger()
node_palette = sc.findChild(QtWidgets.QDockWidget, "NodePalette")
nodeTree = node_palette.findChild(QtWidgets.QTreeView, "treeView")
ai_index = pyside_utils.find_child_by_pattern(nodeTree, "AI")
# 3) Ensure all categories are collapsed for a clean state
nodeTree.collapseAll()
# 4) Left-Click on a node category arrow to expand it
left_click_arrow(nodeTree, ai_index)
# 5) Verify it expanded
Report.result(Tests.click_expand, nodeTree.isExpanded(ai_index))
# 6) Left-Click on a node category arrow to collapse it
left_click_arrow(nodeTree, ai_index)
# 7) Verify it collapsed
Report.result(Tests.click_collapse, not nodeTree.isExpanded(ai_index))
# 8) Double-Click on a node category to expand it
double_click(nodeTree, ai_index)
# 9) Verify it expanded
Report.result(Tests.dClick_expand, nodeTree.isExpanded(ai_index))
# 10) Double-Click on a node category to collapse it
double_click(nodeTree, ai_index)
# 11) Verify it collapsed
Report.result(Tests.dClick_collapse, not nodeTree.isExpanded(ai_index))
if __name__ == "__main__":
import ImportPathHelper as imports
imports.init()
from utils import Report
Report.start_test(NodeCategory_ExpandOnClick)
@@ -10,7 +10,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Test case ID: T92568982
Test Case Title: Renaming variables in the Node Inspector
URL of the test case: https://testrail.agscollab.com/index.php?/tests/view/92568982
"""
@@ -10,7 +10,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Test case ID: T92562993
Test Case Title: Clicking the X button on the Search Box clears the currently entered string
URL of the test case: https://testrail.agscollab.com/index.php?/tests/view/92562993
"""
@@ -0,0 +1,91 @@
"""
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():
set_search_string = ("Search string is set", "Search string is not set")
search_string_deleted = ("Search string deleted as expected", "Search string not deleted")
# fmt: on
def NodePalette_SearchText_Deletion():
"""
Summary:
We enter some string in the Node Palette Search box, select that text and delete it.
Expected Behavior:
After RightClick->Delete the text in the Searchbox should be deleted.
Test Steps:
1) Open Script Canvas window (Tools > Script Canvas)
2) Get the SC window object
3) Open Node Manager if not opened already
4) Set some string in the Search box
5) Verify if the test string is set
6) Delete search string using right click and verify if it is cleared
Note:
- This test file must be called from the Open 3D Engine Editor command terminal
- Any passed and failed tests are written to the Editor.log file.
Parsing the file or running a log_monitor are required to observe the test results.
:return: None
"""
from PySide2 import QtWidgets, QtTest, QtCore
from utils import TestHelper as helper
import azlmbr.legacy.general as general
import pyside_utils
TEST_STRING = "TestString"
# 1) Open Script Canvas window (Tools > Script Canvas)
general.idle_enable(True)
general.open_pane("Script Canvas")
helper.wait_for_condition(lambda: general.is_pane_visible("Script Canvas"), 3.0)
# 2) Get the SC window object
editor_window = pyside_utils.get_editor_main_window()
sc = editor_window.findChild(QtWidgets.QDockWidget, "Script Canvas")
# 3) Open Node Manager if not opened already
if sc.findChild(QtWidgets.QDockWidget, "NodePalette") is None:
action = pyside_utils.find_child_by_pattern(sc, {"text": "Node Palette", "type": QtWidgets.QAction})
action.trigger()
node_palette = sc.findChild(QtWidgets.QDockWidget, "NodePalette")
search_frame = node_palette.findChild(QtWidgets.QFrame, "searchFrame")
# 4) Set some string in the Search box
search_box = search_frame.findChild(QtWidgets.QLineEdit, "searchFilter")
search_box.setText(TEST_STRING)
# 5) Verify if the test string is set
result = helper.wait_for_condition(lambda: search_box.text() == TEST_STRING, 1.0)
Report.result(Tests.set_search_string, result)
# 6) Delete search string using right click and verify if it is cleared
QtTest.QTest.keyClick(search_box, QtCore.Qt.Key_A, QtCore.Qt.ControlModifier)
pyside_utils.trigger_context_menu_entry(search_box, "Delete")
result = helper.wait_for_condition(lambda: search_box.text() == "", 2.0)
Report.result(Tests.search_string_deleted, result)
if __name__ == "__main__":
import ImportPathHelper as imports
imports.init()
from utils import Report
Report.start_test(NodePalette_SearchText_Deletion)
@@ -11,7 +11,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Test case ID: T92568940
Test Case Title: Categories and Nodes can be selected
URL of the test case: https://testrail.agscollab.com/index.php?/tests/view/92568940
"""
@@ -10,7 +10,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Test case ID: T92569253 // T92569254
Test Case Title: On Entity Activated // On Entity Deactivated
URL of the test case: https://testrail.agscollab.com/index.php?/tests/view/92569253 // https://testrail.agscollab.com/index.php?/tests/view/92569254
"""
@@ -10,8 +10,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Test case ID: C1702834 // C1702823
Test Case Title: Opening pane // Closing pane
URLs of the test case: https://testrail.agscollab.com/index.php?/cases/view/1702834 and
https://testrail.agscollab.com/index.php?/cases/view/1702823
"""
@@ -10,8 +10,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Test case ID: C1702821 // C1702832
Test Case Title: Retain visibility, size and location upon Script Canvas restart
URLs of the test case: https://testrail.agscollab.com/index.php?/cases/view/1702821 and
https://testrail.agscollab.com/index.php?/cases/view/1702832
"""
@@ -10,7 +10,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Test case ID: C1702829
Test Case Title: Resizing pane
URLs of the test case: https://testrail.agscollab.com/index.php?/cases/view/1702829
"""
@@ -11,7 +11,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Test case ID: T92562986
Test Case Title: Changing the assigned Script Canvas Asset on an entity properly updates
level functionality
URL of the test case: https://testrail.agscollab.com/index.php?/tests/view/92562986
"""
@@ -10,7 +10,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Test case ID: T92563190
Test Case Title: A single Entity with two Script Canvas components works properly
URL of the test case: https://testrail.agscollab.com/index.php?/tests/view/92563190
"""
@@ -10,7 +10,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Test case ID: T92563191
Test Case Title: Two Entities can use the same Graph asset successfully at RunTime
URL of the test case: https://testrail.agscollab.com/index.php?/tests/view/92563191
"""
@@ -0,0 +1,112 @@
"""
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.
Test Case Title: Event can return a value of set type successfully
"""
# fmt: off
class Tests():
level_created = ("Successfully created temporary level", "Failed to create temporary level")
entity_created = ("Successfully created test entity", "Failed to create test entity")
enter_game_mode = ("Successfully entered game mode", "Failed to enter game mode")
lines_found = ("Successfully found expected message", "Failed to find expected message")
exit_game_mode = ("Successfully exited game mode", "Failed to exit game mode")
# fmt: on
def ScriptEvents_ReturnSetType_Successfully():
"""
Summary: A temporary level is created with an Entity having ScriptCanvas component.
ScriptEvent(T92569006_ScriptEvent.scriptevents) is created with one Method that has a return value.
ScriptCanvas(T92569006_ScriptCanvas.scriptcanvas) is attached to Entity. Graph has Send node that sends the Method
of the ScriptEvent and prints the returned result ( On Entity Activated -> Send node -> Print) and Receive node is
set to return custom value ( Receive node -> Print).
Verify that the entity containing T92569006_ScriptCanvas.scriptcanvas should print the custom value set in both
Send and Receive nodes.
Expected Behavior:
After entering game mode, the graph on the entity should print an expected message to the console
Test Steps:
1) Create test level
2) Create test entity
3) Start Tracer
4) Enter Game Mode
5) Read for line
6) Exit Game Mode
Note:
- This test file must be called from the Open 3D Engine Editor command terminal
- Any passed and failed tests are written to the Editor.log file.
Parsing the file or running a log_monitor are required to observe the test results.
:return: None
"""
import os
from editor_entity_utils import EditorEntity as Entity
from utils import Report
from utils import TestHelper as helper
from utils import Tracer
import azlmbr.legacy.general as general
import azlmbr.asset as asset
import azlmbr.math as math
import azlmbr.bus as bus
LEVEL_NAME = "tmp_level"
WAIT_TIME = 3.0 # SECONDS
EXPECTED_LINES = ["T92569006_ScriptEvent_Sent", "T92569006_ScriptEvent_Received"]
SC_ASSET_PATH = os.path.join("ScriptCanvas", "T92569006_ScriptCanvas.scriptcanvas")
def create_editor_entity(name, sc_asset):
entity = Entity.create_editor_entity(name)
sc_comp = entity.add_component("Script Canvas")
asset_id = asset.AssetCatalogRequestBus(bus.Broadcast, "GetAssetIdByPath", sc_asset, math.Uuid(), False)
sc_comp.set_component_property_value("Script Canvas Asset|Script Canvas Asset", asset_id)
Report.critical_result(Tests.entity_created, entity.id.isValid())
def locate_expected_lines(line_list: list):
found_lines = [printInfo.message.strip() for printInfo in section_tracer.prints]
return all(line in found_lines for line in line_list)
# 1) Create temp level
general.idle_enable(True)
result = general.create_level_no_prompt(LEVEL_NAME, 128, 1, 512, True)
Report.critical_result(Tests.level_created, result == 0)
helper.wait_for_condition(lambda: general.get_current_level_name() == LEVEL_NAME, WAIT_TIME)
general.close_pane("Error Report")
# 2) Create test entity
create_editor_entity("TestEntity", SC_ASSET_PATH)
# 3) Start Tracer
with Tracer() as section_tracer:
# 4) Enter Game Mode
helper.enter_game_mode(Tests.enter_game_mode)
# 5) Read for line
lines_located = helper.wait_for_condition(lambda: locate_expected_lines(EXPECTED_LINES), WAIT_TIME)
Report.result(Tests.lines_found, lines_located)
# 6) Exit Game Mode
helper.exit_game_mode(Tests.exit_game_mode)
if __name__ == "__main__":
import ImportPathHelper as imports
imports.init()
from utils import Report
Report.start_test(ScriptEvents_ReturnSetType_Successfully)
@@ -10,7 +10,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Test case ID: T92567321
Test Case Title: Script Events: Can send and receive a script event across multiple entities successfully
URL of the test case: https://testrail.agscollab.com/index.php?/tests/view/92567321
"""
@@ -10,7 +10,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Test case ID: T92567320
Test Case Title: Script Events: Can send and receive a script event successfully
URL of the test case: https://testrail.agscollab.com/index.php?/tests/view/92567320
"""
@@ -13,11 +13,6 @@ Test Case Title: Tools > Node Palette toggles the Node Palette
Tools > Node Inspector toggles the Node Inspector
Tools > Bookmarks toggles the Bookmarks
Tools > Variable Manager toggles the Variable Manager
URLs of the test case: https://testrail.agscollab.com/index.php?/cases/view/92569165
https://testrail.agscollab.com/index.php?/cases/view/92569167
https://testrail.agscollab.com/index.php?/cases/view/92569168
https://testrail.agscollab.com/index.php?/cases/view/92569170
"""
@@ -10,8 +10,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Test case ID: C1702825 // C1702831
Test Case Title: Undocking // Closing script canvas with the pane floating
URLs of the test case: https://testrail.agscollab.com/index.php?/cases/view/1702825 &
https://testrail.agscollab.com/index.php?/cases/view/1702831
"""
@@ -10,10 +10,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Test case ID: T92564789
Test Case Title: Each Variable type can be created
URL of the test case: https://testrail.agscollab.com/index.php?/tests/view/92564789
Test case ID: T92568873
Test Case Title: Each Variable type can be deleted
URL of the test case: https://testrail.agscollab.com/index.php?/tests/view/92568873
"""