NodePalette_HappyPath_ClearSelection.py 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. set_search_string = ("Search string is set", "Search string is not set")
  9. # fmt: on
  10. def NodePalette_HappyPath_ClearSelection():
  11. """
  12. Summary:
  13. Clicking the X button on the Search Box clears the currently entered string
  14. Expected Behavior:
  15. After entering a string value into the Node Palette's search box and click on
  16. the X button, the search box should be cleared
  17. Test Steps:
  18. 1) Initialize our O3DE editor object
  19. 2) Open and initialize Script Canvas window (Tools > Script Canvas)
  20. 3) Search for a node (this test uses a node from the Math category)
  21. 4) Verify the node was found
  22. 5) Clear search strin
  23. Note:
  24. - Any passed and failed tests are written to the Editor.log file.
  25. Parsing the file or running a log_monitor are required to observe the test results.
  26. :return: None
  27. """
  28. #Preconditions
  29. from editor_python_test_tools.utils import Report
  30. import azlmbr.legacy.general as general
  31. from editor_python_test_tools.QtPy.QtPyO3DEEditor import QtPyO3DEEditor
  32. from consts.scripting import (NODE_STRING_TO_NUMBER)
  33. general.idle_enable(True)
  34. # 1) Initialize our O3DE editor object
  35. qtpy_o3de_editor = QtPyO3DEEditor()
  36. # 2) Open and initialize Script Canvas test objects (Tools > Script Canvas)
  37. qtpy_o3de_editor.open_script_canvas()
  38. qtpy_node_palette = qtpy_o3de_editor.sc_editor.node_palette
  39. # 3) Search for a node (this test uses a node from the Math category)
  40. node_palette_search_results = qtpy_node_palette.search_for_node(NODE_STRING_TO_NUMBER)
  41. # 4) Verify the node was found
  42. Report.result(Tests.set_search_string, node_palette_search_results is not None)
  43. # 5) Clear search string
  44. qtpy_node_palette.click_clear_search_button()
  45. if __name__ == "__main__":
  46. import ImportPathHelper as imports
  47. imports.init()
  48. from utils import Report
  49. Report.start_test(NodePalette_HappyPath_ClearSelection)