From 45abeceb1e6252987fb1b8c15a76319f8e51faab Mon Sep 17 00:00:00 2001 From: Salipa Gurung <53458341+Salipa-Gurung@users.noreply.github.com> Date: Thu, 25 Apr 2024 15:57:00 +0545 Subject: [PATCH 1/4] [tests-only] [full-ci] Remove acceptance test related to image preview (#10670) * remove acceptance test related to media preview * address review * add assertion for media navigation action * change step description * select the first element found by locator --- .drone.star | 2 - .../webUIPreview/mediaPreview.feature | 136 ------------------ .../features/app-provider/lock.feature | 2 +- .../app-provider/officeSuites.feature | 4 +- .../features/shares/internalLink.feature | 2 +- .../e2e/cucumber/features/shares/link.feature | 31 ++-- .../cucumber/features/shares/share.feature | 59 +++++++- .../cucumber/features/smoke/rename.feature | 2 +- .../cucumber/features/smoke/shortcut.feature | 4 +- .../features/spaces/internalLink.feature | 2 +- .../spaces/participantManagement.feature | 2 +- .../cucumber/features/spaces/project.feature | 4 +- .../features/spaces/publicLink.feature | 12 +- tests/e2e/cucumber/steps/ui/links.ts | 2 +- tests/e2e/cucumber/steps/ui/public.ts | 2 +- tests/e2e/cucumber/steps/ui/resources.ts | 26 +++- .../objects/app-files/resource/actions.ts | 62 +++++++- .../objects/app-files/resource/index.ts | 8 ++ .../support/objects/app-files/utils/editor.ts | 2 +- 19 files changed, 181 insertions(+), 183 deletions(-) delete mode 100644 tests/acceptance/features/webUIPreview/mediaPreview.feature diff --git a/.drone.star b/.drone.star index eaf2352408f..802e2b84422 100644 --- a/.drone.star +++ b/.drone.star @@ -100,7 +100,6 @@ config = { ], "suites": { "oCISBasic": [ - "webUIPreview", "webUILogin", ], "oCISFiles1": [ @@ -176,7 +175,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 99988e53565..00000000000 --- a/tests/acceptance/features/webUIPreview/mediaPreview.feature +++ /dev/null @@ -1,136 +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: 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/app-provider/lock.feature b/tests/e2e/cucumber/features/app-provider/lock.feature index f063b0b6248..a3a29fa00e0 100644 --- a/tests/e2e/cucumber/features/app-provider/lock.feature +++ b/tests/e2e/cucumber/features/app-provider/lock.feature @@ -30,7 +30,7 @@ Feature: lock And for "Alice" file "test.odt" should be locked # checking that sharing/unsharing and creating link of the locked file is possible - And "Alice" creates a public link creates a public link of following resource using the sidebar panel + And "Alice" creates a public link of following resource using the sidebar panel | resource | password | | test.odt | %public% | And "Alice" shares the following resource using the sidebar panel diff --git a/tests/e2e/cucumber/features/app-provider/officeSuites.feature b/tests/e2e/cucumber/features/app-provider/officeSuites.feature index c9eac15d084..d29d33980fe 100644 --- a/tests/e2e/cucumber/features/app-provider/officeSuites.feature +++ b/tests/e2e/cucumber/features/app-provider/officeSuites.feature @@ -16,7 +16,7 @@ Feature: Integrate with online office suites like Collabora and OnlyOffice When "Alice" creates the following resources | resource | type | content | | OpenDocument.odt | OpenDocument | OpenDocument Content | - And "Alice" creates a public link creates a public link of following resource using the sidebar panel + And "Alice" creates a public link of following resource using the sidebar panel | resource | role | password | | OpenDocument.odt | Can edit | %public% | And "Alice" logs out @@ -29,7 +29,7 @@ Feature: Integrate with online office suites like Collabora and OnlyOffice When "Alice" creates the following resources | resource | type | content | | MicrosoftWord.docx | Microsoft Word | Microsoft Word Content | - And "Alice" creates a public link creates a public link of following resource using the sidebar panel + And "Alice" creates a public link of following resource using the sidebar panel | resource | role | password | | MicrosoftWord.docx | Can edit | %public% | And "Alice" logs out diff --git a/tests/e2e/cucumber/features/shares/internalLink.feature b/tests/e2e/cucumber/features/shares/internalLink.feature index fb0b6f23763..6dbcd2f6dde 100644 --- a/tests/e2e/cucumber/features/shares/internalLink.feature +++ b/tests/e2e/cucumber/features/shares/internalLink.feature @@ -14,7 +14,7 @@ Feature: internal link share | resource | recipient | type | role | | myfolder | Brian | user | Can edit | And "Alice" opens the "files" app - And "Alice" creates a public link creates a public link of following resource using the sidebar panel + And "Alice" creates a public link of following resource using the sidebar panel | resource | password | | myfolder | %public% | When "Alice" edits the public link named "Link" of resource "myfolder" changing role to "Invited people" diff --git a/tests/e2e/cucumber/features/shares/link.feature b/tests/e2e/cucumber/features/shares/link.feature index 098f1e223ca..a6cdcbc30da 100644 --- a/tests/e2e/cucumber/features/shares/link.feature +++ b/tests/e2e/cucumber/features/shares/link.feature @@ -16,7 +16,7 @@ Feature: link | folderPublic/lorem.txt | lorem ipsum | And "Alice" opens the "files" app - And "Alice" creates a public link creates a public link of following resource using the sidebar panel + And "Alice" creates a public link of following resource using the sidebar panel | resource | role | password | | folderPublic | Secret File Drop | %public% | And "Alice" renames the most recently created public link of resource "folderPublic" to "myPublicLink" @@ -86,6 +86,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 | @@ -93,26 +94,30 @@ Feature: link | testavatar.jpg | Brian | user | Can edit | And "Alice" opens the "files" app - And "Alice" creates a public link creates a public link of following resource using the sidebar panel + And "Alice" creates a public link of following resource using the sidebar panel | resource | password | | folderPublic | %public% | And "Alice" renames the most recently created public link of resource "folderPublic" to "folderLink" - And "Alice" creates a public link creates a public link of following resource using the sidebar panel + And "Alice" creates a public link of following resource using the sidebar panel | resource | password | | folderPublic/shareToBrian.txt | %public% | And "Alice" renames the most recently created public link of resource "folderPublic/shareToBrian.txt" to "textLink" - And "Alice" creates a public link creates a public link of following resource using the sidebar panel + And "Alice" creates a public link of following resource using the sidebar panel | resource | password | | folderPublic/shareToBrian.md | %public% | And "Alice" renames the most recently created public link of resource "folderPublic/shareToBrian.md" to "markdownLink" - And "Alice" creates a public link creates a public link of following resource using the sidebar panel + And "Alice" creates a public link of following resource using the sidebar panel | resource | password | | simple.pdf | %public% | And "Alice" renames the most recently created public link of resource "simple.pdf" to "pdfLink" - And "Alice" creates a public link creates a public link of following resource using the sidebar panel + And "Alice" creates a public link of following resource using the sidebar panel | 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 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 @@ -146,7 +151,7 @@ Feature: link 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 | @@ -182,7 +187,7 @@ Feature: link 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 | @@ -216,11 +221,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 @@ -230,7 +239,7 @@ Feature: link | lorem.txt | some text | And "Alice" opens the "files" app - And "Alice" creates a public link creates a public link of following resource using the sidebar panel + And "Alice" creates a public link of following resource using the sidebar panel | resource | password | | lorem.txt | %public% | When "Alice" tries to sets a new password "ownCloud-1" of the public link named "Link" of resource "lorem.txt" @@ -263,7 +272,7 @@ Feature: link | pathToFile | content | | folderPublic/lorem.txt | lorem ipsum | And "Alice" opens the "files" app - And "Alice" creates a public link creates a public link of following resource using the sidebar panel + And "Alice" creates a public link of following resource using the sidebar panel | resource | role | password | | folderPublic | Can edit | %public% | And "Alice" renames the most recently created public link of resource "folderPublic" to "myPublicLink" diff --git a/tests/e2e/cucumber/features/shares/share.feature b/tests/e2e/cucumber/features/shares/share.feature index 2b176015efe..b9bf637ba92 100644 --- a/tests/e2e/cucumber/features/shares/share.feature +++ b/tests/e2e/cucumber/features/shares/share.feature @@ -86,16 +86,67 @@ Feature: share | shareToBrian.md | new readme content edited | 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" opens a file "testavatar.png" in the media-viewer 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 + And "Alice" navigates to the previous media resource + And "Alice" closes the file viewer + And "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 | + And "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 | Can edit | 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 And "Brian" disables the sync for the following share | name | @@ -107,11 +158,13 @@ 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 | And "Brian" closes the file viewer + And "Alice" navigates to the personal space page And "Alice" removes following sharee | resource | recipient | | shareToBrian.txt | Brian | diff --git a/tests/e2e/cucumber/features/smoke/rename.feature b/tests/e2e/cucumber/features/smoke/rename.feature index 3daa8b72006..c4bd3351f29 100644 --- a/tests/e2e/cucumber/features/smoke/rename.feature +++ b/tests/e2e/cucumber/features/smoke/rename.feature @@ -18,7 +18,7 @@ Feature: rename And "Alice" shares the following resource using API | resource | recipient | type | role | | folder | Brian | user | Can edit | - And "Alice" creates a public link creates a public link of following resource using the sidebar panel + And "Alice" creates a public link of following resource using the sidebar panel | resource | role | password | | folder | Can edit | %public% | And "Brian" logs in diff --git a/tests/e2e/cucumber/features/smoke/shortcut.feature b/tests/e2e/cucumber/features/smoke/shortcut.feature index 648a1520262..d6704508842 100644 --- a/tests/e2e/cucumber/features/smoke/shortcut.feature +++ b/tests/e2e/cucumber/features/smoke/shortcut.feature @@ -21,7 +21,7 @@ Feature: Users can create shortcuts for resources and sites | resource | recipient | type | role | | testavatar.jpg | Brian | user | Can view | And "Alice" opens the "files" app - And "Alice" creates a public link creates a public link of following resource using the sidebar panel + And "Alice" creates a public link of following resource using the sidebar panel | resource | password | | docs/notice.txt | %public% | And "Alice" renames the most recently created public link of resource "docs/notice.txt" to "myPublicLink" @@ -47,7 +47,7 @@ Feature: Users can create shortcuts for resources and sites | resource | name | type | | testavatar.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/internalLink.feature b/tests/e2e/cucumber/features/spaces/internalLink.feature index 8878cb067f6..64038ceb02f 100644 --- a/tests/e2e/cucumber/features/spaces/internalLink.feature +++ b/tests/e2e/cucumber/features/spaces/internalLink.feature @@ -30,7 +30,7 @@ Feature: internal link share in project space And "Alice" renames the most recently created public link of space to "spaceLink" And "Alice" edits the public link named "spaceLink" of the space changing role to "Invited people" # internal link to folder - And "Alice" creates a public link creates a public link of following resource using the sidebar panel + And "Alice" creates a public link of following resource using the sidebar panel | resource | role | password | | myfolder | Invited people | %public% | # When "Alice" edits the public link named "Link" of resource "myfolder" changing role to "Invited people" diff --git a/tests/e2e/cucumber/features/spaces/participantManagement.feature b/tests/e2e/cucumber/features/spaces/participantManagement.feature index 353b8106049..518410db841 100644 --- a/tests/e2e/cucumber/features/spaces/participantManagement.feature +++ b/tests/e2e/cucumber/features/spaces/participantManagement.feature @@ -56,7 +56,7 @@ Feature: spaces participant management Then "Carol" should see folder "parent" but should not be able to edit # page reload is necessary to fetch all the changes made by user Brian When "Alice" reloads the spaces page - And "Alice" creates a public link creates a public link of following resource using the sidebar panel + And "Alice" creates a public link of following resource using the sidebar panel | resource | role | password | | parent | Can edit | %public% | And "Anonymous" opens the public link "Link" diff --git a/tests/e2e/cucumber/features/spaces/project.feature b/tests/e2e/cucumber/features/spaces/project.feature index 38ccde86c99..69732626ab8 100644 --- a/tests/e2e/cucumber/features/spaces/project.feature +++ b/tests/e2e/cucumber/features/spaces/project.feature @@ -48,7 +48,7 @@ Feature: spaces.personal | lorem.txt | folderPublic | | lorem.txt | folder_to_shared | - And "Alice" creates a public link creates a public link of following resource using the sidebar panel + And "Alice" creates a public link of following resource using the sidebar panel | resource | role | password | | folderPublic | Secret File Drop | %public% | And "Alice" renames the most recently created public link of resource "folderPublic" to "team.1" @@ -74,7 +74,7 @@ Feature: spaces.personal | resource | to | | lorem.txt | folderPublic | - And "Alice" creates a public link creates a public link of following resource using the sidebar panel + And "Alice" creates a public link of following resource using the sidebar panel | resource | password | | folderPublic | %public% | And "Alice" renames the most recently created public link of resource "folderPublic" to "team.2" diff --git a/tests/e2e/cucumber/features/spaces/publicLink.feature b/tests/e2e/cucumber/features/spaces/publicLink.feature index 429f9932eec..1b4ba51805b 100644 --- a/tests/e2e/cucumber/features/spaces/publicLink.feature +++ b/tests/e2e/cucumber/features/spaces/publicLink.feature @@ -33,23 +33,23 @@ Feature: spaces public link | testavatar.jpg | And "Alice" creates a public link for the space with password "%public%" using the sidebar panel And "Alice" renames the most recently created public link of space to "spaceLink" - And "Alice" creates a public link creates a public link of following resource using the sidebar panel + And "Alice" creates a public link of following resource using the sidebar panel | resource | password | | spaceFolder | %public% | And "Alice" renames the most recently created public link of resource "spaceFolder" to "folderLink" - And "Alice" creates a public link creates a public link of following resource using the sidebar panel + And "Alice" creates a public link of following resource using the sidebar panel | resource | password | | spaceFolder/shareToBrian.txt | %public% | And "Alice" renames the most recently created public link of resource "spaceFolder/shareToBrian.txt" to "textLink" - And "Alice" creates a public link creates a public link of following resource using the sidebar panel + And "Alice" creates a public link of following resource using the sidebar panel | resource | password | | spaceFolder/subFolder/shareToBrian.md | %public% | And "Alice" renames the most recently created public link of resource "spaceFolder/subFolder/shareToBrian.md" to "markdownLink" - And "Alice" creates a public link creates a public link of following resource using the sidebar panel + And "Alice" creates a public link of following resource using the sidebar panel | resource | password | | simple.pdf | %public% | And "Alice" renames the most recently created public link of resource "simple.pdf" to "pdfLink" - And "Alice" creates a public link creates a public link of following resource using the sidebar panel + And "Alice" creates a public link of following resource using the sidebar panel | resource | password | | testavatar.jpg | %public% | And "Alice" renames the most recently created public link of resource "testavatar.jpg" to "imageLink" @@ -88,7 +88,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/links.ts b/tests/e2e/cucumber/steps/ui/links.ts index 266443e8ab7..32102eac3b3 100644 --- a/tests/e2e/cucumber/steps/ui/links.ts +++ b/tests/e2e/cucumber/steps/ui/links.ts @@ -4,7 +4,7 @@ import { World } from '../../environment' import { objects } from '../../../support' When( - '{string} creates a public link creates a public link of following resource using the sidebar panel', + '{string} creates a public link of following resource using the sidebar panel', async function (this: World, stepUser: string, stepTable: DataTable) { const { page } = this.actorsEnvironment.getActor({ key: stepUser }) const linkObject = new objects.applicationFiles.Link({ page }) 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 8075056d70e..7f698f0c18b 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 }) @@ -470,8 +470,8 @@ export const processDownload = async ( case 'sidebar panel': via = 'SIDEBAR_PANEL' break - case 'preview': - via = 'PREVIEW' + case 'preview topbar': + via = 'PREVIEW_TOPBAR' break default: break @@ -488,7 +488,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 @@ -820,3 +820,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} opens a file {string} in the media-viewer 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 a6b4faea2f4..64ea5e8b436 100644 --- a/tests/e2e/support/objects/app-files/resource/actions.ts +++ b/tests/e2e/support/objects/app-files/resource/actions.ts @@ -9,6 +9,8 @@ import { LinksEnvironment } from '../../../environment' import { config } from '../../../../config' import { buildXpathLiteral } from '../../../utils/locator' +const topbarFilenameSelector = '#app-top-bar-resource .oc-resource-name' +// 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' @@ -78,6 +80,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"]' @@ -122,6 +126,7 @@ const resourceLockIcon = '//*[@data-test-resource-name="%s"]/ancestor::tr//td//span[@data-test-indicator-type="resource-locked"]' 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, @@ -592,6 +597,21 @@ const pauseResumeUpload = (page: Page): Promise => { return page.locator(pauseResumeUploadButton).click() } +export const navigateMediaFile = async ({ page, navigationType }): Promise => { + const oldFileInMediaViewer = await page + .locator(topbarFilenameSelector) + .getAttribute('data-test-resource-name') + + await page.locator(util.format(mediaNavigationButton, navigationType)).click() + const fileViewerLocator = editor.fileViewerLocator({ page, fileViewerType: 'media-viewer' }) + await expect(fileViewerLocator).toBeVisible() + + const currentFileInMediaViewer = await page + .locator(topbarFilenameSelector) + .getAttribute('data-test-resource-name') + expect(currentFileInMediaViewer).not.toEqual(oldFileInMediaViewer) +} + export const pauseResourceUpload = async (page: Page): Promise => { await pauseResumeUpload(page) await Promise.all([ @@ -623,7 +643,11 @@ interface resourceArgs { type?: string } -export type ActionViaType = 'SIDEBAR_PANEL' | 'BATCH_ACTION' | 'SINGLE_SHARE_VIEW' | 'PREVIEW' +export type ActionViaType = + | 'SIDEBAR_PANEL' + | 'BATCH_ACTION' + | 'SINGLE_SHARE_VIEW' + | 'PREVIEW_TOPBAR' export interface downloadResourcesArgs { page: Page @@ -689,14 +713,15 @@ export const downloadResources = async (args: downloadResourcesArgs): Promise => { @@ -1564,9 +1595,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': @@ -1582,6 +1624,12 @@ export const openFileInViewer = async (args: openFileInViewerArgs): Promise => { + await sidebar.open({ page, resource }) + await sidebar.openPanel({ page, name: 'actions' }) + await page.locator(util.format(sideBarActionButton, 'Preview')).first().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 bc3807c0011..b0a5c6d25f1 100644 --- a/tests/e2e/support/objects/app-files/resource/index.ts +++ b/tests/e2e/support/objects/app-files/resource/index.ts @@ -302,4 +302,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 3a11ca07837..43951178a21 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`) From f96aed1aef74c1a0774d3ce18df70ba4189460b6 Mon Sep 17 00:00:00 2001 From: Salipa-Gurung Date: Tue, 30 Apr 2024 14:55:55 +0545 Subject: [PATCH 2/4] refactor test step to download from topbar --- tests/e2e/cucumber/features/smoke/download.feature | 12 ++++++------ .../support/objects/app-files/resource/actions.ts | 1 - 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/e2e/cucumber/features/smoke/download.feature b/tests/e2e/cucumber/features/smoke/download.feature index efa3a071c6b..791a0ce5852 100644 --- a/tests/e2e/cucumber/features/smoke/download.feature +++ b/tests/e2e/cucumber/features/smoke/download.feature @@ -37,9 +37,9 @@ Feature: Download And "Alice" opens the following file in mediaviewer | resource | | testavatar.jpg | - And "Alice" downloads the following image from the mediaviewer - | resource | - | testavatar.jpg | + And "Alice" downloads the following resources using the preview topbar + | resource | type | + | testavatar.jpg | file | And "Alice" closes the file viewer And "Alice" logs out @@ -59,7 +59,7 @@ Feature: Download And "Brian" opens the following file in mediaviewer | resource | | testavatar.jpg | - And "Brian" downloads the following image from the mediaviewer - | resource | - | testavatar.jpg | + And "Brian" downloads the following resources using the preview topbar + | resource | type | + | testavatar.jpg | file | And "Brian" logs out diff --git a/tests/e2e/support/objects/app-files/resource/actions.ts b/tests/e2e/support/objects/app-files/resource/actions.ts index 64ea5e8b436..fb77c48b8e5 100644 --- a/tests/e2e/support/objects/app-files/resource/actions.ts +++ b/tests/e2e/support/objects/app-files/resource/actions.ts @@ -10,7 +10,6 @@ import { config } from '../../../../config' import { buildXpathLiteral } from '../../../utils/locator' const topbarFilenameSelector = '#app-top-bar-resource .oc-resource-name' -// 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' From 469a9a92a1533943bbd3ed5983522b7f4e5a2f80 Mon Sep 17 00:00:00 2001 From: Salipa-Gurung Date: Tue, 30 Apr 2024 15:47:49 +0545 Subject: [PATCH 3/4] update step description --- tests/e2e/cucumber/features/smoke/languageChange.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/cucumber/features/smoke/languageChange.feature b/tests/e2e/cucumber/features/smoke/languageChange.feature index c38dac5f544..c2d820857ec 100644 --- a/tests/e2e/cucumber/features/smoke/languageChange.feature +++ b/tests/e2e/cucumber/features/smoke/languageChange.feature @@ -39,7 +39,7 @@ Feature: language settings | filesForUpload/lorem.txt | lorem.txt | And "Alice" opens the "files" app - And "Alice" creates a public link creates a public link of following resource using the sidebar panel + And "Alice" creates a public link of following resource using the sidebar panel | resource | password | | folderPublic | %public% | And "Alice" logs out From 5993b6618d3e1389f182b5c612c9eb3942b4d87d Mon Sep 17 00:00:00 2001 From: Salipa-Gurung Date: Tue, 30 Apr 2024 16:44:13 +0545 Subject: [PATCH 4/4] remove identical step implementation to download resource from media viewer --- tests/e2e/cucumber/steps/ui/resources.ts | 9 --------- tests/e2e/support/objects/app-files/resource/actions.ts | 1 - 2 files changed, 10 deletions(-) diff --git a/tests/e2e/cucumber/steps/ui/resources.ts b/tests/e2e/cucumber/steps/ui/resources.ts index 7f698f0c18b..3f5ced0f98d 100644 --- a/tests/e2e/cucumber/steps/ui/resources.ts +++ b/tests/e2e/cucumber/steps/ui/resources.ts @@ -111,15 +111,6 @@ When( } ) -When( - /^"([^"]*)" downloads the following image(?:s)? from the mediaviewer$/, - async function (this: World, stepUser: string, stepTable: DataTable) { - const { page } = this.actorsEnvironment.getActor({ key: stepUser }) - const resourceObject = new objects.applicationFiles.Resource({ page }) - await processDownload(stepTable, resourceObject, 'preview') - } -) - When( /^"([^"]*)" deletes the following resource(?:s)? using the (sidebar panel|batch action)$/, async function (this: World, stepUser: string, actionType: string, stepTable: DataTable) { diff --git a/tests/e2e/support/objects/app-files/resource/actions.ts b/tests/e2e/support/objects/app-files/resource/actions.ts index fb77c48b8e5..f633c62a232 100644 --- a/tests/e2e/support/objects/app-files/resource/actions.ts +++ b/tests/e2e/support/objects/app-files/resource/actions.ts @@ -719,7 +719,6 @@ export const downloadResources = async (args: downloadResourcesArgs): Promise