Skip to content

Commit

Permalink
remove acceptance test related to media preview
Browse files Browse the repository at this point in the history
  • Loading branch information
Salipa-Gurung committed Apr 4, 2024
1 parent c7b8edb commit 3f49b1b
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 145 deletions.
131 changes: 0 additions & 131 deletions tests/acceptance/features/webUIPreview/mediaPreview.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,6 @@ 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 "<image-file>" to "<image-file>" in the server
And user "Alice" has logged in using the webUI
When the user views the file "<image-file>" in the preview app using the webUI
Then the file "<image-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
Expand All @@ -32,16 +14,6 @@ Feature: display image in preview app on 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 "<resource-one>" to "<resource-one>" in the server
And user "Alice" has uploaded file "<resource-two>" to "<resource-two>" in the server
Expand All @@ -55,106 +27,3 @@ Feature: display image in preview app on the webUI
| 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 "<image-file>" to "<to-file-name>" 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 "<to-file-name>" in the preview app by clicking on the file name using the webUI
Then the file "<to-file-name>" 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
6 changes: 2 additions & 4 deletions tests/e2e/cucumber/features/shares/link.feature
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,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 |
Expand Down Expand Up @@ -185,7 +184,6 @@ 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
And "Carol" closes the file viewer
And "Carol" downloads the following public link resources using the single share view
Expand Down Expand Up @@ -220,7 +218,7 @@ 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 |
Expand Down
41 changes: 39 additions & 2 deletions tests/e2e/cucumber/features/shares/share.feature
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,49 @@ Feature: share
| 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 |
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" 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
Expand All @@ -105,7 +141,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 |
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/cucumber/features/smoke/shortcut.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/cucumber/features/spaces/publicLink.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/cucumber/steps/ui/public.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
const { page } = this.actorsEnvironment.getActor({ key: stepUser })
const fileViewerLocator = editor.fileViewerLocator({ page, fileViewerType })
Expand Down
22 changes: 18 additions & 4 deletions tests/e2e/support/objects/app-files/resource/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,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"]'
Expand Down Expand Up @@ -1524,7 +1526,13 @@ export const removeTagsFromResource = async (args: resourceTagsArgs): Promise<vo
export interface openFileInViewerArgs {
page: Page
name: string
actionType: 'mediaviewer' | 'pdfviewer' | 'texteditor' | 'Collabora' | 'OnlyOffice'
actionType:
| 'mediaviewer'
| 'audioviewer'
| 'pdfviewer'
| 'texteditor'
| 'Collabora'
| 'OnlyOffice'
}

export const openFileInViewer = async (args: openFileInViewerArgs): Promise<void> => {
Expand Down Expand Up @@ -1553,9 +1561,15 @@ export const openFileInViewer = async (args: openFileInViewerArgs): Promise<void
),
page.locator(util.format(resourceNameSelector, name)).click()
])

// in case of error <img> doesn't contain src="blob:https://url"
expect(await page.locator(previewImage).getAttribute('src')).toContain('blob')
const extension = name.split('.').pop()
if (extension === 'mp3' || extension === 'ogg') {
expect(await page.locator(previewAudio).getAttribute('src')).toContain(name)
} else if (extension === 'webm' || extension === 'mp4') {
expect(await page.locator(previewVideo).getAttribute('src')).toContain(name)
} else {
// in case of error <img> doesn't contain src="blob:https://url"
expect(await page.locator(previewImage).getAttribute('src')).toContain('blob')
}
break
}
case 'pdfviewer':
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/support/objects/app-files/utils/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down

0 comments on commit 3f49b1b

Please sign in to comment.