aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Löhning <robert.loehning@qt.io>2022-10-10 21:42:47 +0200
committerRobert Löhning <robert.loehning@qt.io>2022-10-18 10:02:45 +0000
commitac0d2d2da6f2c930e8d783b507bcc90aeadab7d5 (patch)
treef789f56314d7b89512ada7aa523905168fac2a5b
parent0da7e59bbb6496bab86e8c6a15557571465d6c33 (diff)
Squish: Test uninstalling Qt VS Tools
Change-Id: Ibd4bf148ade403a431d91d39debe6827f4cda909 Reviewed-by: Miguel Costa <miguel.costa@qt.io>
-rw-r--r--Tests/system/Readme.txt11
-rw-r--r--Tests/system/shared/utils.py15
-rw-r--r--Tests/system/suite_installation/shared/scripts/names.py3
-rw-r--r--Tests/system/suite_installation/suite.conf2
-rw-r--r--Tests/system/suite_installation/tst_install_from_marketplace/test.py4
-rw-r--r--Tests/system/suite_installation/tst_install_verify/test.py20
-rw-r--r--Tests/system/suite_installation/tst_uninstall/test.py57
7 files changed, 87 insertions, 25 deletions
diff --git a/Tests/system/Readme.txt b/Tests/system/Readme.txt
index 64fefc11..93d931d7 100644
--- a/Tests/system/Readme.txt
+++ b/Tests/system/Readme.txt
@@ -1,11 +1,12 @@
This directory contains tests for The Qt VS Tools to be run with Squish.
To run these tests:
-1. Have Visual Studio with English language pack and Qt VS Tools installed.
-2 Have Visual Studio's tool vswhere.exe in PATH.
-3. Open at least one of the test suites (suite.conf) in Squish for Windows.
-4. In "Test Suite Settings", select devenv.exe as AUT.
-5. Run individual tests or the entire test suite.
+1. Run Windows with English or German UI.
+2. Have Visual Studio with English language pack and Qt VS Tools installed.
+3. Have Visual Studio's tool vswhere.exe in PATH.
+4. Open at least one of the test suites (suite.conf) in Squish for Windows.
+5. In "Test Suite Settings", select devenv.exe as AUT.
+6. Run individual tests or the entire test suite.
Please note: The tests will run in your normal working environment. Settings you made may influence
the tests and vice versa.
diff --git a/Tests/system/shared/utils.py b/Tests/system/shared/utils.py
index 9d7dd357..57a841ae 100644
--- a/Tests/system/shared/utils.py
+++ b/Tests/system/shared/utils.py
@@ -59,6 +59,21 @@ def openExtensionManager(version):
mouseClick(waitForObject(names.pART_Popup_Manage_Extensions_MenuItem))
+def selectInstalledVsTools(version):
+ openExtensionManager(version)
+ if version == "2017":
+ vsToolsLabel = waitForObject(names.extensionManager_UI_InstalledExtensionItem_The_Qt_VS_Tools_for_Visual_Studio_2017_Label)
+ else:
+ mouseClick(waitForObject({"type": "TreeItem", "id": "Installed"}))
+ vsToolsLabel = waitForObject(names.extensionManager_UI_InstalledExtensionItem_The_Qt_VS_Tools_for_Visual_Studio_2019_Label)
+ mouseClick(vsToolsLabel)
+ return vsToolsLabel.text
+
+
+def changesScheduledLabelExists():
+ return object.exists(names.changes_scheduled_Label)
+
+
def readExpectedVsToolsVersion():
try:
versionXml = minidom.parse("../../../../version.targets")
diff --git a/Tests/system/suite_installation/shared/scripts/names.py b/Tests/system/suite_installation/shared/scripts/names.py
index 4fe93166..2868cbed 100644
--- a/Tests/system/suite_installation/shared/scripts/names.py
+++ b/Tests/system/suite_installation/shared/scripts/names.py
@@ -59,3 +59,6 @@ o_Extensions_Edit = {"container": manage_Extensions_Window, "type": "Edit"}
lvw_Extensions_Microsoft_VisualStudio_ExtensionManager_UI_OnlineExtensionItem_ListViewItem = {"container": extensions_and_Updates_lvw_Extensions_ListView, "text": "Microsoft.VisualStudio.ExtensionManager.UI.OnlineExtensionItem", "type": "ListViewItem"}
OnlineExtensionItem_Download_Button = {"container": lvw_Extensions_Microsoft_VisualStudio_ExtensionManager_UI_OnlineExtensionItem_ListViewItem, "text": "Download", "type": "Button"}
changes_scheduled_Label = {"container": manage_Extensions_Window, "text": "Your changes will be scheduled.  The modifications will begin when all Microsoft Visual Studio windows are closed.", "type": "Label"}
+microsoft_VisualStudio_ExtensionManager_UI_InstalledExtensionItem_Uninstall_Label = {"container": lvw_Extensions_Microsoft_VisualStudio_ExtensionManager_UI_InstalledExtensionItem_ListViewItem, "text": "_Uninstall", "type": "Label"}
+microsoft_Visual_Studio_Dialog = {"text": "Microsoft Visual Studio", "type": "Dialog"}
+microsoft_Visual_Studio_Yes_Button= {"container": microsoft_Visual_Studio_Dialog, "text": RegularExpression("Yes|Ja"), "type": "Button"}
diff --git a/Tests/system/suite_installation/suite.conf b/Tests/system/suite_installation/suite.conf
index 5fb7f100..f9a18d18 100644
--- a/Tests/system/suite_installation/suite.conf
+++ b/Tests/system/suite_installation/suite.conf
@@ -3,6 +3,6 @@ ENVVARS=envvars
IMPLICITAUTSTART=0
LANGUAGE=Python
OBJECTMAPSTYLE=script
-TEST_CASES=tst_install_from_marketplace tst_install_verify
+TEST_CASES=tst_install_from_marketplace tst_install_verify tst_uninstall
VERSION=3
WRAPPERS=Windows
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 51d18639..8829e9c2 100644
--- a/Tests/system/suite_installation/tst_install_from_marketplace/test.py
+++ b/Tests/system/suite_installation/tst_install_from_marketplace/test.py
@@ -48,10 +48,6 @@ def main():
def downloadQtVsTools(version):
-
- def changesScheduledLabelExists():
- return object.exists(names.changes_scheduled_Label)
-
openExtensionManager(version)
mouseClick(waitForObjectItem(names.o_Extensions_ProvidersTree_Tree, "Online"))
mouseClick(waitForObjectItem(names.providersTree_Online_TreeItem, "Visual Studio Marketplace"))
diff --git a/Tests/system/suite_installation/tst_install_verify/test.py b/Tests/system/suite_installation/tst_install_verify/test.py
index 6ffa385a..98a7b646 100644
--- a/Tests/system/suite_installation/tst_install_verify/test.py
+++ b/Tests/system/suite_installation/tst_install_verify/test.py
@@ -38,8 +38,11 @@ def main():
if not version:
return
checkVSVersion(version)
- openExtensionManager(version)
- checkVsToolsVersion(version)
+ vsToolsLabelText = selectInstalledVsTools(version)
+ test.verify(vsToolsLabelText.startswith("The Qt VS Tools for Visual Studio " + version),
+ "Are these 'Qt VS Tools for Visual Studio %s' as expected? Found:\n%s"
+ % (version, vsToolsLabelText))
+ verifyVsToolsVersion()
closeAllWindows()
@@ -55,19 +58,6 @@ def checkVSVersion(version):
clickButton(waitForObject(names.o_Microsoft_Visual_Studio_OK_Button))
-def checkVsToolsVersion(version):
- if version == "2017":
- vsToolsLabel = waitForObject(names.extensionManager_UI_InstalledExtensionItem_The_Qt_VS_Tools_for_Visual_Studio_2017_Label)
- else:
- mouseClick(waitForObject({"type": "TreeItem", "id": "Installed"}))
- vsToolsLabel = waitForObject(names.extensionManager_UI_InstalledExtensionItem_The_Qt_VS_Tools_for_Visual_Studio_2019_Label)
- mouseClick(vsToolsLabel)
- test.verify(vsToolsLabel.text.startswith("The Qt VS Tools for Visual Studio " + version),
- "Are these 'Qt VS Tools for Visual Studio %s' as expected? Found:\n%s"
- % (version, vsToolsLabel.text))
- verifyVsToolsVersion()
-
-
def closeAllWindows():
clickButton(waitForObject(names.manage_Extensions_Close_Button))
closeMainWindow()
diff --git a/Tests/system/suite_installation/tst_uninstall/test.py b/Tests/system/suite_installation/tst_uninstall/test.py
new file mode 100644
index 00000000..897d3869
--- /dev/null
+++ b/Tests/system/suite_installation/tst_uninstall/test.py
@@ -0,0 +1,57 @@
+############################################################################
+#
+# 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 -*-
+
+source("../../shared/utils.py")
+
+import names
+
+
+def main():
+ test.warning("This is a semi-manual test.",
+ "It is designed to run on VS with Qt VS Tools installed "
+ "and requires manual steps.")
+ version = startAppGetVersion()
+ if not version:
+ return
+ if uninstallQtVsTools(version):
+ test.warning("If the test succeeded so far, it now requires manual steps.",
+ "Please finish the steps of the VSIX Installer wizard which should have "
+ "appeared. After this, you can run tst_uninstall_verify to verify the result.")
+ closeMainWindow()
+
+
+def uninstallQtVsTools(version):
+ selectInstalledVsTools(version)
+ mouseClick(waitForObject(names.microsoft_VisualStudio_ExtensionManager_UI_InstalledExtensionItem_Uninstall_Label))
+ clickButton(waitForObject(names.microsoft_Visual_Studio_Yes_Button))
+ test.verify(waitFor(changesScheduledLabelExists, 5000),
+ "Were changes to the installation scheduled?")
+ clickButton(waitForObject(names.manage_Extensions_Close_Button))
+ return True