diff options
author | Swoichha Adhikari <swoichhaa@gmail.com> | 2021-10-04 13:40:13 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-04 13:40:13 +0300 |
commit | c0eed69faaf0acd734d271a5b5c15a04802a11a9 (patch) | |
tree | 9ef6b024b29e59b0b71cb6d18843318208614fd1 /test | |
parent | 9c3b8410a9b023f01ea3ed01c8d7b275f6e1ff07 (diff) |
[tests-only]add tests for deleting files and folder (#9098)
* [tests-only]add tests for deleting files and folder
* combine when steps into one
Diffstat (limited to 'test')
-rw-r--r-- | test/gui/shared/steps/steps.py | 17 | ||||
-rw-r--r-- | test/gui/suite.conf | 2 | ||||
-rw-r--r-- | test/gui/tst_deletFilesFolders/test.feature | 32 | ||||
-rw-r--r-- | test/gui/tst_deletFilesFolders/test.py | 9 |
4 files changed, 59 insertions, 1 deletions
diff --git a/test/gui/shared/steps/steps.py b/test/gui/shared/steps/steps.py index a3835b660..47eafa570 100644 --- a/test/gui/shared/steps/steps.py +++ b/test/gui/shared/steps/steps.py @@ -8,6 +8,7 @@ import re import urllib.request import json import requests +import shutil from objectmaphelper import RegularExpression from pageObjects.AccountConnectionWizard import AccountConnectionWizard @@ -289,6 +290,11 @@ def step(context, fileName): waitForFileToBeSynced(context, fileName) +@When('the user waits for folder "|any|" to be synced') +def step(context, folderName): + waitForFolderToBeSynced(context, folderName) + + @Given('the user has waited for file "|any|" to be synced') def step(context, fileName): waitForFileToBeSynced(context, fileName) @@ -843,3 +849,14 @@ def step(context): def step(context, errorMsg): newAccount = AccountConnectionWizard() test.compare(str(waitForObjectExists(newAccount.ERROR_LABEL).text), errorMsg) + + +@When(r'the user deletes the (file|folder) "([^"]*)"', regexp=True) +def step(context, itemType, resource): + resourcePath = sanitizePath(context.userData['clientSyncPathUser1'] + resource) + if itemType == 'file': + os.remove(resourcePath) + elif itemType == 'folder': + shutil.rmtree(resourcePath) + else: + raise Exception("No such item type for resource") diff --git a/test/gui/suite.conf b/test/gui/suite.conf index fd4cbf701..ec535920c 100644 --- a/test/gui/suite.conf +++ b/test/gui/suite.conf @@ -4,6 +4,6 @@ HOOK_SUB_PROCESSES=false IMPLICITAUTSTART=0 LANGUAGE=Python OBJECTMAPSTYLE=script -TEST_CASES=tst_addAccount tst_sharing tst_syncing tst_loginLogout tst_removeAccountConnection tst_checkAlltabs tst_vfs +TEST_CASES=tst_addAccount tst_sharing tst_syncing tst_loginLogout tst_removeAccountConnection tst_checkAlltabs tst_vfs tst_deletFilesFolders VERSION=3 WRAPPERS=Qt diff --git a/test/gui/tst_deletFilesFolders/test.feature b/test/gui/tst_deletFilesFolders/test.feature new file mode 100644 index 000000000..57ef3f4ac --- /dev/null +++ b/test/gui/tst_deletFilesFolders/test.feature @@ -0,0 +1,32 @@ +Feature: deleting files and folders + + As a user + I want to delete files and folders + So that I can keep my filing system clean and tidy + + + Background: + Given user "Alice" has been created on the server with default attributes and without skeleton files + + Scenario Outline: Delete a file + Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "<fileName>" on the server + And user "Alice" has set up a client with default settings + When the user waits for file "<fileName>" to be synced + And the user deletes the file "<fileName>" + Then as "Alice" file "<fileName>" should not exist on the server + Examples: + | fileName | + | textfile0.txt | + | textfile0-with-name-more-than-20-characters | + + + Scenario Outline: Delete a folder + Given user "Alice" has created folder "<folderName>" on the server + And user "Alice" has set up a client with default settings + When the user waits for folder "<folderName>" to be synced + And the user deletes the folder "<folderName>" + Then as "Alice" file "<folderName>" should not exist on the server + Examples: + | folderName | + | simple-empty-folder | + | simple-folder-with-name-more-than-20-characters | diff --git a/test/gui/tst_deletFilesFolders/test.py b/test/gui/tst_deletFilesFolders/test.py new file mode 100644 index 000000000..d6224b99e --- /dev/null +++ b/test/gui/tst_deletFilesFolders/test.py @@ -0,0 +1,9 @@ +source(findFile('scripts', 'python/bdd.py')) + +setupHooks('../shared/scripts/bdd_hooks.py') +collectStepDefinitions('./steps', '../shared/steps') + + +def main(): + testSettings.throwOnFailure = True + runFeatureFile('test.feature') |