aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Löhning <robert.loehning@qt.io>2022-05-23 21:21:08 +0200
committerRobert Löhning <robert.loehning@qt.io>2022-09-12 11:35:55 +0000
commita3f9d943a5831aa1092b4f0ec7b11321aa382f92 (patch)
tree08d1dda5504558e38e320084c60bcc70296734fb
parent0769d945f8d0040917d654d9731e6b65951e102c (diff)
tests: Add first Squish test
Change-Id: I7dd9f590f66100ac2ecf2930417c9b6e3a991c9b Reviewed-by: Miguel Costa <miguel.costa@qt.io>
-rw-r--r--Tests/system/Readme.txt11
-rw-r--r--Tests/system/suite_proofofconcept/shared/scripts/names.py55
-rw-r--r--Tests/system/suite_proofofconcept/suite.conf8
-rw-r--r--Tests/system/suite_proofofconcept/tst_check_version/test.py114
4 files changed, 188 insertions, 0 deletions
diff --git a/Tests/system/Readme.txt b/Tests/system/Readme.txt
new file mode 100644
index 00000000..64fefc11
--- /dev/null
+++ b/Tests/system/Readme.txt
@@ -0,0 +1,11 @@
+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.
+
+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/suite_proofofconcept/shared/scripts/names.py b/Tests/system/suite_proofofconcept/shared/scripts/names.py
new file mode 100644
index 00000000..ffdd76f7
--- /dev/null
+++ b/Tests/system/suite_proofofconcept/shared/scripts/names.py
@@ -0,0 +1,55 @@
+############################################################################
+#
+# 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$
+#
+############################################################################
+
+# encoding: UTF-8
+
+from objectmaphelper import *
+microsoft_Visual_Studio_Window = {"text": Wildcard("*Microsoft Visual Studio"), "type": "Window"}
+continueWithoutCode_Label = {"container": microsoft_Visual_Studio_Window, "text": "System.Windows.Controls.AccessText Microsoft.VisualStudio.Imaging.CrispImage", "type": "Label"}
+microsoft_Visual_Studio_MenuBar = {"container": microsoft_Visual_Studio_Window, "type": "MenuBar"}
+extensions_MenuItem = {"container": microsoft_Visual_Studio_MenuBar, "text": "Extensions", "type": "MenuItem"}
+pART_Popup_Popup = {"id": "", "name": "PART_Popup", "type": "Popup"}
+pART_Popup_Manage_Extensions_MenuItem = {"container": pART_Popup_Popup, "text": "Manage Extensions", "type": "MenuItem"}
+manage_Extensions_Window = {"text": Wildcard("*Extensions*"), "type": "Window"}
+extensionManager_UI_InstalledExtensionItem_The_Qt_VS_Tools_for_Visual_Studio_2019_Label = {"text": Wildcard("The Qt VS Tools for Visual Studio *"), "type": "Label"}
+manage_Extensions_Close_Button = {"container": manage_Extensions_Window, "text": "Close", "type": "Button"}
+file_MenuItem = {"container": microsoft_Visual_Studio_MenuBar, "text": "File", "type": "MenuItem"}
+pART_Popup_Exit_MenuItem = {"container": pART_Popup_Popup, "text": "Exit", "type": "MenuItem"}
+tools_MenuItem = {"container": microsoft_Visual_Studio_MenuBar, "text": "Tools", "type": "MenuItem"}
+pART_Popup_Extensions_and_Updates_MenuItem = {"container": pART_Popup_Popup, "text": "Extensions and Updates...", "type": "MenuItem"}
+extensions_and_Updates_lvw_Extensions_ListView = {"container": manage_Extensions_Window, "name": "lvw_Extensions", "type": "ListView"}
+lvw_Extensions_Microsoft_VisualStudio_ExtensionManager_UI_InstalledExtensionItem_ListViewItem = {"container": extensions_and_Updates_lvw_Extensions_ListView, "text": "Microsoft.VisualStudio.ExtensionManager.UI.InstalledExtensionItem", "type": "ListViewItem"}
+extensionManager_UI_InstalledExtensionItem_The_Qt_VS_Tools_for_Visual_Studio_2017_Label = {"container": lvw_Extensions_Microsoft_VisualStudio_ExtensionManager_UI_InstalledExtensionItem_ListViewItem, "text": Wildcard("The Qt VS Tools for Visual Studio *"), "type": "Label"}
+extensions_and_Updates_Version_Label = {"container": manage_Extensions_Window, "text": "Version:", "type": "Label"}
+manage_Extensions_Version_Label = {"leftObject": extensions_and_Updates_Version_Label, "type": "Label"}
+help_MenuItem = {"container": microsoft_Visual_Studio_MenuBar, "text": "Help", "type": "MenuItem"}
+pART_Popup_About_Microsoft_Visual_Studio_MenuItem = {"container": pART_Popup_Popup, "text": "About Microsoft Visual Studio", "type": "MenuItem"}
+o_Microsoft_Visual_Studio_OK_Button = {"container": microsoft_Visual_Studio_Window, "text": "OK", "type": "Button"}
+about_Microsoft_Visual_Studio_Window = {"text": "About Microsoft Visual Studio", "type": "Window"}
+about_Microsoft_Visual_Studio_Microsoft_Visual_Studio_Community_2017_Label = {"container": about_Microsoft_Visual_Studio_Window, "text": Wildcard("Microsoft Visual Studio *"), "type": "Label"}
+about_Microsoft_Visual_Studio_Edit = {"container": about_Microsoft_Visual_Studio_Window, "type": "Edit"}
diff --git a/Tests/system/suite_proofofconcept/suite.conf b/Tests/system/suite_proofofconcept/suite.conf
new file mode 100644
index 00000000..4678d8e9
--- /dev/null
+++ b/Tests/system/suite_proofofconcept/suite.conf
@@ -0,0 +1,8 @@
+AUT=devenv
+ENVVARS=envvars
+IMPLICITAUTSTART=0
+LANGUAGE=Python
+OBJECTMAPSTYLE=script
+TEST_CASES=tst_check_version
+VERSION=3
+WRAPPERS=Windows
diff --git a/Tests/system/suite_proofofconcept/tst_check_version/test.py b/Tests/system/suite_proofofconcept/tst_check_version/test.py
new file mode 100644
index 00000000..fbe5bb6e
--- /dev/null
+++ b/Tests/system/suite_proofofconcept/tst_check_version/test.py
@@ -0,0 +1,114 @@
+############################################################################
+#
+# 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 -*-
+
+import names
+import os
+import subprocess
+from xml.dom import minidom
+
+
+def main():
+ version = startAppGetVersion()
+ if not version:
+ return
+ checkVSVersion(version)
+ openExtensionManager(version)
+ checkVsToolsVersion(version)
+ closeAllWindows()
+
+
+def startAppGetVersion():
+ appContext = startApplication("devenv /LCID 1033")
+ try:
+ vsDirectory = appContext.commandLine.strip('"').partition("\\Common7")[0]
+ programFilesDir = os.getenv("ProgramFiles(x86)")
+ plv = subprocess.check_output('"%s/Microsoft Visual Studio/Installer/vswhere.exe" '
+ '-path "%s" -property catalog_productLineVersion'
+ % (programFilesDir, vsDirectory))
+ version = str(plv).strip("b'\\rn\r\n")
+ except:
+ test.fatal("Cannot determine used VS version")
+ version = ""
+ if version == "2019":
+ mouseClick(waitForObject(names.continueWithoutCode_Label))
+ return version
+
+
+def checkVSVersion(version):
+ mouseClick(waitForObject(names.help_MenuItem))
+ mouseClick(waitForObject(names.pART_Popup_About_Microsoft_Visual_Studio_MenuItem))
+ if version == "2017":
+ vsVersionText = waitForObjectExists(names.about_Microsoft_Visual_Studio_Microsoft_Visual_Studio_Community_2017_Label).text
+ elif version == "2019":
+ vsVersionText = waitForObjectExists(names.about_Microsoft_Visual_Studio_Edit).text
+ test.verify(version in vsVersionText,
+ "Is this VS %s as expected? Found:\n%s" % (version, vsVersionText))
+ clickButton(waitForObject(names.o_Microsoft_Visual_Studio_OK_Button))
+
+
+def openExtensionManager(version):
+ if version == "2017":
+ mouseClick(waitForObject(names.tools_MenuItem))
+ mouseClick(waitForObject(names.pART_Popup_Extensions_and_Updates_MenuItem))
+ elif version == "2019":
+ mouseClick(waitForObject(names.extensions_MenuItem))
+ mouseClick(waitForObject(names.pART_Popup_Manage_Extensions_MenuItem))
+
+
+def readVsToolsVersionFromSource():
+ 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 checkVsToolsVersion(version):
+ if version == "2017":
+ vsToolsLabel = waitForObject(names.extensionManager_UI_InstalledExtensionItem_The_Qt_VS_Tools_for_Visual_Studio_2017_Label)
+ elif version == "2019":
+ 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))
+ displayedVersion = waitForObjectExists(names.manage_Extensions_Version_Label).text
+ expectedVersion = readVsToolsVersionFromSource()
+ test.verify(expectedVersion and displayedVersion.startswith(expectedVersion),
+ "Expected version of VS Tools is displayed? Displayed: %s, Expected: %s"
+ % (displayedVersion, expectedVersion))
+
+
+def closeAllWindows():
+ clickButton(waitForObject(names.manage_Extensions_Close_Button))
+ mouseClick(waitForObject(names.file_MenuItem))
+ mouseClick(waitForObject(names.pART_Popup_Exit_MenuItem))