Skip to content

Commit

Permalink
Added more coverage for full text search
Browse files Browse the repository at this point in the history
  • Loading branch information
grgprarup committed Jun 27, 2023
1 parent 437a8e0 commit 0a1498c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 18 deletions.
30 changes: 20 additions & 10 deletions tests/e2e/cucumber/features/smoke/fullTextSearch.ocis.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ Feature: Search
And "Alice" uploads the following local file into personal space using API
| localFile | to |
| filesForUpload/textfile.txt | fileToShare.txt |
And "Alice" opens the "files" app
And "Alice" adds the following tags for the following resources using the sidebar panel
| resource | tags |
| fileToShare.txt | alice tag |
And "Alice" shares the following resource using API
| resource | recipient | type | role |
| fileToShare.txt | Brian | user | Can edit |
Expand All @@ -39,9 +43,8 @@ Feature: Search
| name |
| spaceFolder |
And "Brian" creates the following file in space "FullTextSearch" using API
| name | content |
| spaceFolder/spaceTextfile.txt | This is test file. |

| name | content |
| spaceFolder/spaceTextfile.txt | This is test file. Cheers |
And "Brian" opens the "files" app
And "Brian" adds the following tags for the following resources using the sidebar panel
| resource | tags |
Expand All @@ -51,7 +54,13 @@ Feature: Search
When "Brian" searches "" using the global search bar
Then "Brian" should see the message "Search for files" on the webUI

When "Brian" selects tag "tag 1" from the search result filter chip
When "Brian" selects tag "alice tag" from the search result filter chip
Then following resources should be displayed in the files list for user "Brian"
| resource |
| fileToShare.txt |

When "Brian" clears tag filter
And "Brian" selects tag "tag 1" from the search result filter chip
Then following resources should be displayed in the files list for user "Brian"
| resource |
| fileWithTag.txt |
Expand All @@ -74,10 +83,11 @@ Feature: Search
When "Brian" enables the option to search in file content
And "Brian" searches "Cheers" using the global search bar
Then following resources should be displayed in the files list for user "Brian"
| resource |
| textfile.txt |
| testFolder/innerTextfile.txt |
| fileToShare.txt |
| fileWithTag.txt |
| withTag.txt |
| resource |
| textfile.txt |
| testFolder/innerTextfile.txt |
| fileToShare.txt |
| fileWithTag.txt |
| withTag.txt |
| spaceFolder/spaceTextfile.txt |
And "Brian" logs out
12 changes: 6 additions & 6 deletions tests/e2e/support/objects/app-files/search/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import util from 'util'

const globalSearchInputSelector = '.oc-search-input'
const searchResultMessageSelector = '//p[@class="oc-text-muted"]'
const selectTagDropdownSelector = '.files-search-filter-tags'
const selectTagDropdownSelector =
'//div[contains(@class,"files-search-filter-tags")]//button[contains(@class,"oc-filter-chip-button")]'
const tagFilterChipSelector = '//button[contains(@data-test-value,"%s")]'
const clearTagFilterSelector =
'//div[contains(@class,"files-search-filter-tags")]//button[contains(@class,"oc-filter-chip-clear")]'
Expand All @@ -23,8 +24,8 @@ export const fullTextSearch = async (args: fullTextSearchArgs): Promise<void> =>
await page.keyboard.press('Enter')
}

export const getSearchResultMessage = async ({ page }): Promise<string> => {
return await page.locator(searchResultMessageSelector).innerText()
export const getSearchResultMessage = ({ page }): Promise<string> => {
return page.locator(searchResultMessageSelector).innerText()
}

export const selectTagFilter = async ({ tag, page }): Promise<void> => {
Expand All @@ -37,7 +38,6 @@ export const clearTagFilter = async ({ page }): Promise<void> => {
}

export const toggleSearchInFileContent = async ({ enableOrDisable, page }): Promise<void> => {
enableOrDisable === 'enable'
? await page.locator(enableSearchInFileContentSelector).click()
: await page.locator(disableSearchInFileContentSelector).click()
const selector = enableOrDisable === 'enable' ? enableSearchInFileContentSelector : disableSearchInFileContentSelector
await page.locator(selector).click()
}
4 changes: 2 additions & 2 deletions tests/e2e/support/objects/app-files/search/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export class Search {
await po.fullTextSearch({ ...args, page: this.#page })
}

async getSearchResultMessage(): Promise<string> {
return await po.getSearchResultMessage({ page: this.#page })
getSearchResultMessage(): Promise<string> {
return po.getSearchResultMessage({ page: this.#page })
}

async selectTagFilter({ tag: string }): Promise<void> {
Expand Down

0 comments on commit 0a1498c

Please sign in to comment.