Skip to content
Closed
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
9 changes: 7 additions & 2 deletions cypress/e2e/filesUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ export function moveFile (fileName: string, dirName: string) {
}

export function toggleMenuAction(fileName: string) {
cy.get(`[data-cy-files-list] [data-cy-files-list-row-name="${fileName}"] [data-cy-files-list-row-actions] .action-item__menutoggle`).click()
cy.get('[data-cy-files-list-row-action]').should('be.visible')
cy.get(`[data-cy-files-list] [data-cy-files-list-row-name="${CSS.escape(fileName)}"] [data-cy-files-list-row-actions]`)
.should('be.visible')
.findByRole('button', { name: 'Actions' })
.should('be.visible')
.click()
cy.get('[data-cy-files-list-row-action]')
.should('be.visible')
}
37 changes: 28 additions & 9 deletions cypress/e2e/sidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ import { toggleMenuAction } from './filesUtils'
function showSidebarForFile(fileName: string) {
closeSidebar()
toggleMenuAction(fileName)
cy.get('[data-cy-files-list-row-action="details"] button').click()
cy.get('[data-cy-files-list-row-action="details"]')
.should('be.visible')
.findByRole('menuitem')
.click()
cy.get('#app-sidebar-vue').should('be.visible')
}

Expand Down Expand Up @@ -74,18 +77,34 @@ export function createPublicShare(fileName: string) {
export function addTag(fileName: string, tag: string) {
showSidebarForFile(fileName)

cy.get('.app-sidebar-header__menu button').click()
cy.get('.action-button__icon.icon-tag').click()
cy.get('.system-tags input').type(`${tag}{enter}{esc}`)
cy.get('#app-sidebar-vue .app-sidebar-header')
.should('be.visible')
.findByRole('button', { name: 'Actions' })
.click()

cy.wait(500)
cy.findByRole('menuitem', { name: 'Tags' })
.should('be.visible')
.click()

cy.intercept('PUT', '**/remote.php/dav/systemtags-relations/files/**').as('tag')

cy.findByLabelText('Search or create collaborative tags')
.type(`${tag}{enter}{esc}`)

cy.wait('@tag')
}

export function addComment(fileName: string, comment: string) {
showSidebarForFile(fileName)
cy.get('#app-sidebar-vue').contains('Activity').click()
cy.get('.comment__editor .rich-contenteditable__input').type(comment)
cy.get('.comment__submit button').click()
cy.get('#app-sidebar-vue')
.findByRole('tab', { name: 'Activity' })
.click()

cy.intercept('POST', '**/remote.php/dav/comments/files/*').as('comment')
cy.get('#app-sidebar-vue')
.findByRole('textbox', { name: 'New comment' })
.should('be.visible')
.type(`{selectAll}${comment}{enter}`)

cy.wait(500)
cy.wait('@comment')
}
2 changes: 2 additions & 0 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
/* eslint-disable n/no-unpublished-import */
import { addCommands } from '@nextcloud/cypress'

import '@testing-library/cypress/add-commands'

// Add custom commands
import 'cypress-wait-until'
addCommands()
1 change: 1 addition & 0 deletions cypress/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"include": ["./**/*.ts"],
"compilerOptions": {
"types": [
"@testing-library/cypress",
"cypress",
"dockerode",
"node"
Expand Down
Loading