From c0f0a9eeccbb663d43de6479743639825e685af8 Mon Sep 17 00:00:00 2001 From: Kiran Parajuli Date: Wed, 12 Oct 2022 13:17:38 +0545 Subject: [PATCH] point three Signed-off-by: Kiran Parajuli --- .../apiWebdavOperations/search.feature | 69 ++++++++++++++----- .../features/bootstrap/SearchContext.php | 25 ++++--- 2 files changed, 63 insertions(+), 31 deletions(-) diff --git a/tests/acceptance/features/apiWebdavOperations/search.feature b/tests/acceptance/features/apiWebdavOperations/search.feature index 0b050b472f1e..578ec69156f8 100644 --- a/tests/acceptance/features/apiWebdavOperations/search.feature +++ b/tests/acceptance/features/apiWebdavOperations/search.feature @@ -212,8 +212,9 @@ Feature: Search | dav_version | last_modified_regex | | spaces | ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$ | - @skipOnOcV10 - Scenario Outline: report extra properties in search entries for a file + @skipOnOcV10 @issues-4712 + # after the issue is fixed, the above scenario should be run for oCIS as well + Scenario Outline: report extra properties in search entries for a file (oCIS bug demonstration) Given using DAV path When user "Alice" searches for "upload" using the WebDAV API requesting these properties: | oc:fileid | @@ -226,26 +227,26 @@ Feature: Search | oc:owner-display-name | Then the HTTP status code should be "207" And file "/upload.txt" in the search result of user "Alice" should contain these properties: - | name | value | - | {http://owncloud.org/ns}fileid | \d* | - | {http://owncloud.org/ns}permissions | ^(RDNVW\|RMDNVW)$ | - | {DAV:}getlastmodified | | - | {DAV:}getetag | NULL | - | {DAV:}getcontenttype | text\/plain | - | {http://owncloud.org/ns}size | NA | - | {http://owncloud.org/ns}owner-id | %username% | - | {http://owncloud.org/ns}owner-display-name | %displayname% | + | name | value | + | {http://owncloud.org/ns}fileid | \d* | + | {http://owncloud.org/ns}permissions | ^(RDNVW\|RMDNVW)$ | + | {DAV:}getlastmodified | ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$ | + | {DAV:}getetag | NULL | + | {DAV:}getcontenttype | text\/plain | + | {http://owncloud.org/ns}size | N/A | + | {http://owncloud.org/ns}owner-id | N/A | + | {http://owncloud.org/ns}owner-display-name | N/A | Examples: - | dav_version | last_modified_regex | - | old | ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$ | - | new | ^[MTWFS][uedhfriatno]{2},\s(\d){2}\s[JFMAJSOND][anebrpyulgctov]{2}\s\d{4}\s\d{2}:\d{2}:\d{2} GMT$ | + | dav_version | + | old | + | new | - @skipOnOcV10 @personalSpace + @personalSpace Examples: - | dav_version | last_modified_regex | - | spaces | ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$ | - + | dav_version | + | spaces | + @skipOnOcis Scenario Outline: report extra properties in search entries for a folder Given using DAV path When user "Alice" searches for "upload" using the WebDAV API requesting these properties: @@ -277,6 +278,38 @@ Feature: Search | dav_version | | spaces | + @skipOnOcV10 @issues-4712 + Scenario Outline: report extra properties in search entries for a folder + Given using DAV path + When user "Alice" searches for "upload" using the WebDAV API requesting these properties: + | oc:fileid | + | oc:permissions | + | a:getlastmodified | + | a:getetag | + | a:getcontenttype | + | oc:size | + | oc:owner-id | + | oc:owner-display-name | + Then the HTTP status code should be "207" + And folder "/upload folder" in the search result of user "Alice" should contain these properties: + | name | value | + | {http://owncloud.org/ns}fileid | \d* | + | {http://owncloud.org/ns}permissions | ^(RDNVCK\|RMDNVCK)$ | + | {DAV:}getlastmodified | ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$ | + | {DAV:}getetag | NULL | + | {http://owncloud.org/ns}size | 0 | + | {http://owncloud.org/ns}owner-id | N/A | + | {http://owncloud.org/ns}owner-display-name | N/A | + Examples: + | dav_version | + | old | + | new | + + @skipOnOcV10 @personalSpace + Examples: + | dav_version | + | spaces | + Scenario Outline: search for entry with emoji by pattern Given using DAV path diff --git a/tests/acceptance/features/bootstrap/SearchContext.php b/tests/acceptance/features/bootstrap/SearchContext.php index b5cd16854f45..3fbd143782ba 100644 --- a/tests/acceptance/features/bootstrap/SearchContext.php +++ b/tests/acceptance/features/bootstrap/SearchContext.php @@ -135,21 +135,12 @@ public function fileOrFolderInTheSearchResultShouldContainProperties( ); foreach ($fileProperties as $fileProperty) { if ($fileProperty['name'] === $property['name']) { -// var_dump($fileProperty['value']); - var_dump($property['name']); - var_dump($property['value']); if ($property['value'] === 'NULL') { Assert::assertNull( $fileProperty['value'], "Expected property '$property[name]' to be null" . " but got '$fileProperty[value]'" ); - } else if ($property['value'] === "NA") { - Assert::assertArrayNotHasKey( - $property['name'], - $fileProperty, - "Expected property '$property[name]' to not exist" - ); } else { Assert::assertMatchesRegularExpression( "/" . $property['value'] . "/", @@ -160,10 +151,18 @@ public function fileOrFolderInTheSearchResultShouldContainProperties( break; } } - Assert::assertTrue( - $foundProperty, - "could not find property '" . $property['name'] . "'" - ); + if ($property['value'] === 'N/A') { + // not available check + Assert::assertFalse( + $foundProperty, + "Expected property '$property[name]' to not be present" + ); + } else { + Assert::assertTrue( + $foundProperty, + "could not find property '" . $property['name'] . "'" + ); + } } }