aboutsummaryrefslogtreecommitdiffstats
path: root/tests/system
diff options
context:
space:
mode:
authorThe Qt Project <gerrit-noreply@qt-project.org>2024-03-07 07:34:23 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2024-03-07 07:34:23 +0000
commit71a02b4f02fb3422e3873f351572d71229a92ebf (patch)
tree66bbe8283c7f3f501d3cde67e9c8fd1bace4afca /tests/system
parent19feaad265f40df546917f7cbe00e2a19c7cec08 (diff)
parent8abc95331f1dddafb07c691857d3519829acb4ef (diff)
Merge "Merge remote-tracking branch 'origin/13.0'"
Diffstat (limited to 'tests/system')
-rw-r--r--tests/system/shared/project.py12
-rw-r--r--tests/system/shared/welcome.py39
-rw-r--r--tests/system/suite_WELP/tst_WELP01/test.py55
-rw-r--r--tests/system/suite_WELP/tst_WELP02/test.py7
-rw-r--r--tests/system/suite_WELP/tst_WELP03/test.py3
-rw-r--r--tests/system/suite_WELP/tst_WELP04/test.py3
-rw-r--r--tests/system/suite_general/tst_session_handling/test.py6
7 files changed, 47 insertions, 78 deletions
diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py
index 5bb724a0b1..71689babf7 100644
--- a/tests/system/shared/project.py
+++ b/tests/system/shared/project.py
@@ -9,11 +9,11 @@ def openQbsProject(projectPath):
def openQmakeProject(projectPath, targets=Targets.desktopTargetClasses(), fromWelcome=False):
cleanUpUserFiles(projectPath)
if fromWelcome:
- wsButtonFrame, wsButtonLabel = getWelcomeScreenSideBarButton('Open Project...')
- if not all((wsButtonFrame, wsButtonLabel)):
+ wsButton = getWelcomeScreenSideBarButton('Open Project...')
+ if not object.exists(wsButton):
test.fatal("Could not find 'Open Project...' button on Welcome Page.")
return []
- mouseClick(wsButtonLabel)
+ mouseClick(wsButton)
else:
invokeMenuItem("File", "Open File or Project...")
selectFromFileDialog(projectPath)
@@ -60,11 +60,11 @@ def __createProjectOrFileSelectType__(category, template, fromWelcome = False, i
if fromWelcome:
if not isProject:
test.fatal("'Create Project...' on Welcome screen only handles projects nowadays.")
- wsButtonFrame, wsButtonLabel = getWelcomeScreenSideBarButton("Create Project...")
- if not all((wsButtonFrame, wsButtonLabel)):
+ wsButton = getWelcomeScreenSideBarButton("Create Project...")
+ if not object.exists(wsButton):
test.fatal("Could not find 'Create Project...' button on Welcome Page")
return []
- mouseClick(wsButtonLabel)
+ mouseClick(wsButton)
elif isProject:
invokeMenuItem("File", "New Project...")
else:
diff --git a/tests/system/shared/welcome.py b/tests/system/shared/welcome.py
index 8066f27131..a5ba097ff1 100644
--- a/tests/system/shared/welcome.py
+++ b/tests/system/shared/welcome.py
@@ -4,30 +4,11 @@
def __childrenOfType__(parentObject, typeName):
return [child for child in object.children(parentObject) if className(child) == typeName]
-def __getWelcomeScreenButtonHelper__(buttonLabel, widgetWithQFrames, isUrlButton = False):
- frames = __childrenOfType__(widgetWithQFrames, 'QWidget')
- for frame in frames:
- childCount = 1 # incorrect but okay for framed sidebar buttons
- if isUrlButton:
- childCount = len(__childrenOfType__(frame, 'QLabel'))
- for occurrence in range(1, childCount + 1):
- label = getChildByClass(frame, 'QLabel', occurrence)
- if label is None:
- continue
- if str(label.text) == buttonLabel:
- return frame, label
- return None, None
-
-def getWelcomeScreenSideBarButton(buttonLabel, isUrlButton = False):
- sideBar = waitForObject("{container={type='Welcome::Internal::SideArea' unnamed='1' "
- "window=':Qt Creator_Core::Internal::MainWindow'} type='QWidget' "
- "unnamed='1'}")
- return __getWelcomeScreenButtonHelper__(buttonLabel, sideBar, isUrlButton)
-
-def getWelcomeScreenBottomButton(buttonLabel):
- bottomArea = waitForObject("{type='Welcome::Internal::BottomArea' unnamed='1' "
- "window=':Qt Creator_Core::Internal::MainWindow'}")
- return __getWelcomeScreenButtonHelper__(buttonLabel, bottomArea, False)
+
+def getWelcomeScreenSideBarButton(buttonLabel):
+ return ("{text='%s' type='QPushButton' unnamed='1' visible='1' "
+ "window=':Qt Creator_Core::Internal::MainWindow'}" % buttonLabel)
+
def getWelcomeTreeView(treeViewLabel):
try:
@@ -37,11 +18,11 @@ def getWelcomeTreeView(treeViewLabel):
return None
def switchToSubMode(subModeLabel):
- wsButtonFrame, wsButtonLabel = getWelcomeScreenSideBarButton(subModeLabel)
- frameAndLabelFound = all((wsButtonFrame, wsButtonLabel))
- if frameAndLabelFound:
- mouseClick(wsButtonLabel)
- return frameAndLabelFound
+ wsButton = getWelcomeScreenSideBarButton(subModeLabel)
+ buttonFound = object.exists(wsButton)
+ if buttonFound:
+ mouseClick(wsButton)
+ return buttonFound
def findExampleOrTutorial(tableView, regex, verbose=False):
filterModel = __childrenOfType__(tableView, 'QSortFilterProxyModel')
diff --git a/tests/system/suite_WELP/tst_WELP01/test.py b/tests/system/suite_WELP/tst_WELP01/test.py
index 0bc65d1f00..61ee8a6030 100644
--- a/tests/system/suite_WELP/tst_WELP01/test.py
+++ b/tests/system/suite_WELP/tst_WELP01/test.py
@@ -14,25 +14,16 @@ def clickItemVerifyHelpCombo(button, expectedHelpComboRegex, testDetails):
test.log("Found %s" % str(helpCombo.currentText))
# select "Welcome" page from left toolbar again
switchViewTo(ViewConstants.WELCOME)
- wsButtonFrame, wsButtonLabel = getWelcomeScreenSideBarButton(getStarted)
- return test.verify(all((wsButtonFrame, wsButtonLabel)),
+ return test.verify(object.exists(getWelcomeScreenSideBarButton(getStarted)),
"Verifying: '%s' button is being displayed." % getStarted)
def buttonActive(button):
- # colors of the default theme for active button on Welcome page
- defaultActiveRGB = (69, 206, 85)
- # colors of the dark theme for active button on Welcome page
- darkActiveRGB = (54, 193, 72)
- # QPalette::Window (used background color of Welcome page buttons)
- enumQPaletteWindow = 10
- color = button.palette.color(enumQPaletteWindow)
- current = (color.red, color.green, color.blue)
- return current == defaultActiveRGB or current == darkActiveRGB
+ return waitForObject(button).checked
def waitForButtonsState(projectsActive, examplesActive, tutorialsActive, timeout=5000):
- projButton = getWelcomeScreenSideBarButton('Projects')[0]
- exmpButton = getWelcomeScreenSideBarButton('Examples')[0]
- tutoButton = getWelcomeScreenSideBarButton('Tutorials')[0]
- if not all((projButton, exmpButton, tutoButton)):
+ projButton = getWelcomeScreenSideBarButton('Projects')
+ exmpButton = getWelcomeScreenSideBarButton('Examples')
+ tutoButton = getWelcomeScreenSideBarButton('Tutorials')
+ if not all(map(object.exists, (projButton, exmpButton, tutoButton))):
return False
return waitFor('buttonActive(projButton) == projectsActive '
'and buttonActive(exmpButton) == examplesActive '
@@ -65,25 +56,25 @@ def main():
buttonsAndState = {'Projects':False, 'Examples':True, 'Tutorials':False}
for button, state in buttonsAndState.items():
- wsButtonFrame, wsButtonLabel = getWelcomeScreenSideBarButton(button)
- if test.verify(all((wsButtonFrame, wsButtonLabel)),
+ wsButton = getWelcomeScreenSideBarButton(button)
+ if test.verify(object.exists(wsButton),
"Verified whether '%s' button is shown." % button):
- test.compare(buttonActive(wsButtonFrame), state,
+ test.compare(buttonActive(wsButton), state,
"Verifying whether '%s' button is active (%s)." % (button, state))
# select Projects and roughly check this
switchToSubMode('Projects')
for button in ['Create Project...', 'Open Project...']:
- wsButtonFrame, wsButtonLabel = getWelcomeScreenSideBarButton(button)
- if test.verify(all((wsButtonFrame, wsButtonLabel)),
+ wsButton = getWelcomeScreenSideBarButton(button)
+ if test.verify(object.exists(wsButton),
"Verified whether '%s' button is shown." % button):
- test.verify(not buttonActive(wsButtonFrame),
+ test.verify(not buttonActive(wsButton),
"Verifying whether '%s' button is inactive." % button)
- wsButtonFrame, wsButtonLabel = getWelcomeScreenSideBarButton(getStarted)
- if test.verify(all((wsButtonFrame, wsButtonLabel)),
+ wsButton = getWelcomeScreenSideBarButton(getStarted)
+ if test.verify(object.exists(wsButton),
"Verifying: Qt Creator displays Welcome Page with '%s' button." % getStarted):
- if clickItemVerifyHelpCombo(wsButtonLabel, "Getting Started | Qt Creator Manual",
+ if clickItemVerifyHelpCombo(wsButton, "Getting Started | Qt Creator Manual",
"Verifying: Help with Creator Documentation is being opened."):
textUrls = {'Online Community':'https://forum.qt.io',
@@ -92,13 +83,14 @@ def main():
'User Guide':'qthelp://org.qt-project.qtcreator/doc/index.html'
}
for text, url in textUrls.items():
- button, label = getWelcomeScreenBottomButton(text)
- if test.verify(all((button, label)),
+ button = getWelcomeScreenSideBarButton(text)
+ if test.verify(object.exists(button),
"Verifying whether link button (%s) exists." % text):
- test.compare(str(button.toolTip), url, "Verifying URL for %s" % text)
- wsButtonFrame, wsButtonLabel = getWelcomeScreenSideBarButton(getStarted)
- if wsButtonLabel is not None:
- mouseClick(wsButtonLabel)
+ test.compare(str(waitForObject(button).toolTip), url,
+ "Verifying URL for %s" % text)
+ wsButton = getWelcomeScreenSideBarButton(getStarted)
+ if object.exists(wsButton):
+ mouseClick(wsButton)
qcManualQModelIndexStr = getQModelIndexStr("text~='Qt Creator Manual [0-9.]+'",
":Qt Creator_QHelpContentWidget")
if str(waitForObject(":Qt Creator_HelpSelector_QComboBox").currentText) == "(Untitled)":
@@ -109,8 +101,7 @@ def main():
# select "Welcome" page from left toolbar again
switchViewTo(ViewConstants.WELCOME)
- wsButtonFrame, wsButtonLabel = getWelcomeScreenSideBarButton(getStarted)
- test.verify(wsButtonFrame is not None and wsButtonLabel is not None,
+ test.verify(object.exists(getWelcomeScreenSideBarButton(getStarted)),
"Verifying: Getting Started topic is being displayed.")
# select Examples and roughly check them
switchToSubMode('Examples')
diff --git a/tests/system/suite_WELP/tst_WELP02/test.py b/tests/system/suite_WELP/tst_WELP02/test.py
index d79391d121..add3d28b3a 100644
--- a/tests/system/suite_WELP/tst_WELP02/test.py
+++ b/tests/system/suite_WELP/tst_WELP02/test.py
@@ -6,8 +6,7 @@ source("../../shared/qtcreator.py")
def checkTypeAndProperties(typePropertiesDetails):
for (qType, props, detail) in typePropertiesDetails:
if qType == "QPushButton":
- wsButtonFrame, wsButtonLabel = getWelcomeScreenSideBarButton(props)
- test.verify(all((wsButtonFrame, wsButtonLabel)),
+ test.verify(object.exists(getWelcomeScreenSideBarButton(props)),
"Verifying: Qt Creator displays Welcome Page with %s." % detail)
elif qType == 'QTreeView':
treeView = getWelcomeTreeView(props)
@@ -59,8 +58,8 @@ def main():
)
checkTypeAndProperties(typePropDet)
- getStartedF, getStartedL = getWelcomeScreenSideBarButton("Get Started")
- test.verify(getStartedF is not None and getStartedL is not None, "'Get Started' button found")
+ test.verify(object.exists(getWelcomeScreenSideBarButton("Get Started")),
+ "'Get Started' button found")
# select "Create Project" and try to create a new project
createNewQtQuickApplication(tempDir(), "SampleApp", fromWelcome = True)
diff --git a/tests/system/suite_WELP/tst_WELP03/test.py b/tests/system/suite_WELP/tst_WELP03/test.py
index b09fa9e2a9..50f7b503cc 100644
--- a/tests/system/suite_WELP/tst_WELP03/test.py
+++ b/tests/system/suite_WELP/tst_WELP03/test.py
@@ -55,8 +55,7 @@ def main():
qchs.extend([os.path.join(p, "qtopengl.qch"), os.path.join(p, "qtwidgets.qch")])
addHelpDocumentation(qchs)
setFixedHelpViewer(HelpViewer.HELPMODE)
- wsButtonFrame, wsButtonLabel = getWelcomeScreenSideBarButton('Get Started')
- if not test.verify(all((wsButtonFrame, wsButtonLabel)),
+ if not test.verify(object.exists(getWelcomeScreenSideBarButton('Get Started')),
"Verifying: Qt Creator displays Welcome Page with Getting Started."):
test.fatal("Something's wrong - leaving test.")
invokeMenuItem("File", "Exit")
diff --git a/tests/system/suite_WELP/tst_WELP04/test.py b/tests/system/suite_WELP/tst_WELP04/test.py
index c9a1806669..6ccf2f0d3a 100644
--- a/tests/system/suite_WELP/tst_WELP04/test.py
+++ b/tests/system/suite_WELP/tst_WELP04/test.py
@@ -15,8 +15,7 @@ def main():
startQC()
if not startedWithoutPluginError():
return
- wsButtonFrame, wsButtonLabel = getWelcomeScreenSideBarButton('Get Started')
- if not test.verify(all((wsButtonFrame, wsButtonLabel)),
+ if not test.verify(object.exists(getWelcomeScreenSideBarButton('Get Started')),
"Verifying: Qt Creator displays Welcome Page with Getting Started."):
test.fatal("Something's wrong - leaving test.")
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 b535145cc9..305d64895e 100644
--- a/tests/system/suite_general/tst_session_handling/test.py
+++ b/tests/system/suite_general/tst_session_handling/test.py
@@ -84,11 +84,11 @@ def createAndSwitchToSession(toSession):
def checkWelcomePage(sessionName, isCurrent=False):
switchViewTo(ViewConstants.WELCOME)
- wsButtonFrame, wsButtonLabel = getWelcomeScreenSideBarButton('Projects')
- if not all((wsButtonFrame, wsButtonLabel)):
+ wsButton = getWelcomeScreenSideBarButton('Projects')
+ if not object.exists(wsButton):
test.fatal("Something's pretty wrong - leaving check for WelcomePage.")
return
- mouseClick(wsButtonLabel)
+ mouseClick(wsButton)
treeView = getWelcomeTreeView("Sessions")
if not treeView:
test.fatal("Failed to find Sessions tree view - leaving check for WelcomePage.")