From 60d61fb5b533f014833538b84d90cb48c35b9508 Mon Sep 17 00:00:00 2001 From: Benedikt Kulmann Date: Tue, 24 Aug 2021 11:01:42 +0200 Subject: [PATCH] Rewrite tests to use details button in context menu for sidebar --- .../webUIFilesDetails/fileDetails.feature | 16 ++++++------- .../shareByPublicLink.feature | 2 +- .../pageObjects/FilesPageElement/filesList.js | 24 +++++++++---------- .../stepDefinitions/filesContext.js | 18 +++++++------- .../stepDefinitions/sharingContext.js | 4 ++-- 5 files changed, 32 insertions(+), 32 deletions(-) diff --git a/tests/acceptance/features/webUIFilesDetails/fileDetails.feature b/tests/acceptance/features/webUIFilesDetails/fileDetails.feature index f6d2d3d0a75..d5a000864d8 100644 --- a/tests/acceptance/features/webUIFilesDetails/fileDetails.feature +++ b/tests/acceptance/features/webUIFilesDetails/fileDetails.feature @@ -14,7 +14,7 @@ Feature: User can open the details panel for any file or folder Scenario: View different areas of the app-sidebar for a file in files page Given user "Alice" has created file "lorem.txt" And the user has browsed to the files page - When the user picks the row of file "lorem.txt" on the webUI + When the user opens the sidebar for file "lorem.txt" on the webUI Then the app-sidebar should be visible And the thumbnail should be visible in the app-sidebar And the "details" details panel should be visible @@ -27,7 +27,7 @@ Feature: User can open the details panel for any file or folder Scenario: View different areas of the app-sidebar for a folder in files page Given user "Alice" has created folder "simple-folder" And the user has browsed to the files page - When the user picks the row of folder "simple-folder" on the webUI + When the user opens the sidebar for folder "simple-folder" on the webUI Then the app-sidebar should be visible And the thumbnail should be visible in the app-sidebar And the "details" details panel should be visible @@ -44,7 +44,7 @@ Feature: User can open the details panel for any file or folder And the user has browsed to the files page And user "Alice" has favorited element "lorem.txt" And the user has browsed to the favorites page - When the user picks the row of file "lorem.txt" on the webUI + When the user opens the sidebar for file "lorem.txt" on the webUI Then the app-sidebar should be visible And the thumbnail should be visible in the app-sidebar And the "details" details panel should be visible @@ -59,7 +59,7 @@ Feature: User can open the details panel for any file or folder And the user has browsed to the files page And user "Alice" has favorited element "simple-folder" And the user has browsed to the favorites page - When the user picks the row of folder "simple-folder" on the webUI + When the user opens the sidebar for folder "simple-folder" on the webUI Then the app-sidebar should be visible And the thumbnail should be visible in the app-sidebar And the "details" details panel should be visible @@ -93,7 +93,7 @@ Feature: User can open the details panel for any file or folder And user "Alice" has shared folder "simple-folder" with user "Brian" When the user browses to the shared-with-others page Then folder "simple-folder" should be listed on the webUI - When the user picks the row of folder "simple-folder" on the webUI + When the user opens the sidebar for folder "simple-folder" on the webUI Then the app-sidebar should be visible And the thumbnail should be visible in the app-sidebar When the user switches to "people" panel in details panel using the webUI @@ -110,7 +110,7 @@ Feature: User can open the details panel for any file or folder And user "Alice" has created a new public link for resource "simple-folder" When the user browses to the shared-with-others page Then folder "simple-folder" should be listed on the webUI - When the user picks the row of folder "simple-folder" on the webUI + When the user opens the sidebar for folder "simple-folder" on the webUI Then the app-sidebar should be visible And the thumbnail should be visible in the app-sidebar When the user switches to "people" panel in details panel using the webUI @@ -128,7 +128,7 @@ Feature: User can open the details panel for any file or folder And the user re-logs in as "Brian" using the webUI When the user browses to the shared-with-me page Then folder "simple-folder" should be listed on the webUI - When the user picks the row of folder "simple-folder" on the webUI + When the user opens the sidebar for folder "simple-folder" on the webUI Then the app-sidebar should be visible And the thumbnail should be visible in the app-sidebar When the user switches to "people" panel in details panel using the webUI @@ -171,7 +171,7 @@ Feature: User can open the details panel for any file or folder Scenario: the sidebar is invisible after closing Given user "Alice" has created file "lorem.txt" And the user has browsed to the files page - When the user picks the row of file "lorem.txt" on the webUI + When the user opens the sidebar for file "lorem.txt" on the webUI Then the app-sidebar should be visible When the user closes the app-sidebar using the webUI Then the app-sidebar should be invisible diff --git a/tests/acceptance/features/webUISharingPublicManagement/shareByPublicLink.feature b/tests/acceptance/features/webUISharingPublicManagement/shareByPublicLink.feature index d29cb72b0fb..11d617764d7 100644 --- a/tests/acceptance/features/webUISharingPublicManagement/shareByPublicLink.feature +++ b/tests/acceptance/features/webUISharingPublicManagement/shareByPublicLink.feature @@ -93,7 +93,7 @@ Feature: Public link share management When the user creates a new public link for folder "simple-folder" using the webUI with | role | Editor | And the public uses the webUI to access the last public link created by user "Alice" - And the user picks the row of file "lorem.txt" on the webUI + And the user opens the sidebar for file "lorem.txt" on the webUI Then the following panels should be visible in the details dialog on the webUI | name | | versions | diff --git a/tests/acceptance/pageObjects/FilesPageElement/filesList.js b/tests/acceptance/pageObjects/FilesPageElement/filesList.js index 8bca2c7c0fa..70be3786302 100644 --- a/tests/acceptance/pageObjects/FilesPageElement/filesList.js +++ b/tests/acceptance/pageObjects/FilesPageElement/filesList.js @@ -195,7 +195,7 @@ module.exports = { * @returns {*} */ openSideBar: async function(resource) { - await this.clickRow(resource) + await this.clickDetailsInContextMenu(resource) return this.api.page.FilesPageElement.appSideBar() }, /** @@ -221,14 +221,15 @@ module.exports = { /** * @param {string} item the file/folder to click */ - clickRow: async function(item) { + clickDetailsInContextMenu: async function(item) { await this.waitForFileVisible(item) - const selectorXPath = - this.getFileRowSelectorByFileName(item) + this.elements.detailsBtnInFileRow.selector + const selectorContextMenu = + this.getFileRowSelectorByFileName(item) + this.elements.contextBtnInFileRow.selector await this.click({ - selector: selectorXPath, + selector: selectorContextMenu, locateStrategy: 'xpath' - }).waitForAjaxCallsToStartAndFinish() + }) + await this.click('@detailsBtnInContextMenu') return this }, @@ -265,10 +266,6 @@ module.exports = { }) return selectionStatus }, - waitForTableLoaded: async function() { - await this.waitForElementVisible('@filesTable') - return this - }, waitForLoadingFinished: async function(awaitVisible = true, abortOnFailure = true) { if (awaitVisible) { await this.waitForElementVisible({ selector: '@anyAfterLoading', abortOnFailure }) @@ -698,10 +695,13 @@ module.exports = { '//span[contains(@class, "oc-resource-name") and (@data-test-resource-name=%s or @data-test-resource-path=%s) and @data-test-resource-type=%s]/parent::*', locateStrategy: 'xpath' }, - detailsBtnInFileRow: { - selector: '//button[contains(@class, "oc-table-files-btn-show-details")]', + contextBtnInFileRow: { + selector: '//button[contains(@class, "oc-table-files-btn-action-dropdown")]', locateStrategy: 'xpath' }, + detailsBtnInContextMenu: { + selector: 'button.oc-files-actions-show-details-trigger' + }, /** * This element is concatenated as child of @see fileRowByResourcePath */ diff --git a/tests/acceptance/stepDefinitions/filesContext.js b/tests/acceptance/stepDefinitions/filesContext.js index a3e69e5fdf6..8e1d1679e18 100644 --- a/tests/acceptance/stepDefinitions/filesContext.js +++ b/tests/acceptance/stepDefinitions/filesContext.js @@ -134,8 +134,8 @@ When('the user browses to display the {string} details of file {string}', async filename ) { const api = client.page.FilesPageElement - await api.filesList().clickRow(filename) await client.initAjaxCounters() + await api.filesList().openSideBar(filename) await api.appSideBar().activatePanel(accordionItem) await client.waitForOutstandingAjaxCalls() @@ -367,7 +367,7 @@ When('the user marks file/folder {string} as favorite using the webUI sidebar', path ) { const api = client.page.FilesPageElement - await api.filesList().clickRow(path) + await api.filesList().openSideBar(path) api.appSideBar().markFavoriteSidebar() return client }) @@ -376,7 +376,7 @@ When('the user unmarks the favorited file/folder {string} using the webUI sideba path ) { const api = client.page.FilesPageElement - await api.filesList().clickRow(path) + await api.filesList().openSideBar(path) api.appSideBar().unmarkFavoriteSidebar() return client }) @@ -485,8 +485,8 @@ Then('the versions list for resource {string} should contain {int} entry/entries expectedNumber ) { const api = client.page.FilesPageElement - await api.filesList().clickRow(resourceName) await client.initAjaxCounters() + await api.filesList().openSideBar(resourceName) await api.appSideBar().activatePanel('versions') await client.waitForOutstandingAjaxCalls() const count = await api.versionsDialog().getVersionsCount() @@ -599,8 +599,8 @@ When('the user batch restores the marked files using the webUI', function() { return client.page.FilesPageElement.filesList().restoreSelected() }) -When('the user picks the row of file/folder {string} on the webUI', function(item) { - return client.page.FilesPageElement.filesList().clickRow(item) +When('the user opens the sidebar for file/folder {string} on the webUI', function(item) { + return client.page.FilesPageElement.filesList().openSideBar(item) }) When('the user switches to {string} panel in details panel using the webUI', function(item) { @@ -822,7 +822,7 @@ Then('as user {string} file/folder {string} should not be marked as favorite', a Then('file/folder {string} should be marked as favorite on the webUI', async function(path) { const selector = client.page.FilesPageElement.appSideBar().elements.fileInfoFavoriteShining - await client.page.FilesPageElement.filesList().clickRow(path) + await client.page.FilesPageElement.filesList().openSideBar(path) client.expect.element(selector).to.be.present client.page.FilesPageElement.appSideBar().closeSidebar() @@ -832,7 +832,7 @@ Then('file/folder {string} should be marked as favorite on the webUI', async fun Then('file/folder {string} should not be marked as favorite on the webUI', async function(path) { const selector = client.page.FilesPageElement.appSideBar().elements.fileInfoFavoriteDimm - await client.page.FilesPageElement.filesList().clickRow(path) + await client.page.FilesPageElement.filesList().openSideBar(path) client.expect.element(selector).to.be.present client.page.FilesPageElement.appSideBar().closeSidebar() @@ -1396,7 +1396,7 @@ Then( Given('the app-sidebar for file/folder {string} has been visible on the webUI', async function( resource ) { - await client.page.FilesPageElement.filesList().clickRow(resource) + await client.page.FilesPageElement.filesList().openSideBar(resource) const visible = await client.page.personalPage().isSidebarVisible() assert.strictEqual(visible, true, 'app-sidebar should be visible, but is not') diff --git a/tests/acceptance/stepDefinitions/sharingContext.js b/tests/acceptance/stepDefinitions/sharingContext.js index 080d5935a37..513d7233f35 100644 --- a/tests/acceptance/stepDefinitions/sharingContext.js +++ b/tests/acceptance/stepDefinitions/sharingContext.js @@ -953,7 +953,7 @@ Then('user {string} should be listed as {string} in the collaborators list on th Then( 'the share {string} shared with user {string} should have no expiration information displayed on the webUI', async function(item, user) { - await client.page.FilesPageElement.filesList().clickRow(item) + await client.page.FilesPageElement.filesList().openSideBar(item) await client.page.FilesPageElement.appSideBar().activatePanel('people') const elementID = await client.page.FilesPageElement.SharingDialog.collaboratorsDialog().getCollaboratorExpirationInfo( user @@ -969,7 +969,7 @@ Then( Then( 'the expiration information displayed on the webUI of share {string} shared with user {string} should be {string} or {string}', async function(item, user, information1, information2) { - await client.page.FilesPageElement.filesList().clickRow(item) + await client.page.FilesPageElement.filesList().openSideBar(item) await client.page.FilesPageElement.appSideBar().activatePanel('people') const actualInfo = await client.page.FilesPageElement.SharingDialog.collaboratorsDialog().getCollaboratorExpirationInfo( user