Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 18 additions & 20 deletions cypress/e2e/actions/sidebar.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,12 @@ describe('Open the sidebar from the viewer and open viewer with sidebar already
// open the menu
cy.get('body > .viewer .modal-header button.action-item__menutoggle').click()
// open the sidebar
cy.get('.action-button__icon.icon-menu-sidebar').click()
cy.findByRole('menuitem', { name: 'Open sidebar' }).click()
cy.get('aside.app-sidebar').should('be.visible')
// we hide the sidebar button if opened
cy.get('.action-button__icon.icon-menu-sidebar').should('not.exist')
// check the sidebar is opened for the correct file
cy.get('aside.app-sidebar .app-sidebar-header .app-sidebar-header__mainname').should('contain', 'image1.jpg')
// check we do not have a preview
cy.get('aside.app-sidebar .app-sidebar-header').should('have.class', 'app-sidebar-header--with-figure')
cy.get('aside.app-sidebar .app-sidebar-header').should('have.class', 'app-sidebar-header--compact')
cy.get('aside.app-sidebar .app-sidebar-header .app-sidebar-header__figure').should('have.attr', 'style').should('contain', 'core/filetypes')
})

it('Sidebar is in compact mode', function() {
// check the sidebar is opened for the correct file
cy.get('aside.app-sidebar .app-sidebar-header .app-sidebar-header__mainname').should('contain', 'image1.jpg')
// check we do not have a preview
cy.get('aside.app-sidebar .app-sidebar-header').should('have.class', 'app-sidebar-header--with-figure')
cy.get('aside.app-sidebar .app-sidebar-header').should('have.class', 'app-sidebar-header--compact')
cy.get('aside.app-sidebar .app-sidebar-header .app-sidebar-header__figure').should('have.attr', 'style').should('contain', 'core/filetypes')
})

