@@ -64,6 +64,30 @@ test('sign document with email token as unauthenticated signer', async ({ page }
6464 const email = await waitForEmailTo ( mailpit , 'signer01@libresign.coop' , 'LibreSign: There is a file for you to sign' )
6565 const signLink = extractSignLink ( email . Text )
6666 if ( ! signLink ) throw new Error ( 'Sign link not found in email' )
67+
68+ // Regression guard: validation payload can contain signer without email.
69+ // Reuse this existing E2E flow and force `email = null` in the validate response.
70+ await page . route ( '**/ocs/v2.php/apps/libresign/api/v1/file/validate/uuid/**' , async ( route ) => {
71+ const response = await route . fetch ( )
72+ const payload = await response . json ( ) as Record < string , unknown >
73+ const ocs = payload . ocs as Record < string , unknown > | undefined
74+ const data = ocs ?. data as Record < string , unknown > | undefined
75+
76+ if ( data && Array . isArray ( data . signers ) && data . signers . length > 0 ) {
77+ const firstSigner = data . signers [ 0 ] as Record < string , unknown >
78+ firstSigner . email = null
79+ }
80+
81+ await route . fulfill ( {
82+ status : response . status ( ) ,
83+ headers : {
84+ ...response . headers ( ) ,
85+ 'content-type' : 'application/json' ,
86+ } ,
87+ body : JSON . stringify ( payload ) ,
88+ } )
89+ } )
90+
6791 await page . goto ( signLink ) ;
6892 await page . getByRole ( 'button' , { name : 'Sign the document.' } ) . click ( ) ;
6993 await page . getByRole ( 'textbox' , { name : 'Email' } ) . click ( ) ;
@@ -84,6 +108,7 @@ test('sign document with email token as unauthenticated signer', async ({ page }
84108 await page . getByRole ( 'button' , { name : 'Sign document' } ) . click ( ) ;
85109 await page . waitForURL ( '**/validation/**' ) ;
86110 await expect ( page . getByText ( 'This document is valid' ) ) . toBeVisible ( ) ;
111+ await expect ( page . getByText ( 'Failed to validate document' ) ) . not . toBeVisible ( ) ;
87112 await expect ( page . getByText ( 'Congratulations you have' ) ) . toBeVisible ( ) ;
88113 await expect ( page . getByRole ( 'button' , { name : 'Sign the document.' } ) ) . not . toBeVisible ( ) ;
89114} ) ;
0 commit comments