@@ -26,13 +26,13 @@ import { randHash } from '../../utils/'
2626/**
2727 * Make a name aimed to break the viewer in case of escaping errors
2828 *
29- * @param {String } realName
30- * @returns { String } a name for the file to be uploaded as
29+ * @param {string } realName the file original name
30+ * @return { string } a name for the file to be uploaded as
3131 */
3232function naughtyFileName ( realName ) {
3333 const ext = realName . split ( '.' ) . pop ( )
3434 return (
35- '~⛰️ shot of a ${ big} mountain`, '
35+ '~⛰️ shot of a $[ big} mountain`, '
3636 + "realy #1's "
3737 + '" #_+="%2520%27%22%60%25%21%23 was this called '
3838 + realName
@@ -50,7 +50,7 @@ Cypress.on('fail', (error, runnable) => {
5050 throw error // throw error to have test still fail
5151} )
5252
53- export default function ( file , type ) {
53+ export default function ( file , type , sidebar = false ) {
5454 const placedName = naughtyFileName ( file )
5555
5656 // We'll escape all the characters in the name to match it with css
@@ -62,7 +62,7 @@ export default function(file, type) {
6262 const folderName
6363 = 'Nextcloud "%27%22%60%25%21%23" >`⛰️<' + file + "><` e*'rocks!#?#%~"
6464
65- describe ( `Open ${ file } in viewer with a naughty name` , function ( ) {
65+ describe ( `Open ${ file } in viewer with a naughty name ${ sidebar ? 'with sidebar' : '' } ` , function ( ) {
6666 before ( function ( ) {
6767 // fail fast
6868 if ( failsLeft < 0 ) {
@@ -119,6 +119,24 @@ export default function(file, type) {
119119 it ( 'See the menu icon and title on the viewer header' , menuOk )
120120 it ( 'Does not see navigation arrows' , arrowsOK )
121121
122+ if ( sidebar ) {
123+ it ( 'Open the sidebar' , function ( ) {
124+ // open the menu
125+ cy . get ( 'body > .viewer .modal-header button.action-item__menutoggle' ) . click ( )
126+ // open the sidebar
127+ cy . get ( '.action-button__icon.icon-menu-sidebar' ) . click ( )
128+ cy . get ( 'aside.app-sidebar' ) . should ( 'be.visible' )
129+ // we hide the sidebar button if opened
130+ cy . get ( '.action-button__icon.icon-menu-sidebar' ) . should ( 'not.exist' )
131+ // check the sidebar is opened for the correct file
132+ cy . get ( 'aside.app-sidebar .app-sidebar-header .app-sidebar-header__maintitle' ) . should ( 'contain' , placedName )
133+ // check we do not have a preview
134+ cy . get ( 'aside.app-sidebar .app-sidebar-header' ) . should ( 'have.class' , 'app-sidebar-header--with-figure' )
135+ cy . get ( 'aside.app-sidebar .app-sidebar-header' ) . should ( 'have.class' , 'app-sidebar-header--compact' )
136+ cy . get ( 'aside.app-sidebar .app-sidebar-header .app-sidebar-header__figure' ) . should ( 'have.attr' , 'style' ) . should ( 'contain' , 'core/filetypes' )
137+ } )
138+ }
139+
122140 it ( 'Share the folder with a share link and access the share link' , function ( ) {
123141 cy . createLinkShare ( folderName ) . then ( ( token ) => {
124142 cy . logout ( )
0 commit comments