From e5645ced1123f705ede06765df7a2b4180954390 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Wed, 26 Aug 2020 18:13:26 +0545 Subject: [PATCH 1/4] [Tests-Only] Add api trashbin tests --- .../expected-failures-on-OC-storage.txt | 6 +++ .../apiTrashbin-trashbinDelete.feature | 52 +++++++++++++++++++ .../apiTrashbin-trashbinFilesFolders.feature | 38 ++++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 tests/acceptance/features/apiOcisSpecific/apiTrashbin-trashbinDelete.feature create mode 100644 tests/acceptance/features/apiOcisSpecific/apiTrashbin-trashbinFilesFolders.feature diff --git a/tests/acceptance/expected-failures-on-OC-storage.txt b/tests/acceptance/expected-failures-on-OC-storage.txt index e6cf6e14a3..c1f0a05510 100644 --- a/tests/acceptance/expected-failures-on-OC-storage.txt +++ b/tests/acceptance/expected-failures-on-OC-storage.txt @@ -468,6 +468,8 @@ apiSharePublicLink2/uploadToPublicLinkShare.feature:255 # https://github.com/owncloud/ocis-reva/issues/286 Upload-only shares must not overwrite but create a separate file apiSharePublicLink2/uploadToPublicLinkShare.feature:273 # +# https://github.com/owncloud/product/issues/179 Propfind to trashbin endpoint requires UUID +# https://github.com/owncloud/product/issues/178 File deletion using dav gives unique string in filename in the trashbin apiTrashbin/trashbinDelete.feature:31 apiTrashbin/trashbinDelete.feature:32 apiTrashbin/trashbinDelete.feature:33 @@ -476,6 +478,8 @@ apiTrashbin/trashbinDelete.feature:37 apiTrashbin/trashbinDelete.feature:50 apiTrashbin/trashbinDelete.feature:67 # +# https://github.com/owncloud/product/issues/179 Propfind to trashbin endpoint requires UUID +# https://github.com/owncloud/product/issues/178 File deletion using dav gives unique string in filename in the trashbin apiTrashbin/trashbinFilesFolders.feature:44 apiTrashbin/trashbinFilesFolders.feature:45 apiTrashbin/trashbinFilesFolders.feature:60 @@ -497,6 +501,8 @@ apiTrashbin/trashbinFilesFolders.feature:242 apiTrashbin/trashbinFilesFolders.feature:255 apiTrashbin/trashbinFilesFolders.feature:256 # +# https://github.com/owncloud/product/issues/179 Propfind to trashbin endpoint requires UUID +# https://github.com/owncloud/product/issues/178 File deletion using dav gives unique string in filename in the trashbin apiTrashbin/trashbinRestore.feature:31 apiTrashbin/trashbinRestore.feature:32 apiTrashbin/trashbinRestore.feature:62 diff --git a/tests/acceptance/features/apiOcisSpecific/apiTrashbin-trashbinDelete.feature b/tests/acceptance/features/apiOcisSpecific/apiTrashbin-trashbinDelete.feature new file mode 100644 index 0000000000..697c8787c1 --- /dev/null +++ b/tests/acceptance/features/apiOcisSpecific/apiTrashbin-trashbinDelete.feature @@ -0,0 +1,52 @@ +@api @files_trashbin-app-required +Feature: files and folders can be deleted from the trashbin + As a user + I want to delete files and folders from the trashbin + So that I can control my trashbin space and which files are kept in that space + + Background: + Given user "Alice" has been created with default attributes and without skeleton files + And user "Alice" has uploaded file with content "to delete" to "/textfile0.txt" + And user "Alice" has uploaded file with content "to delete" to "/textfile1.txt" + And user "Alice" has created folder "PARENT" + And user "Alice" has created folder "PARENT/CHILD" + And user "Alice" has uploaded file with content "to delete" to "/PARENT/parent.txt" + And user "Alice" has uploaded file with content "to delete" to "/PARENT/CHILD/child.txt" + + @smokeTest + @issue-product-139 + @issue-product-178 + @issue-product-179 + Scenario Outline: Trashbin cannot be emptied + # after fixing all issues delete this Scenario and use the one from oC10 core + # because of @issue-product-178 we cannot perform this test using new dav, so only old dav is being used + Given user "Alice" has uploaded file with content "file with comma" to "sample,0.txt" + And user "Alice" has uploaded file with content "file with comma" to "sample,1.txt" + And using old DAV path + And user "Alice" has deleted file "" + And user "Alice" has deleted file "" + And as "Alice" file "" should exist in the trashbin + And as "Alice" file "" should exist in the trashbin + When user "Alice" empties the trashbin using the trashbin API + Then as "Alice" the file with original path "" should exist in the trashbin + And as "Alice" the file with original path "" should exist in the trashbin + Examples: + | filename1 | filename2 | + | textfile0.txt | textfile1.txt | + | sample,0.txt | sample,1.txt | + + @smokeTest + @issue-ocis-reva-118 + @issue-product-179 + # after fixing all issues delete this Scenario and use the one from oC10 core + Scenario: delete a single file from the trashbin + Given user "Alice" has deleted file "/textfile0.txt" + And user "Alice" has deleted file "/textfile1.txt" + And user "Alice" has deleted file "/PARENT/parent.txt" + And user "Alice" has deleted file "/PARENT/CHILD/child.txt" + When user "Alice" deletes the file with original path "textfile1.txt" from the trashbin using the trashbin API + Then the HTTP status code should be "405" + And as "Alice" the file with original path "/textfile1.txt" should exist in the trashbin + But as "Alice" the file with original path "/textfile0.txt" should exist in the trashbin + And as "Alice" the file with original path "/PARENT/parent.txt" should exist in the trashbin + And as "Alice" the file with original path "/PARENT/CHILD/child.txt" should exist in the trashbin diff --git a/tests/acceptance/features/apiOcisSpecific/apiTrashbin-trashbinFilesFolders.feature b/tests/acceptance/features/apiOcisSpecific/apiTrashbin-trashbinFilesFolders.feature new file mode 100644 index 0000000000..3da3f6e6f1 --- /dev/null +++ b/tests/acceptance/features/apiOcisSpecific/apiTrashbin-trashbinFilesFolders.feature @@ -0,0 +1,38 @@ +@api @files_trashbin-app-required +Feature: files and folders exist in the trashbin after being deleted + As a user + I want deleted files and folders to be available in the trashbin + So that I can recover data easily + + Background: + Given user "Alice" has been created with default attributes and skeleton files + + @smokeTest + @issue-product-178 + # after fixing all issues delete this Scenario and use the one from oC10 core + Scenario: deleting a file moves it to trashbin + Given using old DAV path + When user "Alice" deletes file "/textfile0.txt" using the WebDAV API + And using new DAV path + When user "Alice" deletes file "/textfile1.txt" using the WebDAV API + Then as "Alice" the file with original path "/textfile0.txt" should exist in the trashbin + But as "Alice" the file with original path "/textfile1.txt" should not exist in the trashbin + And as "Alice" the file with original path "Alice/textfile1.txt" should exist in the trashbin + And as "Alice" file "/textfile0.txt" should not exist + And as "Alice" file "/textfile1.txt" should not exist + + @smokeTest + @issue-product-178 + # after fixing all issues delete this Scenario and use the one from oC10 core + Scenario: deleting a folder moves it to trashbin + Given user "Alice" has created folder "/tmp1" + And user "Alice" has created folder "/tmp2" + And using old DAV path + When user "Alice" deletes folder "/tmp1" using the WebDAV API + And using new DAV path + When user "Alice" deletes folder "/tmp2" using the WebDAV API + Then as "Alice" the folder with original path "/tmp1" should exist in the trashbin + But as "Alice" the folder with original path "/tmp2" should not exist in the trashbin + And as "Alice" the folder with original path "Alice/tmp2" should exist in the trashbin + And as "Alice" folder "/tmp1" should not exist + And as "Alice" folder "/tmp2" should not exist From b1e1f9f6a49597332f44e50e477a215dabbc993a Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Wed, 26 Aug 2020 22:25:17 +0545 Subject: [PATCH 2/4] Also use new dav-path for empty-trashbin local scenarios --- .../apiTrashbin-trashbinDelete.feature | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/acceptance/features/apiOcisSpecific/apiTrashbin-trashbinDelete.feature b/tests/acceptance/features/apiOcisSpecific/apiTrashbin-trashbinDelete.feature index 697c8787c1..a1202f0f31 100644 --- a/tests/acceptance/features/apiOcisSpecific/apiTrashbin-trashbinDelete.feature +++ b/tests/acceptance/features/apiOcisSpecific/apiTrashbin-trashbinDelete.feature @@ -19,10 +19,9 @@ Feature: files and folders can be deleted from the trashbin @issue-product-179 Scenario Outline: Trashbin cannot be emptied # after fixing all issues delete this Scenario and use the one from oC10 core - # because of @issue-product-178 we cannot perform this test using new dav, so only old dav is being used Given user "Alice" has uploaded file with content "file with comma" to "sample,0.txt" And user "Alice" has uploaded file with content "file with comma" to "sample,1.txt" - And using old DAV path + And using "" DAV path And user "Alice" has deleted file "" And user "Alice" has deleted file "" And as "Alice" file "" should exist in the trashbin @@ -31,9 +30,11 @@ Feature: files and folders can be deleted from the trashbin Then as "Alice" the file with original path "" should exist in the trashbin And as "Alice" the file with original path "" should exist in the trashbin Examples: - | filename1 | filename2 | - | textfile0.txt | textfile1.txt | - | sample,0.txt | sample,1.txt | + | dav-path | filename1 | filename2 | + | old | textfile0.txt | textfile1.txt | + | old | sample,0.txt | sample,1.txt | + | new | textfile0.txt | textfile1.txt | + | new | sample,0.txt | sample,1.txt | @smokeTest @issue-ocis-reva-118 From 34dd0dc00029ece104ea3b296429c6712663f643 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Wed, 26 Aug 2020 22:39:33 +0545 Subject: [PATCH 3/4] Add TrashbinContext to local acceptance tests --- tests/acceptance/config/behat.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml index 883dd16793..36ce61dfef 100644 --- a/tests/acceptance/config/behat.yml +++ b/tests/acceptance/config/behat.yml @@ -26,6 +26,7 @@ default: - FavoritesContext: - FilesVersionsContext: - PublicWebDavContext: + - TrashbinContext: - WebDavPropertiesContext: extensions: From f9c4560de7503fe9387be7f4c7a77230aad119d7 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Wed, 26 Aug 2020 22:54:59 +0545 Subject: [PATCH 4/4] Adjust local trashbin scenarios now that new DAV path works --- .../apiTrashbin-trashbinFilesFolders.feature | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/acceptance/features/apiOcisSpecific/apiTrashbin-trashbinFilesFolders.feature b/tests/acceptance/features/apiOcisSpecific/apiTrashbin-trashbinFilesFolders.feature index 3da3f6e6f1..ff8fc05e62 100644 --- a/tests/acceptance/features/apiOcisSpecific/apiTrashbin-trashbinFilesFolders.feature +++ b/tests/acceptance/features/apiOcisSpecific/apiTrashbin-trashbinFilesFolders.feature @@ -16,8 +16,7 @@ Feature: files and folders exist in the trashbin after being deleted And using new DAV path When user "Alice" deletes file "/textfile1.txt" using the WebDAV API Then as "Alice" the file with original path "/textfile0.txt" should exist in the trashbin - But as "Alice" the file with original path "/textfile1.txt" should not exist in the trashbin - And as "Alice" the file with original path "Alice/textfile1.txt" should exist in the trashbin + And as "Alice" the file with original path "/textfile1.txt" should exist in the trashbin And as "Alice" file "/textfile0.txt" should not exist And as "Alice" file "/textfile1.txt" should not exist @@ -32,7 +31,6 @@ Feature: files and folders exist in the trashbin after being deleted And using new DAV path When user "Alice" deletes folder "/tmp2" using the WebDAV API Then as "Alice" the folder with original path "/tmp1" should exist in the trashbin - But as "Alice" the folder with original path "/tmp2" should not exist in the trashbin - And as "Alice" the folder with original path "Alice/tmp2" should exist in the trashbin + And as "Alice" the folder with original path "/tmp2" should exist in the trashbin And as "Alice" folder "/tmp1" should not exist And as "Alice" folder "/tmp2" should not exist