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/suite_WELP | |
parent | aadc3804479bf8b65feb7eb6035a0305bc28edac (diff) |
Squish: Revive WELP01 for Squish 5.1.1+
Change-Id: I1d1bc9334fe6c0fc1187b9bcde27d0b4ed3081b4
Reviewed-by: Robert Loehning <robert.loehning@digia.com>
Diffstat (limited to 'tests/system/suite_WELP')
-rwxr-xr-x | tests/system/suite_WELP/tst_WELP01/test.py | 157 |
1 files changed, 92 insertions, 65 deletions
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") |