Skip to content

Commit 7773f28

Browse files
committed
test(e2e): add parallel multi-signer signature request test
Upload PDF, add two email signers (signer01 and signer02), confirm the 'Sign in order' switch is visible and unchecked by default, send the request and verify via mailpit that both signers receive their notification email simultaneously, confirming parallel mode. Signed-off-by: Vitor Mattos <[email protected]>
1 parent c62bb8f commit 7773f28

1 file changed

Lines changed: 78 additions & 0 deletions

File tree

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/**
2+
* SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
3+
* SPDX-License-Identifier: AGPL-3.0-or-later
4+
*/
5+
6+
import { expect, test } from '@playwright/test'
7+
import { login } from '../support/nc-login'
8+
import { configureOpenSsl, setAppConfig } from '../support/nc-provisioning'
9+
import { createMailpitClient, waitForEmailTo } from '../support/mailpit'
10+
11+
test('request signatures from two signers in parallel', async ({ page }) => {
12+
await login(
13+
page.request,
14+
process.env.NEXTCLOUD_ADMIN_USER ?? 'admin',
15+
process.env.NEXTCLOUD_ADMIN_PASSWORD ?? 'admin',
16+
)
17+
18+
await configureOpenSsl(page.request, 'LibreSign Test', {
19+
C: 'BR',
20+
OU: ['Organization Unit'],
21+
ST: 'Rio de Janeiro',
22+
O: 'LibreSign',
23+
L: 'Rio de Janeiro',
24+
})
25+
26+
await setAppConfig(
27+
page.request,
28+
'libresign',
29+
'identify_methods',
30+
JSON.stringify([
31+
{ name: 'account', enabled: false, mandatory: false },
32+
{ name: 'email', enabled: true, mandatory: true, signatureMethods: { clickToSign: { enabled: true } }, can_create_account: false },
33+
]),
34+
)
35+
36+
const mailpit = createMailpitClient()
37+
await mailpit.deleteMessages()
38+
39+
await page.goto('./apps/libresign')
40+
await page.getByRole('button', { name: 'Upload from URL' }).click()
41+
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')
42+
await page.getByRole('button', { name: 'Send' }).click()
43+
44+
// Add first signer via email tab
45+
await page.getByRole('button', { name: 'Add signer' }).click()
46+
await page.getByRole('tab', { name: 'Email' }).click()
47+
await page.getByPlaceholder('Email').fill('[email protected]')
48+
await page.getByRole('option', { name: '[email protected]' }).click()
49+
await page.getByRole('textbox', { name: 'Signer name' }).fill('Signer 01')
50+
await page.getByRole('button', { name: 'Save' }).click()
51+
52+
// Add second signer via email tab
53+
await page.getByRole('button', { name: 'Add signer' }).click()
54+
await page.getByRole('tab', { name: 'Email' }).click()
55+
await page.getByPlaceholder('Email').fill('[email protected]')
56+
await page.getByRole('option', { name: '[email protected]' }).click()
57+
await page.getByRole('textbox', { name: 'Signer name' }).fill('Signer 02')
58+
await page.getByRole('button', { name: 'Save' }).click()
59+
60+
// With 2+ signers the "Sign in order" switch must be visible and unchecked by default,
61+
// meaning parallel flow — both signers will be notified at the same time.
62+
const signInOrderSwitch = page.getByRole('switch', { name: 'Sign in order' })
63+
await expect(signInOrderSwitch).toBeVisible()
64+
await expect(signInOrderSwitch).not.toBeChecked()
65+
66+
// Send the signature request
67+
await page.getByRole('button', { name: 'Request signatures' }).click()
68+
await page.getByRole('button', { name: 'Send' }).click()
69+
70+
// In parallel mode both signers are notified simultaneously.
71+
// Proof: wait for signer01's email, then verify that signer02's email also arrived.
72+
await waitForEmailTo(mailpit, '[email protected]', 'LibreSign: There is a file for you to sign')
73+
await waitForEmailTo(mailpit, '[email protected]', 'LibreSign: There is a file for you to sign')
74+
75+
// Both emails arrived — both signers were notified at the same time, confirming parallel mode.
76+
const result = await mailpit.searchMessages({ query: 'subject:"LibreSign: There is a file for you to sign"' })
77+
expect(result.messages).toHaveLength(2)
78+
})

0 commit comments

Comments
 (0)