forked from qt-creator/qt-creator
Squish: Handle more server side issues
If we get correct http responses that point to server side issues handle them appropriate if possible to let the test continue instead of crash. Change-Id: I7d2e8848269600762e9c7fe980414c4f7106433c Reviewed-by: Robert Loehning <robert.loehning@qt.io>
This commit is contained in:
@@ -42,6 +42,19 @@ def invalidPasteId(protocol):
|
||||
else:
|
||||
return -1
|
||||
|
||||
def closeHTTPStatusAndPasterDialog(protocol, pasterDialog):
|
||||
mBoxStr = "{type='QMessageBox' unnamed='1' visible='1' windowTitle?='%s *'}" % protocol
|
||||
mBox = waitForObject(mBoxStr, 1000)
|
||||
text = str(mBox.text)
|
||||
# close message box and paster window
|
||||
clickButton("{type='QPushButton' text='Cancel' visible='1' window=%s}" % mBoxStr)
|
||||
clickButton("{type='QPushButton' text='Cancel' visible='1' window='%s'}" % pasterDialog)
|
||||
if 'Service Unavailable' in text:
|
||||
test.warning(text)
|
||||
return True
|
||||
test.log("Closed dialog without expected error.", text)
|
||||
return False
|
||||
|
||||
def pasteFile(sourceFile, protocol):
|
||||
def resetFiles():
|
||||
clickButton(waitForObject(":*Qt Creator.Clear_QToolButton"))
|
||||
@@ -71,12 +84,17 @@ def pasteFile(sourceFile, protocol):
|
||||
# make sure to read all former errors (they won't get read twice)
|
||||
aut.readStderr()
|
||||
clickButton(waitForObject(":Send to Codepaster.Paste_QPushButton"))
|
||||
outputWindow = waitForObject(":Qt Creator_Core::OutputWindow")
|
||||
waitFor("'https://' in str(outputWindow.plainText)", 20000)
|
||||
try:
|
||||
outputWindow = waitForObject(":Qt Creator_Core::OutputWindow")
|
||||
waitFor("'https://' in str(outputWindow.plainText)", 20000)
|
||||
output = str(outputWindow.plainText).splitlines()[-1]
|
||||
except:
|
||||
output = ""
|
||||
try:
|
||||
if closeHTTPStatusAndPasterDialog(protocol, ':Send to Codepaster_CodePaster::PasteView'):
|
||||
raise Exception(serverProblems)
|
||||
except:
|
||||
pass
|
||||
stdErrOut = aut.readStderr()
|
||||
match = re.search("^%s protocol error: (.*)$" % protocol, stdErrOut, re.MULTILINE)
|
||||
if match:
|
||||
@@ -102,7 +120,14 @@ def fetchSnippet(protocol, description, pasteId, skippedPasting):
|
||||
foundSnippet = True
|
||||
invokeMenuItem("Tools", "Code Pasting", "Fetch Snippet...")
|
||||
selectFromCombo(":PasteSelectDialog.protocolBox_QComboBox", protocol)
|
||||
pasteModel = waitForObject(":PasteSelectDialog.listWidget_QListWidget").model()
|
||||
try:
|
||||
pasteModel = waitForObject(":PasteSelectDialog.listWidget_QListWidget").model()
|
||||
except:
|
||||
try:
|
||||
if closeHTTPStatusAndPasterDialog(protocol, ':PasteSelectDialog_CodePaster::PasteSelectDialog'):
|
||||
return -1
|
||||
except:
|
||||
pass
|
||||
waitFor("pasteModel.rowCount() > 1", 20000)
|
||||
if (not skippedPasting and not protocol == NAME_PBCA
|
||||
and not any(map(lambda str:pasteId in str, dumpItems(pasteModel)))):
|
||||
|
||||
Reference in New Issue
Block a user