Integrating latest 47acbe8

This commit is contained in:
alexpete
2021-03-25 13:57:57 -07:00
parent 448c549698
commit 75dc720198
10312 changed files with 2711566 additions and 671451 deletions
@@ -0,0 +1,119 @@
"""
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: C1702824
Test Case Title: Docking
URLs of the test case: https://testrail.agscollab.com/index.php?/cases/view/1702824
"""
# fmt: off
class Tests():
open_sc_window = ("Script Canvas window is opened", "Failed to open Script Canvas window")
pane_opened = ("Pane is opened successfully", "Failed to open pane")
dock_pane = ("Pane is docked successfully", "Failed to dock Pane into one or more allowed area")
# fmt: on
def Docking_Pane():
"""
Summary:
The Script Canvas window is opened to verify if Script canvas panes can be docked into
every possible area of Script Canvas main window.
Expected Behavior:
The pane docks successfully.
Test Steps:
1) Open Script Canvas window (Tools > Script Canvas)
2) Make sure Node Palette pane is opened
3) Dock the Node Palette pane into every possible area of main window
4) Restore default layout
5) Close Script Canvas window
Note:
- This test file must be called from the Lumberyard 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
"""
# Helper imports
import ImportPathHelper as imports
imports.init()
from utils import Report
from utils import TestHelper as helper
import pyside_utils
# Lumberyard imports
import azlmbr.legacy.general as general
# Pyside imports
from PySide2 import QtCore, QtWidgets
from PySide2.QtCore import Qt
PANE_WIDGET = "NodePalette" # Chosen most commonly used pane
DOCKAREAS = [Qt.TopDockWidgetArea, Qt.BottomDockWidgetArea, Qt.RightDockWidgetArea, Qt.LeftDockWidgetArea]
DOCKED = True
def click_menu_option(window, option_text):
action = pyside_utils.find_child_by_pattern(window, {"text": option_text, "type": QtWidgets.QAction})
action.trigger()
def find_pane(window, pane_name):
return window.findChild(QtWidgets.QDockWidget, pane_name)
# Test starts here
general.idle_enable(True)
# 1) Open Script Canvas window (Tools > Script Canvas)
general.open_pane("Script Canvas")
is_sc_visible = helper.wait_for_condition(lambda: general.is_pane_visible("Script Canvas"), 5.0)
Report.result(Tests.open_sc_window, is_sc_visible)
# 2) Make sure Node Palette pane is opened
editor_window = pyside_utils.get_editor_main_window()
sc = editor_window.findChild(QtWidgets.QDockWidget, "Script Canvas")
sc_main = sc.findChild(QtWidgets.QMainWindow)
pane = find_pane(sc_main, PANE_WIDGET)
if not pane.isVisible():
click_menu_option(sc, "Node Palette")
pane = find_pane(sc_main, PANE_WIDGET) # New reference
Report.result(Tests.pane_opened, pane.isVisible())
# 3) Dock the Node Palette pane into every possible area of main window
for area in DOCKAREAS:
sc_main.addDockWidget(area, find_pane(sc_main, PANE_WIDGET), QtCore.Qt.Vertical)
if not (sc_main.dockWidgetArea(find_pane(sc_main, PANE_WIDGET)) == area):
Report.info(f"Failed to dock into {str(area)}")
DOCKED = DOCKED and (sc_main.dockWidgetArea(find_pane(sc_main, PANE_WIDGET)) == area)
Report.result(Tests.dock_pane, DOCKED)
# 4) Restore default layout
# Need this step to restore to default in case of test failure
click_menu_option(sc, "Restore Default Layout")
# 5) Close Script Canvas window
sc.close()
if __name__ == "__main__":
import ImportPathHelper as imports
imports.init()
from utils import Report
Report.start_test(Docking_Pane)
@@ -0,0 +1,16 @@
"""
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.
"""
def init():
import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../automatedtesting_shared')
@@ -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: 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
"""
# fmt: off
class Tests():
open_sc_window = ("Script Canvas window is opened", "Failed to open Script Canvas window")
default_visible = ("All the panes visible by default", "One or more panes do not visible by default")
open_panes = ("All the Panes opened successfully", "Failed to open one or more panes")
close_pane = ("All the Panes closed successfully", "Failed to close one or more panes")
# fmt: on
def Opening_Closing_Pane():
"""
Summary:
The Script Canvas window is opened to verify if Script canvas panes can be opened and closed.
Expected Behavior:
The pane opens and closes successfully.
Test Steps:
1) Open Script Canvas window (Tools > Script Canvas)
2) Restore default layout
3) Verify if panes were opened by default
4) Close the opened panes
5) Open Script Canvas panes (Tools > <pane>)
6) Restore default layout
7) Close Script Canvas window
Note:
- This test file must be called from the Lumberyard 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
"""
# Helper imports
import ImportPathHelper as imports
imports.init()
from utils import Report
from utils import TestHelper as helper
import pyside_utils
# Lumberyard Imports
import azlmbr.legacy.general as general
# Pyside imports
from PySide2 import QtWidgets
PANE_WIDGETS = ("NodePalette", "VariableManager")
def click_menu_option(window, option_text):
action = pyside_utils.find_child_by_pattern(window, {"text": option_text, "type": QtWidgets.QAction})
action.trigger()
def find_pane(window, pane_name):
return window.findChild(QtWidgets.QDockWidget, pane_name)
def is_pane_visible(window, pane_name):
pane = find_pane(window, pane_name)
return pane.isVisible()
# Test starts here
general.idle_enable(True)
# 1) Open Script Canvas window (Tools > Script Canvas)
general.open_pane("Script Canvas")
is_sc_visible = helper.wait_for_condition(lambda: general.is_pane_visible("Script Canvas"), 5.0)
Report.result(Tests.open_sc_window, is_sc_visible)
# 2) Restore default layout
editor_window = pyside_utils.get_editor_main_window()
sc = editor_window.findChild(QtWidgets.QDockWidget, "Script Canvas")
click_menu_option(sc, "Restore Default Layout")
# 3) Verify if panes were opened by default
PANES_VISIBLE = all(is_pane_visible(sc, pane) for pane in PANE_WIDGETS)
Report.critical_result(Tests.default_visible, PANES_VISIBLE)
# 4) Close the opened panes
for item in PANE_WIDGETS:
pane = sc.findChild(QtWidgets.QDockWidget, item)
pane.close()
if pane.isVisible():
Report.info(f"Failed to close pane : {item}")
PANES_VISIBLE = any(is_pane_visible(sc, pane) for pane in PANE_WIDGETS)
Report.result(Tests.close_pane, not PANES_VISIBLE)
# 5) Open Script Canvas panes (Tools > <pane>)
click_menu_option(sc, "Node Palette")
click_menu_option(sc, "Variable Manager")
PANES_VISIBLE = helper.wait_for_condition(lambda: all(is_pane_visible(sc, pane) for pane in PANE_WIDGETS), 2.0)
Report.result(Tests.open_panes, PANES_VISIBLE)
# 6) Restore default layout
# Needed this step to restore to default in case of test failure
click_menu_option(sc, "Restore Default Layout")
# 7) Close Script Canvas window
sc.close()
if __name__ == "__main__":
import ImportPathHelper as imports
imports.init()
from utils import Report
Report.start_test(Opening_Closing_Pane)
@@ -0,0 +1,120 @@
"""
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: C1702829
Test Case Title: Resizing pane
URLs of the test case: https://testrail.agscollab.com/index.php?/cases/view/1702829
"""
# fmt: off
class Tests():
open_sc_window = ("Script Canvas window is opened", "Failed to open Script Canvas window")
open_pane = ("Pane opened successfully", "Failed to open pane")
resize_pane = ("Pane window resized successfully", "Failed to resize pane window")
# fmt: on
def Resizing_Pane():
"""
Summary:
The Script Canvas window is opened to verify if Script canvas panes can be resized and scaled
Expected Behavior:
The pane is resized and scaled appropriately.
Test Steps:
1) Open Script Canvas window (Tools > Script Canvas)
2) Restore default layout
3) Make sure pane is opened
4) Resize pane
5) Restore default layout
6) Close Script Canvas window
Note:
- This test file must be called from the Lumberyard 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
"""
# Helper imports
import ImportPathHelper as imports
imports.init()
from utils import Report
from utils import TestHelper as helper
import pyside_utils
# Lumberyard imports
import azlmbr.legacy.general as general
# Pyside imports
from PySide2 import QtWidgets
PANE_WIDGET = "NodePalette"
SCALE_INT = 10
def click_menu_option(window, option_text):
action = pyside_utils.find_child_by_pattern(window, {"text": option_text, "type": QtWidgets.QAction})
action.trigger()
def find_pane(window, pane_name):
return window.findChild(QtWidgets.QDockWidget, pane_name)
# Test starts here
general.idle_enable(True)
# 1) Open Script Canvas window (Tools > Script Canvas)
general.open_pane("Script Canvas")
is_sc_visible = helper.wait_for_condition(lambda: general.is_pane_visible("Script Canvas"), 5.0)
Report.result(Tests.open_sc_window, is_sc_visible)
# 2) Restore default layout
editor_window = pyside_utils.get_editor_main_window()
sc = editor_window.findChild(QtWidgets.QDockWidget, "Script Canvas")
click_menu_option(sc, "Restore Default Layout")
# 3) Make sure pane is opened
editor_window = pyside_utils.get_editor_main_window()
sc = editor_window.findChild(QtWidgets.QDockWidget, "Script Canvas")
pane = find_pane(sc, PANE_WIDGET)
if not pane.isVisible():
click_menu_option(sc, "Node Palette")
pane = find_pane(sc, PANE_WIDGET) # New reference
Report.result(Tests.open_pane, pane.isVisible())
# 4) Resize pane
initial_size = pane.frameSize()
pane.resize(initial_size.width() + SCALE_INT, initial_size.height() + SCALE_INT)
new_size = pane.frameSize()
test_success = (
abs(initial_size.width() - new_size.width()) == abs(initial_size.height() - new_size.height()) == SCALE_INT
)
Report.result(Tests.resize_pane, test_success)
# 5) Restore default layout
# Needed this step to restore to default in case of test failure
click_menu_option(sc, "Restore Default Layout")
# 6) Close Script Canvas window
sc.close()
if __name__ == "__main__":
import ImportPathHelper as imports
imports.init()
from utils import Report
Report.start_test(Resizing_Pane)
@@ -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.
"""
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 test_Opening_Closing_Pane(self, request, workspace, editor, launcher_platform):
from . import Opening_Closing_Pane as test_module
self._run_test(request, workspace, editor, test_module)
def test_Docking_Pane(self, request, workspace, editor, launcher_platform):
from . import Docking_Pane as test_module
self._run_test(request, workspace, editor, test_module)
def test_Resizing_Pane(self, request, workspace, editor, launcher_platform):
from . import Resizing_Pane as test_module
self._run_test(request, workspace, editor, test_module)
@@ -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.
"""