Debugger_HappyPath_TargetMultipleGraphs.py 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. """
  2. Copyright (c) Contributors to the Open 3D Engine Project.
  3. For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. SPDX-License-Identifier: Apache-2.0 OR MIT
  5. """
  6. # fmt: off
  7. class Tests():
  8. select_multiple_targets = ("Multiple targets are selected", "Multiple targets are not selected")
  9. # fmt: on
  10. GENERAL_WAIT = 0.5 # seconds
  11. def Debugger_HappyPath_TargetMultipleGraphs():
  12. """
  13. Summary:
  14. Multiple Graphs can be targeted in the Debugger tool
  15. Expected Behavior:
  16. Multiple elected files can be checked for logging.
  17. Upon checking, checkboxes of the parent folders change to either full or partial check.
  18. Test Steps:
  19. 1) Open Script Canvas window (Tools > Script Canvas)
  20. 2) Get the SC window object
  21. 3) Open Debugging Tool if not opened already
  22. 4) Select Graphs tab under logging window
  23. 5) Select multiple targets from levels and scriptcanvas
  24. 6) Verify if multiple targets are selected
  25. 7) Close Debugging window and Script Canvas window
  26. Note:
  27. - This test file must be called from the Open 3D Engine Editor command terminal
  28. - Any passed and failed tests are written to the Editor.log file.
  29. Parsing the file or running a log_monitor are required to observe the test results.
  30. :return: None
  31. """
  32. from PySide2 import QtWidgets
  33. from PySide2.QtCore import Qt
  34. import azlmbr.legacy.general as general
  35. import pyside_utils
  36. from utils import TestHelper as helper
  37. from utils import Report
  38. # 1) Open Script Canvas window (Tools > Script Canvas)
  39. general.idle_enable(True)
  40. general.open_pane("Script Canvas")
  41. helper.wait_for_condition(lambda: general.is_pane_visible("Script Canvas"), 6.0)
  42. # 2) Get the SC window object
  43. editor_window = pyside_utils.get_editor_main_window()
  44. sc = editor_window.findChild(QtWidgets.QDockWidget, "Script Canvas")
  45. # 3) Open Debugging Tool if not opened already
  46. if (
  47. sc.findChild(QtWidgets.QDockWidget, "LoggingWindow") is None
  48. or not sc.findChild(QtWidgets.QDockWidget, "LoggingWindow").isVisible()
  49. ):
  50. action = pyside_utils.find_child_by_pattern(sc, {"text": "Debugging", "type": QtWidgets.QAction})
  51. action.trigger()
  52. logging_window = sc.findChild(QtWidgets.QDockWidget, "LoggingWindow")
  53. # 4) Select Graphs tab under logging window
  54. button = pyside_utils.find_child_by_pattern(logging_window, {"type": QtWidgets.QPushButton, "text": "Graphs"})
  55. button.click()
  56. # 5) Select multiple targets from levels and scriptcanvas
  57. graphs = logging_window.findChild(QtWidgets.QWidget, "graphsPage")
  58. tree = graphs.findChild(QtWidgets.QTreeView, "pivotTreeView")
  59. # Select the first child under levels
  60. level_model_index = pyside_utils.find_child_by_pattern(tree, "levels")
  61. level_child_index = pyside_utils.get_item_view_index(tree, 0, 0, level_model_index)
  62. tree.model().setData(level_child_index, 2, Qt.CheckStateRole)
  63. # Select the first child under scriptcanvas
  64. sc_model_index = pyside_utils.find_child_by_pattern(tree, "scriptcanvas")
  65. sc_child_index = pyside_utils.get_item_view_index(tree, 0, 0, sc_model_index)
  66. tree.model().setData(sc_child_index, 2, Qt.CheckStateRole)
  67. # 6) Verify if multiple targets are selected
  68. result = all([index.data(Qt.CheckStateRole) != 0 for index in (level_model_index, sc_model_index)])
  69. result = result and all([index.data(Qt.CheckStateRole) == 2 for index in (level_child_index, sc_child_index)])
  70. Report.result(Tests.select_multiple_targets, result)
  71. # 7) Close Debugging window and Script Canvas window
  72. logging_window.close()
  73. general.close_pane("Script Canvas")
  74. if __name__ == "__main__":
  75. import ImportPathHelper as imports
  76. imports.init()
  77. from utils import Report
  78. Report.start_test(Debugger_HappyPath_TargetMultipleGraphs)