Skip to content

Commit 42b7244

Browse files
test(e2e): fix selectors and add assertions in sequential multi-signer test
Selector fixes (same as parallel test): - Remove tab clicks, add .click() before .fill(), use getByLabel() for the switch state and getByText() to toggle it (input is hidden by CSS) Logout before sign link: - The email sign link is for an unauthenticated flow; accessing it while the admin session is active triggers the new backend error. Log out via Settings menu before navigating to avoid this. Validation page assertions: - After signer01 signs, assert the validation page shows both signers, with signer02 still in 'Not signed yet' state, proving the sequential flow held at that point. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 479a670 commit 42b7244

1 file changed

Lines changed: 18 additions & 9 deletions

File tree

playwright/e2e/multi-signer-sequential.spec.ts

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,27 +41,27 @@ test('request signatures from two signers in sequential order', async ({ page })
4141
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')
4242
await page.getByRole('button', { name: 'Send' }).click()
4343

44-
// Add first signer via email tab
44+
// Add first signer — only email method is active, so the field appears directly (no tabs)
4545
await page.getByRole('button', { name: 'Add signer' }).click()
46-
await page.getByRole('tab', { name: 'Email' }).click()
46+
await page.getByPlaceholder('Email').click()
4747
await page.getByPlaceholder('Email').fill('signer01@libresign.coop')
4848
await page.getByRole('option', { name: 'signer01@libresign.coop' }).click()
4949
await page.getByRole('textbox', { name: 'Signer name' }).fill('Signer 01')
5050
await page.getByRole('button', { name: 'Save' }).click()
5151

52-
// Add second signer via email tab
52+
// Add second signer
5353
await page.getByRole('button', { name: 'Add signer' }).click()
54-
await page.getByRole('tab', { name: 'Email' }).click()
54+
await page.getByPlaceholder('Email').click()
5555
await page.getByPlaceholder('Email').fill('signer02@libresign.coop')
5656
await page.getByRole('option', { name: 'signer02@libresign.coop' }).click()
5757
await page.getByRole('textbox', { name: 'Signer name' }).fill('Signer 02')
5858
await page.getByRole('button', { name: 'Save' }).click()
5959

60-
// Enable sequential signing — the switch must be accessible by role="switch"
61-
const signInOrderSwitch = page.getByRole('switch', { name: 'Sign in order' })
62-
await expect(signInOrderSwitch).toBeVisible()
63-
await signInOrderSwitch.click()
64-
await expect(signInOrderSwitch).toBeChecked()
60+
// Enable sequential signing.
61+
// The checkbox input is hidden by CSS; click the visible label text to toggle it.
62+
await expect(page.getByLabel('Sign in order')).toBeVisible()
63+
await page.getByText('Sign in order').click()
64+
await expect(page.getByLabel('Sign in order')).toBeChecked()
6565

6666
// Send the signature request
6767
await page.getByRole('button', { name: 'Request signatures' }).click()
@@ -74,6 +74,11 @@ test('request signatures from two signers in sequential order', async ({ page })
7474
const afterFirst = await mailpit.searchMessages({ query: 'subject:"LibreSign: There is a file for you to sign"' })
7575
expect(afterFirst.messages).toHaveLength(1)
7676

77+
// Logout before signing as signer01 — the sign link is for an email-based signer
78+
// (no Nextcloud account), so it must be accessed without an active admin session.
79+
await page.getByRole('button', { name: 'Settings menu' }).click()
80+
await page.getByRole('link', { name: 'Log out' }).click()
81+
7782
// Signer01 signs via the link received in the email
7883
const signLink = extractSignLink(email01.Text)
7984
if (!signLink) throw new Error('Sign link not found in email')
@@ -82,6 +87,10 @@ test('request signatures from two signers in sequential order', async ({ page })
8287
await page.getByRole('button', { name: 'Sign document' }).click()
8388
await page.waitForURL('**/validation/**')
8489
await expect(page.getByText('This document is valid')).toBeVisible()
90+
// Signer01 signed; signer02 is still waiting (sequential mode proof at this point)
91+
await expect(page.getByText('Signer 01')).toBeVisible()
92+
await expect(page.getByText('Signer 02')).toBeVisible()
93+
await expect(page.getByText('Not signed yet')).toBeVisible()
8594

8695
// Now that signer01 has signed, signer02 must receive their notification.
8796
await waitForEmailTo(mailpit, 'signer02@libresign.coop', 'LibreSign: There is a file for you to sign')

0 commit comments

Comments
 (0)