aboutsummaryrefslogtreecommitdiffstats
path: root/cypress/e2e/files_sharing/public-share/copy-move-files.cy.ts
blob: 078ecf747bf4cdf0982476de3ff08170b7d65f02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*!
 * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */
import { copyFile, getRowForFile, moveFile, navigateToFolder } from '../../files/FilesUtils.ts'
import { getShareUrl, setupPublicShare } from './setup-public-share.ts'

describe('files_sharing: Public share - copy and move files', { testIsolation: true }, () => {

	beforeEach(() => {
		setupPublicShare()
			.then(() => cy.logout())
			.then(() => cy.visit(getShareUrl()))
	})

	it('Can copy a file to new folder', () => {
		getRowForFile('foo.txt').should('be.visible')
		getRowForFile('subfolder').should('be.visible')

		copyFile('foo.txt', 'subfolder')

		// still visible
		getRowForFile('foo.txt').should('be.visible')
		navigateToFolder('subfolder')

		cy.url().should('contain', 'dir=/subfolder')
		getRowForFile('foo.txt').should('be.visible')
		getRowForFile('bar.txt').should('be.visible')
		getRowForFile('subfolder').should('not.exist')
	})

	it('Can move a file to new folder', () => {
		getRowForFile('foo.txt').should('be.visible')
		getRowForFile('subfolder').should('be.visible')

		moveFile('foo.txt', 'subfolder')

		// wait until visible again
		getRowForFile('subfolder').should('be.visible')

		// file should be moved -> not exist anymore
		getRowForFile('foo.txt').should('not.exist')
		navigateToFolder('subfolder')

		cy.url().should('contain', 'dir=/subfolder')
		getRowForFile('foo.txt').should('be.visible')
		getRowForFile('subfolder').should('not.exist')
	})
})