@@ -6,7 +6,6 @@ import { User } from '@nextcloud/cypress'
66
77const usesHttps = Cypress . env ( 'baseUrl' ) . substr ( 0 , 5 ) === 'https'
88const collaboraUrl = Cypress . env ( 'collaboraUrl' )
9- const defaultFonts = [ 'AmaticSC-Regular.ttf' ]
109
1110describe ( 'Office admin settings' , function ( ) {
1211
@@ -65,16 +64,50 @@ describe('Office admin settings', function() {
6564 . scrollIntoView ( )
6665 . should ( 'be.visible' )
6766
68- cy . get ( '#font-settings' )
67+ cy . get ( '.settings-section__name' )
68+ . contains ( 'Global Templates' )
6969 . scrollIntoView ( )
7070 . should ( 'be.visible' )
71- defaultFonts . forEach ( font => {
72- cy . get ( '.settings-entry.font-list-settings' ) . contains ( font )
73- } )
71+ } )
72+ } )
73+
74+ describe . only ( 'Custom Fonts' , function ( ) {
75+ const defaultFonts = [ 'AmaticSC-Regular.ttf' ]
76+
77+ beforeEach ( function ( ) {
78+ cy . login ( new User ( 'admin' , 'admin' ) )
79+ cy . visit ( '/settings/admin/richdocuments' )
7480
7581 cy . get ( '.settings-section__name' )
76- . contains ( 'Global Templates ' )
82+ . contains ( 'Custom Fonts ' )
7783 . scrollIntoView ( )
7884 . should ( 'be.visible' )
7985 } )
86+
87+ it ( 'Can delete a font' , function ( ) {
88+ cy . intercept ( {
89+ method : 'DELETE' ,
90+ url : `**/richdocuments/settings/fonts/${ defaultFonts [ 0 ] } ` ,
91+ } ) . as ( 'deleteFontRequest' )
92+
93+ cy . get ( `button[aria-label="Delete ${ defaultFonts [ 0 ] } "]` )
94+ . click ( { force : true } )
95+
96+ cy . wait ( '@deleteFontRequest' ) . its ( 'response.statusCode' ) . should ( 'eq' , 200 )
97+ } )
98+
99+ it ( 'Can upload a font file' , function ( ) {
100+ cy . intercept ( {
101+ method : 'POST' ,
102+ url : '**/richdocuments/settings/fonts' ,
103+ } ) . as ( 'uploadFontRequest' )
104+
105+ cy . uploadFontFile ( {
106+ fixturePath : `fonts/${ defaultFonts [ 0 ] } ` ,
107+ fileName : defaultFonts [ 0 ] ,
108+ mimeType : 'font/ttf' ,
109+ } )
110+
111+ cy . wait ( '@uploadFontRequest' ) . its ( 'response.statusCode' ) . should ( 'eq' , 200 )
112+ } )
80113} )
0 commit comments