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 | |
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')
-rw-r--r-- | test/gui/shared/scripts/pageObjects/Activity.py | 32 | ||||
-rw-r--r-- | test/gui/shared/steps/steps.py | 6 | ||||
-rw-r--r-- | test/gui/tst_syncing/test.feature | 2 |
3 files changed, 34 insertions, 6 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) diff --git a/test/gui/shared/steps/steps.py b/test/gui/shared/steps/steps.py index 60b94c794..6657825ca 100644 --- a/test/gui/shared/steps/steps.py +++ b/test/gui/shared/steps/steps.py @@ -413,10 +413,10 @@ def step(context, filename): activity.checkFileExist(filename) -@When('the user selects the unsynced files tab') -def step(context): +@When('the user selects "|any|" tab in the activity') +def step(context, tabName): activity = Activity() - activity.clickTab("Not Synced") + activity.clickTab(tabName) def openSharingDialog(context, resource, itemType='file'): diff --git a/test/gui/tst_syncing/test.feature b/test/gui/tst_syncing/test.feature index d0b5bdb45..deda71b2c 100644 --- a/test/gui/tst_syncing/test.feature +++ b/test/gui/tst_syncing/test.feature @@ -38,7 +38,7 @@ Feature: Syncing files And user "Alice" has uploaded file on the server with content "changed server content" to "/conflict.txt" When the user resumes the file sync on the client And the user clicks on the activity tab - And the user selects the unsynced files tab + And the user selects "Not Synced" tab in the activity # Then a conflict warning should be shown for 1 files Then the table of conflict warnings should include file "conflict.txt" And the file "conflict.txt" should exist on the file system with the following content |