diff options
author | Robert Löhning <robert.loehning@qt.io> | 2022-10-21 22:09:53 +0200 |
---|---|---|
committer | Robert Löhning <robert.loehning@qt.io> | 2022-10-26 10:40:58 +0000 |
commit | 1c5e65f547759b6af009133e2509286fd788cfd4 (patch) | |
tree | 62136197fd5c42c8f1e19581d590442dbaa4006d | |
parent | 5bb883e7b807db667edbd6f0c0fa5a72f42c29fb (diff) |
Squish: Move installation specific code to separate file
Change-Id: I5825314625f97120e05975611fb9f31f92456dba
Reviewed-by: Miguel Costa <miguel.costa@qt.io>
6 files changed, 87 insertions, 54 deletions
diff --git a/Tests/system/shared/utils.py b/Tests/system/shared/utils.py index a7f4756d..347c5ea8 100644 --- a/Tests/system/shared/utils.py +++ b/Tests/system/shared/utils.py @@ -50,60 +50,6 @@ def startAppGetVersion(): return version -def openExtensionManager(version): - if version == "2017": - mouseClick(waitForObject(names.tools_MenuItem)) - mouseClick(waitForObject(names.pART_Popup_Extensions_and_Updates_MenuItem)) - else: - mouseClick(waitForObject(names.extensions_MenuItem)) - mouseClick(waitForObject(names.pART_Popup_Manage_Extensions_MenuItem)) - - -def selectInstalledVsTools(version): - openExtensionManager(version) - if version == "2017": - try: - vsToolsLabel = waitForObject(names.extensionManager_UI_InstalledExtItem_Qt_2017_Label, - 5000) - except: - return None - else: - mouseClick(waitForObject({"type": "TreeItem", "id": "Installed"})) - try: - vsToolsLabel = waitForObject(names.extensionManager_UI_InstalledExtItem_Qt_Label, - 5000) - except: - return None - mouseClick(vsToolsLabel) - return vsToolsLabel.text - - -def changesScheduledLabelExists(): - return object.exists(names.changes_scheduled_Label) - - -def readExpectedVsToolsVersion(): - expectedVersion = os.getenv("SQUISH_VSTOOLS_VERSION") - if expectedVersion: - return expectedVersion - test.warning("No expected Qt VS Tools version set.", - "The environment variable SQUISH_VSTOOLS_VERSION is not set. Falling back to " - "reading the expected version from version.targets") - try: - versionXml = minidom.parse("../../../../version.targets") - return versionXml.getElementsByTagName("QtVSToolsVersion")[0].firstChild.data - except: - test.fatal("Can't read expected VS Tools version from sources.") - return "" - - -def verifyVsToolsVersion(): - displayedVersion = waitForObjectExists(names.manage_Extensions_Version_Label).text - expectedVersion = readExpectedVsToolsVersion() - test.compare(displayedVersion, expectedVersion, - "Expected version of VS Tools is displayed?") - - def openVsToolsMenu(version): if version == "2017": mouseClick(waitForObject(names.qt_VS_Tools_MenuItem, 5000)) diff --git a/Tests/system/suite_installation/shared/scripts/install_utils.py b/Tests/system/suite_installation/shared/scripts/install_utils.py new file mode 100644 index 00000000..4dbe621f --- /dev/null +++ b/Tests/system/suite_installation/shared/scripts/install_utils.py @@ -0,0 +1,83 @@ +############################################################################ +# +# Copyright (C) 2022 The Qt Company Ltd. +# Contact: https://www.qt.io/licensing/ +# +# This file is part of the Qt VS Tools. +# +# $QT_BEGIN_LICENSE:GPL-EXCEPT$ +# Commercial License Usage +# Licensees holding valid commercial Qt licenses may use this file in +# accordance with the commercial license agreement provided with the +# Software or, alternatively, in accordance with the terms contained in +# a written agreement between you and The Qt Company. For licensing terms +# and conditions see https://www.qt.io/terms-conditions. For further +# information use the contact form at https://www.qt.io/contact-us. +# +# GNU General Public License Usage +# Alternatively, this file may be used under the terms of the GNU +# General Public License version 3 as published by the Free Software +# Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +# included in the packaging of this file. Please review the following +# information to ensure the GNU General Public License requirements will +# be met: https://www.gnu.org/licenses/gpl-3.0.html. +# +# $QT_END_LICENSE$ +# +############################################################################ + +# -*- coding: utf-8 -*- + + +def openExtensionManager(version): + if version == "2017": + mouseClick(waitForObject(names.tools_MenuItem)) + mouseClick(waitForObject(names.pART_Popup_Extensions_and_Updates_MenuItem)) + else: + mouseClick(waitForObject(names.extensions_MenuItem)) + mouseClick(waitForObject(names.pART_Popup_Manage_Extensions_MenuItem)) + + +def selectInstalledVsTools(version): + openExtensionManager(version) + if version == "2017": + try: + vsToolsLabel = waitForObject(names.extensionManager_UI_InstalledExtItem_Qt_2017_Label, + 5000) + except: + return None + else: + mouseClick(waitForObject({"type": "TreeItem", "id": "Installed"})) + try: + vsToolsLabel = waitForObject(names.extensionManager_UI_InstalledExtItem_Qt_Label, + 5000) + except: + return None + mouseClick(vsToolsLabel) + return vsToolsLabel.text + + +def changesScheduledLabelExists(): + return object.exists(names.changes_scheduled_Label) + + +def readExpectedVsToolsVersion(): + expectedVersion = os.getenv("SQUISH_VSTOOLS_VERSION") + if expectedVersion: + return expectedVersion + test.warning("No expected Qt VS Tools version set.", + "The environment variable SQUISH_VSTOOLS_VERSION is not set. Falling back to " + "reading the expected version from version.targets") + try: + versionXml = minidom.parse("../../../../version.targets") + return versionXml.getElementsByTagName("QtVSToolsVersion")[0].firstChild.data + except: + test.fatal("Can't read expected VS Tools version from sources.") + return "" + + +def verifyVsToolsVersion(): + displayedVersion = waitForObjectExists(names.manage_Extensions_Version_Label).text + expectedVersion = readExpectedVsToolsVersion() + test.compare(displayedVersion, expectedVersion, + "Expected version of VS Tools is displayed?") diff --git a/Tests/system/suite_installation/tst_install_from_marketplace/test.py b/Tests/system/suite_installation/tst_install_from_marketplace/test.py index c0d20d31..b3bf40ca 100644 --- a/Tests/system/suite_installation/tst_install_from_marketplace/test.py +++ b/Tests/system/suite_installation/tst_install_from_marketplace/test.py @@ -29,6 +29,7 @@ # -*- coding: utf-8 -*- source("../../shared/utils.py") +source("../shared/scripts/install_utils.py") import names diff --git a/Tests/system/suite_installation/tst_install_verify/test.py b/Tests/system/suite_installation/tst_install_verify/test.py index 281264bf..bc93734a 100644 --- a/Tests/system/suite_installation/tst_install_verify/test.py +++ b/Tests/system/suite_installation/tst_install_verify/test.py @@ -29,6 +29,7 @@ # -*- coding: utf-8 -*- source("../../shared/utils.py") +source("../shared/scripts/install_utils.py") import names diff --git a/Tests/system/suite_installation/tst_uninstall/test.py b/Tests/system/suite_installation/tst_uninstall/test.py index 0eefef9f..70c0fb69 100644 --- a/Tests/system/suite_installation/tst_uninstall/test.py +++ b/Tests/system/suite_installation/tst_uninstall/test.py @@ -29,6 +29,7 @@ # -*- coding: utf-8 -*- source("../../shared/utils.py") +source("../shared/scripts/install_utils.py") import names diff --git a/Tests/system/suite_installation/tst_uninstall_verify/test.py b/Tests/system/suite_installation/tst_uninstall_verify/test.py index 3ef33ae5..79c50251 100644 --- a/Tests/system/suite_installation/tst_uninstall_verify/test.py +++ b/Tests/system/suite_installation/tst_uninstall_verify/test.py @@ -29,6 +29,7 @@ # -*- coding: utf-8 -*- source("../../shared/utils.py") +source("../shared/scripts/install_utils.py") import names |