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 | |
parent | 3465795ebb2d8dd84f2aa9a3a18ac7b7ac5133d2 (diff) |
[Tests-Only]Added tests for folder creation and syncing (#8980)
Diffstat (limited to 'test/gui')
-rw-r--r-- | test/gui/shared/scripts/pageObjects/Activity.py | 23 | ||||
-rw-r--r-- | test/gui/shared/steps/steps.py | 39 | ||||
-rw-r--r-- | test/gui/tst_syncing/test.feature | 115 |
3 files changed, 176 insertions, 1 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() diff --git a/test/gui/tst_syncing/test.feature b/test/gui/tst_syncing/test.feature index 633bd2fae..eca30085b 100644 --- a/test/gui/tst_syncing/test.feature +++ b/test/gui/tst_syncing/test.feature @@ -146,4 +146,117 @@ Feature: Syncing files | folder | | aFolder | | 123Folder | - | bFolder |
\ No newline at end of file + | bFolder | + + + Scenario Outline: Syncing a folder to the server + Given user "Alice" has set up a client with default settings + When the user creates a folder "<foldername>" + And the user waits for folder "<foldername>" to be synced + Then as "Alice" folder "<foldername>" should exist on the server + Examples: + | foldername | + | myFolder | + | really long folder name with some spaces and special char such as $%ñ& | + + + Scenario: Many subfolders can be synced + Given user "Alice" has set up a client with default settings + And the user has created a folder "parent" + When the user creates a folder "parent/subfolderEmpty1" + And the user creates a folder "parent/subfolderEmpty2" + And the user creates a folder "parent/subfolderEmpty3" + And the user creates a folder "parent/subfolderEmpty4" + And the user creates a folder "parent/subfolderEmpty5" + And the user creates a folder "parent/subfolder1" + And the user creates a folder "parent/subfolder2" + And the user creates a folder "parent/subfolder3" + And the user creates a folder "parent/subfolder4" + And the user creates a folder "parent/subfolder5" + And the user creates a file "parent/subfolder1/test.txt" with the following content on the file system + """ + test content + """ + And the user creates a file "parent/subfolder2/test.txt" with the following content on the file system + """ + test content + """ + And the user creates a file "parent/subfolder3/test.txt" with the following content on the file system + """ + test content + """ + And the user creates a file "parent/subfolder4/test.txt" with the following content on the file system + """ + test content + """ + And the user creates a file "parent/subfolder5/test.txt" with the following content on the file system + """ + test content + """ + And the user waits for folder "parent" to be synced + Then as "Alice" folder "parent/subfolderEmpty1" should exist on the server + And as "Alice" folder "parent/subfolderEmpty2" should exist on the server + And as "Alice" folder "parent/subfolderEmpty3" should exist on the server + And as "Alice" folder "parent/subfolderEmpty4" should exist on the server + And as "Alice" folder "parent/subfolderEmpty5" should exist on the server + And as "Alice" folder "parent/subfolder1" should exist on the server + And as "Alice" folder "parent/subfolder2" should exist on the server + And as "Alice" folder "parent/subfolder3" should exist on the server + And as "Alice" folder "parent/subfolder4" should exist on the server + And as "Alice" folder "parent/subfolder5" should exist on the server + + + Scenario: Both original and copied folders can be synced + Given user "Alice" has set up a client with default settings + And the user has created a folder "original" + And the user has created a file "original/test.txt" with the following content on the file system + """ + test content + """ + When the user copies the folder "original" to "copied" + And the user waits for folder "copied" to be synced + Then as "Alice" folder "original" should exist on the server + And as "Alice" folder "copied" should exist on the server + + + Scenario: Verify that you can create a subfolder with long name + Given user "Alice" has set up a client with default settings + And the user has created a folder "Folder1" + When the user creates a folder "Folder1/really long folder name with some spaces and special char such as $%ñ&" + And the user creates a file "Folder1/really long folder name with some spaces and special char such as $%ñ&/test.txt" with the following content on the file system + """ + test content + """ + And the user waits for file "Folder1/really long folder name with some spaces and special char such as $%ñ&/test.txt" to be synced + Then as "Alice" folder "Folder1" should exist on the server + And as "Alice" folder "Folder1/really long folder name with some spaces and special char such as $%ñ&" should exist on the server + And the file "Folder1/really long folder name with some spaces and special char such as $%ñ&/test.txt" should exist on the file system with the following content + """ + test content + """ + And as "Alice" the file "Folder1/really long folder name with some spaces and special char such as $%ñ&/test.txt" on the server should have the content "test content" + + + Scenario: Verify pre existing folders in local (Desktop client) are copied over to the server + Given the user has created a folder "Folder1" + And the user has created a folder "Folder1/subFolder1" + And the user has created a folder "Folder1/subFolder1/subFolder2" + And user "Alice" has set up a client with default settings + When the user waits for folder "Folder1" to be synced + Then as "Alice" folder "Folder1" should exist on the server + And as "Alice" folder "Folder1/subFolder1" should exist on the server + And as "Alice" folder "Folder1/subFolder1/subFolder2" should exist on the server + + + Scenario: Filenames that are rejected by the server are reported + Given user "Alice" has set up a client with default settings + And the user has created a folder "Folder1" + When the user creates a file "Folder1/a\\a.txt" with the following content on the file system + """ + 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 + Then the file "Folder1/a\\a.txt" should be blacklisted |