|
| 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, deleteUserPfx, setAppConfig } from '../support/nc-provisioning' |
| 9 | + |
| 10 | +test('sign herself with pkcs12 certificate', async ({ page }) => { |
| 11 | + const adminUser = process.env.NEXTCLOUD_ADMIN_USER ?? 'admin' |
| 12 | + const adminPassword = process.env.NEXTCLOUD_ADMIN_PASSWORD ?? 'admin' |
| 13 | + |
| 14 | + await login(page.request, adminUser, adminPassword) |
| 15 | + |
| 16 | + await configureOpenSsl(page.request, 'LibreSign Test', { |
| 17 | + C: 'BR', |
| 18 | + OU: ['Organization Unit'], |
| 19 | + ST: 'Rio de Janeiro', |
| 20 | + O: 'LibreSign', |
| 21 | + L: 'Rio de Janeiro', |
| 22 | + }) |
| 23 | + |
| 24 | + await setAppConfig( |
| 25 | + page.request, |
| 26 | + 'libresign', |
| 27 | + 'identify_methods', |
| 28 | + JSON.stringify([ |
| 29 | + { name: 'account', enabled: true, mandatory: true, signatureMethods: { password: { enabled: true } } }, |
| 30 | + { name: 'email', enabled: false, mandatory: false }, |
| 31 | + ]), |
| 32 | + ) |
| 33 | + |
| 34 | + // Ensure the user has no existing certificate so the test always goes |
| 35 | + // through the "create password" flow. |
| 36 | + await deleteUserPfx(page.request, adminUser, adminPassword) |
| 37 | + |
| 38 | + await page.goto('./apps/libresign') |
| 39 | + |
| 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 | + await page.getByRole('button', { name: 'Add signer' }).click() |
| 44 | + await page.getByPlaceholder('Account').fill(adminUser) |
| 45 | + await page.getByText('admin@email.tld').click() |
| 46 | + await page.getByRole('button', { name: 'Save' }).click() |
| 47 | + await page.getByRole('button', { name: 'Request signatures' }).click() |
| 48 | + await page.getByRole('button', { name: 'Send' }).click() |
| 49 | + await page.getByRole('button', { name: 'Sign document' }).click() |
| 50 | + await page.getByRole('button', { name: 'Define a password and sign the document.' }).click() |
| 51 | + await page.getByLabel('Enter a password').fill('Password1234') |
| 52 | + await page.getByRole('button', { name: 'Confirm' }).click() |
| 53 | + await page.getByRole('button', { name: 'Sign the document.' }).click() |
| 54 | + await page.getByLabel('Signature password').fill('Password1234') |
| 55 | + await page.getByRole('button', { name: 'Sign document' }).click() |
| 56 | + await page.waitForURL('**/validation/**') |
| 57 | + await expect(page.getByText('This document is valid')).toBeVisible() |
| 58 | + await page.getByRole('button', { name: 'Expand details' }).click() |
| 59 | + await page.getByRole('button', { name: 'Expand validation status', exact: true }).click() |
| 60 | + await expect(page.getByRole('link', { name: 'Document integrity verified' })).toBeVisible() |
| 61 | + await page.getByRole('button', { name: 'Expand document certification', exact: true }).click() |
| 62 | + await expect(page.getByRole('link', { name: 'Document has not been' })).toBeVisible() |
| 63 | +}) |
0 commit comments