From f529051b58b93631decb1f8ab4e8248bb19828d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Wed, 18 Aug 2021 21:36:01 +0200 Subject: [PATCH] Squish: Be fuzzy when comparing snippet fetched from Pastebin.Com Change-Id: If08b2b9136d55e2dddca6181c1075d845422a30b Reviewed-by: Christian Stenger --- tests/system/suite_tools/tst_codepasting/test.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/system/suite_tools/tst_codepasting/test.py b/tests/system/suite_tools/tst_codepasting/test.py index 76dbb7ca092..530deca473a 100644 --- a/tests/system/suite_tools/tst_codepasting/test.py +++ b/tests/system/suite_tools/tst_codepasting/test.py @@ -239,9 +239,16 @@ def main(): clickButton(waitForObject(":*Qt Creator.Clear_QToolButton")) continue test.compare(filenameCombo.currentText, "%s: %s" % (protocol, pasteId), "Verify title of editor") - if protocol in (NAME_DPCOM, NAME_PBCOM) and pastedText.endswith("\n"): - pastedText = pastedText[:-1] - test.compare(editor.plainText, pastedText, "Verify that pasted and fetched texts are the same") + if protocol in (NAME_PBCOM): + test.verify(abs(len(str(editor.plainText)) - len(pastedText)) < 2, + "Verify that pasted and fetched texts have similar length") + test.compare(str(editor.plainText).rstrip(), pastedText.rstrip(), + "Verify that pasted and fetched texts have the same content") + else: + if protocol in (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()