diff --git a/cypress/e2e/groupfolders.cy.ts b/cypress/e2e/groupfolders.cy.ts index 0cdafbd53..fc3696d1b 100644 --- a/cypress/e2e/groupfolders.cy.ts +++ b/cypress/e2e/groupfolders.cy.ts @@ -30,7 +30,7 @@ import { } from './groupfoldersUtils.ts' import { currentSearchSectionCanLoadMoreResults, - currentSearchSectionHasResult, + currentSearchSectionHasFileResult, openSearchResultsFor, searchFor, } from './unifiedSearchUtils.ts' @@ -395,11 +395,11 @@ 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 @@ -407,11 +407,11 @@ describe('Groupfolders ACLs and unified search behavior', () => { 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() }) diff --git a/cypress/e2e/unifiedSearchUtils.ts b/cypress/e2e/unifiedSearchUtils.ts index 9c21d0943..6c886a7ff 100644 --- a/cypress/e2e/unifiedSearchUtils.ts +++ b/cypress/e2e/unifiedSearchUtils.ts @@ -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) } /** @@ -43,12 +45,16 @@ 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) } /** @@ -56,6 +62,5 @@ export function currentSearchSectionHasResult(result: string) { */ export function currentSearchSectionCanLoadMoreResults() { const loadMoreResults = getUnifiedSearchResultsFooterForCurrentOpenSection().contains('Load more results') - loadMoreResults.scrollIntoView() - loadMoreResults.should('be.visible') + loadMoreResults.should('exist').and('not.be.disabled') }