diff options
author | Christian Stenger <christian.stenger@qt.io> | 2020-07-23 14:40:26 +0200 |
---|---|---|
committer | Christian Stenger <christian.stenger@qt.io> | 2020-08-19 13:55:09 +0000 |
commit | abffbe380623b2cf45571eab4ca3ae7558a7d151 (patch) | |
tree | 90a95d733736f8b8f9aa064c9f4af4fcd5a2202b /tests | |
parent | a638c252527cd5f819d6c934d94c5965616864a2 (diff) |
Squish: Fix expectations
Added observation functionality for a temporary move
of the URL.
Let the test fail if the move becomes permanent.
Change-Id: I7989d654ea6e89ccba112b5cb640144afba40339
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/system/suite_tools/tst_codepasting/test.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/tests/system/suite_tools/tst_codepasting/test.py b/tests/system/suite_tools/tst_codepasting/test.py index e2686d25b6..a5441050a9 100644 --- a/tests/system/suite_tools/tst_codepasting/test.py +++ b/tests/system/suite_tools/tst_codepasting/test.py @@ -91,7 +91,7 @@ def pasteFile(sourceFile, protocol): clickButton(waitForObject(":Send to Codepaster.Paste_QPushButton")) try: outputWindow = waitForObject(":Qt Creator_Core::OutputWindow") - waitFor("re.search('^https?://', str(outputWindow.plainText)) is not None", 20000) + waitFor("re.search('^https://', str(outputWindow.plainText)) is not None", 20000) output = filter(lambda x: len(x), str(outputWindow.plainText).splitlines())[-1] except: output = "" @@ -174,6 +174,21 @@ def fetchSnippet(protocol, description, pasteId, skippedPasting): clickButton(waitForObject(":PasteSelectDialog.OK_QPushButton")) return pasteId +def checkForMovedUrl(): # protocol may be redirected (HTTP status 30x) - check for permanent moves + try: + pattern = re.compile(r'HTTP redirect \((\d{3})\) to "(.+)"') + outputWindow = waitForObject(":Qt Creator_Core::OutputWindow", 2000) + match = [None] + def __patternMatches__(matchHack): + matchHack[0] = pattern.search(str(outputWindow.plainText)) + return matchHack[0] is not None + waitFor("__patternMatches__(match)", 1000) + if match[0] is not None: + test.fail("URL has moved permanently.", match[0].group(0)) + except: + t,v,tb = sys.exc_info() + test.log(str(t), str(v)) + def main(): startQC() if not startedWithoutPluginError(): @@ -224,9 +239,13 @@ def main(): clickButton(waitForObject(":*Qt Creator.Clear_QToolButton")) continue test.compare(filenameCombo.currentText, "%s: %s" % (protocol, pasteId), "Verify title of editor") - if protocol == NAME_PBCOM and pastedText.endswith("\n"): + if protocol in (NAME_PBCOM, NAME_DPCOM) and pastedText.endswith("\n"): pastedText = pastedText[:-1] test.compare(editor.plainText, pastedText, "Verify that pasted and fetched texts are the same") + + if protocol == NAME_DPCOM: + checkForMovedUrl() + invokeMenuItem("File", "Close All") invokeMenuItem("File", "Open File or Project...") selectFromFileDialog(sourceFile) |