Skip to content

Commit

Permalink
Switch tests to using the toggle button for the sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
kulmann committed Aug 30, 2021
1 parent 059356d commit ab13bbc
Show file tree
Hide file tree
Showing 21 changed files with 326 additions and 389 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<oc-icon name="tune" size="medium" />
</oc-button>
<oc-button
id="files-toggle-sidebar"
v-oc-tooltip="toggleSidebarButtonLabel"
:aria-label="toggleSidebarButtonLabel"
variation="passive"
Expand Down
4 changes: 1 addition & 3 deletions packages/web-app-files/src/components/SideBar/FileInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
<div class="file_info">
<oc-icon :name="highlightedFile.icon" size="large" class="file_info__icon" />
<div class="file_info__body">
<h2 tabindex="-1">
{{ highlightedFile.name }}
</h2>
<h2 tabindex="-1">{{ highlightedFile.name }}</h2>
<div>
<template v-if="highlightedFile.size > -1">
{{ getResourceSize(highlightedFile.size) }},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ Other free text and markdown formatting can be used elsewhere in the document if
- [webUISharingNotifications/notificationLink.feature:18](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingNotifications/notificationLink.feature#L18)
- [webUISharingNotificationsToRoot/notificationLink.feature:17](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingNotificationsToRoot/notificationLink.feature#L17)

### [Cannot determine share source path when sharing same name file from different path in shared-with pages](https://github.com/owncloud/web/issues/5302)
- [webUISharingPublicBasic/publicLinkCreate.feature:88](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingPublicBasic/publicLinkCreate.feature#L88)

### [impossible to navigate into a folder in the trashbin](https://github.com/owncloud/web/issues/1725)
- [webUITrashbinDelete/trashbinDelete.feature:29](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUITrashbinDelete/trashbinDelete.feature#L29)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ Other free text and markdown formatting can be used elsewhere in the document if
- [webUISharingInternalUsersShareWithPage/shareWithUsers.feature:118](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingInternalUsersShareWithPage/shareWithUsers.feature#L118)
- [webUIResharing1/reshareUsers.feature:230](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIResharing1/reshareUsers.feature#L230)

### [delete pending share option is not available for sharee](https://github.com/owncloud/web/issues/5435)
- [webUIDeleteFilesFolders/deleteFilesFolders.feature:235](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIDeleteFilesFolders/deleteFilesFolders.feature#L235)

### [file_path property is not unique for a share created with same resource name i.e already present in sharee](https://github.com/owncloud/ocis/issues/2249)
- [webUIRenameFiles/renameFiles.feature:205](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIRenameFiles/renameFiles.feature#L205)

Expand Down Expand Up @@ -429,9 +426,6 @@ Other free text and markdown formatting can be used elsewhere in the document if
- [webUISharingInternalGroupsEdgeCases/shareWithGroupsEdgeCases.feature:41](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingInternalGroupsEdgeCases/shareWithGroupsEdgeCases.feature#L41)
- [webUISharingInternalGroupsEdgeCases/shareWithGroupsEdgeCases.feature:42](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingInternalGroupsEdgeCases/shareWithGroupsEdgeCases.feature#L42)

### [Cannot determine share source path when sharing same name file from different path in shared-with pages](https://github.com/owncloud/web/issues/5302)
- [webUISharingPublicBasic/publicLinkCreate.feature:88](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingPublicBasic/publicLinkCreate.feature#L88)

### [impossible to navigate into a folder in the trashbin](https://github.com/owncloud/web/issues/1725)
- [webUITrashbinDelete/trashbinDelete.feature:29](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUITrashbinDelete/trashbinDelete.feature#L29)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Background: prepare user and files
Scenario: observe different actions menu options on selecting different file types or folder
Given user "Alice" has uploaded file with content "pdf file" to "lorem.pdf"
And the user has reloaded the current page of the webUI
And the app-sidebar for file "lorem.txt" has been visible on the webUI
When the user opens the actions sidebar panel of folder "simple-folder" on the webUI
Then the app-sidebar for folder "simple-folder" should be visible on the webUI
And only the following items with default items should be visible in the actions menu on the webUI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Feature: User can open the details panel for any file or folder
And user "Alice" has created a public link with following settings
| path | simple-folder |
And the user has browsed to the shared-via-link page
When the user opens the file action menu of folder "simple-folder" using the webUI
When the user opens the actions sidebar panel of file "simple-folder" on the webUI
Then the thumbnail should be visible in the app-sidebar
When the user switches to "people" panel in details panel using the webUI
Then the "people" details panel should be visible
Expand Down Expand Up @@ -156,7 +156,7 @@ Feature: User can open the details panel for any file or folder
When the user browses to the tags page
And the user searches for tag "simple" using the webUI
Then folder "simple-folder" should be listed on the webUI
When the user opens the file action menu of folder "simple-folder" using the webUI
When the user opens the actions sidebar panel of file "simple-folder" on the webUI
Then the thumbnail should be visible in the app-sidebar
When the user switches to "people" panel in details panel using the webUI
Then the "people" details panel should be visible
Expand All @@ -180,6 +180,5 @@ Feature: User can open the details panel for any file or folder
Scenario: the sidebar is invisible after opening the selected folder
Given user "Alice" has created file "simple-folder"
And the user has browsed to the files page
Given the app-sidebar for file "simple-folder" has been visible on the webUI
When the user opens folder "simple-folder" using the webUI
Then the app-sidebar should be invisible
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ Feature: Sharing files and folders with internal groups
| grp3 |
| grp4 |
And user "Alice" has created folder "simple-folder"
And user "Alice" has created folder "simple-folder2"
And user "Alice" has created file "simple-folder/testimage.png"
When user "Alice" has logged in using the webUI
Then the following resources should not have share indicators on the webUI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Feature: Create public link shares
Then file "lorem.txt" should be listed on the webUI

@issue-5302
Scenario: share two file with same name but different paths by public link
Scenario: share two files with same name but different paths by public link
Given user "Alice" has created folder "simple-folder"
And user "Alice" has created file "simple-folder/lorem.txt"
And user "Alice" has created file "lorem.txt"
Expand Down
197 changes: 115 additions & 82 deletions tests/acceptance/pageObjects/FilesPageElement/appSideBar.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,55 @@
/* eslint-disable no-unused-expressions */
const util = require('util')
const path = require('path')
const _ = require('lodash')
const timeoutHelper = require('../../helpers/timeoutHelper')

module.exports = {
commands: {
isThumbnailVisible: function() {
return this.waitForElementVisible(
this.api.page.personalPage().elements.sideBar
).waitForElementVisible(this.elements.fileInfoIcon)
return this.waitForElementVisible('@sidebar').waitForElementVisible('@fileInfoIcon')
},
closeSidebar: function(timeout = null) {
timeout = timeoutHelper.parseTimeout(timeout)
closeSidebarIfOpen: async function(timeout = 300) {
if (!(await this.isSideBarOpen(timeout))) {
return this.api.page.FilesPageElement.filesList()
}

try {
this.click({
await this.click({
selector: '@sidebarCloseBtn',
timeout: timeout
timeout: timeoutHelper.parseTimeout(timeout)
})
} catch (e) {
// do nothing
}
return this.api.page.FilesPageElement.filesList()
},
isSideBarOpen: async function(timeout = 500) {
const element = this.elements.sidebar
let isVisible = false
await this.isVisible(
{
locateStrategy: element.locateStrategy,
selector: element.selector,
timeout: timeoutHelper.parseTimeout(timeout)
},
result => {
isVisible = result.status === 0
}
)
return isVisible
},
isSideBarOpenForResource: async function(resource, timeout = 500) {
if (!(await this.isSideBarOpen(timeout))) {
return false
}
let resourceName
await this.getText('@fileInfoResourceName', function(result) {
resourceName = result.value
})
return resourceName === path.basename(resource)
},
activatePanel: async function(item) {
await this.waitForElementVisible(this.api.page.personalPage().elements.sideBar)
const panelName = item === 'people' ? 'collaborators' : item
const active = await this.isPanelActive(
item,
this.api.globals.waitForNegativeConditionTimeout
Expand All @@ -34,7 +60,7 @@ module.exports = {
await this.isVisible(
{ locateStrategy: backBtn.locateStrategy, selector: backBtn.selector, timeout: 200 },
result => {
backBtnVisible = result.status === 0
backBtnVisible = result.value === true
}
)
if (backBtnVisible) {
Expand All @@ -43,30 +69,16 @@ module.exports = {
})
await this.waitForAnimationToFinish() // wait for sliding animation to the root panel
}
this.useXpath()
.click(this.getXpathOfPanelSelect(item))
const menuItemElement = this.elements[panelName + 'PanelMenuItem']
await this.click({
locateStrategy: menuItemElement.locateStrategy,
selector: menuItemElement.selector
})
.waitForAjaxCallsToStartAndFinish()
.useCss()
await this.waitForAnimationToFinish() // wait for sliding animation to the sub panel
.waitForAnimationToFinish() // wait for sliding animation to the sub panel
}
const panelName = item === 'people' ? 'collaborators' : item
const element = this.elements[panelName + 'Panel']
const selector = element.selector
return this.waitForElementPresent(selector)
},
/**
* return the complete xpath of the link to the specified panel in the side-bar
* @param item
* @returns {string}
*/
getXpathOfPanelSelect: function(item) {
return (
this.api.page.personalPage().elements.sideBar.selector +
util.format(
"//button[contains(translate(.,'ABCDEFGHJIKLMNOPQRSTUVWXYZ','abcdefghjiklmnopqrstuvwxyz'),'%s')]",
item
)
)
const panelElement = this.elements[panelName + 'Panel']
return await this.waitForElementPresent(panelElement.locateStrategy, panelElement.selector)
},
getVisibleAccordionItems: async function() {
const items = []
Expand All @@ -81,19 +93,6 @@ module.exports = {
}
return items
},
getVisibleActionsMenuItems: async function() {
const items = []
let elements
await this.api.elements('@panelActionsItems', function(result) {
elements = result.value
})
for (const { ELEMENT } of elements) {
await this.api.elementIdText(ELEMENT, function(result) {
items.push(result.value.toLowerCase())
})
}
return items
},
getActionsMenuItemsExceptDefaults: async function() {
const defaultItems = ['add to favorites', 'copy', 'move', 'rename', 'delete']
const items = []
Expand All @@ -118,57 +117,66 @@ module.exports = {
isPanelActive: async function(panelName, timeout = null) {
panelName = panelName === 'people' ? 'collaborators' : panelName
const element = this.elements[panelName + 'Panel']
const selector = element.selector + '.is-active'
let isVisible = false
timeout = timeoutHelper.parseTimeout(timeout)
await this.isVisible({ locateStrategy: 'css selector', selector, timeout }, result => {
isVisible = result.value === true
})
await this.isVisible(
{
locateStrategy: element.locateStrategy,
selector: element.selector,
timeout: timeoutHelper.parseTimeout(timeout)
},
result => {
isVisible = result.value === true
}
)
return isVisible
},
/**
* checks if the item with the given selector is present on the files-page-sidebar
* checks if it's possible to navigate into the given panel
*
* @param {object} selector
* @param {string} panelName
* @param {number} timeout
* @returns {Promise<boolean>}
*/
isPanelItemPresent: async function(selector) {
let isPresent = true
await this.useXpath()
.waitForElementVisible(this.api.page.personalPage().elements.sideBar) // sidebar is expected to be opened and visible
.api.elements(selector, result => {
isPresent = result.value.length > 0
})
.useCss()
return isPresent
isPanelSelectable: async function(panelName, timeout = 300) {
panelName = panelName === 'people' ? 'collaborators' : panelName
const element = this.elements[panelName + 'PanelMenuItem']
let isVisible = false
await this.isVisible(
{
locateStrategy: element.locateStrategy,
selector: element.selector,
timeout: timeoutHelper.parseTimeout(timeout)
},
result => {
isVisible = result.value === true
}
)
return isVisible
},
/**
* @returns {Promise<boolean>}
*/
isLinksPanelSelectPresent: function() {
return this.isPanelItemPresent(this.elements.linksPanelSelect)
isLinksPanelSelectable: async function() {
return await this.isPanelSelectable('links')
},
/**
* @returns {Promise<boolean>}
*/
isCollaboratorsAccordionItemPresent: function() {
return this.isPanelItemPresent(this.elements.collaboratorsPanel)
isSharingPanelSelectable: async function() {
return await this.isPanelSelectable('people')
},
markFavoriteSidebar: function() {
return this.useXpath()
.waitForElementVisible(this.api.page.personalPage().elements.sideBar)
return this.waitForElementVisible('@sidebar')
.waitForElementVisible('@fileInfoFavoriteDimm')
.click('@fileInfoFavorite')
.waitForElementVisible('@fileInfoFavoriteShining')
},
unmarkFavoriteSidebar: function() {
return this.waitForElementVisible(this.api.page.personalPage().elements.sideBar)
return this.waitForElementVisible('@sidebar')
.waitForElementVisible('@fileInfoFavoriteShining')
.click('@fileInfoFavorite')
.waitForElementVisible('@fileInfoFavoriteDimm')
}
},
elements: {
sidebar: {
selector: '//*[@id="files-sidebar"]',
locateStrategy: 'xpath'
},
fileInfoIcon: {
selector: '.file_info .oc-icon'
},
Expand All @@ -181,6 +189,9 @@ module.exports = {
fileInfoFavoriteDimm: {
selector: '.oc-star-dimm'
},
fileInfoResourceName: {
selector: '.sidebar-panel.is-active h2'
},
sidebarCloseBtn: {
selector:
'//div[contains(@id, "files-sidebar")]//div[contains(@class, "is-active")]//button[contains(@class, "header__close")]',
Expand All @@ -200,23 +211,45 @@ module.exports = {
'//div[contains(@id, "files-sidebar")]//div[@class="sidebar-panel__navigation"]/button',
locateStrategy: 'xpath'
},
linksPanelSelect: {
selector: '#sidebar-panel-links-item-select'
},
collaboratorsPanel: {
selector: '#sidebar-panel-sharing-item'
selector: '//*[@id="sidebar-panel-sharing-item"]',
locateStrategy: 'xpath'
},
collaboratorsPanelMenuItem: {
selector: '//button[@id="sidebar-panel-sharing-item-select"]',
locateStrategy: 'xpath'
},
linksPanel: {
selector: '#sidebar-panel-links-item'
selector: '//*[@id="sidebar-panel-links-item"]',
locateStrategy: 'xpath'
},
linksPanelMenuItem: {
selector: '//button[@id="sidebar-panel-links-item-select"]',
locateStrategy: 'xpath'
},
actionsPanel: {
selector: '#sidebar-panel-actions-item'
selector: '//*[@id="sidebar-panel-actions-item"]',
locateStrategy: 'xpath'
},
actionsPanelMenuItem: {
selector: '//button[@id="sidebar-panel-actions-item-select"]',
locateStrategy: 'xpath'
},
detailsPanel: {
selector: '#sidebar-panel-details-item'
selector: '//*[@id="sidebar-panel-details-item"]',
locateStrategy: 'xpath'
},
detailsPanelMenuItem: {
selector: '//button[@id="sidebar-panel-details-item-select"]',
locateStrategy: 'xpath'
},
versionsPanel: {
selector: '#sidebar-panel-versions-item'
selector: '//*[@id="sidebar-panel-versions-item"]',
locateStrategy: 'xpath'
},
versionsPanelMenuItem: {
selector: '//button[@id="sidebar-panel-versions-item-select"]',
locateStrategy: 'xpath'
}
}
}
Loading

0 comments on commit ab13bbc

Please sign in to comment.