1
0

recent-view.cy.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /**
  2. * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  3. * SPDX-License-Identifier: AGPL-3.0-or-later
  4. */
  5. import type { User } from '@nextcloud/cypress'
  6. import { getRowForFile, triggerActionForFile } from './FilesUtils'
  7. describe('files: Recent view', { testIsolation: true }, () => {
  8. let user: User
  9. beforeEach(() => cy.createRandomUser().then(($user) => {
  10. user = $user
  11. cy.uploadContent(user, new Blob([]), 'text/plain', '/file.txt')
  12. cy.login(user)
  13. }))
  14. it('see the recently created file in the recent view', () => {
  15. cy.visit('/apps/files/recent')
  16. // All are visible by default
  17. getRowForFile('file.txt').should('be.visible')
  18. })
  19. /**
  20. * Regression test: There was a bug that the files were correctly loaded but with invalid source
  21. * so the delete action failed.
  22. */
  23. it('can delete a file in the recent view', () => {
  24. cy.intercept('DELETE', '**/remote.php/dav/files/**').as('deleteFile')
  25. cy.visit('/apps/files/recent')
  26. // See the row
  27. getRowForFile('file.txt').should('be.visible')
  28. // delete the file
  29. triggerActionForFile('file.txt', 'delete')
  30. cy.wait('@deleteFile')
  31. // See it is not visible anymore
  32. getRowForFile('file.txt').should('not.exist')
  33. // also not existing in default view after reload
  34. cy.visit('/apps/files')
  35. getRowForFile('file.txt').should('not.exist')
  36. })
  37. })