aboutsummaryrefslogtreecommitdiffstats
path: root/cypress/e2e/files_sharing/public-share/sidebar-tab.cy.ts
blob: 6b026717fd88a14752ae837faad6de6dc32d87e3 (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
/*!
 * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

import type { User } from "@nextcloud/cypress"
import { createShare } from "./FilesSharingUtils"
import { createLinkShare, openLinkShareDetails } from "./PublicShareUtils"

describe('files_sharing: sidebar tab', () => {
	let alice: User

	beforeEach(() => {
		cy.createRandomUser()
			.then((user) => {
				alice = user
				cy.mkdir(user, '/test')
				cy.login(user)
				cy.visit('/apps/files')
			})
	})

	/**
	 * Regression tests of https://github.com/nextcloud/server/issues/53566
	 * Where the ' char was shown as '
	 */
	it('correctly lists shares by label with special characters', () => {
		createLinkShare({ user: alice }, 'test')
		openLinkShareDetails(0)
		cy.findByRole('textbox', { name: /share label/i })
			.should('be.visible')
			.type('Alice\' share')

		cy.intercept('PUT', '**/ocs/v2.php/apps/files_sharing/api/v1/shares/*').as('PUT')
		cy.findByRole('button', { name: /update share/i }).click()
		cy.wait('@PUT')

		// see the label is shown correctly
		cy.findByRole('list', { name: /link shares/i })
			.findAllByRole('listitem')
			.should('have.length', 1)
			.first()
			.should('contain.text', 'Share link (Alice\' share)')
	})
})