-
-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathdelete-pending-request.spec.ts
More file actions
87 lines (75 loc) · 3.63 KB
/
delete-pending-request.spec.ts
File metadata and controls
87 lines (75 loc) · 3.63 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/**
* SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { expect, test } from '@playwright/test'
import { login } from '../support/nc-login'
import { configureOpenSsl, setAppConfig } from '../support/nc-provisioning'
test('delete pending signature request', async ({ page }) => {
await login(
page.request,
process.env.NEXTCLOUD_ADMIN_USER ?? 'admin',
process.env.NEXTCLOUD_ADMIN_PASSWORD ?? 'admin',
)
await configureOpenSsl(page.request, 'LibreSign Test', {
C: 'BR',
OU: ['Organization Unit'],
ST: 'Rio de Janeiro',
O: 'LibreSign',
L: 'Rio de Janeiro',
})
await setAppConfig(
page.request,
'libresign',
'identify_methods',
JSON.stringify([
{ name: 'account', enabled: true, mandatory: true, signatureMethods: { clickToSign: { enabled: true } } },
{ name: 'email', enabled: false, mandatory: false },
]),
)
await page.goto('./apps/libresign')
await page.getByRole('button', { name: 'Upload from URL' }).click()
await page.getByRole('textbox', { name: 'URL of a PDF file' }).fill('https://raw.githubusercontent.com/LibreSign/libresign/main/tests/php/fixtures/pdfs/small_valid.pdf')
await page.getByRole('button', { name: 'Send' }).click()
await page.getByRole('button', { name: 'Add signer' }).click()
await page.getByPlaceholder('Account').fill('a')
await page.getByRole('option', { name: '[email protected]' }).click()
await page.getByRole('button', { name: 'Save' }).click()
await page.getByRole('button', { name: 'Request signatures' }).click()
await page.getByRole('button', { name: 'Send' }).click()
// Navigate to the Files list and ensure it is sorted by Created at, newest first
await page.locator('#fileslist').getByRole('link', { name: 'Files' }).click()
const createdAtTh = page.getByRole('columnheader', { name: 'Created at' })
const sortDirection = await createdAtTh.evaluate((el: HTMLElement) => el.ariaSort)
if (sortDirection !== 'descending') {
await page.getByRole('button', { name: 'Created at' }).click()
if (sortDirection === 'none') {
// Column was sortable but not active: first click set it to ascending, one more for descending
await page.getByRole('button', { name: 'Created at' }).click()
}
}
// The most recently uploaded document is first — rename it to a unique name
// so it can be unambiguously identified regardless of other documents in the list.
// NcActionButton inside NcActions renders as role="menuitem", not role="button".
const uniqueName = `delete-pending-test-${Date.now()}`
const firstRow = page.locator('[data-cy-files-list-tbody] tr.files-list__row')
.filter({ hasText: 'small_valid' })
.first()
await firstRow.getByRole('button', { name: 'Actions' }).click()
await page.getByRole('menuitem', { name: 'Rename' }).click()
await page.getByLabel('File name').fill(uniqueName)
await page.getByLabel('File name').press('Enter')
// Find the row by its unique name and assert the status
const targetRow = page.locator('[data-cy-files-list-tbody] tr.files-list__row')
.filter({ hasText: uniqueName })
await expect(targetRow.locator('.status-chip__text')).toHaveText('Ready to sign')
// Delete it
await targetRow.getByRole('button', { name: 'Actions' }).click()
await page.getByRole('menuitem', { name: 'Delete' }).click()
// Confirm the deletion in the dialog
await expect(page.getByRole('dialog', { name: 'Confirm' })).toBeVisible()
await expect(page.getByText('The signature request will be deleted. Do you confirm this action?')).toBeVisible()
await page.getByRole('button', { name: 'Ok' }).click()
// The specific row we deleted must disappear from the list
await expect(targetRow).toBeHidden()
})