copy-move-files.cy.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*!
  2. * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  3. * SPDX-License-Identifier: AGPL-3.0-or-later
  4. */
  5. import { copyFile, getRowForFile, moveFile, navigateToFolder } from '../../files/FilesUtils.ts'
  6. import { getShareUrl, setupPublicShare } from './setup-public-share.ts'
  7. describe('files_sharing: Public share - copy and move files', { testIsolation: true }, () => {
  8. beforeEach(() => {
  9. setupPublicShare()
  10. .then(() => cy.logout())
  11. .then(() => cy.visit(getShareUrl()))
  12. })
  13. it('Can copy a file to new folder', () => {
  14. getRowForFile('foo.txt').should('be.visible')
  15. getRowForFile('subfolder').should('be.visible')
  16. copyFile('foo.txt', 'subfolder')
  17. // still visible
  18. getRowForFile('foo.txt').should('be.visible')
  19. navigateToFolder('subfolder')
  20. cy.url().should('contain', 'dir=/subfolder')
  21. getRowForFile('foo.txt').should('be.visible')
  22. getRowForFile('bar.txt').should('be.visible')
  23. getRowForFile('subfolder').should('not.exist')
  24. })
  25. it('Can move a file to new folder', () => {
  26. getRowForFile('foo.txt').should('be.visible')
  27. getRowForFile('subfolder').should('be.visible')
  28. moveFile('foo.txt', 'subfolder')
  29. // wait until visible again
  30. getRowForFile('subfolder').should('be.visible')
  31. // file should be moved -> not exist anymore
  32. getRowForFile('foo.txt').should('not.exist')
  33. navigateToFolder('subfolder')
  34. cy.url().should('contain', 'dir=/subfolder')
  35. getRowForFile('foo.txt').should('be.visible')
  36. getRowForFile('subfolder').should('not.exist')
  37. })
  38. })