From d6a70c0113b5c3e9fe53cfa4ffc97c4dc5fd8c92 Mon Sep 17 00:00:00 2001 From: nabim777 Date: Wed, 12 Jul 2023 12:46:16 +0545 Subject: [PATCH] search files using content --- .drone.star | 11 +++++++- tests/acceptance/config/behat.yml | 15 +++++++++++ .../features/apiFullTextSearch/search.feature | 27 +++++++++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 tests/acceptance/features/apiFullTextSearch/search.feature diff --git a/.drone.star b/.drone.star index 4c9f6bb3549..d0c9ed1f06c 100644 --- a/.drone.star +++ b/.drone.star @@ -142,6 +142,13 @@ config = { "OCIS_ADD_RUN_SERVICES": "antivirus", }, }, + "apiFullTextSearch": { + "suites": [ + "apiFullTextSearch", + ], + "skip": False, + "tikaNeeded": True, + }, }, "apiTests": { "numberOfParts": 10, @@ -735,6 +742,7 @@ def localApiTestPipeline(ctx): "accounts_hash_difficulty": 4, "emailNeeded": False, "antivirusNeeded": False, + "tikaNeeded": False, } if "localApiTests" in config: @@ -755,7 +763,8 @@ def localApiTestPipeline(ctx): }, "steps": skipIfUnchanged(ctx, "acceptance-tests") + restoreBuildArtifactCache(ctx, "ocis-binary-amd64", "ocis/bin") + - ocisServer(storage, params["accounts_hash_difficulty"], extra_server_environment = params["extraServerEnvironment"], with_wrapper = True) + + (tikaService() if params["tikaNeeded"] else []) + + ocisServer(storage, params["accounts_hash_difficulty"], extra_server_environment = params["extraServerEnvironment"], with_wrapper = True, tika_enabled = params["tikaNeeded"]) + (waitForClamavService() if params["antivirusNeeded"] else []) + (waitForEmailService() if params["emailNeeded"] else []) + localApiTests(suite, storage, params["extraEnvironment"]), diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml index 18c545d2aa6..aca23fc38cd 100644 --- a/tests/acceptance/config/behat.yml +++ b/tests/acceptance/config/behat.yml @@ -175,6 +175,21 @@ default: - OcisConfigContext: - PublicWebDavContext: + apiFullTextSearch: + paths: + - '%paths.base%/../features/apiFullTextSearch' + context: *common_ldap_suite_context + contexts: + - SettingsContext: + - GraphContext: + - SpacesContext: + - PublicWebDavContext: + - FeatureContext: *common_feature_context_params + - SearchContext: + - CapabilitiesContext: + - FilesVersionsContext: + - OCSContext: + extensions: rdx\behatvars\BehatVariablesExtension: ~ diff --git a/tests/acceptance/features/apiFullTextSearch/search.feature b/tests/acceptance/features/apiFullTextSearch/search.feature new file mode 100644 index 00000000000..970e9d86d34 --- /dev/null +++ b/tests/acceptance/features/apiFullTextSearch/search.feature @@ -0,0 +1,27 @@ +@api +Feature: full text search + As a user + I want to do full text search + So that I can find the files with the content I am looking for + + Background: + Given user "Alice" has been created with default attributes and without skeleton files + + + Scenario Outline: search files by content + Given using DAV path + And user "Alice" has uploaded file with content "hello world from nepal" to "keywordAtStart.txt" + And user "Alice" has uploaded file with content "saying hello to the world" to "keywordAtMiddle.txt" + And user "Alice" has uploaded file with content "nepal want to say hello" to "keywordAtLast.txt" + And user "Alice" has uploaded file with content "namaste from nepal" to "hello.txt" + When user "Alice" searches for "Content:hello" using the WebDAV API + Then the HTTP status code should be "207" + And the search result of user "Alice" should contain only these files: + | keywordAtStart.txt | + | keywordAtMiddle.txt | + | keywordAtLast.txt | + Examples: + | dav-path-version | + | old | + | new | + | spaces |