mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-20 00:53:26 +02:00
- Refactored e2e tests in separated test suites.
- `gulp protractor` now accepts a `--suite name` flag. - Removed warning bug in ChromeDriver. - ControlPage test now kicks the device.
This commit is contained in:
32
res/test/e2e/devices/devices-spec.js
Normal file
32
res/test/e2e/devices/devices-spec.js
Normal file
@@ -0,0 +1,32 @@
|
||||
describe('Device Page', function () {
|
||||
describe('List', function () {
|
||||
|
||||
var DeviceListPage = require('./')
|
||||
var deviceListPage = new DeviceListPage()
|
||||
|
||||
it('should go to Devices List page', function () {
|
||||
deviceListPage.get()
|
||||
browser.getLocationAbsUrl().then(function (newUrl) {
|
||||
expect(newUrl).toBe(protractor.getInstance().baseUrl + 'devices')
|
||||
})
|
||||
})
|
||||
|
||||
it('should have more than 1 device in the list', function () {
|
||||
expect(deviceListPage.numberOfDevices()).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
it('should filter available devices', function () {
|
||||
deviceListPage.filterAvailableDevices()
|
||||
expect(deviceListPage.searchInput.getAttribute('value')).toBe('state: "available"')
|
||||
})
|
||||
|
||||
it('should have more than 1 device available', function () {
|
||||
expect(deviceListPage.devicesUsable.count()).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
it('should have one device usable', function () {
|
||||
expect(deviceListPage.availableDevice().getText()).toBe('Use')
|
||||
})
|
||||
|
||||
})
|
||||
})
|
||||
23
res/test/e2e/devices/index.js
Normal file
23
res/test/e2e/devices/index.js
Normal file
@@ -0,0 +1,23 @@
|
||||
module.exports = function DeviceListPage() {
|
||||
this.get = function () {
|
||||
// TODO: Let's get rid off the login first
|
||||
browser.get(protractor.getInstance().baseUrl + 'devices')
|
||||
}
|
||||
this.devices = element(by.model('tracker.devices'))
|
||||
this.devicesByCss = element.all(by.css('ul.devices-icon-view > li'))
|
||||
this.devicesUsable =
|
||||
element.all(by.css('button.device-status.btn-primary-outline'))
|
||||
this.searchInput = element(by.model('search.deviceFilter'))
|
||||
this.filterAvailableDevices = function () {
|
||||
return this.searchInput.sendKeys('state: "available"')
|
||||
}
|
||||
this.numberOfDevices = function () {
|
||||
return this.devicesByCss.count()
|
||||
}
|
||||
this.availableDevice = function () {
|
||||
return this.devicesUsable.first()
|
||||
}
|
||||
this.controlAvailableDevice = function () {
|
||||
this.availableDevice().click()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user