diff options
Diffstat (limited to 'packaging-tools/squish_suites')
8 files changed, 362 insertions, 0 deletions
diff --git a/packaging-tools/squish_suites/shared/__init__.py b/packaging-tools/squish_suites/shared/__init__.py new file mode 100644 index 000000000..90e6df838 --- /dev/null +++ b/packaging-tools/squish_suites/shared/__init__.py @@ -0,0 +1,2 @@ +# This file makes python to treat this directory as package +# As Package file can be imported using import statement diff --git a/packaging-tools/squish_suites/shared/shared.py b/packaging-tools/squish_suites/shared/shared.py new file mode 100644 index 000000000..fabd46636 --- /dev/null +++ b/packaging-tools/squish_suites/shared/shared.py @@ -0,0 +1,85 @@ +########################################################################### +## +## Copyright (C) 2018 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the Qt Installer Framework. +## +## $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$ +## +########################################################################### +import os +import sys +import shlex +import subprocess +import test +import testData +import object +import objectMap +import squishinfo +import squish +import squish_module_helper + +def add_attachable_aut(name="teest",port=11233): + test.log("Adding attachable aut to autlist") + squish_module_helper.import_squish_symbols() + if sys.platform.startswith("win"): + subprocess.Popen([os.path.join(os.environ["SQUISH_PREFIX"], 'bin', 'squishserver.exe'), '--config', 'addAttachableAUT', name, str(port)]) + else: + subprocess.Popen([os.path.join(os.environ["SQUISH_PREFIX"], 'bin', 'squishserver'), '--config', 'addAttachableAUT', name, str(port)]) + +def attach_to_aut(application_folder_path, + executable, + arguments_for_aut = "--uses-builtin-hook", + squish_path = os.path.join(os.environ["SQUISH_PREFIX"])): + + squish_module_helper.import_squish_symbols() + start_aut_bin = os.path.join(squish_path, "bin", "startaut") + if sys.platform.startswith("win"): + executable += ".exe" + start_aut_bin += ".exe" + application_under_test = os.path.join(application_folder_path, executable) + # builds absolute path to testable application + test.log("Application under test: " + str(application_folder_path)+"/"+executable) + test.log(str(start_aut_bin)) + if sys.platform.startswith("win"): + start_aut_bin = start_aut_bin.replace("\\", "\\\\") + application_under_test = application_under_test.replace("\\", "\\\\") + start_aut_cmd = " ".join([start_aut_bin,arguments_for_aut,application_under_test]) # creates string for launching aut + start_aut_cmd = shlex.split(start_aut_cmd) # Converts launch string to list as needed by Unix; Windows can use string or list. + test.log("Subprocess call arguments", ' '.join(start_aut_cmd)) + test.log(start_aut_cmd[0]) + subprocess_handle = subprocess.Popen(start_aut_cmd, shell=False) + if sys.platform.startswith("win"): + snooze(5) + else: + snooze(1) # This delay is need to give time for application to start + test.log("Attaching to application") + testSettings.waitForObjectTimeout = 2000 +# Attempts to attach to application under test, if it fails will close program. + try: + attachToApplication("teest") # Note that name teest comes from Applications source code (all examples use this at least for now) + except Exception as e: # Handles failing to attach to application eg. log and kill. + test.fatal("FAIL: failed to attach to application", str(e)) + subprocess_handle.kill() + return None + else: + test.passes("Application successfully attached") + return subprocess_handle diff --git a/packaging-tools/squish_suites/shared/squish_module_helper.py b/packaging-tools/squish_suites/shared/squish_module_helper.py new file mode 100644 index 000000000..c6907349a --- /dev/null +++ b/packaging-tools/squish_suites/shared/squish_module_helper.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- + +# Copyright by Squish +# Script from +# https://kb.froglogic.com/display/KB/Article+-+Using+Squish+functions+in+your+own+Python+modules+or+packages +# +import inspect +import sys + +import test + +def import_squish_symbols(import_into_module=None): + if import_into_module is None: + frame = inspect.stack()[1] + fn = frame[1] + mn = inspect.getmodulename(fn) + import_into_module = sys.modules[mn] + squish_module = sys.modules["squish"] + for n in dir(squish_module): + setattr(import_into_module, n, getattr(squish_module, n)) + setattr(import_into_module, "test", sys.modules["test"]) + setattr(import_into_module, "testData", sys.modules["testData"]) + setattr(import_into_module, "object", sys.modules["object"]) + setattr(import_into_module, "objectMap", sys.modules["objectMap"]) + setattr(import_into_module, "squishinfo", sys.modules["squishinfo"]) + +def import_squish_symbols_decorator(f, import_into_module): + def wrapper(): + squish_module = sys.modules["squish"] + for n in dir(squish_module): + setattr(import_into_module, n, getattr(squish_module, n)) + setattr(import_into_module, "test", sys.modules["test"]) + setattr(import_into_module, "testData", sys.modules["testData"]) + setattr(import_into_module, "object", sys.modules["object"]) + setattr(import_into_module, "objectMap", sys.modules["objectMap"]) + setattr(import_into_module, "squishinfo", sys.modules["squishinfo"]) + f() + return wrapper diff --git a/packaging-tools/squish_suites/suite_IFW_examples/envvars b/packaging-tools/squish_suites/suite_IFW_examples/envvars new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/packaging-tools/squish_suites/suite_IFW_examples/envvars diff --git a/packaging-tools/squish_suites/suite_IFW_examples/objects.map b/packaging-tools/squish_suites/suite_IFW_examples/objects.map new file mode 100644 index 000000000..d53c18396 --- /dev/null +++ b/packaging-tools/squish_suites/suite_IFW_examples/objects.map @@ -0,0 +1,66 @@ +::Maintain Modify Extract Installer Example.__qt__passive_wizardbutton1_QPushButton {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Maintain Modify Extract Installer Example_MaintenanceGui'} +::Maintain Modify Extract Installer Example.qt_wizard_commit_QPushButton {name='qt_wizard_commit' type='QPushButton' visible='1' window=':Maintain Modify Extract Installer Example_MaintenanceGui'} +::Maintain Modify Extract Installer Example.qt_wizard_finish_QPushButton {name='qt_wizard_finish' type='QPushButton' visible='1' window=':Maintain Modify Extract Installer Example_MaintenanceGui'} +:Change Installer UI Example Setup.AcceptLicenseLabel_QLabel {name='AcceptLicenseLabel' type='QLabel' visible='1' window=':Change Installer UI Example Setup_InstallerGui'} +:Change Installer UI Example Setup.AcceptLicenseRadioButton_QRadioButton {name='AcceptLicenseRadioButton' type='QRadioButton' visible='1' window=':Change Installer UI Example Setup_InstallerGui'} +:Change Installer UI Example Setup.TargetDirectoryLineEdit_QLineEdit {name='TargetDirectoryLineEdit' type='QLineEdit' visible='1' window=':Change Installer UI Example Setup_InstallerGui'} +:Change Installer UI Example Setup.__qt__passive_wizardbutton1_QPushButton {name='qt_wizard_commit' type='QPushButton' visible='1' window=':Change Installer UI Example Setup_InstallerGui'} +:Change Installer UI Example Setup.__qt__passive_wizardbutton1_QPushButton_2 {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Change Installer UI Example Setup_InstallerGui'} +:Change Installer UI Example Setup.qt_wizard_cancel_QPushButton {name='qt_wizard_cancel' type='QPushButton' visible='1' window=':Change Installer UI Example Setup_InstallerGui'} +:Change Installer UI Example Setup.qt_wizard_commit_QPushButton {name='qt_wizard_finish' type='QPushButton' visible='1' window=':Change Installer UI Example Setup_InstallerGui'} +:Change Installer UI Example Setup.qt_wizard_finish_QPushButton {name='qt_wizard_finish' type='QPushButton' visible='1' window=':Change Installer UI Example Setup_InstallerGui'} +:Change Installer UI Example Setup_InstallerGui {type='InstallerGui' unnamed='1' visible='1' windowTitle='Change Installer UI Example Setup'} +:Component Error Example Setup.FinishedPage_QInstaller::FinishedPage {name='FinishedPage' type='QInstaller::FinishedPage' visible='1' window=':Component Error Example Setup_InstallerGui'} +:Component Error Example Setup.IntroductionPage_QInstaller::IntroductionPage {name='IntroductionPage' type='QInstaller::IntroductionPage' visible='1' window=':Component Error Example Setup_InstallerGui'} +:Component Error Example Setup.MessageLabel_QLabel {name='MessageLabel' type='QLabel' visible='1' window=':Component Error Example Setup_InstallerGui'} +:Component Error Example Setup.__qt__passive_wizardbutton1_QPushButton {name='qt_wizard_cancel' type='QPushButton' visible='1' window=':Component Error Example Setup_InstallerGui'} +:Component Error Example Setup.__qt__pazardbutton1_QPushButton {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Component Error Example Setup_InstallerGui'} +:Component Error Example Setup.qt_wizard_finish_QPushButton {name='qt_wizard_finish' type='QPushButton' visible='1' window=':Component Error Example Setup_InstallerGui'} +:Component Error Example Setup_InstallerGui {type='InstallerGui' unnamed='1' visible='1' windowTitle='Component Error Example Setup'} +:Component Error Example Setup_QWidget {type='QWidget' unnamed='1' visible='1' window=':Component Error Example Setup_InstallerGui'} +:ComponentsTreeView.Uncheckable component_QModelIndex {column='0' container=':Hide checkbox Setup.ComponentsTreeView_QTreeView' text='Uncheckable component' type='QModelIndex'} +:Dependency Solving Example Setup.TargetDirectoryLineEdit_QLineEdit {name='TargetDirectoryLineEdit' type='QLineEdit' visible='1' window=':Dependency Solving Example Setup_InstallerGui'} +:Dependency Solving Example Setup.__qt__passive_wizardbutton1_QPushButton {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Dependency Solving Example Setup_InstallerGui'} +:Dependency Solving Example Setup.__qt__passive_wizardbutton1_QPushButton_2 {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Dependency Solving Example Setup_InstallerGui'} +:Dependency Solving Example Setup.qt_wizard_commit_QPushButton {name='qt_wizard_commit' type='QPushButton' visible='1' window=':Dependency Solving Example Setup_InstallerGui'} +:Dependency Solving Example Setup.qt_wizard_finish_QPushButton {name='qt_wizard_finish' type='QPushButton' visible='1' window=':Dependency Solving Example Setup_InstallerGui'} +:Dependency Solving Example Setup_InstallerGui {type='InstallerGui' unnamed='1' visible='1' windowTitle='Dependency Solving Example Setup'} +:Hide checkbox Setup.ComponentsTreeView_QTreeView {name='ComponentsTreeView' type='QTreeView' visible='1' window=':Hide checkbox Setup_InstallerGui'} +:Hide checkbox Setup.__qt__passive_wizardbutton1_QPushButton {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Hide checkbox Setup_InstallerGui'} +:Hide checkbox Setup.__qt__passive_wizardbutton1_QPushButton_2 {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Hide checkbox Setup_InstallerGui'} +:Hide checkbox Setup.qt_wizard_commit_QPushButton {name='qt_wizard_commit' type='QPushButton' visible='1' window=':Hide checkbox Setup_InstallerGui'} +:Hide checkbox Setup.qt_wizard_finish_QPushButton {name='qt_wizard_finish' type='QPushButton' visible='1' window=':Hide checkbox Setup_InstallerGui'} +:Hide checkbox Setup_InstallerGui {type='InstallerGui' unnamed='1' visible='1' windowTitle='Hide checkbox Setup'} +:License Agreement Example Setup.AcceptLicenseLabel_QLabel {name='AcceptLicenseLabel' type='QLabel' visible='1' window=':License Agreement Example Setup_InstallerGui'} +:License Agreement Example Setup.AcceptLicenseRadioButton_QRadioButton {name='AcceptLicenseRadioButton' type='QRadioButton' visible='1' window=':License Agreement Example Setup_InstallerGui'} +:License Agreement Example Setup.RejectLicenseLabel_QLabel {name='RejectLicenseLabel' type='QLabel' visible='1' window=':License Agreement Example Setup_InstallerGui'} +:License Agreement Example Setup.__qt__passive_wizardbutton1_QPushButton {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':License Agreement Example Setup_InstallerGui'} +:License Agreement Example Setup.__qt__passive_wizardbutton1_QPushButton_2 {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':License Agreement Example Setup_InstallerGui'} +:License Agreement Example Setup.qt_wizard_commit_QPushButton {name='qt_wizard_commit' type='QPushButton' visible='1' window=':License Agreement Example Setup_InstallerGui'} +:License Agreement Example Setup.qt_wizard_finish_QPushButton {name='qt_wizard_finish' type='QPushButton' visible='1' window=':License Agreement Example Setup_InstallerGui'} +:License Agreement Example Setup_InstallerGui {type='InstallerGui' unnamed='1' visible='1' windowTitle='License Agreement Example Setup'} +:Maintain Change Installer UI Example.__qt__passive_wizardbutton1_QPushButton {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Maintain Change Installer UI Example_MaintenanceGui'} +:Maintain Change Installer UI Example.qt_wizard_commit_QPushButton {name='qt_wizard_commit' type='QPushButton' visible='1' window=':Maintain Change Installer UI Example_MaintenanceGui'} +:Maintain Change Installer UI Example.qt_wizard_finish_QPushButton {name='qt_wizard_finish' type='QPushButton' visible='1' window=':Maintain Change Installer UI Example_MaintenanceGui'} +:Maintain Change Installer UI Example_MaintenanceGui {type='MaintenanceGui' unnamed='1' visible='1' windowTitle='Maintain Change Installer UI Example'} +:Maintain Dependency Solving Example.__qt__passive_wizardbutton1_QPushButton {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Maintain Dependency Solving Example_MaintenanceGui'} +:Maintain Dependency Solving Example.qt_wizard_commit_QPushButton {name='qt_wizard_commit' type='QPushButton' visible='1' window=':Maintain Dependency Solving Example_MaintenanceGui'} +:Maintain Dependency Solving Example.qt_wizard_finish_QPushButton {name='qt_wizard_finish' type='QPushButton' visible='1' window=':Maintain Dependency Solving Example_MaintenanceGui'} +:Maintain Dependency Solving Example_MaintenanceGui {type='MaintenanceGui' unnamed='1' visible='1' windowTitle='Maintain Dependency Solving Example'} +:Maintain Hide checkbox.__qt__passive_wizardbutton1_QPushButton {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Maintain Hide checkbox_MaintenanceGui'} +:Maintain Hide checkbox.qt_wizard_commit_QPushButton {name='qt_wizard_commit' type='QPushButton' visible='1' window=':Maintain Hide checkbox_MaintenanceGui'} +:Maintain Hide checkbox.qt_wizard_finish_QPushButton {name='qt_wizard_finish' type='QPushButton' visible='1' window=':Maintain Hide checkbox_MaintenanceGui'} +:Maintain Hide checkbox_MaintenanceGui {type='MaintenanceGui' unnamed='1' visible='1' windowTitle='Maintain Hide checkbox'} +:Maintain License Agreement Example.__qt__passive_wizardbutton1_QPushButton {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Maintain License Agreement Example_MaintenanceGui'} +:Maintain License Agreement Example.qt_wizard_commit_QPushButton {name='qt_wizard_commit' type='QPushButton' visible='1' window=':Maintain License Agreement Example_MaintenanceGui'} +:Maintain License Agreement Example.qt_wizard_finish_QPushButton {name='qt_wizard_finish' type='QPushButton' visible='1' window=':Maintain License Agreement Example_MaintenanceGui'} +:Maintain License Agreement Example_MaintenanceGui {type='MaintenanceGui' unnamed='1' visible='1' windowTitle='Maintain License Agreement Example'} +:Maintain Modify Extract Installer Example.__qt__passive_wizardbutton1_QPushButton {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Maintain Modify Extract Installer Example_MaintenanceGui'} +:Maintain Modify Extract Installer Example.qt_wizard_commit_QPushButton {name='qt_wizard_commit' type='QPushButton' visible='1' window=':Maintain Modify Extract Installer Example_MaintenanceGui'} +:Maintain Modify Extract Installer Example.qt_wizard_finish_QPushButton {name='qt_wizard_finish' type='QPushButton' visible='1' window=':Maintain Modify Extract Installer Example_MaintenanceGui'} +:Maintain Modify Extract Installer Example_MaintenanceGui {type='MaintenanceGui' unnamed='1' visible='1' windowTitle='Maintain Modify Extract Installer Example'} +:Modify Extract Installer Example Setup.__qt__passive_wizardbutton1_QPushButton {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Modify Extract Installer Example Setup_InstallerGui'} +:Modify Extract Installer Example Setup.__qt__passive_wizardbutton1_QPushButton_2 {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Modify Extract Installer Example Setup_InstallerGui'} +:Modify Extract Installer Example Setup.qt_wizard_commit_QPushButton {name='qt_wizard_commit' type='QPushButton' visible='1' window=':Modify Extract Installer Example Setup_InstallerGui'} +:Modify Extract Installer Example Setup.qt_wizard_finish_QPushButton {name='qt_wizard_finish' type='QPushButton' visible='1' window=':Modify Extract Installer Example Setup_InstallerGui'} +:Modify Extract Installer Example Setup_InstallerGui {type='InstallerGui' unnamed='1' visible='1' windowTitle='Modify Extract Installer Example Setup'} diff --git a/packaging-tools/squish_suites/suite_IFW_examples/suite.conf b/packaging-tools/squish_suites/suite_IFW_examples/suite.conf new file mode 100644 index 000000000..5b2a400f5 --- /dev/null +++ b/packaging-tools/squish_suites/suite_IFW_examples/suite.conf @@ -0,0 +1,8 @@ +AUT= +ENVVARS=envvars +HOOK_SUB_PROCESSES=false +IMPLICITAUTSTART=0 +LANGUAGE=Python +TEST_CASES=tst_start_suite tst_install_changeuserinterface tst_uninstall_changeuserinterface tst_install_dependencies_default tst_uninstall_dependencies_default tst_base tst_install_hidecheckbox tst_uninstall_hidecheckbox tst_install_licenseagreement tst_uninstall_licenseagreement tst_install_modifyextract tst_uninstall_modifyextract tst_end_suite +VERSION=3 +WRAPPERS=Qt diff --git a/packaging-tools/squish_suites/suite_IFW_examples/tst_install_changeuserinterface/test.py b/packaging-tools/squish_suites/suite_IFW_examples/tst_install_changeuserinterface/test.py new file mode 100644 index 000000000..fcf8eaa34 --- /dev/null +++ b/packaging-tools/squish_suites/suite_IFW_examples/tst_install_changeuserinterface/test.py @@ -0,0 +1,88 @@ +# -*- coding: utf-8 -*- + +########################################################################### +## +## Copyright (C) 2018 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the Qt Installer Framework. +## +## $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$ +## +########################################################################### + +import os +from os.path import expanduser +import subprocess +import shlex +import sys +sys.path.append(os.path.join(os.pardir,os.pardir, "shared")) +import shared +import time + + +def info(): + test.log("#" * 50) + test.log("Squish path: " + os.environ["SQUISH_PREFIX"]) + test.log("#" * 50 + "\n") + +def main(): + info() + shared.add_attachable_aut() + time.sleep(7) + home = os.path.expanduser("~") + application_folder = "changeuserinterface" #folder where application resides + executable = "installer" #executable without filename extension eg. exe + # abs path to application folder(folder of tested program) + primary_test_install_dir = os.path.join(home, "IfwExamples") + application_folder_path = os.path.join("ifw-src", "examples", application_folder) + application_folder_path = os.path.normpath(os.path.join(os.path.abspath(__file__), os.path.pardir,os.path.pardir, os.path.pardir, os.path.pardir, application_folder_path)) + # Attempts to start and attach testable application + test.log("Attempting to start and attach AUT") + subprocess_handle = shared.attach_to_aut(application_folder_path, executable) + if not subprocess_handle: + return False + + # Actual beginning for test + test.log("Clicking next button at welcome page.") + clickButton(waitForObject(":Change Installer UI Example Setup.__qt__passive_wizardbutton1_QPushButton_2")) + test.log("Appending _2 to installation path.") + type(waitForObject(":Change Installer UI Example Setup.TargetDirectoryLineEdit_QLineEdit"), "_2") + test.log("Clicking next button at installation path specification page.") + clickButton(waitForObject(":Change Installer UI Example Setup.__qt__passive_wizardbutton1_QPushButton_2")) + test.log("Clicking next button at component selection page.") + clickButton(waitForObject(":Change Installer UI Example Setup.__qt__passive_wizardbutton1_QPushButton_2")) + test.log("Clicking i agree radio button at license agreement page.") + clickButton(waitForObject(":Change Installer UI Example Setup.AcceptLicenseRadioButton_QRadioButton")) + test.log("Clicking next button at license agreement page.") + clickButton(waitForObject(":Change Installer UI Example Setup.__qt__passive_wizardbutton1_QPushButton_2")) + #Only win has this start menu thing + if sys.platform.startswith("win"): + test.log("Clicking next button at StartMenu Shortcut specification screen.") + clickButton(waitForObject(":Change Installer UI Example Setup.__qt__passive_wizardbutton1_QPushButton_2")) + test.log("Clicking install button at ready to install page.") + clickButton(waitForObject(":Change Installer UI Example Setup.__qt__passive_wizardbutton1_QPushButton")) + test.log("Clicking finish button at end page.") + clickButton(waitForObject(":Change Installer UI Example Setup.qt_wizard_finish_QPushButton")) + test.verify(os.path.exists(os.path.join(home, "IfwExamples", "changeuserinterface_2")), "installation folder exists") + + snooze(1) + # Makes sure that application under test will not keep running after test. + subprocess_handle.kill() diff --git a/packaging-tools/squish_suites/suite_IFW_examples/tst_uninstall_changeuserinterface/test.py b/packaging-tools/squish_suites/suite_IFW_examples/tst_uninstall_changeuserinterface/test.py new file mode 100644 index 000000000..eaeb471ca --- /dev/null +++ b/packaging-tools/squish_suites/suite_IFW_examples/tst_uninstall_changeuserinterface/test.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- +########################################################################### +## +## Copyright (C) 2018 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the Qt Installer Framework. +## +## $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$ +## +########################################################################### +import os +from os.path import expanduser +import subprocess +import shlex +import sys +sys.path.append(os.path.join(os.pardir,os.pardir,"shared")) +import shared +import time + + +def info(): + test.log("#" * 50) + test.log("Squish path: " + os.environ["SQUISH_PREFIX"]) + test.log("#" * 50 + "\n") + +def main(): + info() + shared.add_attachable_aut() + time.sleep(7) + home = os.path.expanduser("~") + application_folder = "changeuserinterface_2" #folder where application resides + executable = "maintenancetool" #executable without filename extension eg. exe + # abs path to application folder(folder of tested program) + primary_test_install_dir = os.path.join(home, "IfwExamples") + application_folder_path = os.path.join(primary_test_install_dir, application_folder) + application_folder_path = os.path.normpath(os.path.join(os.path.abspath(__file__), os.path.pardir, os.path.pardir, os.path.pardir, application_folder_path)) + # Attempts to start and attach testable application + test.log("Attempting to start and attach AUT") + subprocess_handle = shared.attach_to_aut(application_folder_path, executable) + if not subprocess_handle: + return False + + # Actual beginning for test + test.log("Clicking next button at action selection screen.") + clickButton(waitForObject(":Maintain Change Installer UI Example.__qt__passive_wizardbutton1_QPushButton")) + test.log("Clicking uninstall button at warning screen.") + clickButton(waitForObject(":Maintain Change Installer UI Example.qt_wizard_commit_QPushButton")) + test.log("Clicking Finish button") + clickButton(waitForObject(":Maintain Change Installer UI Example.qt_wizard_finish_QPushButton")) + #win file operations are slow + if sys.platform.startswith("win"): + snooze(5) + else: + snooze(1) + test.verify(not os.path.exists(os.path.join(home,"IfwExamples",application_folder)), "Installation folder successfully removed") + # Makes sure that application under test will not keep running after test. + subprocess_handle.kill() |