|
| 1 | +/** |
| 2 | + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors |
| 3 | + * SPDX-License-Identifier: AGPL-3.0-or-later |
| 4 | + */ |
| 5 | + |
| 6 | +import type { User } from '@nextcloud/cypress' |
| 7 | +import { getRowForFile, triggerActionForFile } from './FilesUtils' |
| 8 | + |
| 9 | +describe('files: Recent view', { testIsolation: true }, () => { |
| 10 | + let user: User |
| 11 | + |
| 12 | + beforeEach(() => cy.createRandomUser().then(($user) => { |
| 13 | + user = $user |
| 14 | + |
| 15 | + cy.uploadContent(user, new Blob([]), 'text/plain', '/file.txt') |
| 16 | + cy.login(user) |
| 17 | + })) |
| 18 | + |
| 19 | + it('see the recently created file in the recent view', () => { |
| 20 | + cy.visit('/apps/files/recent') |
| 21 | + // All are visible by default |
| 22 | + getRowForFile('file.txt').should('be.visible') |
| 23 | + }) |
| 24 | + |
| 25 | + /** |
| 26 | + * Regression test: There was a bug that the files were correctly loaded but with invalid source |
| 27 | + * so the delete action failed. |
| 28 | + */ |
| 29 | + it('can delete a file in the recent view', () => { |
| 30 | + cy.intercept('DELETE', '**/remote.php/dav/files/**').as('deleteFile') |
| 31 | + |
| 32 | + cy.visit('/apps/files/recent') |
| 33 | + // See the row |
| 34 | + getRowForFile('file.txt').should('be.visible') |
| 35 | + // delete the file |
| 36 | + triggerActionForFile('file.txt', 'delete') |
| 37 | + cy.wait('@deleteFile') |
| 38 | + // See it is not visible anymore |
| 39 | + getRowForFile('file.txt').should('not.exist') |
| 40 | + // also not existing in default view after reload |
| 41 | + cy.visit('/apps/files') |
| 42 | + getRowForFile('file.txt').should('not.exist') |
| 43 | + }) |
| 44 | +}) |
0 commit comments