diff options
author | Talank <talank@gces.edu.np> | 2021-10-29 14:52:21 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-29 14:52:21 +0300 |
commit | 3506d0831ea5e86bb384e352f5f5b03ce20af9cb (patch) | |
tree | d198d0fe13a31785ce56f33a2b45c5ad81198a0e /test/gui/shared | |
parent | 3465795ebb2d8dd84f2aa9a3a18ac7b7ac5133d2 (diff) |
[Tests-Only]Added tests for folder creation and syncing (#8980)
Diffstat (limited to 'test/gui/shared')
-rw-r--r-- | test/gui/shared/scripts/pageObjects/Activity.py | 23 | ||||
-rw-r--r-- | test/gui/shared/steps/steps.py | 39 |
2 files changed, 62 insertions, 0 deletions
diff --git a/test/gui/shared/scripts/pageObjects/Activity.py b/test/gui/shared/scripts/pageObjects/Activity.py index a0e1a7d54..518fa7b14 100644 --- a/test/gui/shared/scripts/pageObjects/Activity.py +++ b/test/gui/shared/scripts/pageObjects/Activity.py @@ -56,3 +56,26 @@ class Activity: "type": "QModelIndex", } ) + + def checkBlackListedFileExist(self, 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", + } + ) diff --git a/test/gui/shared/steps/steps.py b/test/gui/shared/steps/steps.py index 879466b15..5791e8c71 100644 --- a/test/gui/shared/steps/steps.py +++ b/test/gui/shared/steps/steps.py @@ -303,14 +303,47 @@ def step(context, fileName): waitForFileToBeSynced(context, fileName) +@Given( + 'the user has created a file "|any|" with the following content on the file system' +) +def step(context, filename): + createFile(context, filename) + + @When('the user creates a file "|any|" with the following content on the file system') def step(context, filename): + createFile(context, filename) + + +def createFile(context, filename): fileContent = "\n".join(context.multiLineText) f = open(context.userData['clientSyncPathUser1'] + filename, "w") f.write(fileContent) f.close() +@When('the user creates a folder "|any|"') +def step(context, foldername): + createFolder(context, foldername) + + +@Given('the user has created a folder "|any|"') +def step(context, foldername): + createFolder(context, foldername) + + +def createFolder(context, foldername): + path = join(context.userData['clientSyncPathUser1'], foldername) + os.makedirs(path) + + +@When('the user copies the folder "|any|" to "|any|"') +def step(context, sourceFolder, destinationFolder): + source_dir = join(context.userData['clientSyncPathUser1'], sourceFolder) + destination_dir = join(context.userData['clientSyncPathUser1'], destinationFolder) + shutil.copytree(source_dir, destination_dir) + + @Given(r"^(.*) on the server (.*)$", regexp=True) def step(context, stepPart1, stepPart2): executeStepThroughMiddleware(context, "Given " + stepPart1 + " " + stepPart2) @@ -482,6 +515,12 @@ def step(context, filename): activity.checkFileExist(filename) +@Then('the file "|any|" should be blacklisted') +def step(context, filename): + activity = Activity() + activity.checkBlackListedFileExist(filename) + + @When('the user selects "|any|" tab in the activity') def step(context, tabName): activity = Activity() |