Skip to content

Commit

Permalink
Adjust acceptance selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
JammingBen committed Mar 3, 2023
1 parent cc7e139 commit 0c6b3d5
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 292 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

41 changes: 4 additions & 37 deletions tests/acceptance/pageObjects/webPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,6 @@ module.exports = {
await this.api.page.FilesPageElement.filesList().waitForLoadingFinished()
return this
},
markNotificationAsRead: function () {
return this.waitForElementVisible('@notificationBell')
.click('@notificationBell')
.waitForElementVisible('@markNotificationAsReadLink')
.click('@markNotificationAsReadLink')
},
closeMessage: function () {
return this.waitForElementPresent('@messageCloseIcon')
.click('@messageCloseIcon')
Expand Down Expand Up @@ -118,20 +112,6 @@ module.exports = {
.useCss()
}
},
/**
* notification bell is present only when the user have got some notifications to show
* after clicking the notification bell then only user can see notifications received
* So,there would be no notifications when the notification bell on the top-bar of webUI is not visible
*
* @return boolean
*/
isNotificationBellVisible: async function () {
let isVisible = false
await this.api.element('@notificationBell', (result) => {
isVisible = result.value === 0
})
return isVisible
},
/**
* Perform decline action on the offered shares in the notifications
*/
Expand Down Expand Up @@ -196,11 +176,6 @@ module.exports = {
})
return displayedmessage
},
getLinkSelectorFromNotification: function (resource, sharer) {
const notifyString = `"${defaultUsers[sharer].displayname}" shared "${resource}" with you`
const linkSelector = util.format(this.elements.filelink.selector, notifyString)
return linkSelector
},
followLink: function (linkSelector) {
return this.useXpath().waitForElementVisible(linkSelector).click(linkSelector).useCss()
},
Expand Down Expand Up @@ -264,10 +239,7 @@ module.exports = {
locateStrategy: 'xpath'
},
notificationBell: {
selector: '#oc-notification-bell'
},
markNotificationAsReadLink: {
selector: '#resolve-notification-button'
selector: '#oc-notifications-bell'
},
ocDialogPromptAlert: {
selector: '.oc-modal .oc-text-input-message'
Expand Down Expand Up @@ -310,26 +282,21 @@ module.exports = {
selector: '#files-view'
},
notificationElement: {
selector: '//div[@id="oc-notification"]//h4',
selector: '//div[@id="oc-notifications"]//div[contains(@class, "oc-notifications-message")]',
locateStrategy: 'xpath'
},
declineSharesInNotifications: {
selector:
'//div[@id="oc-notification"]//h4[contains(text(),\'%s\')]/../div/button[.="Decline"]',
'//div[@id="oc-notifications"]//span[contains(text(),\'%s\')]/../../div/button[contains(@class, "oc-button-passive")]',
locateStrategy: 'xpath'
},
acceptSharesInNotifications: {
selector:
'//div[@id="oc-notification"]//h4[contains(text(),\'%s\')]/../div/button[.="Accept"]',
'//div[@id="oc-notifications"]//span[contains(text(),\'%s\')]/../../div/button[contains(@class, "oc-button-primary")]',
locateStrategy: 'xpath'
},
appNavigation: {
selector: '#web-nav-sidebar'
},
filelink: {
selector:
'//div[@id="oc-notification-drop"]//h4[contains(text(),\'%s\')]/following-sibling::p/a',
locateStrategy: 'xpath'
}
}
}
27 changes: 0 additions & 27 deletions tests/acceptance/stepDefinitions/notificationsContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ const { When, Then } = require('@cucumber/cucumber')
const codify = require('../helpers/codify')
const assert = require('assert')

When('the user marks the notification as read', function () {
return client.page.webPage().markNotificationAsRead()
})

When('the user accepts all shares displayed in the notifications on the webUI', function () {
return client.page.webPage().acceptAllSharesInNotification()
})
Expand All @@ -15,15 +11,6 @@ When('the user declines all shares displayed in the notifications on the webUI',
return client.page.webPage().declineAllSharesInNotification()
})

Then('the user should see the notification bell on the webUI', function () {
return client.page.webPage().waitForElementVisible('@notificationBell')
})

Then('the user should see the notification bell on the webUI after a page reload', function () {
client.refresh()
return client.page.webPage().waitForElementVisible('@notificationBell')
})

Then(
'the user should see {int} notifications on the webUI with these details',
async function (numberOfNotifications, dataTable) {
Expand All @@ -44,17 +31,3 @@ Then(
}
}
)

Then('the user should have no notifications', async function () {
const status = await client.page.webPage().isNotificationBellVisible()
assert.ok(!status, 'Expected: notification bell to be absent but found: visible')
})

When(
'the user follows the link of following share from notification using the webUI',
function (dataTable) {
const { resource, sharer } = dataTable.rowsHash()
const linkSelector = client.page.webPage().getLinkSelectorFromNotification(resource, sharer)
return client.page.webPage().toggleNotificationDrawer().followLink(linkSelector)
}
)

0 comments on commit 0c6b3d5

Please sign in to comment.