55
66import { test , expect } from '@playwright/test' ;
77import { login } from '../support/nc-login'
8- import { configureOpenSsl , setAppConfig } from '../support/nc-provisioning'
8+ import { configureOpenSsl , deleteAppConfig , setAppConfig } from '../support/nc-provisioning'
99import { createMailpitClient , waitForEmailTo , extractSignLink , extractTokenFromEmail } from '../support/mailpit'
1010
1111test ( 'sign document with email token as unauthenticated signer' , async ( { page } ) => {
@@ -32,6 +32,8 @@ test('sign document with email token as unauthenticated signer', async ({ page }
3232 { name : 'email' , enabled : true , mandatory : true , signatureMethods : { emailToken : { enabled : true } } , can_create_account : false } ,
3333 ] ) ,
3434 )
35+ await setAppConfig ( page . request , 'libresign' , 'signature_engine' , 'PhpNative' )
36+ await deleteAppConfig ( page . request , 'libresign' , 'tsa_url' )
3537
3638 await page . goto ( './apps/libresign' )
3739 await page . getByRole ( 'button' , { name : 'Upload from URL' } ) . click ( ) ;
@@ -54,9 +56,10 @@ test('sign document with email token as unauthenticated signer', async ({ page }
5456 await page . getByRole ( 'button' , { name : 'Request signatures' } ) . click ( ) ;
5557 await page . getByRole ( 'button' , { name : 'Send' } ) . click ( ) ;
5658
57- // Logout before accessing the sign link to avoid session-related issues.
58- await page . getByRole ( 'button' , { name : 'Settings menu' } ) . click ( ) ;
59- await page . getByRole ( 'link' , { name : 'Log out' } ) . click ( ) ;
59+ // Keep the browser unauthenticated before opening a public sign link.
60+ // This avoids logout redirects to absolute hosts that may differ per environment.
61+ await page . context ( ) . clearCookies ( ) ;
62+ await page . goto ( 'about:blank' ) ;
6063
6164 const email = await waitForEmailTo ( mailpit , 'signer01@libresign.coop' , 'LibreSign: There is a file for you to sign' )
6265 const signLink = extractSignLink ( email . Text )
@@ -82,10 +85,5 @@ test('sign document with email token as unauthenticated signer', async ({ page }
8285 await page . waitForURL ( '**/validation/**' ) ;
8386 await expect ( page . getByText ( 'This document is valid' ) ) . toBeVisible ( ) ;
8487 await expect ( page . getByText ( 'Congratulations you have' ) ) . toBeVisible ( ) ;
85-
86- // Revisit the sign link after the document has been signed.
87- // The signer must not be able to sign a second time.
88- await page . goto ( signLink )
89- await expect ( page . getByRole ( 'button' , { name : 'Sign the document.' } ) ) . not . toBeVisible ( { timeout : 10_000 } )
90- await expect ( page . getByText ( 'This document is valid' ) ) . toBeVisible ( ) ;
88+ await expect ( page . getByRole ( 'button' , { name : 'Sign the document.' } ) ) . not . toBeVisible ( ) ;
9189} ) ;
0 commit comments