From eb6f037df019add26adaf572c1773d24a92ab7ba Mon Sep 17 00:00:00 2001 From: Alex Jbanca Date: Fri, 21 Jun 2024 10:28:44 +0300 Subject: [PATCH] fix(e2e): Fixing ComboBox isChecked flag to allow 3 state checkboxes --- test/e2e/gui/elements/check_box.py | 5 +++-- test/e2e/gui/elements/object.py | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/test/e2e/gui/elements/check_box.py b/test/e2e/gui/elements/check_box.py index e88aa493b..95ee62226 100644 --- a/test/e2e/gui/elements/check_box.py +++ b/test/e2e/gui/elements/check_box.py @@ -13,8 +13,9 @@ class CheckBox(QObject): @allure.step("Set {0} value: {1}") def set(self, value: bool): - if self.is_checked is not value: + checked = self.checkState != 0 + if checked is not value: self.click() assert driver.waitFor( - lambda: self.is_checked is value, configs.timeouts.UI_LOAD_TIMEOUT_MSEC), 'Value not changed' + lambda: value == (self.checkState != 0), configs.timeouts.UI_LOAD_TIMEOUT_MSEC), 'Value not changed' LOG.info('%s: value changed to "%s"', self, value) diff --git a/test/e2e/gui/elements/object.py b/test/e2e/gui/elements/object.py index 0d04cd187..71007eef6 100644 --- a/test/e2e/gui/elements/object.py +++ b/test/e2e/gui/elements/object.py @@ -72,6 +72,13 @@ class QObject: @allure.step('Get checked {0}') def is_checked(self) -> bool: return getattr(self.object, 'checked') + + @property + @allure.step('Get checkState {0}') + def checkState(self) -> int: + if hasattr(self.object, 'checkState'): + return getattr(self.object, 'checkState') + return 2 if self.is_checked else 0 @property @allure.step('Get visible {0}')