diff --git a/.drone.star b/.drone.star index 49c51000516..ca6b8088186 100644 --- a/.drone.star +++ b/.drone.star @@ -102,7 +102,6 @@ config = { ], "suites": { "oCISBasic": [ - "webUIPreview", "webUILogin", ], "oCISFiles1": [ @@ -179,7 +178,6 @@ basicTestSuites = [ "webUIFilesDetails", "webUILogin", "webUIMoveFilesFolders", - "webUIPreview", "webUIRenameFiles", "webUIRenameFolders", "webUISharingAcceptShares", diff --git a/tests/acceptance/features/webUIPreview/mediaPreview.feature b/tests/acceptance/features/webUIPreview/mediaPreview.feature deleted file mode 100644 index e4f03fe65ac..00000000000 --- a/tests/acceptance/features/webUIPreview/mediaPreview.feature +++ /dev/null @@ -1,160 +0,0 @@ -Feature: display image in preview app on the webUI - - Background: - Given user "Alice" has been created with default attributes and without skeleton files in the server - - @ocisSmokeTest - Scenario Outline: preview of image files with preview app is possible - Given user "Alice" has uploaded file "" to "" in the server - And user "Alice" has logged in using the webUI - When the user views the file "" in the preview app using the webUI - Then the file "" should be displayed in the preview app webUI - Examples: - | image-file | - | testavatar.jpg | - | testavatar.png | - | testavatar.jpeg | - - Scenario: preview of video with preview app is possible - Given user "Alice" has uploaded file "test_video.mp4" to "test_video.mp4" in the server - And user "Alice" has logged in using the webUI - When the user views the file "test_video.mp4" in the preview app using the webUI - Then the file "test_video.mp4" should be displayed in the preview app webUI - - - Scenario: video playback in public share - Given user "Alice" has created folder "simple-empty-folder" in the server - And user "Alice" has uploaded file "test_video.mp4" to "simple-empty-folder/test_video.mp4" in the server - And user "Alice" has created a public link with following settings in the server - | path | simple-empty-folder | - When the public uses the webUI to access the last public link created by user "Alice" in a new session - And the public views the file "test_video.mp4" in the preview app using the webUI - Then the file "test_video.mp4" should be displayed in the preview app webUI - - - Scenario: image preview in public share - Given user "Alice" has created folder "simple-empty-folder" in the server - And user "Alice" has uploaded file "testavatar.jpg" to "simple-empty-folder/testavatar.jpg" in the server - And user "Alice" has created a public link with following settings in the server - | path | simple-empty-folder | - When the public uses the webUI to access the last public link created by user "Alice" in a new session - And the public views the file "testavatar.jpg" in the preview app using the webUI - Then the file "testavatar.jpg" should be displayed in the preview app webUI - - - Scenario Outline: navigate to next and previous media resource with preview app is possible - Given user "Alice" has uploaded file "" to "" in the server - And user "Alice" has uploaded file "" to "" in the server - And user "Alice" has logged in using the webUI - When the user views the file "" in the preview app using the webUI - And the user navigates to the next media resource using the webUI - Then the file "" should be displayed in the preview app webUI - When the user navigates to the previous media resource using the webUI - Then the file "" should be displayed in the preview app webUI - Examples: - | resource-one | resource-two | - | test_video0.mp4 | test_video1.mp4 | - | testavatar.jpg | testavatar.png | - - - Scenario: downloading media resource is possible - Given user "Alice" has uploaded file "testavatar.jpg" to "testavatar.jpg" in the server - And user "Alice" has logged in using the webUI - And the user has viewed the file "testavatar.jpg" in the preview app using the webUI - When the user downloads the media resource using the webUI - Then no message should be displayed on the webUI - - - Scenario: closing preview app is possible - Given user "Alice" has uploaded file "testavatar.jpg" to "testavatar.jpg" in the server - And user "Alice" has logged in using the webUI - And the user has viewed the file "testavatar.jpg" in the preview app using the webUI - When the user closes the media resource using the webUI - Then the file "testavatar.jpg" should not be displayed in the preview app webUI - And the user should be in the root directory on the webUI - - - Scenario: preview of image with preview app by clicking on the file name - Given user "Alice" has uploaded file "testavatar.jpg" to "testavatar.jpg" in the server - And user "Alice" has logged in using the webUI - When the user views the file "testavatar.jpg" in the preview app by clicking on the file name using the webUI - Then the file "testavatar.jpg" should be displayed in the preview app webUI - - - Scenario: preview of mp3 file with preview app by clicking on the file name - Given user "Alice" has uploaded file "testimage.mp3" to "testimage.mp3" in the server - And user "Alice" has logged in using the webUI - When the user views the file "testimage.mp3" in the preview app by clicking on the file name using the webUI - Then the file "testimage.mp3" should be displayed in the preview app webUI - - - Scenario: preview of mp3 file with preview app is possible - Given user "Alice" has uploaded file "testimage.mp3" to "testimage.mp3" in the server - And user "Alice" has logged in using the webUI - When the user views the file "testimage.mp3" in the preview app using the webUI - Then the file "testimage.mp3" should be displayed in the preview app webUI - - - Scenario: preview of image in file list view for .jpeg format file - Given user "Alice" has uploaded file "testavatar.jpeg" to "testavatar.jpeg" in the server - And user "Alice" has logged in using the webUI - When the user browses to the files page - When the user views the file "testavatar.jpeg" in the preview app using the webUI - Then the file "testavatar.jpeg" should be displayed in the preview app webUI - - @issue-ocis-1490 @issue-4667 - Scenario: preview of image in file list view for .ogg format file - Given user "Alice" has uploaded file "sampleOgg.ogg" to "sampleOgg.ogg" in the server - And user "Alice" has logged in using the webUI - When the user browses to the files page - When the user views the file "sampleOgg.ogg" in the preview app using the webUI - Then the file "sampleOgg.ogg" should be displayed in the preview app webUI - - @issue-ocis-1490 - Scenario: preview of image in file list view for .gif format file - Given user "Alice" has uploaded file "sampleGif.gif" to "sampleGif.gif" in the server - And user "Alice" has logged in using the webUI - When the user browses to the files page - When the user views the file "sampleGif.gif" in the preview app using the webUI - Then the file "sampleGif.gif" should be displayed in the preview app webUI - - @issue-ocis-1490 @issue-4667 - Scenario: preview of image in file list view for .webm format file - Given user "Alice" has uploaded file "sampleWebm.webm" to "sampleWebm.webm" in the server - And user "Alice" has logged in using the webUI - When the user browses to the files page - When the user views the file "sampleWebm.webm" in the preview app using the webUI - Then the file "sampleWebm.webm" should be displayed in the preview app webUI - - - Scenario Outline: preview of image files with extensions in UpperCase with preview app - Given user "Alice" has uploaded file "" to "" in the server - And user "Alice" has logged in using the webUI - When the user browses to the files page - When the user views the file "" in the preview app by clicking on the file name using the webUI - Then the file "" should be displayed in the preview app webUI - Examples: - | image-file | to-file-name | - | testavatar.jpg | testavatar.JPG | - | testavatar.png | testavatar.PNG | - | testavatar.jpeg | testavatar.JPEG | - - - Scenario: Open jpeg file with preview app in shared-with-others page - Given user "Brian" has been created with default attributes and without skeleton files in the server - And user "Brian" has uploaded file "testavatar.jpeg" to "testavatar.jpeg" in the server - And user "Brian" has shared file "testavatar.jpeg" with user "Alice" with "all" permissions in the server - And user "Brian" has logged in using the webUI - And the user browses to the shared-with-others page - When the user views the file "testavatar.jpeg" in the preview app by clicking on the file name using the webUI - Then the file "testavatar.jpeg" should be displayed in the preview app webUI - - - Scenario: Open jpeg file with preview app in shared-with-me page - Given user "Brian" has been created with default attributes and without skeleton files in the server - And user "Brian" has uploaded file "testavatar.jpeg" to "testavatar.jpeg" in the server - And user "Brian" has shared file "testavatar.jpeg" with user "Alice" with "all" permissions in the server - And user "Alice" has logged in using the webUI - And the user browses to the shared-with-me page - When the user views the file "testavatar.jpeg" in the preview app by clicking on the file name using the webUI - Then the file "testavatar.jpeg" should be displayed in the preview app webUI diff --git a/tests/e2e/cucumber/features/shares/link.feature b/tests/e2e/cucumber/features/shares/link.feature index ad2be60ed41..f79ae56bc41 100644 --- a/tests/e2e/cucumber/features/shares/link.feature +++ b/tests/e2e/cucumber/features/shares/link.feature @@ -90,6 +90,7 @@ Feature: link | localFile | to | | filesForUpload/simple.pdf | simple.pdf | | filesForUpload/testavatar.jpg | testavatar.jpg | + | filesForUpload/test_video.mp4 | test_video.mp4 | And "Alice" shares the following resource using API | resource | recipient | type | role | | folderPublic | Brian | user | Can edit | @@ -117,6 +118,10 @@ Feature: link | resource | password | | testavatar.jpg | %public% | And "Alice" renames the most recently created public link of resource "testavatar.jpg" to "imageLink" + And "Alice" creates a public link creates a public link of following resource using the sidebar panel + | resource | password | + | test_video.mp4 | %public% | + And "Alice" renames the most recently created public link of resource "test_video.mp4" to "videoLink" And "Alice" logs out # authenticated user with access to resources. should be redirected to shares with me page @@ -149,8 +154,7 @@ Feature: link | simple.pdf | file | When "Brian" opens the public link "imageLink" And "Brian" unlocks the public link with password "%public%" - # https://github.com/owncloud/ocis/issues/8602 - Then "Brian" is in a image-viewer + Then "Brian" is in a media-viewer And "Brian" closes the file viewer And "Brian" downloads the following public link resources using the single share view | resource | type | @@ -185,8 +189,7 @@ Feature: link | simple.pdf | file | When "Carol" opens the public link "imageLink" And "Carol" unlocks the public link with password "%public%" - # https://github.com/owncloud/ocis/issues/8602 - Then "Carol" is in a image-viewer + Then "Carol" is in a media-viewer And "Carol" closes the file viewer And "Carol" downloads the following public link resources using the single share view | resource | type | @@ -220,11 +223,15 @@ Feature: link When "Anonymous" opens the public link "imageLink" And "Anonymous" unlocks the public link with password "%public%" # https://github.com/owncloud/ocis/issues/8602 - Then "Anonymous" is in a image-viewer + Then "Anonymous" is in a media-viewer And "Anonymous" closes the file viewer And "Anonymous" downloads the following public link resources using the single share view | resource | type | | testavatar.jpg | file | + When "Anonymous" opens the public link "videoLink" + And "Anonymous" unlocks the public link with password "%public%" + Then "Anonymous" is in a media-viewer + And "Anonymous" closes the file viewer Scenario: add banned password for public link diff --git a/tests/e2e/cucumber/features/shares/share.feature b/tests/e2e/cucumber/features/shares/share.feature index b9c667f65fc..c4ef754c0e7 100644 --- a/tests/e2e/cucumber/features/shares/share.feature +++ b/tests/e2e/cucumber/features/shares/share.feature @@ -83,15 +83,65 @@ Feature: share | sharedFile.txt | txtFile | some text | And "Alice" uploads the following resource | resource | - | testavatar.jpeg | | simple.pdf | - When "Alice" shares the following resource using the sidebar panel + | sampleGif.gif | + | testimage.mp3 | + | sampleOgg.ogg | + | sampleWebm.webm | + | test_video.mp4 | + | testavatar.jpeg | + | testavatar.png | + When "Alice" views the file "testavatar.png" in the preview app using the sidebar panel + Then "Alice" is in a media-viewer + When "Alice" closes the file viewer + And "Alice" opens the following file in mediaviewer + | resource | + | testavatar.jpeg | + Then "Alice" is in a media-viewer + When "Alice" navigates to the next media resource + When "Alice" navigates to the previous media resource + When "Alice" closes the file viewer + When "Alice" opens the following file in mediaviewer + | resource | + | sampleGif.gif | + Then "Alice" is in a media-viewer + When "Alice" closes the file viewer + And "Alice" opens the following file in mediaviewer + | resource | + | testimage.mp3 | + Then "Alice" is in a media-viewer + When "Alice" closes the file viewer + And "Alice" opens the following file in mediaviewer + | resource | + | sampleOgg.ogg | + Then "Alice" is in a media-viewer + When "Alice" closes the file viewer + And "Alice" opens the following file in mediaviewer + | resource | + | sampleWebm.webm | + Then "Alice" is in a media-viewer + When "Alice" closes the file viewer + And "Alice" opens the following file in mediaviewer + | resource | + | test_video.mp4 | + Then "Alice" is in a media-viewer + When "Alice" downloads the following resource using the preview topbar + | resource | type | + | test_video.mp4 | file | + When "Alice" closes the file viewer + And "Alice" shares the following resource using the sidebar panel | resource | recipient | type | role | resourceType | | shareToBrian.txt | Brian | user | Can edit | file | | shareToBrian.md | Brian | user | Can edit | file | | testavatar.jpeg | Brian | user | Can view | file | | simple.pdf | Brian | user | custom_permissions:read,update,share | file | | sharedFile.txt | Brian | user | Can edit | file | + And "Alice" navigates to the shared with others page + And "Alice" opens the following file in mediaviewer + | resource | + | testavatar.jpeg | + Then "Alice" is in a media-viewer + When "Alice" closes the file viewer And "Brian" opens the "files" app And "Brian" navigates to the shared with me page @@ -105,7 +155,8 @@ Feature: share And "Brian" opens the following file in mediaviewer | resource | | testavatar.jpeg | - And "Brian" closes the file viewer + Then "Brian" is in a media-viewer + When "Brian" closes the file viewer And "Brian" opens the following file in pdfviewer | resource | | simple.pdf | diff --git a/tests/e2e/cucumber/features/smoke/shortcut.feature b/tests/e2e/cucumber/features/smoke/shortcut.feature index aaba56b3da2..9e672a663e5 100644 --- a/tests/e2e/cucumber/features/smoke/shortcut.feature +++ b/tests/e2e/cucumber/features/smoke/shortcut.feature @@ -47,7 +47,7 @@ Feature: Users can create shortcuts for resources and sites | resource | name | type | | logo.jpg | logo | file | And "Brian" opens a shortcut "logo.url" - Then "Brian" is in a image-viewer + Then "Brian" is in a media-viewer And "Brian" closes the file viewer # create a shortcut to the public link diff --git a/tests/e2e/cucumber/features/spaces/publicLink.feature b/tests/e2e/cucumber/features/spaces/publicLink.feature index 05ad23bc70a..8dca484e278 100644 --- a/tests/e2e/cucumber/features/spaces/publicLink.feature +++ b/tests/e2e/cucumber/features/spaces/publicLink.feature @@ -89,7 +89,7 @@ Feature: spaces public link And "David" edits the public link named "folderLink" of resource "spaceFolder" changing role to "Can edit" When "David" opens the public link "imageLink" And "David" unlocks the public link with password "%public%" - Then "David" is in a image-viewer + Then "David" is in a media-viewer And "David" closes the file viewer And "David" logs out diff --git a/tests/e2e/cucumber/steps/ui/public.ts b/tests/e2e/cucumber/steps/ui/public.ts index cf8b0f7fd31..542fb911123 100644 --- a/tests/e2e/cucumber/steps/ui/public.ts +++ b/tests/e2e/cucumber/steps/ui/public.ts @@ -58,7 +58,7 @@ When( ) Then( - /^"([^"]*)" is in a (text-editor|pdf-viewer|image-viewer)$/, + /^"([^"]*)" is in a (text-editor|pdf-viewer|media-viewer)$/, async function (this: World, stepUser: string, fileViewerType: string): Promise { const { page } = this.actorsEnvironment.getActor({ key: stepUser }) const fileViewerLocator = editor.fileViewerLocator({ page, fileViewerType }) diff --git a/tests/e2e/cucumber/steps/ui/resources.ts b/tests/e2e/cucumber/steps/ui/resources.ts index 28ce31bb1f1..2b26cec9b9a 100644 --- a/tests/e2e/cucumber/steps/ui/resources.ts +++ b/tests/e2e/cucumber/steps/ui/resources.ts @@ -103,7 +103,7 @@ When( ) When( - /^"([^"]*)" downloads the following resource(?:s)? using the (sidebar panel|batch action)$/, + /^"([^"]*)" downloads the following resource(?:s)? using the (sidebar panel|batch action|preview topbar)$/, async function (this: World, stepUser: string, actionType: string, stepTable: DataTable) { const { page } = this.actorsEnvironment.getActor({ key: stepUser }) const resourceObject = new objects.applicationFiles.Resource({ page }) @@ -461,6 +461,9 @@ export const processDownload = async ( case 'sidebar panel': via = 'SIDEBAR_PANEL' break + case 'preview topbar': + via = 'PREVIEW_TOPBAR' + break default: break } @@ -476,7 +479,7 @@ export const processDownload = async ( downloadedResources.push(name) }) - if (actionType === 'sidebar panel') { + if (actionType === 'sidebar panel' || actionType === 'preview topbar') { expect(downloads.length).toBe(files.length) for (const resource of files) { const fileOrFolderName = path.parse(resource.name).name @@ -782,3 +785,21 @@ Then( : await expect(lockLocator).not.toBeVisible() } ) + +When( + /^"([^"]*)" navigates to the (next|previous) media resource$/, + async function (this: World, stepUser: string, navigationType: string): Promise { + const { page } = this.actorsEnvironment.getActor({ key: stepUser }) + const resourceObject = new objects.applicationFiles.Resource({ page }) + await resourceObject.navigateMediaFile(navigationType) + } +) + +When( + '{string} views the file {string} in the preview app using the sidebar panel', + async function (this: World, stepUser: any, file: any): Promise { + const { page } = this.actorsEnvironment.getActor({ key: stepUser }) + const resourceObject = new objects.applicationFiles.Resource({ page }) + await resourceObject.previewMediaFromSidebarPanel(file) + } +) diff --git a/tests/e2e/support/objects/app-files/resource/actions.ts b/tests/e2e/support/objects/app-files/resource/actions.ts index 1ce642457b1..00d4669e0f3 100644 --- a/tests/e2e/support/objects/app-files/resource/actions.ts +++ b/tests/e2e/support/objects/app-files/resource/actions.ts @@ -9,6 +9,7 @@ import { LinksEnvironment } from '../../../environment' import { config } from '../../../../config' import { buildXpathLiteral } from '../../../utils/locator' +const downloadPreviewButton = '//button[contains(@id, "preview-download")]' const downloadFileButtonSingleShareView = '.oc-files-actions-download-file-trigger' const downloadFolderButtonSingleShareView = '.oc-files-actions-download-archive-trigger' const filesView = '#files-view' @@ -75,6 +76,8 @@ const loadingSpinner = '#files-global-search-options .loading' const filesViewOptionButton = '#files-view-options-btn' const hiddenFilesToggleButton = '//*[@data-testid="files-switch-hidden-files"]//button' const previewImage = '//main[@id="preview"]//div[contains(@class,"stage_media")]//img' +const previewAudio = '//main[@id="preview"]//div[contains(@class,"stage_media")]//audio//source' +const previewVideo = '//main[@id="preview"]//div[contains(@class,"stage_media")]//video//source' const drawioSaveButton = '.geBigButton >> text=Save' const drawioIframe = '#drawio-editor' const externalEditorIframe = '[name="app-iframe"]' @@ -119,6 +122,7 @@ const resourceLockIcon = '//*[@data-test-resource-name="%s"]/ancestor::tr//td//span[contains(@class, "oc-resource-icon-status-badge")]' const sharesNavigationButtonSelector = '.oc-sidebar-nav [data-nav-name="files-shares"]' const keepBothButton = '.oc-modal-body-actions-confirm' +const mediaNavigationButton = `//button[contains(@class, "preview-controls-%s")]` export const clickResource = async ({ page, @@ -589,6 +593,15 @@ const pauseResumeUpload = (page: Page): Promise => { return page.locator(pauseResumeUploadButton).click() } +export const navigateMediaFile = async ({ page, navigationType }): Promise => { + await Promise.all([ + page.waitForResponse((resp) => resp.status() === 200 && resp.request().method() === 'GET'), + page.locator(util.format(mediaNavigationButton, navigationType)).click() + ]) + const fileViewerLocator = editor.fileViewerLocator({ page, fileViewerType: 'media-viewer' }) + await expect(fileViewerLocator).toBeVisible() +} + export const pauseResourceUpload = async (page: Page): Promise => { await pauseResumeUpload(page) await Promise.all([ @@ -620,7 +633,11 @@ interface resourceArgs { type?: string } -export type ActionViaType = 'SIDEBAR_PANEL' | 'BATCH_ACTION' | 'SINGLE_SHARE_VIEW' +export type ActionViaType = + | 'SIDEBAR_PANEL' + | 'BATCH_ACTION' + | 'SINGLE_SHARE_VIEW' + | 'PREVIEW_TOPBAR' export interface downloadResourcesArgs { page: Page @@ -686,6 +703,15 @@ export const downloadResources = async (args: downloadResourcesArgs): Promise => { @@ -1553,9 +1585,20 @@ export const openFileInViewer = async (args: openFileInViewerArgs): Promise doesn't contain src="blob:https://url" - expect(await page.locator(previewImage).getAttribute('src')).toContain('blob') + const extension = name.split('.').pop() + switch (extension) { + case 'mp3': + case 'ogg': + expect(await page.locator(previewAudio).getAttribute('src')).toContain(name) + break + case 'webm': + case 'mp4': + expect(await page.locator(previewVideo).getAttribute('src')).toContain(name) + break + default: + // in case of error doesn't contain src="blob:https://url" + expect(await page.locator(previewImage).getAttribute('src')).toContain('blob') + } break } case 'pdfviewer': @@ -1571,6 +1614,12 @@ export const openFileInViewer = async (args: openFileInViewerArgs): Promise => { + await sidebar.open({ page: page, resource }) + await sidebar.openPanel({ page, name: 'actions' }) + await page.locator(util.format(sideBarActionButton, 'Preview')).click() +} + export const checkThatFileVersionIsNotAvailable = async ( args: resourceVersionArgs ): Promise => { diff --git a/tests/e2e/support/objects/app-files/resource/index.ts b/tests/e2e/support/objects/app-files/resource/index.ts index cba4aa34d9e..27e2dc85732 100644 --- a/tests/e2e/support/objects/app-files/resource/index.ts +++ b/tests/e2e/support/objects/app-files/resource/index.ts @@ -294,4 +294,12 @@ export class Resource { getLockLocator(args: Omit): Locator { return po.getLockLocator({ ...args, page: this.#page }) } + + async navigateMediaFile(navigationType): Promise { + return po.navigateMediaFile({ page: this.#page, navigationType }) + } + + async previewMediaFromSidebarPanel(resource): Promise { + await po.previewMediaFromSidebarPanel({ page: this.#page, resource }) + } } diff --git a/tests/e2e/support/objects/app-files/utils/editor.ts b/tests/e2e/support/objects/app-files/utils/editor.ts index 48147b025f7..e728ce026d2 100644 --- a/tests/e2e/support/objects/app-files/utils/editor.ts +++ b/tests/e2e/support/objects/app-files/utils/editor.ts @@ -32,7 +32,7 @@ export const fileViewerLocator = ({ return page.locator(texEditor) case 'pdf-viewer': return page.locator(pdfViewer) - case 'image-viewer': + case 'media-viewer': return page.locator(imageViewer) default: throw new Error(`${fileViewerType} not implemented`)