Squish: Use sections for services in tst_codepasting

Change-Id: If97331e3a18f44ca82ad81c7609dc3162caf5254
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Robert Loehning
2018-07-27 15:43:55 +02:00
parent 7cc5376f0d
commit 8c0042da40

View File

@@ -177,44 +177,45 @@ def main():
openGeneralMessages() openGeneralMessages()
clickButton(waitForObject(":*Qt Creator.Clear_QToolButton")) clickButton(waitForObject(":*Qt Creator.Clear_QToolButton"))
for protocol in protocolsToTest: for protocol in protocolsToTest:
skippedPasting = True with TestSection(protocol):
description = "Paste from 2017-05-11" skippedPasting = True
if protocol == NAME_KDE: description = "Paste from 2017-05-11"
pasteId = "pysjk6n2i" if protocol == NAME_KDE:
pastedText = readFile(os.path.join(os.getcwd(), "testdata", "main-prepasted.cpp")) pasteId = "pysjk6n2i"
elif skipPastingToPastebinCom and protocol == NAME_PBCOM: pastedText = readFile(os.path.join(os.getcwd(), "testdata", "main-prepasted.cpp"))
pasteId = "8XHP0ZgH" elif skipPastingToPastebinCom and protocol == NAME_PBCOM:
pastedText = readFile(os.path.join(os.getcwd(), "testdata", "main-prepasted.cpp")) pasteId = "8XHP0ZgH"
else: pastedText = readFile(os.path.join(os.getcwd(), "testdata", "main-prepasted.cpp"))
skippedPasting = False else:
try: skippedPasting = False
pasteId, description, pastedText = pasteFile(sourceFile, protocol) try:
except Exception as e: pasteId, description, pastedText = pasteFile(sourceFile, protocol)
if e.message == serverProblems: except Exception as e:
test.warning("Ignoring server side issues") if e.message == serverProblems:
test.warning("Ignoring server side issues")
continue
else: # if it was not our own exception re-raise
raise e
if not pasteId:
test.fatal("Could not get id of paste to %s" % protocol)
continue continue
else: # if it was not our own exception re-raise pasteId = fetchSnippet(protocol, description, pasteId, skippedPasting)
raise e if pasteId == -1:
if not pasteId:
test.fatal("Could not get id of paste to %s" % protocol)
continue continue
pasteId = fetchSnippet(protocol, description, pasteId, skippedPasting) filenameCombo = waitForObject(":Qt Creator_FilenameQComboBox")
if pasteId == -1: waitFor("not filenameCombo.currentText.isEmpty()", 20000)
continue try:
filenameCombo = waitForObject(":Qt Creator_FilenameQComboBox") editor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
waitFor("not filenameCombo.currentText.isEmpty()", 20000) except:
try: outputWindow = waitForObject(":Qt Creator_Core::OutputWindow")
editor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget") test.fail("Could not find editor with snippet", str(outputWindow.plainText))
except: clickButton(waitForObject(":*Qt Creator.Clear_QToolButton"))
outputWindow = waitForObject(":Qt Creator_Core::OutputWindow") continue
test.fail("Could not find editor with snippet", str(outputWindow.plainText)) test.compare(filenameCombo.currentText, "%s: %s" % (protocol, pasteId), "Verify title of editor")
clickButton(waitForObject(":*Qt Creator.Clear_QToolButton")) if protocol in (NAME_KDE, NAME_PBCOM) and pastedText.endswith("\n"):
continue pastedText = pastedText[:-1]
test.compare(filenameCombo.currentText, "%s: %s" % (protocol, pasteId), "Verify title of editor") test.compare(editor.plainText, pastedText, "Verify that pasted and fetched texts are the same")
if protocol in (NAME_KDE, NAME_PBCOM) and pastedText.endswith("\n"): invokeMenuItem("File", "Close All")
pastedText = pastedText[:-1]
test.compare(editor.plainText, pastedText, "Verify that pasted and fetched texts are the same")
invokeMenuItem("File", "Close All")
invokeMenuItem("File", "Open File or Project...") invokeMenuItem("File", "Open File or Project...")
selectFromFileDialog(sourceFile) selectFromFileDialog(sourceFile)
editor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget") editor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")