Add test for issue #1076

Add tests for device icon view
This commit is contained in:
Lukasz.Zeglinski
2019-09-19 16:40:26 +02:00
parent 8bba7f4558
commit 7d593cdb51
8 changed files with 220 additions and 16 deletions

View File

@@ -0,0 +1,18 @@
module.exports = function WidgetContainerPage() {
this.get = function() {
browser.get(browser.baseUrl + 'devices')
browser.wait(waitUrl(/devices/), 5000)
}
this.userName = element(by.binding('currentUser.name'))
this.amountOfAssignedToUserDevices = element(by.xpath('//*[@class="number color-orange"]/span'))
this.getUserNameFromWidget = function() {
return this.userName.getText()
}
this.getAmountOfAssignedToUserDevices = function() {
return this.amountOfAssignedToUserDevices.getText()
}
}

View File

@@ -0,0 +1,36 @@
describe('Widget Container Page', function() {
var DeviceListPage = require('../devices')
var deviceListPage = new DeviceListPage()
var WidgetContainerPage = require('./')
var widgetContainerObj = new WidgetContainerPage()
var LoginPage = require('../login')
var loginPage = new LoginPage()
it('should display amount of devices used by the user', function() {
deviceListPage.get()
deviceListPage.controlAvailableDevice()
deviceListPage.get()
widgetContainerObj.getAmountOfAssignedToUserDevices().then(function(amount) {
expect(amount).toBe('1')
})
})
it('should display user name after login on widget', function() {
widgetContainerObj.getUserNameFromWidget().then(function(userName) {
expect(userName.toLowerCase()).toBe(loginPage.getUserName().toLowerCase())
})
})
afterEach(function() {
// Unassign element if is assigned
deviceListPage.get()
deviceListPage.deviceStopUsingBtn.count().then(function(elements) {
if (elements > 0) {
deviceListPage.unassignDevice()
}
})
})
})