mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-23 17:25:23 +02:00
@@ -1,22 +1,70 @@
|
||||
module.exports = function DeviceListPage() {
|
||||
|
||||
this.get = function() {
|
||||
// TODO: Let's get rid off the login first
|
||||
browser.get(browser.baseUrl + 'devices')
|
||||
browser.wait(waitUrl(/devices/), 5000)
|
||||
}
|
||||
|
||||
this.devices = element(by.model('tracker.devices'))
|
||||
this.deviceStopUsingBtn = element.all(by.css('.state-using'))
|
||||
this.devicesByCss = element.all(by.css('ul.devices-icon-view > li'))
|
||||
this.devicesUsable = element.all(by.css('.state-available'))
|
||||
this.devicesBusy = element.all(by.css('.state-busy'))
|
||||
this.searchInput = element(by.model('search.deviceFilter'))
|
||||
this.devicesFilteredOut = element.all(by.xpath('//*[contains(@class, "filter-out")]'))
|
||||
|
||||
this.filterAvailableDevices = function() {
|
||||
return this.searchInput.sendKeys('state: "available"')
|
||||
}
|
||||
this.numberOfDevices = function() {
|
||||
return this.devicesByCss.count()
|
||||
|
||||
this.filterUsingDevices = function() {
|
||||
return this.searchInput.sendKeys('state: "using"')
|
||||
}
|
||||
|
||||
this.numberOfDevices = function() {
|
||||
return this.devicesByCss.count().then(function(amount) {
|
||||
return amount
|
||||
})
|
||||
}
|
||||
|
||||
this.getNumberOfFilteredOutDevices = function() {
|
||||
return this.devicesFilteredOut.count().then(function(amount) {
|
||||
return amount
|
||||
})
|
||||
}
|
||||
|
||||
this.getNumberOfBusyDevices = function() {
|
||||
return this.devicesBusy.count().then(function(amount) {
|
||||
return amount
|
||||
})
|
||||
}
|
||||
|
||||
this.availableDevice = function() {
|
||||
return this.devicesUsable.first()
|
||||
}
|
||||
|
||||
this.controlAvailableDevice = function() {
|
||||
return this.availableDevice().click()
|
||||
this.availableDevice().click()
|
||||
browser.wait(waitUrl(/control/), 5000)
|
||||
}
|
||||
|
||||
this.assignedDevice = function() {
|
||||
return this.deviceStopUsingBtn.first()
|
||||
}
|
||||
|
||||
this.getFirstBusyDevice = function() {
|
||||
return this.devicesBusy.first()
|
||||
}
|
||||
|
||||
this.unassignDevice = function() {
|
||||
return this.assignedDevice().click()
|
||||
}
|
||||
|
||||
this.selectAssignedDevice = function() {
|
||||
return this.assignedDevice().element(by.xpath('..')).click()
|
||||
}
|
||||
|
||||
this.selectBusyDevice = function() {
|
||||
return this.getFirstBusyDevice().element(by.xpath('..')).click()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user