it('Change to next image with sidebar open', function() {
Expand All @@ -100,30 +87,41 @@ describe('Open the sidebar from the viewer and open viewer with sidebar already

it('Close the sidebar', function() {
cy.get('aside.app-sidebar .app-sidebar-header .app-sidebar__close').click()
cy.get('aside.app-sidebar').should('not.exist')
cy.get('aside.app-sidebar').should('not.be.visible')
cy.get('body > .viewer .modal-header button.action-item__menutoggle').should('be.visible')
cy.get('body > .viewer .modal-header button.action-item__menutoggle').click()
// The button to show the sidebar is shown again
cy.get('.action-button__icon.icon-menu-sidebar').should('be.visible')
cy.findByRole('menuitem', { name: 'Open sidebar' }).should('be.visible')
})

it('Open the viewer with the sidebar open', function() {
cy.get('body > .viewer .modal-header button.header-close').click()
cy.get('body > .viewer').should('not.exist')

// open the sidebar without viewer open
cy.getFile('image1.jpg').find('[data-cy-files-list-row-mtime]').click()
cy.getFile('image1.jpg')
.find('[data-cy-files-list-row-mtime]')
.click()
cy.get('aside.app-sidebar').should('be.visible')
cy.url().should('contain', 'opendetails=true')

// eslint-disable-next-line
cy.wait(500)

cy.openFile('image1.jpg')
cy.get('body > .viewer', { timeout: 10000 })
.should('be.visible')
.and('have.class', 'modal-mask')
.and('not.have.class', 'icon-loading')
cy.get('aside.app-sidebar').should('have.class', 'app-sidebar--full')

// eslint-disable-next-line
cy.wait(500)

// close the sidebar again
cy.get('aside.app-sidebar .app-sidebar-header .app-sidebar__close').click()
cy.get('aside.app-sidebar').should('not.exist')
cy.get('aside.app-sidebar')
.findByRole('button', { name: 'Close sidebar' })
.click()
cy.get('aside.app-sidebar').should('not.be.visible')
cy.get('body > .viewer .modal-header button.action-item__menutoggle').should('be.visible')
})
})
2 changes: 2 additions & 0 deletions cypress/e2e/download-forbidden.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ describe('Disable download button if forbidden', { testIsolation: true }, () =>

it('See the title on the viewer header but not the Download nor the menu button', () => {
cy.getFile('image1.jpg').should('be.visible')
// eslint-disable-next-line
cy.wait(250)
cy.openFile('image1.jpg')
cy.get('body > .viewer .modal-header__name').should('contain', 'image1.jpg')

Expand Down
6 changes: 1 addition & 5 deletions cypress/e2e/mixins/oddname.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@

/**
*
* @param file

Check warning on line 35 in cypress/e2e/mixins/oddname.ts

View workflow job for this annotation

GitHub Actions / NPM lint

Missing JSDoc @param "file" description
* @param type

Check warning on line 36 in cypress/e2e/mixins/oddname.ts

View workflow job for this annotation

GitHub Actions / NPM lint

Missing JSDoc @param "type" description
* @param sidebar

Check warning on line 37 in cypress/e2e/mixins/oddname.ts

View workflow job for this annotation

GitHub Actions / NPM lint

Missing JSDoc @param "sidebar" description
*/
export default function(file, type, sidebar = false) {
const placedName = naughtyFileName(file)
Expand Down Expand Up @@ -113,16 +113,12 @@
// open the menu
cy.get('body > .viewer .modal-header button.action-item__menutoggle').click()
// open the sidebar
cy.get('.action-button__icon.icon-menu-sidebar').click()
cy.findByRole('menuitem', { name: 'Open sidebar' }).should('be.visible').click()
cy.get('aside.app-sidebar').should('be.visible')
// we hide the sidebar button if opened
cy.get('.action-button__icon.icon-menu-sidebar').should('not.exist')
// check the sidebar is opened for the correct file
cy.get('aside.app-sidebar .app-sidebar-header .app-sidebar-header__mainname').should('contain', placedName)
// check we do not have a preview
cy.get('aside.app-sidebar .app-sidebar-header').should('have.class', 'app-sidebar-header--with-figure')
cy.get('aside.app-sidebar .app-sidebar-header').should('have.class', 'app-sidebar-header--compact')
cy.get('aside.app-sidebar .app-sidebar-header .app-sidebar-header__figure').should('have.attr', 'style').should('contain', 'core/filetypes')
})
}

Expand Down
14 changes: 6 additions & 8 deletions cypress/e2e/sharing/download-share-disabled.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,14 @@ describe(`Download ${fileName} in viewer`, function() {
})

it('Share the Photos folder with a share link, disable download and access the share link', function() {
cy.on('uncaught:exception', (err) => {
// This can happen because of blink engine handling animation, its not a bug just engine related.
if (err.message.includes('ResizeObserver loop limit exceeded')) {
return false
}
})

cy.createLinkShare('/Photos').then((token: string) => {
cy.intercept('GET', '**/apps/files_sharing/api/v1/shares*').as('sharingAPI')

// Open the sidebar from the breadcrumbs
cy.get('[data-cy-files-content-breadcrumbs] .files-list__header-share-button').click()
cy.findByRole('navigation', { name: 'Current directory path' })
.findByRole('button', { name: 'Photos' })
.click()
cy.findByRole('menuitem', { name: 'Share' }).click()
cy.get('aside.app-sidebar').should('be.visible')

// Wait for the sidebar to be done loading
Expand All @@ -54,6 +50,8 @@ describe(`Download ${fileName} in viewer`, function() {
// Open the share menu
cy.get('.sharing-link-list > .sharing-entry button[aria-label*="Actions for "]').click()
cy.get('.action-button:contains(\'Customize link\')').click()
cy.findByRole('button', { name: 'Advanced settings' }).click()

cy.get('.checkbox-radio-switch-checkbox').contains('Hide download').as('hideDownloadBtn')
// click the label
cy.get('@hideDownloadBtn').get('span').contains('Hide download').click()
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/sharing/download-share.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ describe(`Download ${fileName} from viewer in link share`, function() {
})

it('See the full screen and download icons in the menu', function() {
cy.get('body > .v-popper__popper ul span.fullscreen-icon').should('be.visible')
cy.get(`body > .v-popper__popper ul a.action-link[href*='/public.php/dav/files/${token}/image1.jpg']`).should('be.visible')
cy.findByRole('menuitem', { name: 'Full screen' }).should('be.visible')
cy.findByRole('menuitem', { name: 'Download' }).should('be.visible')
})

it('Download the image', function() {
// https://github.com/cypress-io/cypress/issues/14857
cy.window().then((win) => { setTimeout(() => { win.location.reload() }, 5000) })
// download the file
cy.get(`body > .v-popper__popper ul a.action-link[href*='/public.php/dav/files/${token}/image1.jpg']`).click()
cy.findByRole('menuitem', { name: 'Download' }).click()
})

it('Compare downloaded file with asset by size', function() {
Expand Down
6 changes: 5 additions & 1 deletion cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
/**
* cy.uploadedFile - uploads a file from the fixtures folder
*
* @param {User} user the owner of the file, e.g. admin

Check warning on line 25 in cypress/support/commands.ts

View workflow job for this annotation

GitHub Actions / NPM lint

The type 'User' is undefined
* @param {string} fixture the fixture file name, e.g. image1.jpg
* @param {string} mimeType e.g. image/png
* @param {string} [target] the target of the file relative to the user root
Expand Down Expand Up @@ -80,7 +80,11 @@
})

Cypress.Commands.add('openFile', fileName => {
cy.getFile(fileName).click()
cy.getFile(fileName)
.find('button')
.first()
.should('be.visible')
.click()
// eslint-disable-next-line
cy.wait(250)
})
Expand Down
4 changes: 4 additions & 0 deletions cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@

// Import commands.js using ES2015 syntax:
import './commands'

Cypress.on('uncaught:exception', () => {
return false
})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import{n as i,ai as s,bi as a,bj as n}from"./previewUtils-mb7vuryY.chunk.mjs";import{A as o}from"./actionText-fFcUPi2g-gjw6zxAU.chunk.mjs";const l={name:"NcActionButton",components:{NcIconSvgWrapper:s},mixins:[o],inject:{isInSemanticMenu:{from:"NcActions:isSemanticMenu",default:!1}},props:{ariaHidden:{type:Boolean,default:null},disabled:{type:Boolean,default:!1},isMenu:{type:Boolean,default:!1},type:{type:String,default:"button",validator:t=>["button","checkbox","radio","reset","submit"].includes(t)},modelValue:{type:[Boolean,String],default:null},value:{type:String,default:null},description:{type:String,default:""}},setup(){return{mdiCheck:n,mdiChevronRight:a}},computed:{isFocusable(){return!this.disabled},isChecked(){return this.type==="radio"&&typeof this.modelValue!="boolean"?this.modelValue===this.value:this.modelValue},nativeType(){return this.type==="submit"||this.type==="reset"?this.type:"button"},buttonAttributes(){const t={};return this.isInSemanticMenu?(t.role="menuitem",this.type==="radio"?(t.role="menuitemradio",t["aria-checked"]=this.isChecked?"true":"false"):(this.type==="checkbox"||this.nativeType==="button"&&this.modelValue!==null)&&(t.role="menuitemcheckbox",t["aria-checked"]=this.modelValue===null?"mixed":this.modelValue?"true":"false")):this.modelValue!==null&&this.nativeType==="button"&&(t["aria-pressed"]=this.modelValue?"true":"false"),t}},methods:{handleClick(t){this.onClick(t),(this.modelValue!==null||this.type!=="button")&&(this.type==="radio"?typeof this.modelValue!="boolean"?this.isChecked||this.$emit("update:modelValue",this.value):this.$emit("update:modelValue",!this.isChecked):this.$emit("update:modelValue",!this.isChecked))}}};var c=function(){var t=this,e=t._self._c;return e("li",{staticClass:"action",class:{"action--disabled":t.disabled},attrs:{role:t.isInSemanticMenu&&"presentation"}},[e("button",t._b({class:["action-button button-vue",{"action-button--active":t.isChecked,focusable:t.isFocusable}],attrs:{"aria-label":t.ariaLabel,disabled:t.disabled,title:t.title,type:t.nativeType},on:{click:t.handleClick}},"button",t.buttonAttributes,!1),[t._t("icon",function(){return[e("span",{staticClass:"action-button__icon",class:[t.isIconUrl?"action-button__icon--url":t.icon],style:{backgroundImage:t.isIconUrl?`url(${t.icon})`:null},attrs:{"aria-hidden":"true"}})]}),e("span",{staticClass:"action-button__longtext-wrapper"},[t.name?e("strong",{staticClass:"action-button__name"},[t._v(" "+t._s(t.name)+" ")]):t._e(),t.isLongText?e("span",{staticClass:"action-button__longtext",domProps:{textContent:t._s(t.text)}}):e("span",{staticClass:"action-button__text"},[t._v(" "+t._s(t.text)+" ")]),t.description?e("span",{staticClass:"action-button__description",domProps:{textContent:t._s(t.description)}}):t._e()]),t.isMenu?e("NcIconSvgWrapper",{staticClass:"action-button__menu-icon",attrs:{directional:"",path:t.mdiChevronRight}}):t.isChecked?e("NcIconSvgWrapper",{staticClass:"action-button__pressed-icon",attrs:{path:t.mdiCheck}}):t.isChecked===!1?e("span",{staticClass:"action-button__pressed-icon material-design-icon"}):t._e(),t._e()],2)])},u=[],r=i(l,c,u,!1,null,"102cfc0a");const h=r.exports;export{h as default};
//# sourceMappingURL=NcActionButton-BfBFARjv.chunk.mjs.map
import{n as i,ai as s,bi as a,bj as n}from"./previewUtils-Cu93PGNf.chunk.mjs";import{A as o}from"./actionText-fFcUPi2g-gjw6zxAU.chunk.mjs";const l={name:"NcActionButton",components:{NcIconSvgWrapper:s},mixins:[o],inject:{isInSemanticMenu:{from:"NcActions:isSemanticMenu",default:!1}},props:{ariaHidden:{type:Boolean,default:null},disabled:{type:Boolean,default:!1},isMenu:{type:Boolean,default:!1},type:{type:String,default:"button",validator:t=>["button","checkbox","radio","reset","submit"].includes(t)},modelValue:{type:[Boolean,String],default:null},value:{type:String,default:null},description:{type:String,default:""}},setup(){return{mdiCheck:n,mdiChevronRight:a}},computed:{isFocusable(){return!this.disabled},isChecked(){return this.type==="radio"&&typeof this.modelValue!="boolean"?this.modelValue===this.value:this.modelValue},nativeType(){return this.type==="submit"||this.type==="reset"?this.type:"button"},buttonAttributes(){const t={};return this.isInSemanticMenu?(t.role="menuitem",this.type==="radio"?(t.role="menuitemradio",t["aria-checked"]=this.isChecked?"true":"false"):(this.type==="checkbox"||this.nativeType==="button"&&this.modelValue!==null)&&(t.role="menuitemcheckbox",t["aria-checked"]=this.modelValue===null?"mixed":this.modelValue?"true":"false")):this.modelValue!==null&&this.nativeType==="button"&&(t["aria-pressed"]=this.modelValue?"true":"false"),t}},methods:{handleClick(t){this.onClick(t),(this.modelValue!==null||this.type!=="button")&&(this.type==="radio"?typeof this.modelValue!="boolean"?this.isChecked||this.$emit("update:modelValue",this.value):this.$emit("update:modelValue",!this.isChecked):this.$emit("update:modelValue",!this.isChecked))}}};var c=function(){var t=this,e=t._self._c;return e("li",{staticClass:"action",class:{"action--disabled":t.disabled},attrs:{role:t.isInSemanticMenu&&"presentation"}},[e("button",t._b({class:["action-button button-vue",{"action-button--active":t.isChecked,focusable:t.isFocusable}],attrs:{"aria-label":t.ariaLabel,disabled:t.disabled,title:t.title,type:t.nativeType},on:{click:t.handleClick}},"button",t.buttonAttributes,!1),[t._t("icon",function(){return[e("span",{staticClass:"action-button__icon",class:[t.isIconUrl?"action-button__icon--url":t.icon],style:{backgroundImage:t.isIconUrl?`url(${t.icon})`:null},attrs:{"aria-hidden":"true"}})]}),e("span",{staticClass:"action-button__longtext-wrapper"},[t.name?e("strong",{staticClass:"action-button__name"},[t._v(" "+t._s(t.name)+" ")]):t._e(),t.isLongText?e("span",{staticClass:"action-button__longtext",domProps:{textContent:t._s(t.text)}}):e("span",{staticClass:"action-button__text"},[t._v(" "+t._s(t.text)+" ")]),t.description?e("span",{staticClass:"action-button__description",domProps:{textContent:t._s(t.description)}}):t._e()]),t.isMenu?e("NcIconSvgWrapper",{staticClass:"action-button__menu-icon",attrs:{directional:"",path:t.mdiChevronRight}}):t.isChecked?e("NcIconSvgWrapper",{staticClass:"action-button__pressed-icon",attrs:{path:t.mdiCheck}}):t.isChecked===!1?e("span",{staticClass:"action-button__pressed-icon material-design-icon"}):t._e(),t._e()],2)])},u=[],r=i(l,c,u,!1,null,"102cfc0a");const h=r.exports;export{h as default};
//# sourceMappingURL=NcActionButton-Bkk2OwJq.chunk.mjs.map
Loading
Loading