diff options
author | Christian Stenger <christian.stenger@digia.com> | 2014-07-22 16:33:43 +0200 |
---|---|---|
committer | Christian Stenger <christian.stenger@digia.com> | 2014-07-28 14:50:41 +0200 |
commit | 9b89379745a6590ce5f901397e86ea98d2aa7c95 (patch) | |
tree | 5f734d3becb7e940a1d3ac618d1133c19c2df037 /tests/system | |
parent | aadc3804479bf8b65feb7eb6035a0305bc28edac (diff) | |
download | qt-creator-9b89379745a6590ce5f901397e86ea98d2aa7c95.tar.gz |
Squish: Revive WELP01 for Squish 5.1.1+
Change-Id: I1d1bc9334fe6c0fc1187b9bcde27d0b4ed3081b4
Reviewed-by: Robert Loehning <robert.loehning@digia.com>
Diffstat (limited to 'tests/system')
-rwxr-xr-x | tests/system/shared/suites_qtta.py | 10 | ||||
-rw-r--r-- | tests/system/shared/utils.py | 6 | ||||
-rwxr-xr-x | tests/system/suite_WELP/tst_WELP01/test.py | 157 | ||||
-rw-r--r-- | tests/system/suite_general/tst_session_handling/test.py | 8 |
4 files changed, 106 insertions, 75 deletions
diff --git a/tests/system/shared/suites_qtta.py b/tests/system/shared/suites_qtta.py index 01ed84a0da..8dce154b81 100755 --- a/tests/system/shared/suites_qtta.py +++ b/tests/system/shared/suites_qtta.py @@ -88,6 +88,10 @@ def checkIfObjectItemExists(object, item, timeout = 3000): def getQmlItem(type, container, clip, text=""): if (container.startswith(":")): container = "'%s'" % container - clip = ("%s" % __builtin__.bool(clip)).lower() - return ("{clip='%s' container=%s enabled='true' %s type='%s' unnamed='1' visible='true'}" - % (clip, container, text, type))
\ No newline at end of file + if clip != None: + clip = ("%s" % __builtin__.bool(clip)).lower() + return ("{clip='%s' container=%s enabled='true' %s type='%s' unnamed='1' visible='true'}" + % (clip, container, text, type)) + else: + return ("{container=%s enabled='true' %s type='%s' unnamed='1' visible='true'}" + % (container, text, type)) diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index c3177280a3..b9e35782ec 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -540,7 +540,7 @@ def setAlwaysStartFullHelp(): waitForObjectItem(":Options_QListView", "Help") clickItem(":Options_QListView", "Help", 5, 5, 0, Qt.LeftButton) clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "General") - selectFromCombo(":Startup.contextHelpComboBox_QComboBox", "Always Start Full Help") + selectFromCombo(":Startup.contextHelpComboBox_QComboBox", "Always Show in Help Mode") clickButton(waitForObject(":Options.OK_QPushButton")) def removePackagingDirectory(projectPath): @@ -674,3 +674,7 @@ def getHelpTitle(): return str(hv.title) except: return str(hv.documentTitle) + +def canTestEmbeddedQtQuick(): + return (squishinfo.major * 0x10000 + squishinfo.minor * 0x100 + + squishinfo.patch) > 0x050100 diff --git a/tests/system/suite_WELP/tst_WELP01/test.py b/tests/system/suite_WELP/tst_WELP01/test.py index 708d6b14a6..e5148e4f6b 100755 --- a/tests/system/suite_WELP/tst_WELP01/test.py +++ b/tests/system/suite_WELP/tst_WELP01/test.py @@ -30,91 +30,118 @@ source("../../shared/qtcreator.py") source("../../shared/suites_qtta.py") -webPageContentLoadedValue = 0 -gettingStartedText = getQmlItem("Text", ":Qt Creator_QDeclarativeView", False, - "text='Getting Started'") - -# wait until help gets loaded -def webPageContentLoaded(*args): - global webPageContentLoadedValue - objectClass = str(args[0].metaObject().className()) - if objectClass in ("QWebPage", "Help::Internal::HelpViewer"): - webPageContentLoadedValue += 1 +gettingStartedText = getQmlItem("Button", ":WelcomePage.scrollView_ScrollView", False, + "text='Get Started Now' id='gettingStartedButton'") def clickItemVerifyHelpCombo(qmlItem, expectedHelpComboRegex, testDetails): global gettingStartedText - webPageContentLoadedValue = 0 mouseClick(waitForObject(qmlItem), 5, 5, 0, Qt.LeftButton) - waitFor("webPageContentLoadedValue == 4", 5000) - foundText = str(waitForObject(":Qt Creator_HelpSelector_QComboBox").currentText) - if not test.verify(re.match(expectedHelpComboRegex, foundText), testDetails): - test.log("Found %s" % foundText) + helpCombo = waitForObject(":Qt Creator_HelpSelector_QComboBox") + if not test.verify(waitFor('re.match(expectedHelpComboRegex, str(helpCombo.currentText))', + 5000), testDetails): + test.log("Found %s" % str(helpCombo.currentText)) # select "Welcome" page from left toolbar again switchViewTo(ViewConstants.WELCOME) test.verify(checkIfObjectExists(gettingStartedText), - "Verifying: Getting Started topic is being displayed.") + "Verifying: Get Started Now button is being displayed.") + +def waitForButtonsState(projectsChecked, examplesChecked, tutorialsChecked, timeout=5000): + projButton = waitForObject(getQmlItem("Button", ":WelcomePage.scrollView_ScrollView", False, + "text='Projects'")) + exmpButton = waitForObject(getQmlItem("Button", ":WelcomePage.scrollView_ScrollView", False, + "text='Examples'")) + tutoButton = waitForObject(getQmlItem("Button", ":WelcomePage.scrollView_ScrollView", False, + "text='Tutorials'")) + return waitFor('projButton.checked == projectsChecked ' + 'and exmpButton.checked == examplesChecked ' + 'and tutoButton.checked == tutorialsChecked', timeout) def main(): - test.log("Welcome mode is not scriptable at the moment") - return - global webPageContentLoadedValue, gettingStartedText + if isQt4Build or not canTestEmbeddedQtQuick(): + test.log("Welcome mode is not available or not scriptable with this Squish version") + return + global gettingStartedText # open Qt Creator startApplication("qtcreator" + SettingsPath) if not startedWithoutPluginError(): return - installLazySignalHandler(":QWebPage","loadFinished(bool)", "webPageContentLoaded") - installLazySignalHandler(":Qt Creator_Help::Internal::HelpViewer", "loadFinished(bool)", - "webPageContentLoaded") + setAlwaysStartFullHelp() addCurrentCreatorDocumentation() - if not test.verify(checkIfObjectExists(gettingStartedText), - "Verifying: Qt Creator displays Welcome Page with Getting Started."): - mouseClick(waitForObject(getQmlItem("LinkedText", ":Qt Creator_QDeclarativeView", False, - "text='Getting Started'")), 5, 5, 0, Qt.LeftButton) - qmlItem = getQmlItem("LinkedText", ":Qt Creator_QDeclarativeView", False, "text='User Guide'") + + buttonsAndState = {'Projects':True, 'Examples':False, 'Tutorials':False, 'New Project':False, + 'Open Project':False} + for button, state in buttonsAndState.items(): + qmlItem = getQmlItem("Button", ":WelcomePage.scrollView_ScrollView", False, + "text='%s'" % button) + if test.verify(checkIfObjectExists(qmlItem), + "Verifying whether '%s' button is shown." % button): + buttonObj = findObject(qmlItem) + test.compare(buttonObj.checked, state, "Verifying whether '%s' button is checked." + % button) + + test.verify(checkIfObjectExists(gettingStartedText), + "Verifying: Qt Creator displays Welcome Page with 'Get Started Now' button.") expectedText = "(QtCreator : Qt Creator Manual)|(Qt Creator Manual [|] QtCreator)" testDetails = "Verifying: Help with Creator Documentation is being opened." - # select "User Guide" topic - clickItemVerifyHelpCombo(qmlItem, expectedText, testDetails) - # check "Online Community" link - test.verify(checkIfObjectExists(getQmlItem("LinkedText", ":Qt Creator_QDeclarativeView", False, - "text='Online Community'")), - "Verifying: Link to Qt forums exists.") - test.verify(checkIfObjectExists(getQmlItem("LinkedText", ":Qt Creator_QDeclarativeView", False, - "text='Blogs'")), - "Verifying: Link to Planet Qt exists.") - qmlItem = getQmlItem("Text", ":Qt Creator_QDeclarativeView", False, "text='IDE Overview'") - expectedText = "(QtCreator : IDE Overview)|(IDE Overview [|] QtCreator)" - testDetails = "Verifying: Help with IDE Overview topic is being opened." - # select "IDE Overview" - clickItemVerifyHelpCombo(qmlItem, expectedText, testDetails) - qmlItem = getQmlItem("Text", ":Qt Creator_QDeclarativeView", False, "text='User Interface'") - expectedText = "(QtCreator : User Interface)|(User Interface [|]) QtCreator" - testDetails = "Verifying: Help with User Interface topic is being opened." - # select "User interface" - clickItemVerifyHelpCombo(qmlItem, expectedText, testDetails) - # select "Building and Running an Example Application" - webPageContentLoadedValue = 0 - mouseClick(waitForObject(getQmlItem("Text", ":Qt Creator_QDeclarativeView", False, - "text='Building and Running an Example Application'")), - 5, 5, 0, Qt.LeftButton) - waitFor("webPageContentLoadedValue == 4", 5000) - checkPattern = ("(QtCreator : Building and Running an Example( Application)?)" - "|(Building and Running an Example( Application)? [|] QtCreator)") - checkText = str(waitForObject(":Qt Creator_HelpSelector_QComboBox").currentText) - if not test.verify(re.search(checkPattern, checkText), - "Verifying: Building and Running an Example is opened."): - test.fail("Pattern does not match: '%s', text found in QComboBox is: " - "'%s'" % (checkPattern, checkText)) + + clickItemVerifyHelpCombo(gettingStartedText, expectedText, testDetails) + textUrls = {'Online Community':'http://qt-project.org/forums', + 'Blogs':'http://planet.qt-project.org', + 'Qt Account':'https://login.qt.digia.com/qtaccount', + 'Qt Cloud Services':'https://developer.qtcloudservices.com', + 'User Guide':'qthelp://org.qt-project.qtcreator/doc/index.html' + } + for text, url in textUrls.items(): + qmlItem = getQmlItem("LinkedText", ":WelcomePage.scrollView_ScrollView", False, + "text='%s'" % text) + if test.verify(checkIfObjectExists(qmlItem), + "Verifying: Link to %s exists." % text): + itemObj = findObject(qmlItem) + # some URLs might have varying parameters - limiting them to URL without a query + if url.startswith("qthelp"): + relevantUrlPart = str(itemObj.parent.openHelpUrl).split("?")[0] + else: + relevantUrlPart = str(itemObj.parent.openUrl).split("?")[0] + test.compare(relevantUrlPart, url, "Verifying link.") + + mouseClick(gettingStartedText, 5, 5, 0, Qt.LeftButton) + qcManualQModelIndexStr = getQModelIndexStr("text~='Qt Creator Manual [0-9.]+'", + ":Qt Creator_QHelpContentWidget") + if str(waitForObject(":Qt Creator_HelpSelector_QComboBox").currentText) == "(Untitled)": + mouseClick(qcManualQModelIndexStr, 5, 5, 0, Qt.LeftButton) + test.warning("Clicking 'Get Started Now' the second time showed blank page (Untitled)") + # select "Welcome" page from left toolbar again switchViewTo(ViewConstants.WELCOME) test.verify(checkIfObjectExists(gettingStartedText), "Verifying: Getting Started topic is being displayed.") - # select "Start Developing" - mouseClick(waitForObject(getQmlItem("Text", ":Qt Creator_QDeclarativeView", False, - "text='Start Developing'")), 5, 5, 0, Qt.LeftButton) - test.verify(checkIfObjectExists(getQmlItem("Text", ":Qt Creator_QDeclarativeView", False, - "text='Tutorials'")), - "Verifying: Tutorials are opened in Welcome Page.") + # select Examples and roughly check them + mouseClick(waitForObject(getQmlItem("Button", ":WelcomePage.scrollView_ScrollView", False, + "text='Examples'")), 5, 5, 0, Qt.LeftButton) + waitForButtonsState(False, True, False) + expect = (("Rectangle", "id='rectangle1' radius='0'", "examples rectangle"), + ("TextField", "id='lineEdit' placeholderText='Search in Examples...'", + "examples search line edit"), + ("ComboBox", "id='comboBox'", "Qt version combo box"), + ("Delegate", "id='delegate' radius='0' caption~='.*Example'", "at least one example") + ) + for (qType, prop, info) in expect: + test.verify(checkIfObjectExists(getQmlItem(qType, ":WelcomePage.scrollView_ScrollView", + None, prop)), + "Verifying whether %s is shown" % info) + # select Tutorials and roughly check them + mouseClick(waitForObject(getQmlItem("Button", ":WelcomePage.scrollView_ScrollView", False, + "text='Tutorials'")), 5, 5, 0, Qt.LeftButton) + waitForButtonsState(False, False, True) + expect = (("Rectangle", "id='rectangle1' radius='0'", "tutorials rectangle"), + ("TextField", "id='lineEdit' placeholderText='Search in Tutorials...'", + "tutorials search line edit"), + ("Delegate", "id='delegate' radius='0' caption~='Creating.*'", "at least one tutorial") + ) + for (qType, prop, info) in expect: + test.verify(checkIfObjectExists(getQmlItem(qType, ":WelcomePage.scrollView_ScrollView", + None, prop)), + "Verifying whether %s is shown" % info) # exit Qt Creator invokeMenuItem("File", "Exit") diff --git a/tests/system/suite_general/tst_session_handling/test.py b/tests/system/suite_general/tst_session_handling/test.py index e5ef8cf410..ae65515424 100644 --- a/tests/system/suite_general/tst_session_handling/test.py +++ b/tests/system/suite_general/tst_session_handling/test.py @@ -29,10 +29,6 @@ source("../../shared/qtcreator.py") -def canTestQtQuick(): - return (squishinfo.major * 0x10000 + squishinfo.minor * 0x100 - + squishinfo.patch) > 0x050100 - def main(): projects = prepareTestExamples() if not projects: @@ -45,7 +41,7 @@ def main(): mainWindow = waitForObject(":Qt Creator_Core::Internal::MainWindow") test.verify(waitFor("sessionName in str(mainWindow.windowTitle)", 2000), "Verifying window title contains created session name.") - if not isQt4Build and canTestQtQuick(): + if not isQt4Build and canTestEmbeddedQtQuick(): checkWelcomePage(sessionName, True) for project in projects: openQmakeProject(project, Targets.DESKTOP_480_GCC) @@ -58,7 +54,7 @@ def main(): switchSession("default") test.verify(waitFor("'Qt Creator' == str(mainWindow.windowTitle)", 2000), "Verifying window title is set to default.") - if not isQt4Build and canTestQtQuick(): + if not isQt4Build and canTestEmbeddedQtQuick(): checkWelcomePage(sessionName, False) switchViewTo(ViewConstants.EDIT) checkNavigator(1, "Verifying that no more project is opened.") |