Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix(Cypress): Adjust tests for new breadcrumbs
Signed-off-by: Eduardo Morales <emoral435@gmail.com>
  • Loading branch information
emoral435 authored and susnux committed Apr 9, 2024
commit 0213fb6b5df0e472e31ee479f6994b1ebfd89b1a
2 changes: 1 addition & 1 deletion apps/files/src/components/BreadCrumbs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export default defineComponent({
return this.filesStore.getNode(id)
},
getFileIdFromPath(path: string): number | undefined {
return this.pathsStore.getPath(this.currentView!.id, path)
return this.pathsStore.getPath(this.currentView?.id, path)
},
getDirDisplayName(path: string): string {
if (path === '/') {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/files/FilesUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export const closeSidebar = () => {
cy.get('[cy-data-sidebar] .app-sidebar__close').click({ force: true })
}

export const clickOnBreadcumbs = (label: string) => {
export const clickOnBreadcrumbs = (label: string) => {
cy.intercept('PROPFIND', /\/remote.php\/dav\//).as('propfind')
cy.get('[data-cy-files-content-breadcrumbs]').contains(label).click()
cy.wait('@propfind')
Expand Down
18 changes: 9 additions & 9 deletions cypress/e2e/files/live_photos.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/

import type { User } from '@nextcloud/cypress'
import { clickOnBreadcumbs, closeSidebar, copyFile, getRowForFile, getRowForFileId, renameFile, triggerActionForFile, triggerInlineActionForFileId } from './FilesUtils'
import { clickOnBreadcrumbs, closeSidebar, copyFile, getRowForFile, getRowForFileId, renameFile, triggerActionForFile, triggerInlineActionForFileId } from './FilesUtils'

/**
*
Expand Down Expand Up @@ -113,7 +113,7 @@ describe('Files: Live photos', { testIsolation: true }, () => {

it('Copies both files when copying the .jpg', () => {
copyFile(`${randomFileName}.jpg`, '.')
clickOnBreadcumbs('All files')
clickOnBreadcrumbs('All files')

getRowForFile(`${randomFileName}.jpg`).should('have.length', 1)
getRowForFile(`${randomFileName}.mov`).should('have.length', 1)
Expand All @@ -123,7 +123,7 @@ describe('Files: Live photos', { testIsolation: true }, () => {

it('Copies both files when copying the .mov', () => {
copyFile(`${randomFileName}.mov`, '.')
clickOnBreadcumbs('All files')
clickOnBreadcrumbs('All files')

getRowForFile(`${randomFileName}.mov`).should('have.length', 1)
getRowForFile(`${randomFileName} (copy).jpg`).should('have.length', 1)
Expand All @@ -132,23 +132,23 @@ describe('Files: Live photos', { testIsolation: true }, () => {

it('Moves files when moving the .jpg', () => {
renameFile(`${randomFileName}.jpg`, `${randomFileName}_moved.jpg`)
clickOnBreadcumbs('All files')
clickOnBreadcrumbs('All files')

getRowForFileId(jpgFileId).invoke('attr', 'data-cy-files-list-row-name').should('equal', `${randomFileName}_moved.jpg`)
getRowForFileId(movFileId).invoke('attr', 'data-cy-files-list-row-name').should('equal', `${randomFileName}_moved.mov`)
})

it('Moves files when moving the .mov', () => {
renameFile(`${randomFileName}.mov`, `${randomFileName}_moved.mov`)
clickOnBreadcumbs('All files')
clickOnBreadcrumbs('All files')

getRowForFileId(jpgFileId).invoke('attr', 'data-cy-files-list-row-name').should('equal', `${randomFileName}_moved.jpg`)
getRowForFileId(movFileId).invoke('attr', 'data-cy-files-list-row-name').should('equal', `${randomFileName}_moved.mov`)
})

it('Deletes files when deleting the .jpg', () => {
triggerActionForFile(`${randomFileName}.jpg`, 'delete')
clickOnBreadcumbs('All files')
clickOnBreadcrumbs('All files')

getRowForFile(`${randomFileName}.jpg`).should('have.length', 0)
getRowForFile(`${randomFileName}.mov`).should('have.length', 0)
Expand All @@ -161,7 +161,7 @@ describe('Files: Live photos', { testIsolation: true }, () => {

it('Block deletion when deleting the .mov', () => {
triggerActionForFile(`${randomFileName}.mov`, 'delete')
clickOnBreadcumbs('All files')
clickOnBreadcrumbs('All files')

getRowForFile(`${randomFileName}.jpg`).should('have.length', 1)
getRowForFile(`${randomFileName}.mov`).should('have.length', 1)
Expand All @@ -176,7 +176,7 @@ describe('Files: Live photos', { testIsolation: true }, () => {
triggerActionForFile(`${randomFileName}.jpg`, 'delete')
cy.visit('/apps/files/trashbin')
triggerInlineActionForFileId(jpgFileId, 'restore')
clickOnBreadcumbs('Deleted files')
clickOnBreadcrumbs('Deleted files')

getRowForFile(`${randomFileName}.jpg`).should('have.length', 0)
getRowForFile(`${randomFileName}.mov`).should('have.length', 0)
Expand All @@ -191,7 +191,7 @@ describe('Files: Live photos', { testIsolation: true }, () => {
triggerActionForFile(`${randomFileName}.jpg`, 'delete')
cy.visit('/apps/files/trashbin')
triggerInlineActionForFileId(movFileId, 'restore')
clickOnBreadcumbs('Deleted files')
clickOnBreadcrumbs('Deleted files')

getRowForFileId(jpgFileId).should('have.length', 1)
getRowForFileId(movFileId).should('have.length', 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/

import { assertVersionContent, openVersionsPanel, setupTestSharedFileFromUser, uploadThreeVersions, nameVersion } from './filesVersionsUtils'
import { clickOnBreadcumbs, closeSidebar, copyFile, moveFile, navigateToFolder } from '../files/FilesUtils'
import { clickOnBreadcrumbs, closeSidebar, copyFile, moveFile, navigateToFolder } from '../files/FilesUtils'
import type { User } from '@nextcloud/cypress'

/**
Expand All @@ -31,7 +31,7 @@ import type { User } from '@nextcloud/cypress'
function assertVersionsContent(filePath: string) {
const path = filePath.split('/').slice(0, -1).join('/')

clickOnBreadcumbs('All files')
clickOnBreadcrumbs('All files')

if (path !== '') {
navigateToFolder(path)
Expand Down Expand Up @@ -96,7 +96,7 @@ describe('Versions cross share move and copy', () => {
beforeEach(() => {
randomSubFolderName = Math.random().toString(36).replace(/[^a-z]+/g, '').substring(0, 10)
randomSubSubFolderName = Math.random().toString(36).replace(/[^a-z]+/g, '').substring(0, 10)
clickOnBreadcumbs('All files')
clickOnBreadcrumbs('All files')
cy.mkdir(bob, `/${randomSharedFolderName}/${randomSubFolderName}`)
cy.mkdir(bob, `/${randomSharedFolderName}/${randomSubFolderName}/${randomSubSubFolderName}`)
cy.login(bob)
Expand Down