diff options
author | Sushmita Poudel <66173400+sushmita56@users.noreply.github.com> | 2022-05-04 08:51:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-04 08:51:25 +0300 |
commit | 4e98e193ef3f4bf6b8b004188603d0fa49d1497b (patch) | |
tree | 02eba06cd277a74a156c93115174ce4abfa5e9a4 /test | |
parent | e6358f42d4c251ec635048e93fdff41fdc874dc3 (diff) |
fixed file blacklisting issue (#9599)
Diffstat (limited to 'test')
-rw-r--r-- | test/gui/config.sample.ini | 1 | ||||
-rw-r--r-- | test/gui/shared/scripts/bdd_hooks.py | 2 | ||||
-rw-r--r-- | test/gui/shared/scripts/pageObjects/Activity.py | 63 | ||||
-rw-r--r-- | test/gui/shared/steps/steps.py | 17 | ||||
-rw-r--r-- | test/gui/tst_syncing/test.feature | 5 |
5 files changed, 47 insertions, 41 deletions
diff --git a/test/gui/config.sample.ini b/test/gui/config.sample.ini index 537519538..5b74f6a91 100644 --- a/test/gui/config.sample.ini +++ b/test/gui/config.sample.ini @@ -5,4 +5,5 @@ MIDDLEWARE_URL= CLIENT_ROOT_SYNC_PATH= MAX_SYNC_TIMEOUT= MIN_SYNC_TIMEOUT= +LOWEST_SYNC_TIMEOUT= CLIENT_LOG_FILE=
\ No newline at end of file diff --git a/test/gui/shared/scripts/bdd_hooks.py b/test/gui/shared/scripts/bdd_hooks.py index b8e8e490c..bb4899ffc 100644 --- a/test/gui/shared/scripts/bdd_hooks.py +++ b/test/gui/shared/scripts/bdd_hooks.py @@ -32,6 +32,7 @@ def hook(context): 'secureLocalBackendUrl': 'SECURE_BACKEND_HOST', 'maxSyncTimeout': 'MAX_SYNC_TIMEOUT', 'minSyncTimeout': 'MIN_SYNC_TIMEOUT', + 'lowestSyncTimeout': 'LOWEST_SYNC_TIMEOUT', 'middlewareUrl': 'MIDDLEWARE_URL', 'clientConfigFile': 'CLIENT_LOG_FILE', 'clientRootSyncPath': 'CLIENT_ROOT_SYNC_PATH', @@ -43,6 +44,7 @@ def hook(context): 'secureLocalBackendUrl': 'https://localhost:9200/', 'maxSyncTimeout': 60, 'minSyncTimeout': 5, + 'lowestSyncTimeout': 1, 'middlewareUrl': 'http://localhost:3000/', 'clientConfigFile': '-', 'clientRootSyncPath': '/tmp/client-bdd/', diff --git a/test/gui/shared/scripts/pageObjects/Activity.py b/test/gui/shared/scripts/pageObjects/Activity.py index 136605c84..6497d7a32 100644 --- a/test/gui/shared/scripts/pageObjects/Activity.py +++ b/test/gui/shared/scripts/pageObjects/Activity.py @@ -20,9 +20,6 @@ class Activity: } def clickTab(self, tabName): - # It might take some time for all files to sync except the expected number of unsynced files - squish.snooze(10) - tabFound = False # Selecting tab by name fails for "Not Synced" when there are no unsynced files @@ -57,35 +54,39 @@ class Activity: } ) - def checkBlackListedFileExist(self, filename): + def checkBlackListedResourceExist(self, context, filename): squish.waitForObject(names.settings_OCC_SettingsDialog) - # The blacklisted file does not have text like (conflicted copy) appended to it in the not synced table. - fileRow = squish.waitForObject( - { - "column": 1, - "container": names.oCC_IssuesWidget_tableView_QTableView, - "text": filename, - "type": "QModelIndex", - } - )["row"] - - squish.waitForObjectExists( - { - "column": 6, - "row": fileRow, - "container": names.oCC_IssuesWidget_tableView_QTableView, - "text": "Blacklisted", - "type": "QModelIndex", - } + result = squish.waitFor( + lambda: self.isResourceBlackListed(context, filename), + context.userData['maxSyncTimeout'] * 1000, ) - def checkAtLeastABlacklistedFile(self): - squish.waitForObjectExists( - { - "column": 6, - "container": names.oCC_IssuesWidget_tableView_QTableView, - "text": "Blacklisted", - "type": "QModelIndex", - } - ) + return result + + def isResourceBlackListed(self, context, filename): + try: + # The blacklisted file does not have text like (conflicted copy) appended to it in the not synced table. + fileRow = squish.waitForObject( + { + "column": 1, + "container": names.oCC_IssuesWidget_tableView_QTableView, + "text": filename, + "type": "QModelIndex", + }, + context.userData['lowestSyncTimeout'] * 1000, + )["row"] + squish.waitForObjectExists( + { + "column": 6, + "row": fileRow, + "container": names.oCC_IssuesWidget_tableView_QTableView, + "text": "Blacklisted", + "type": "QModelIndex", + }, + context.userData['lowestSyncTimeout'] * 1000, + ) + + return True + except: + return False diff --git a/test/gui/shared/steps/steps.py b/test/gui/shared/steps/steps.py index fe7dc32ee..927fc7ede 100644 --- a/test/gui/shared/steps/steps.py +++ b/test/gui/shared/steps/steps.py @@ -429,6 +429,11 @@ def step(context, type, resource): waitForFileOrFolderToSync(context, resource, type) +@Given(r'user has waited for (file|folder) to be synced', regexp=True) +def step(context, type, resource): + waitForFileOrFolderToSync(context, resource, type) + + @When(r'the user waits for (file|folder) "([^"]*)" to have sync error', regexp=True) def step(context, type, resource): waitForFileOrFolderToHaveSyncError(context, resource, type) @@ -705,13 +710,11 @@ def step(context, filename): @Then('the file "|any|" should be blacklisted') def step(context, filename): activity = Activity() - activity.checkBlackListedFileExist(filename) - - -@When('the user waits until at least a file is blacklisted') -def step(context): - activity = Activity() - activity.checkAtLeastABlacklistedFile() + test.compare( + True, + activity.checkBlackListedResourceExist(context, filename), + "File is blacklisted", + ) @When('the user selects "|any|" tab in the activity') diff --git a/test/gui/tst_syncing/test.feature b/test/gui/tst_syncing/test.feature index e733019e6..e57c8e06d 100644 --- a/test/gui/tst_syncing/test.feature +++ b/test/gui/tst_syncing/test.feature @@ -242,15 +242,15 @@ Feature: Syncing files And as "Alice" folder "Folder1/subFolder1" should exist on the server And as "Alice" folder "Folder1/subFolder1/subFolder2" should exist on the server - @skip @issue-9281 + Scenario: Filenames that are rejected by the server are reported Given user "Alice" has set up a client with default settings And user "Alice" has created a folder "Folder1" inside the sync folder + And the user has waited for folder "Folder1" to be synced When user "Alice" creates a file "Folder1/a\\a.txt" with the following content inside the sync folder """ test content """ - And the user waits for folder "Folder1" to be synced Then as "Alice" folder "Folder1" should exist on the server When the user clicks on the activity tab And the user selects "Not Synced" tab in the activity @@ -351,7 +351,6 @@ Feature: Syncing files """ And the user clicks on the activity tab And the user selects "Not Synced" tab in the activity - And the user waits until at least a file is blacklisted Then the file "<filename>" should be blacklisted Examples: | filename | |