Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(f2v): Move to new file actions api #1878

Merged
merged 7 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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
6 changes: 3 additions & 3 deletions cypress/e2e/actions/delete.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ describe('Delete image.png in viewer', function() {
})

it('See image.png in the list', function() {
cy.get('.files-fileList tr[data-file="image.png"]', { timeout: 10000 })
.should('contain', 'image.png')
cy.getFile('image.png', { timeout: 10000 })
.should('contain', 'image .png')
})

it('Open the viewer on file click', function() {
Expand Down Expand Up @@ -67,7 +67,7 @@ describe('Delete image.png in viewer', function() {

it('Does not see image.png in the list anymore', function() {
cy.visit('/apps/files')
cy.get('.files-fileList tr[data-file="image.png"]', { timeout: 10000 })
cy.getFile('image.png', { timeout: 10000 })
.should('not.exist')
})
})
4 changes: 2 additions & 2 deletions cypress/e2e/actions/download.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ describe(`Download ${fileName} in viewer`, function() {
})

it(`See "${fileName}" in the list`, function() {
cy.get(`.files-fileList tr[data-file="${fileName}"]`, { timeout: 10000 })
.should('contain', fileName)
cy.getFile(fileName, { timeout: 10000 })
.should('contain', fileName.replace(/(.*)\./, '$1 .'))
})

it('Open the viewer on file click', function() {
Expand Down
18 changes: 9 additions & 9 deletions cypress/e2e/actions/sidebar.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ describe('Open the sidebar from the viewer and open viewer with sidebar already
})

it('See images in the list', function() {
cy.get('.files-fileList tr[data-file="image1.jpg"]', { timeout: 10000 })
.should('contain', 'image1.jpg')
cy.get('.files-fileList tr[data-file="image2.jpg"]', { timeout: 10000 })
.should('contain', 'image2.jpg')
cy.get('.files-fileList tr[data-file="image3.jpg"]', { timeout: 10000 })
.should('contain', 'image3.jpg')
cy.get('.files-fileList tr[data-file="image4.jpg"]', { timeout: 10000 })
.should('contain', 'image4.jpg')
cy.getFile('image1.jpg', { timeout: 10000 })
.should('contain', 'image1 .jpg')
cy.getFile('image2.jpg', { timeout: 10000 })
.should('contain', 'image2 .jpg')
cy.getFile('image3.jpg', { timeout: 10000 })
.should('contain', 'image3 .jpg')
cy.getFile('image4.jpg', { timeout: 10000 })
.should('contain', 'image4 .jpg')
})

it('Open the viewer on file click', function() {
Expand Down Expand Up @@ -130,7 +130,7 @@ describe('Open the sidebar from the viewer and open viewer with sidebar already
cy.get('body > .viewer').should('not.exist')

// open the sidebar without viewer open
cy.get('.files-fileList tr[data-file="image1.jpg"] .date .modified').click()
cy.getFile('image1.jpg').find('[data-cy-files-list-row-mtime]').click()

cy.openFile('image1.jpg')
cy.get('body > .viewer', { timeout: 10000 })
Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/audios/audios.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ describe('Open mp3 and ogg audio in viewer', function() {
})

it('See audios in the list', function() {
cy.get('.files-fileList tr[data-file="audio.mp3"]', { timeout: 10000 })
.should('contain', 'audio.mp3')
cy.get('.files-fileList tr[data-file="audio.ogg"]', { timeout: 10000 })
.should('contain', 'audio.ogg')
cy.getFile('audio.mp3', { timeout: 10000 })
.should('contain', 'audio .mp3')
cy.getFile('audio.ogg', { timeout: 10000 })
.should('contain', 'audio .ogg')
})

it('Open the viewer on file click', function() {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/files.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('Files default view', function() {

it('See the default files list', function() {
cy.visit('/apps/files')
cy.get('.files-fileList tr').should('contain', 'welcome.txt')
cy.getFile('welcome.txt').should('contain', 'welcome .txt')
})

it('Take screenshot', function() {
Expand Down
16 changes: 8 additions & 8 deletions cypress/e2e/images/images-custom-list-loadmore.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ describe('Open custom list of images in viewer with pagination', function() {
})

it('See images in the list', function() {
cy.get('.files-fileList tr[data-file="image1.jpg"]', { timeout: 10000 })
.should('contain', 'image1.jpg')
cy.get('.files-fileList tr[data-file="image2.jpg"]', { timeout: 10000 })
.should('contain', 'image2.jpg')
cy.get('.files-fileList tr[data-file="image3.jpg"]', { timeout: 10000 })
.should('contain', 'image3.jpg')
cy.get('.files-fileList tr[data-file="image4.jpg"]', { timeout: 10000 })
.should('contain', 'image4.jpg')
cy.getFile('image1.jpg', { timeout: 10000 })
.should('contain', 'image1 .jpg')
cy.getFile('image2.jpg', { timeout: 10000 })
.should('contain', 'image2 .jpg')
cy.getFile('image3.jpg', { timeout: 10000 })
.should('contain', 'image3 .jpg')
cy.getFile('image4.jpg', { timeout: 10000 })
.should('contain', 'image4 .jpg')
})

it('Open the viewer with a specific list', function() {
Expand Down
16 changes: 8 additions & 8 deletions cypress/e2e/images/images-custom-list.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ describe('Open custom images list in viewer', function() {
})

it('See images in the list', function() {
cy.get('.files-fileList tr[data-file="image1.jpg"]', { timeout: 10000 })
.should('contain', 'image1.jpg')
cy.get('.files-fileList tr[data-file="image2.jpg"]', { timeout: 10000 })
.should('contain', 'image2.jpg')
cy.get('.files-fileList tr[data-file="image3.jpg"]', { timeout: 10000 })
.should('contain', 'image3.jpg')
cy.get('.files-fileList tr[data-file="image4.jpg"]', { timeout: 10000 })
.should('contain', 'image4.jpg')
cy.getFile('image1.jpg', { timeout: 10000 })
.should('contain', 'image1 .jpg')
cy.getFile('image2.jpg', { timeout: 10000 })
.should('contain', 'image2 .jpg')
cy.getFile('image3.jpg', { timeout: 10000 })
.should('contain', 'image3 .jpg')
cy.getFile('image4.jpg', { timeout: 10000 })
.should('contain', 'image4 .jpg')
})

it('Open the viewer with a specific list', function() {
Expand Down
16 changes: 8 additions & 8 deletions cypress/e2e/images/images.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ describe('Open images in viewer', function() {
})

it('See images in the list', function() {
cy.get('.files-fileList tr[data-file="image1.jpg"]', { timeout: 10000 })
.should('contain', 'image1.jpg')
cy.get('.files-fileList tr[data-file="image2.jpg"]', { timeout: 10000 })
.should('contain', 'image2.jpg')
cy.get('.files-fileList tr[data-file="image3.jpg"]', { timeout: 10000 })
.should('contain', 'image3.jpg')
cy.get('.files-fileList tr[data-file="image4.jpg"]', { timeout: 10000 })
.should('contain', 'image4.jpg')
cy.getFile('image1.jpg', { timeout: 10000 })
.should('contain', 'image1 .jpg')
cy.getFile('image2.jpg', { timeout: 10000 })
.should('contain', 'image2 .jpg')
cy.getFile('image3.jpg', { timeout: 10000 })
.should('contain', 'image3 .jpg')
cy.getFile('image4.jpg', { timeout: 10000 })
.should('contain', 'image4 .jpg')
})

it('Open the viewer on file click', function() {
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/mixins/audio.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export default function(fileName = 'audio.ogg', mimeType = 'audio/ogg') {
})

it(`See ${fileName} in the list`, function() {
cy.get(`.files-fileList tr[data-file="${fileName}"]`, { timeout: 10000 })
.should('contain', fileName)
cy.getFile(fileName, { timeout: 10000 })
.should('contain', fileName.replace(/(.*)\./, '$1 .'))
})

it('Open the viewer on file click and wait for loading to end', function() {
Expand Down
18 changes: 8 additions & 10 deletions cypress/e2e/mixins/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
* @param {string} source the optional custom source to check against
*/
export default function(fileName = 'image1.jpg', mimeType = 'image/jpeg', source = null) {
let fileId
before(function() {
// Init user
cy.createRandomUser().then(user => {
Expand All @@ -45,19 +44,18 @@ export default function(fileName = 'image1.jpg', mimeType = 'image/jpeg', source
})

it(`See ${fileName} in the list`, function() {
cy.get(`.files-fileList tr[data-file="${fileName}"]`, { timeout: 10000 })
.should('contain', fileName)
.then(row => {
fileId = row[0].dataset.id
})
cy.getFile(fileName, { timeout: 10000 })
.should('contain', fileName.replace(/(.*)\./, '$1 .'))
})

it('Open the viewer on file click and wait for loading to end', function() {
// Match image request
const matchRoute = source
? `/remote.php/dav/files/*/${fileName}`
: `/index.php/core/preview*fileId=${fileId}*`
cy.intercept('GET', matchRoute).as('image')
cy.getFileId(fileName).then(fileId => {
const matchRoute = source
? `/remote.php/dav/files/*/${fileName}`
: `/index.php/core/preview*fileId=${fileId}*`
cy.intercept('GET', matchRoute).as('image')
})

// Open the file and check Viewer existence
cy.openFile(fileName)
Expand Down
11 changes: 4 additions & 7 deletions cypress/e2e/mixins/oddname.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ Cypress.on('fail', (error, runnable) => {
export default function(file, type, sidebar = false) {
const placedName = naughtyFileName(file)

// We'll escape all the characters in the name to match it with css
const placedNameCss = CSS.escape(placedName)

const folderName
= 'Nextcloud "%27%22%60%25%21%23" >`⛰️<' + file + "><` e*'rocks!#?#%~"

Expand Down Expand Up @@ -115,9 +112,9 @@ export default function(file, type, sidebar = false) {
}

it(`See ${file} as ${placedName} in the list`, function() {
cy.get(`.files-fileList tr[data-file="${placedNameCss}"]`, {
timeout: 10000,
}).should('contain', placedName)
// cy.getFile will escape all the characters in the name to match it with css
cy.getFile(placedName, { timeout: 10000 })
.should('contain', placedName.replace(/(.*)\./, '$1 .'))
})

it('Open the viewer on file click', function() {
Expand Down Expand Up @@ -155,7 +152,7 @@ export default function(file, type, sidebar = false) {
})

it('Open the viewer on file click (public)', function() {
cy.openFile(placedName)
cy.openFileInShare(placedName)
cy.get('body > .viewer').should('be.visible')
})

Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/mixins/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export default function(fileName = 'image1.jpg', mimeType = 'image/jpeg') {
})

it(`See ${fileName} in the list`, function() {
cy.get(`.files-fileList tr[data-file="${fileName}"]`, { timeout: 10000 })
.should('contain', fileName)
cy.getFile(fileName, { timeout: 10000 })
.should('contain', fileName.replace(/(.*)\./, '$1 .'))
})

it('Open the viewer on file click and wait for loading to end', function() {
Expand Down
17 changes: 9 additions & 8 deletions cypress/e2e/sharing/download-share-disabled.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,25 @@ describe(`Download ${fileName} in viewer`, function() {
})

it('See the default files list', function() {
cy.get('.files-fileList tr').should('contain', 'welcome.txt')
cy.get('.files-fileList tr').should('contain', 'Photos')
cy.getFile('welcome.txt').should('contain', 'welcome .txt')
cy.getFile('Photos').should('contain', 'Photos')
})

it('See shared files in the list', function() {
cy.openFile('Photos')
cy.get('.files-fileList tr[data-file="image1.jpg"]', { timeout: 10000 })
.should('contain', 'image1.jpg')
cy.get('.files-fileList tr[data-file="image2.jpg"]', { timeout: 10000 })
.should('contain', 'image2.jpg')
cy.getFile('image1.jpg', { timeout: 10000 })
.should('contain', 'image1 .jpg')
cy.getFile('image2.jpg', { timeout: 10000 })
.should('contain', 'image2 .jpg')
})

it('Share the Photos folder with a share link and access the share link', function() {
cy.createLinkShare('/Photos').then(token => {
// Open the sidebar
cy.visit('/apps/files')
cy.get('.files-fileList tr[data-file="Photos"] .fileactions .action-share', { timeout: 10000 }).click()
cy.getFile('Photos').clickAction('details')
cy.get('aside.app-sidebar').should('be.visible')
cy.get('[data-id="sharing"] label').click()

// Open the share menu
cy.get(`.sharing-link-list > .sharing-entry > .action-item[href*='/s/${token}'] + .sharing-entry__actions .action-item__menutoggle`).click()
Expand All @@ -73,7 +74,7 @@ describe(`Download ${fileName} in viewer`, function() {
})

it('Open the viewer on file click', function() {
cy.openFile('image1.jpg')
cy.openFileInShare('image1.jpg')
cy.get('body > .viewer').should('be.visible')
})

Expand Down
14 changes: 7 additions & 7 deletions cypress/e2e/sharing/download-share.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ describe(`Download ${fileName} from viewer in link share`, function() {
})

it('See the default files list', function() {
cy.get('.files-fileList tr').should('contain', 'welcome.txt')
cy.get('.files-fileList tr').should('contain', 'Photos')
cy.getFile('welcome.txt').should('contain', 'welcome .txt')
cy.getFile('Photos').should('contain', 'Photos')
})

it('See shared files in the list', function() {
cy.openFile('Photos')
cy.get('.files-fileList tr[data-file="image1.jpg"]', { timeout: 10000 })
.should('contain', 'image1.jpg')
cy.get('.files-fileList tr[data-file="image2.jpg"]', { timeout: 10000 })
.should('contain', 'image2.jpg')
cy.getFile('image1.jpg', { timeout: 10000 })
.should('contain', 'image1 .jpg')
cy.getFile('image2.jpg', { timeout: 10000 })
.should('contain', 'image2 .jpg')
})

it('Share the Photos folder with a share link and access the share link', function() {
Expand All @@ -67,7 +67,7 @@ describe(`Download ${fileName} from viewer in link share`, function() {
})

it('Open the viewer on file click', function() {
cy.openFile('image1.jpg')
cy.openFileInShare('image1.jpg')
cy.get('body > .viewer').should('be.visible')
})

Expand Down
26 changes: 13 additions & 13 deletions cypress/e2e/sharing/files-shares.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,22 @@ describe('See shared folder with link share', function() {
})

it('See the default files list', function() {
cy.get('.files-fileList tr').should('contain', 'welcome.txt')
cy.get('.files-fileList tr').should('contain', 'Photos')
cy.getFile('welcome.txt').should('contain', 'welcome .txt')
cy.getFile('Photos').should('contain', 'Photos')
})

it('See shared files in the list', function() {
cy.openFile('Photos')
cy.get('.files-fileList tr[data-file="image1.jpg"]', { timeout: 10000 })
.should('contain', 'image1.jpg')
cy.get('.files-fileList tr[data-file="image2.jpg"]', { timeout: 10000 })
.should('contain', 'image2.jpg')
cy.get('.files-fileList tr[data-file="image3.jpg"]', { timeout: 10000 })
.should('contain', 'image3.jpg')
cy.get('.files-fileList tr[data-file="image4.jpg"]', { timeout: 10000 })
.should('contain', 'image4.jpg')
cy.get('.files-fileList tr[data-file="video1.mp4"]', { timeout: 10000 })
.should('contain', 'video1.mp4')
cy.getFile('image1.jpg', { timeout: 10000 })
.should('contain', 'image1 .jpg')
cy.getFile('image2.jpg', { timeout: 10000 })
.should('contain', 'image2 .jpg')
cy.getFile('image3.jpg', { timeout: 10000 })
.should('contain', 'image3 .jpg')
cy.getFile('image4.jpg', { timeout: 10000 })
.should('contain', 'image4 .jpg')
cy.getFile('video1.mp4', { timeout: 10000 })
.should('contain', 'video1 .mp4')
})

it('Share the Photos folder with a share link and access the share link', function() {
Expand All @@ -69,7 +69,7 @@ describe('See shared folder with link share', function() {
})

it('Open the viewer on file click', function() {
cy.openFile('image1.jpg')
cy.openFileInShare('image1.jpg')
cy.get('body > .viewer').should('be.visible')
})

Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/videos/videos.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ describe('Open mp4 videos in viewer', function() {
})

it('See videos in the list', function() {
cy.get('.files-fileList tr[data-file="video1.mp4"]', { timeout: 10000 })
.should('contain', 'video1.mp4')
cy.get('.files-fileList tr[data-file="video2.mp4"]', { timeout: 10000 })
.should('contain', 'video2.mp4')
cy.getFile('video1.mp4', { timeout: 10000 })
.should('contain', 'video1 .mp4')
cy.getFile('video2.mp4', { timeout: 10000 })
.should('contain', 'video2 .mp4')
})

it('Open the viewer on file click', function() {
Expand Down
12 changes: 5 additions & 7 deletions cypress/e2e/visual-regression.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,13 @@ describe('Visual regression tests ', function() {
cy.visit('/apps/files')
})
})
after(function() {
cy.logout()
})

it('See files in the list', function() {
cy.get('.files-fileList tr[data-file="test-card.mp4"]', { timeout: 10000 })
.should('contain', 'test-card.mp4')
cy.get('.files-fileList tr[data-file="test-card.png"]', { timeout: 10000 })
.should('contain', 'test-card.png')
// TODO: Do we care about the file name being split by a ' ' in the text property?
cy.getFile('test-card.mp4', { timeout: 10000 })
.should('contain', 'test-card .mp4')
juliusknorr marked this conversation as resolved.
Show resolved Hide resolved
cy.getFile('test-card.png', { timeout: 10000 })
.should('contain', 'test-card .png')
})

it('Open the viewer on file click', function() {
Expand Down
Loading