-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add end-to-end tests for new public share Vue UI
Signed-off-by: Ferdinand Thiessen <[email protected]>
- Loading branch information
Showing
21 changed files
with
879 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,6 +120,7 @@ describe('Edit locally action execute tests', () => { | |
data: { ocs: { data: { token: 'foobar' } } }, | ||
})) | ||
const showError = vi.spyOn(nextcloudDialogs, 'showError') | ||
const windowOpenSpy = vi.spyOn(window, 'open').mockImplementation(() => null) | ||
|
||
const file = new File({ | ||
id: 1, | ||
|
@@ -138,7 +139,7 @@ describe('Edit locally action execute tests', () => { | |
expect(axios.post).toBeCalledTimes(1) | ||
expect(axios.post).toBeCalledWith('http://nextcloud.local/ocs/v2.php/apps/files/api/v1/openlocaleditor?format=json', { path: '/foobar.txt' }) | ||
expect(showError).toBeCalledTimes(0) | ||
expect(window.location.href).toBe('nc://open/[email protected]/foobar.txt?token=foobar') | ||
expect(windowOpenSpy).toBeCalledWith('nc://open/[email protected]/foobar.txt?token=foobar', '_self') | ||
}) | ||
|
||
test('Edit locally fails and shows error', async () => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
cypress/e2e/files_sharing/public-share/copy-move-files.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/*! | ||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
import { copyFile, getRowForFile, moveFile, navigateToFolder } from '../../files/FilesUtils.ts' | ||
import { getShareUrl, setupPublicShare } from './setup-public-share.ts' | ||
|
||
describe('files_sharing: Public share - copy and move files', { testIsolation: true }, () => { | ||
|
||
beforeEach(() => { | ||
setupPublicShare() | ||
.then(() => cy.logout()) | ||
.then(() => cy.visit(getShareUrl())) | ||
}) | ||
|
||
it('Can copy a file to new folder', () => { | ||
getRowForFile('foo.txt').should('be.visible') | ||
getRowForFile('subfolder').should('be.visible') | ||
|
||
copyFile('foo.txt', 'subfolder') | ||
|
||
// still visible | ||
getRowForFile('foo.txt').should('be.visible') | ||
navigateToFolder('subfolder') | ||
|
||
cy.url().should('contain', 'dir=/subfolder') | ||
getRowForFile('foo.txt').should('be.visible') | ||
getRowForFile('bar.txt').should('be.visible') | ||
getRowForFile('subfolder').should('not.exist') | ||
}) | ||
|
||
it('Can move a file to new folder', () => { | ||
getRowForFile('foo.txt').should('be.visible') | ||
getRowForFile('subfolder').should('be.visible') | ||
|
||
moveFile('foo.txt', 'subfolder') | ||
|
||
// wait until visible again | ||
getRowForFile('subfolder').should('be.visible') | ||
|
||
// file should be moved -> not exist anymore | ||
getRowForFile('foo.txt').should('not.exist') | ||
navigateToFolder('subfolder') | ||
|
||
cy.url().should('contain', 'dir=/subfolder') | ||
getRowForFile('foo.txt').should('be.visible') | ||
getRowForFile('subfolder').should('not.exist') | ||
}) | ||
}) |
Oops, something went wrong.