@@ -56,6 +56,53 @@ test.describe('files_sharing: Link share editor', () => {
5656 await sharingTab . openAdvancedSettings ( )
5757 await expect ( sharingTab . checkbox ( 'Hide download' ) ) . toBeChecked ( )
5858 } )
59+
60+ test ( 'cancelling the edition resets to the previous state' , async ( { page, filesListPage, sharingTab } ) => {
61+ await openSharingPanel ( filesListPage , sharingTab , 'test' )
62+
63+ await sharingTab . openLinkShareDetails ( )
64+ await sharingTab . openAdvancedSettings ( )
65+ await expect ( sharingTab . labelInput ( ) ) . toHaveValue ( '' )
66+ await sharingTab . labelInput ( ) . fill ( 'The label' )
67+ await expect ( sharingTab . checkbox ( 'Set password' ) ) . not . toBeChecked ( )
68+ await sharingTab . setCheckbox ( 'Set password' , true )
69+ // A password is automatically generated and added to the input
70+ await expect ( sharingTab . checkbox ( 'Set expiration date' ) ) . not . toBeChecked ( )
71+ await sharingTab . setCheckbox ( 'Set expiration date' , true )
72+ // A default expiration date is automatically added to the input
73+ await expect ( sharingTab . checkbox ( 'Hide download' ) ) . not . toBeChecked ( )
74+ await sharingTab . setCheckbox ( 'Hide download' , true )
75+ await expect ( sharingTab . checkbox ( 'Note to recipient' ) ) . not . toBeChecked ( )
76+ await sharingTab . setCheckbox ( 'Note to recipient' , true )
77+ await sharingTab . noteInput ( ) . fill ( 'The note' )
78+ await expect ( sharingTab . checkbox ( 'Custom permissions' ) ) . not . toBeChecked ( )
79+ await sharingTab . setCheckbox ( 'Custom permissions' , true )
80+ await expect ( sharingTab . checkbox ( 'Edit' ) ) . not . toBeChecked ( )
81+ await sharingTab . setCheckbox ( 'Edit' , true )
82+ await sharingTab . cancel ( )
83+
84+ // Back to the original state when the editor is opened again …
85+ await sharingTab . openLinkShareDetails ( )
86+ await sharingTab . openAdvancedSettings ( )
87+ await expect ( sharingTab . labelInput ( ) ) . toHaveValue ( '' )
88+ await expect ( sharingTab . checkbox ( 'Set password' ) ) . not . toBeChecked ( )
89+ await expect ( sharingTab . checkbox ( 'Set expiration date' ) ) . not . toBeChecked ( )
90+ await expect ( sharingTab . checkbox ( 'Hide download' ) ) . not . toBeChecked ( )
91+ await expect ( sharingTab . checkbox ( 'Note to recipient' ) ) . not . toBeChecked ( )
92+ await expect ( sharingTab . checkbox ( 'Custom permissions' ) ) . not . toBeChecked ( )
93+
94+ // … and after a reload, i.e. it was not stored
95+ await page . reload ( )
96+ await openSharingPanel ( filesListPage , sharingTab , 'test' )
97+ await sharingTab . openLinkShareDetails ( )
98+ await sharingTab . openAdvancedSettings ( )
99+ await expect ( sharingTab . labelInput ( ) ) . toHaveValue ( '' )
100+ await expect ( sharingTab . checkbox ( 'Set password' ) ) . not . toBeChecked ( )
101+ await expect ( sharingTab . checkbox ( 'Set expiration date' ) ) . not . toBeChecked ( )
102+ await expect ( sharingTab . checkbox ( 'Hide download' ) ) . not . toBeChecked ( )
103+ await expect ( sharingTab . checkbox ( 'Note to recipient' ) ) . not . toBeChecked ( )
104+ await expect ( sharingTab . checkbox ( 'Custom permissions' ) ) . not . toBeChecked ( )
105+ } )
59106} )
60107
61108test . describe ( 'files_sharing: Email share editor' , ( ) => {
0 commit comments