forked from qt-creator/qt-creator
Squish: Fix tst_session_handling
Adapt to changed UI and Welcome page. Change-Id: I413835926411687d6161026da42be97b2b6a41c3 Reviewed-by: Robert Loehning <robert.loehning@qt.io>
This commit is contained in:
@@ -41,7 +41,7 @@ def main():
|
|||||||
for project in projects:
|
for project in projects:
|
||||||
openQmakeProject(project, Targets.DESKTOP_531_DEFAULT)
|
openQmakeProject(project, Targets.DESKTOP_531_DEFAULT)
|
||||||
progressBarWait(20000)
|
progressBarWait(20000)
|
||||||
checkNavigator(53, "Verifying whether all projects have been opened.")
|
checkNavigator(52, "Verifying whether all projects have been opened.")
|
||||||
openDocument("animation.Resources.animation\\.qrc./animation.basics.animators\\.qml")
|
openDocument("animation.Resources.animation\\.qrc./animation.basics.animators\\.qml")
|
||||||
openDocument("keyinteraction.Sources.main\\.cpp")
|
openDocument("keyinteraction.Sources.main\\.cpp")
|
||||||
checkOpenDocuments(2, "Verifying whether 2 files are open.")
|
checkOpenDocuments(2, "Verifying whether 2 files are open.")
|
||||||
@@ -51,12 +51,12 @@ def main():
|
|||||||
"Verifying window title is set to default.")
|
"Verifying window title is set to default.")
|
||||||
checkWelcomePage(sessionName, False)
|
checkWelcomePage(sessionName, False)
|
||||||
switchViewTo(ViewConstants.EDIT)
|
switchViewTo(ViewConstants.EDIT)
|
||||||
checkNavigator(1, "Verifying that no more project is opened.")
|
checkNavigator(0, "Verifying that no more project is opened.")
|
||||||
checkOpenDocuments(0, "Verifying whether all files have been closed.")
|
checkOpenDocuments(0, "Verifying whether all files have been closed.")
|
||||||
switchSession(sessionName)
|
switchSession(sessionName)
|
||||||
test.verify(waitFor("sessionName in str(mainWindow.windowTitle)", 2000),
|
test.verify(waitFor("sessionName in str(mainWindow.windowTitle)", 2000),
|
||||||
"Verifying window title contains created session name.")
|
"Verifying window title contains created session name.")
|
||||||
checkNavigator(53, "Verifying whether all projects have been re-opened.")
|
checkNavigator(52, "Verifying whether all projects have been re-opened.")
|
||||||
checkOpenDocuments(2, "Verifying whether 2 files have been re-opened.")
|
checkOpenDocuments(2, "Verifying whether 2 files have been re-opened.")
|
||||||
if test.verify("main.cpp" in str(mainWindow.windowTitle),
|
if test.verify("main.cpp" in str(mainWindow.windowTitle),
|
||||||
"Verifying whether utility.h has been opened."):
|
"Verifying whether utility.h has been opened."):
|
||||||
@@ -100,24 +100,32 @@ def createAndSwitchToSession(toSession):
|
|||||||
lineEdit = waitForObject("{type='QLineEdit' unnamed='1' visible='1' window=%s}"
|
lineEdit = waitForObject("{type='QLineEdit' unnamed='1' visible='1' window=%s}"
|
||||||
% sessionInputDialog)
|
% sessionInputDialog)
|
||||||
replaceEditorContent(lineEdit, toSession)
|
replaceEditorContent(lineEdit, toSession)
|
||||||
clickButton(waitForObject("{text='Switch To' type='QPushButton' unnamed='1' visible='1' "
|
clickButton(waitForObject("{text='Create and Open' type='QPushButton' unnamed='1' visible='1' "
|
||||||
"window=%s}" % sessionInputDialog))
|
"window=%s}" % sessionInputDialog))
|
||||||
|
|
||||||
def checkWelcomePage(sessionName, isCurrent=False):
|
def checkWelcomePage(sessionName, isCurrent=False):
|
||||||
welcomePage = ":Qt Creator.WelcomePage_QQuickWidget"
|
|
||||||
switchViewTo(ViewConstants.WELCOME)
|
switchViewTo(ViewConstants.WELCOME)
|
||||||
mouseClick(waitForObject("{container='%s' text='Projects' type='Button' "
|
wsButtonFrame, wsButtonLabel = getWelcomeScreenSideBarButton('Projects')
|
||||||
"unnamed='1' visible='true'}" % welcomePage))
|
if not all((wsButtonFrame, wsButtonLabel)):
|
||||||
waitForObject("{container='%s' id='sessionsTitle' text='Sessions' type='Text' "
|
test.fatal("Something's pretty wrong - leaving check for WelcomePage.")
|
||||||
"unnamed='1' visible='true'}" % welcomePage)
|
return
|
||||||
if isCurrent:
|
mouseClick(wsButtonLabel)
|
||||||
sessions = ["default", "%s (current session)" % sessionName]
|
treeView = getWelcomeTreeView("Sessions")
|
||||||
else:
|
if not treeView:
|
||||||
sessions = ["default (current session)", sessionName]
|
test.fatal("Failed to find Sessions tree view - leaving check for WelcomePage.")
|
||||||
for sessionName in sessions:
|
return
|
||||||
test.verify(object.exists("{container='%s' enabled='true' type='Text' unnamed='1' "
|
sessions = {"default":not isCurrent, sessionName:isCurrent}
|
||||||
"visible='true' text='%s'}" % (welcomePage, sessionName)),
|
indices = dumpIndices(treeView.model())
|
||||||
"Verifying session '%s' exists." % sessionName)
|
for session, current in sessions.items():
|
||||||
|
found = False
|
||||||
|
for index in indices:
|
||||||
|
if session == str(index.data()):
|
||||||
|
# 259 -> ActiveSessionRole [sessionmodel.h]
|
||||||
|
isCurrent = index.data(259).toBool()
|
||||||
|
if current == isCurrent:
|
||||||
|
found = True
|
||||||
|
break
|
||||||
|
test.verify(found, "Verifying: Qt Creator displays Welcome Page with %s." % session)
|
||||||
|
|
||||||
def checkNavigator(expectedRows, message):
|
def checkNavigator(expectedRows, message):
|
||||||
navigatorModel = waitForObject(":Qt Creator_Utils::NavigationTreeView").model()
|
navigatorModel = waitForObject(":Qt Creator_Utils::NavigationTreeView").model()
|
||||||
|
Reference in New Issue
Block a user