Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions cypress/e2e/groupfolders.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
} from './groupfoldersUtils.ts'
import {
currentSearchSectionCanLoadMoreResults,
currentSearchSectionHasResult,
currentSearchSectionHasFileResult,
openSearchResultsFor,
searchFor,
} from './unifiedSearchUtils.ts'
Expand Down Expand Up @@ -395,23 +395,23 @@ describe('Groupfolders ACLs and unified search behavior', () => {
cy.visit('/apps/files')
searchFor('test')
openSearchResultsFor('Files')
currentSearchSectionHasResult(`test11.txt in ${groupFolderName}/subfolder2`)
currentSearchSectionHasResult(`test10.txt in ${groupFolderName}/subfolder1`)
currentSearchSectionHasResult(`test9.txt in ${groupFolderName}/subfolder2`)
currentSearchSectionHasResult(`test8.txt in ${groupFolderName}/subfolder1`)
currentSearchSectionHasResult(`test7.txt in ${groupFolderName}/subfolder2`)
currentSearchSectionHasFileResult('test11.txt', `${groupFolderName}/subfolder2`)
currentSearchSectionHasFileResult('test10.txt', `${groupFolderName}/subfolder1`)
currentSearchSectionHasFileResult('test9.txt', `${groupFolderName}/subfolder2`)
currentSearchSectionHasFileResult('test8.txt', `${groupFolderName}/subfolder1`)
currentSearchSectionHasFileResult('test7.txt', `${groupFolderName}/subfolder2`)
currentSearchSectionCanLoadMoreResults()

// user2 can find files only in subfolder1
cy.login(user2)
cy.visit('/apps/files')
searchFor('test')
openSearchResultsFor('Files')
currentSearchSectionHasResult(`test10.txt in ${groupFolderName}/subfolder1`)
currentSearchSectionHasResult(`test8.txt in ${groupFolderName}/subfolder1`)
currentSearchSectionHasResult(`test6.txt in ${groupFolderName}/subfolder1`)
currentSearchSectionHasResult(`test4.txt in ${groupFolderName}/subfolder1`)
currentSearchSectionHasResult(`test2.txt in ${groupFolderName}/subfolder1`)
currentSearchSectionHasFileResult('test10.txt', `${groupFolderName}/subfolder1`)
currentSearchSectionHasFileResult('test8.txt', `${groupFolderName}/subfolder1`)
currentSearchSectionHasFileResult('test6.txt', `${groupFolderName}/subfolder1`)
currentSearchSectionHasFileResult('test4.txt', `${groupFolderName}/subfolder1`)
currentSearchSectionHasFileResult('test2.txt', `${groupFolderName}/subfolder1`)
currentSearchSectionCanLoadMoreResults()
})

Expand Down
19 changes: 12 additions & 7 deletions cypress/e2e/unifiedSearchUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export function getUnifiedSearchResults() {
* @param string section the section
*/
export function openSearchResultsFor(section: string) {
getUnifiedSearchResults().contains('button', `More from ${section}`).click()
getUnifiedSearchResults().contains('button', `More from ${section}`, { timeout: 5000 }).should('be.visible').click()
getUnifiedSearchResults().contains('button', 'Back', { timeout: 5000 }).should('be.visible')
getUnifiedSearchResultsForCurrentOpenSection().find('.result-item').should('have.length.greaterThan', 3)
}

/**
Expand All @@ -43,19 +45,22 @@ export function getUnifiedSearchResultsFooterForCurrentOpenSection() {
}

/**
* Checks that the given result is found in the current open section
* Checks that the given file result is found in the current open section
*
* @param string result the result in the section
* @param string fileName the file name in the result
* @param string path the path in the result
*/
export function currentSearchSectionHasResult(result: string) {
getUnifiedSearchResultsForCurrentOpenSection().contains(result).should('be.visible')
export function currentSearchSectionHasFileResult(fileName: string, path: string) {
getUnifiedSearchResultsForCurrentOpenSection()
.contains('.result-item', fileName, { timeout: 5000 })
.should('be.visible')
.and('contain', path)
}

/**
* Checks that more results can be loaded for the current open section
*/
export function currentSearchSectionCanLoadMoreResults() {
const loadMoreResults = getUnifiedSearchResultsFooterForCurrentOpenSection().contains('Load more results')
loadMoreResults.scrollIntoView()
loadMoreResults.should('be.visible')
loadMoreResults.should('exist').and('not.be.disabled')
}
Loading