diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-11-06 10:43:58 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-11-06 14:57:23 +0100 |
commit | c7d258d6e8b0ca78003b172806928443e9634416 (patch) | |
tree | 746810e62f63e22825d6bae2e6734a62fe51cf8f /sw/qa | |
parent | 78dac9f19460b92da3e56214cd5833c7407ab0f2 (diff) |
tdf#137908: uitest: Add asserts to check there is at least 1 element
Change-Id: I7e259043ad493d7e9c4ca34d64a4ca1ed1cf8db5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105391
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/uitest/writer_tests5/autocorrectOptions.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/sw/qa/uitest/writer_tests5/autocorrectOptions.py b/sw/qa/uitest/writer_tests5/autocorrectOptions.py index 55d4b382cd3e..f9d5d5b9117b 100644 --- a/sw/qa/uitest/writer_tests5/autocorrectOptions.py +++ b/sw/qa/uitest/writer_tests5/autocorrectOptions.py @@ -30,6 +30,8 @@ class autocorrectOptions(UITestCase): xreset = xDialog.getChild("reset") nrRows = get_state_as_dict(xtabview)["VisibleCount"] + self.assertTrue(int(nrRows) > 0) + #add new rule origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) @@ -58,16 +60,19 @@ class autocorrectOptions(UITestCase): delabbrev = xDialog.getChild("delabbrev") abbrevlist = xDialog.getChild("abbrevlist") - nrRowsAbb = get_state_as_dict(abbrevlist)["Children"] + nrRowsAbb = get_state_as_dict(abbrevlist)["VisibleCount"] + + self.assertTrue(int(nrRowsAbb) > 0) + abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) abbrev.executeAction("TYPE", mkPropertyValues({"TEXT":"qqqqq"})) newabbrev.executeAction("CLICK", tuple()) - nrRowsAbbNew = get_state_as_dict(abbrevlist)["Children"] + nrRowsAbbNew = get_state_as_dict(abbrevlist)["VisibleCount"] nrRowsAbbDiff = int(nrRowsAbbNew) - int(nrRowsAbb) self.assertEqual(nrRowsAbbDiff, 1) #we have +1 rule delabbrev.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(abbrevlist)["Children"], nrRowsAbb) #we have default nr of rules + self.assertEqual(get_state_as_dict(abbrevlist)["VisibleCount"], nrRowsAbb) #we have default nr of rules #words with two initial capitals double = xDialog.getChild("double") @@ -75,16 +80,19 @@ class autocorrectOptions(UITestCase): deldouble = xDialog.getChild("deldouble") doublelist = xDialog.getChild("doublelist") - nrRowsDouble = get_state_as_dict(doublelist)["Children"] + nrRowsDouble = get_state_as_dict(doublelist)["VisibleCount"] + + self.assertTrue(int(nrRowsDouble) > 0) + double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) double.executeAction("TYPE", mkPropertyValues({"TEXT":"QQqqq"})) newdouble.executeAction("CLICK", tuple()) - nrRowsDoubleNew = get_state_as_dict(doublelist)["Children"] + nrRowsDoubleNew = get_state_as_dict(doublelist)["VisibleCount"] nrRowsDoubleDiff = int(nrRowsDoubleNew) - int(nrRowsDouble) #convert string and self.assertEqual(nrRowsDoubleDiff, 1) #we have +1 rule deldouble.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(doublelist)["Children"], nrRowsDouble) #we have default nr of rules + self.assertEqual(get_state_as_dict(doublelist)["VisibleCount"], nrRowsDouble) #we have default nr of rules xCancelButton = xDialog.getChild("cancel") xCancelButton.executeAction("CLICK", tuple()) |