Skip to content

Commit

Permalink
Check if the navigation is visible in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasHirt committed May 11, 2020
1 parent 00e9a5e commit 80f432d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/Phoenix.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
</template>
<div v-else key="core-content" class="uk-height-1-1 uk-flex uk-flex-row uk-flex-row">
<oc-sidebar
class="oc-app-navigation"
:logo-img="logoImage"
:product-name="productName"
:nav-items="navItems"
Expand Down
2 changes: 1 addition & 1 deletion src/components/Top-Bar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
>
<oc-button
variation="raw"
class="uk-hidden@l"
class="oc-app-navigation-toggle uk-hidden@l"
:aria-label="$gettext('Open navigation menu')"
@click="toggleAppNavigationVisibility"
>
Expand Down
33 changes: 25 additions & 8 deletions tests/acceptance/pageObjects/phoenixPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,31 @@ module.exports = {
/**
* @param {string} page
*/
navigateToUsingMenu: function(page) {
navigateToUsingMenu: async function(page) {
const menuItemSelector = util.format(this.elements.menuItem.selector, page)
return this.waitForElementVisible('@menuButton')
.click('@menuButton')
.useXpath()
let isAppNavigationVisible = true

// Check if the navigation is visible
await this.api.element('@appNavigationHidden', result => {
if (result.status > -1) {
isAppNavigationVisible = false
}
})

// If app navigation is not visible, try to click on the menu button
if (!isAppNavigationVisible) {
this.click('@menuButton').waitForAnimationToFinish()
}

this.useXpath()
.waitForElementVisible(menuItemSelector)
.waitForAnimationToFinish()
.click(menuItemSelector)
.api.page.FilesPageElement.filesList()
.waitForElementPresent({ selector: '@filesListProgressBar', abortOnFailure: false }) // don't fail if we are too late
.waitForElementNotPresent('@filesListProgressBar')
.useCss()

return this
},
markNotificationAsRead: function() {
return this.waitForElementVisible('@notificationBell')
Expand Down Expand Up @@ -208,11 +222,10 @@ module.exports = {
selector: '#_userMenuButton'
},
menuButton: {
selector: '//button[@aria-label="Menu"]',
locateStrategy: 'xpath'
selector: '.oc-app-navigation-toggle'
},
menuItem: {
selector: '//ul[contains(@class, "oc-main-menu")]/li/a[contains(text(),"%s")]',
selector: '//nav[contains(@class, "oc-sidebar-nav")]/ul/li/a[contains(text(),"%s")]',
locateStrategy: 'xpath'
},
logoutMenuItem: {
Expand Down Expand Up @@ -240,6 +253,10 @@ module.exports = {
selector:
'//div[@id="oc-notification"]//h5[contains(text(),\'%s\')]/../div/button/span[.="Accept"]',
locateStrategy: 'xpath'
},
appNavigationHidden: {
selector: '//div[contains(@class, "oc-app-navigation") and contains(@class, "uk-visible@l")]',
locateStrategy: 'xpath'
}
}
}

0 comments on commit 80f432d

Please sign in to comment.