forked from qt-creator/qt-creator
Squish: Test newly added code paster
Change-Id: Ied5d08393185cc117a5f3986f05c3d6fbbb45718 Reviewed-by: Robert Loehning <robert.loehning@qt.io>
This commit is contained in:
@@ -35,6 +35,7 @@ def __platformToBeRunToday__():
|
|||||||
skipPastingToPastebinCom = platform.system() not in __platformToBeRunToday__()
|
skipPastingToPastebinCom = platform.system() not in __platformToBeRunToday__()
|
||||||
|
|
||||||
NAME_PBCOM = "Pastebin.Com"
|
NAME_PBCOM = "Pastebin.Com"
|
||||||
|
NAME_DPCOM = "DPaste.Com"
|
||||||
|
|
||||||
serverProblems = "Server side problems."
|
serverProblems = "Server side problems."
|
||||||
|
|
||||||
@@ -90,8 +91,8 @@ def pasteFile(sourceFile, protocol):
|
|||||||
clickButton(waitForObject(":Send to Codepaster.Paste_QPushButton"))
|
clickButton(waitForObject(":Send to Codepaster.Paste_QPushButton"))
|
||||||
try:
|
try:
|
||||||
outputWindow = waitForObject(":Qt Creator_Core::OutputWindow")
|
outputWindow = waitForObject(":Qt Creator_Core::OutputWindow")
|
||||||
waitFor("'https://' in str(outputWindow.plainText)", 20000)
|
waitFor("re.search('^https?://', str(outputWindow.plainText)) is not None", 20000)
|
||||||
output = str(outputWindow.plainText).splitlines()[-1]
|
output = filter(lambda x: len(x), str(outputWindow.plainText).splitlines())[-1]
|
||||||
except:
|
except:
|
||||||
output = ""
|
output = ""
|
||||||
if closeHTTPStatusAndPasterDialog(protocol, ':Send to Codepaster_CodePaster::PasteView'):
|
if closeHTTPStatusAndPasterDialog(protocol, ':Send to Codepaster_CodePaster::PasteView'):
|
||||||
@@ -127,8 +128,17 @@ def fetchSnippet(protocol, description, pasteId, skippedPasting):
|
|||||||
except:
|
except:
|
||||||
closeHTTPStatusAndPasterDialog(protocol, ':PasteSelectDialog_CodePaster::PasteSelectDialog')
|
closeHTTPStatusAndPasterDialog(protocol, ':PasteSelectDialog_CodePaster::PasteSelectDialog')
|
||||||
return -1
|
return -1
|
||||||
waitFor("pasteModel.rowCount() > 1", 20000)
|
|
||||||
if (protocol != NAME_PBCOM and not skippedPasting and not any(map(lambda str:pasteId in str, dumpItems(pasteModel)))):
|
condition = "pasteModel.rowCount() > 1"
|
||||||
|
if protocol == NAME_DPCOM: # no list support
|
||||||
|
condition = "pasteModel.rowCount() == 1"
|
||||||
|
waitFor(condition, 20000)
|
||||||
|
|
||||||
|
if protocol == NAME_DPCOM:
|
||||||
|
items = dumpItems(pasteModel)
|
||||||
|
test.compare(items, ["This protocol does not support listing"], "Check expected message.")
|
||||||
|
elif (protocol != NAME_PBCOM and not skippedPasting
|
||||||
|
and not any(map(lambda str:pasteId in str, dumpItems(pasteModel)))):
|
||||||
test.warning("Fetching too fast for server of %s - waiting 3s and trying to refresh." % protocol)
|
test.warning("Fetching too fast for server of %s - waiting 3s and trying to refresh." % protocol)
|
||||||
snooze(3)
|
snooze(3)
|
||||||
clickButton("{text='Refresh' type='QPushButton' unnamed='1' visible='1' "
|
clickButton("{text='Refresh' type='QPushButton' unnamed='1' visible='1' "
|
||||||
@@ -154,8 +164,8 @@ def fetchSnippet(protocol, description, pasteId, skippedPasting):
|
|||||||
message = "Could not find id '%s' in list of pastes from %s" % (pasteId, protocol)
|
message = "Could not find id '%s' in list of pastes from %s" % (pasteId, protocol)
|
||||||
if protocol == NAME_PBCOM:
|
if protocol == NAME_PBCOM:
|
||||||
test.xfail(message, "pastebin.com does not show pastes in list anymore")
|
test.xfail(message, "pastebin.com does not show pastes in list anymore")
|
||||||
else:
|
elif protocol != NAME_DPCOM: # does not happen now, but kept to avoid forgetting to
|
||||||
test.fail(message)
|
test.fail(message) # re-add when protocols change again
|
||||||
foundSnippet = False
|
foundSnippet = False
|
||||||
replaceEditorContent(waitForObject(":PasteSelectDialog.pasteEdit_QLineEdit"), pasteId)
|
replaceEditorContent(waitForObject(":PasteSelectDialog.pasteEdit_QLineEdit"), pasteId)
|
||||||
if foundSnippet:
|
if foundSnippet:
|
||||||
@@ -168,7 +178,7 @@ def main():
|
|||||||
startQC()
|
startQC()
|
||||||
if not startedWithoutPluginError():
|
if not startedWithoutPluginError():
|
||||||
return
|
return
|
||||||
protocolsToTest = [NAME_PBCOM]
|
protocolsToTest = [NAME_PBCOM, NAME_DPCOM]
|
||||||
sourceFile = os.path.join(os.getcwd(), "testdata", "main.cpp")
|
sourceFile = os.path.join(os.getcwd(), "testdata", "main.cpp")
|
||||||
# make sure General Messages is open
|
# make sure General Messages is open
|
||||||
openGeneralMessages()
|
openGeneralMessages()
|
||||||
|
Reference in New Issue
Block a user