12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- import type { User } from '@nextcloud/cypress'
- import { getRowForFile, navigateToFolder } from './FilesUtils'
- import { UnifiedSearchFilter, getUnifiedSearchFilter, getUnifiedSearchInput, getUnifiedSearchModal, openUnifiedSearch } from '../core-utils.ts'
- describe('files: Search and filter in files list', { testIsolation: true }, () => {
- let user: User
- beforeEach(() => cy.createRandomUser().then(($user) => {
- user = $user
- cy.mkdir(user, '/a folder')
- cy.uploadContent(user, new Blob([]), 'text/plain', '/b file')
- cy.uploadContent(user, new Blob([]), 'text/plain', '/a folder/c file')
- cy.login(user)
- cy.visit('/apps/files')
- }))
- it('filters current view', () => {
-
- getRowForFile('a folder').should('be.visible')
- getRowForFile('b file').should('be.visible')
-
- openUnifiedSearch()
- getUnifiedSearchInput().type('a folder')
- getUnifiedSearchFilter(UnifiedSearchFilter.FilterCurrentView).click({ force: true })
-
- getUnifiedSearchModal().should('not.be.visible')
-
- getRowForFile('a folder').should('be.visible')
- getRowForFile('b file').should('not.exist')
- })
- it('resets filter when changeing the directory', () => {
-
- getRowForFile('a folder').should('be.visible')
- getRowForFile('b file').should('be.visible')
-
- openUnifiedSearch()
- getUnifiedSearchInput().type('a folder')
- getUnifiedSearchFilter(UnifiedSearchFilter.FilterCurrentView).click({ force: true })
-
- getUnifiedSearchModal().should('not.be.visible')
-
- getRowForFile('a folder').should('be.visible')
- getRowForFile('b file').should('not.exist')
-
- navigateToFolder('a folder')
-
- getRowForFile('c file').should('be.visible')
- })
- it('resets filter when changeing the view', () => {
-
- getRowForFile('a folder').should('be.visible')
- getRowForFile('b file').should('be.visible')
-
- openUnifiedSearch()
- getUnifiedSearchInput().type('a folder')
- getUnifiedSearchFilter(UnifiedSearchFilter.FilterCurrentView).click({ force: true })
-
- getUnifiedSearchModal().should('not.be.visible')
-
- getRowForFile('a folder').should('be.visible')
- getRowForFile('b file').should('not.exist')
-
- cy.get('[data-cy-files-navigation-item="personal"] a').click({ force: true })
-
- cy.url().should('match', /apps\/files\/personal/)
-
- getRowForFile('a folder').should('be.visible')
- getRowForFile('b file').should('be.visible')
- })
- })
|