diff options
author | Swoichha Adhikari <swoichhaa@gmail.com> | 2021-09-17 17:41:35 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-17 17:41:35 +0300 |
commit | 2a758f37edbf6fa0ffc59cd83c8c189fe3775925 (patch) | |
tree | 0c0b2278be66c8506f891b441c284ac588ca4a21 /test/gui/shared/scripts | |
parent | e0d1caf7780b4ad07fe40ed31be2ca99cc8a6856 (diff) |
[tests-only] Fix "sync conflict" test scenario (#9032)
* refactor clickTab in Activity
* make test step reusable
Co-authored-by: Saw-jan <saw.jan.grg3e@gmail.com>
Diffstat (limited to 'test/gui/shared/scripts')
-rw-r--r-- | test/gui/shared/scripts/pageObjects/Activity.py | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/test/gui/shared/scripts/pageObjects/Activity.py b/test/gui/shared/scripts/pageObjects/Activity.py index 1ec71db9e..a0e1a7d54 100644 --- a/test/gui/shared/scripts/pageObjects/Activity.py +++ b/test/gui/shared/scripts/pageObjects/Activity.py @@ -5,6 +5,13 @@ from helpers.FilesHelper import buildConflictedRegex class Activity: + SUBTAB_CONTAINER = { + "container": names.settings_stack_QStackedWidget, + "name": "qt_tabwidget_tabbar", + "type": "QTabBar", + "visible": 1, + } + SUBTAB = { "container": names.settings_stack_QStackedWidget, "type": "QTabWidget", @@ -13,10 +20,31 @@ class Activity: } def clickTab(self, tabName): - # TODO: find some way to dynamically select the tab name # It might take some time for all files to sync except the expected number of unsynced files squish.snooze(10) - squish.clickTab(squish.waitForObject(self.SUBTAB), tabName) + + tabFound = False + + # Selecting tab by name fails for "Not Synced" when there are no unsynced files + # Because files count will be appended like "Not Synced (2)" + # So to overcome this the following approach has been implemented + tabCount = squish.waitForObjectExists(self.SUBTAB_CONTAINER).count + for index in range(tabCount): + tabText = squish.waitForObjectExists( + { + "container": names.stack_qt_tabwidget_tabbar_QTabBar, + "index": index, + "type": "TabItem", + } + ).text + + if tabName in tabText: + tabFound = True + squish.clickTab(squish.waitForObject(self.SUBTAB), tabText) + break + + if not tabFound: + raise Exception("Tab not found: " + tabName) def checkFileExist(self, filename): squish.waitForObject(names.settings_OCC_SettingsDialog) |