mirror of
https://github.com/openstf/stf
synced 2025-10-06 03:50:04 +02:00

-Add parallel multi browser protractor configuration. -Add screenshot reports. -Add fail fast helper.
84 lines
2.5 KiB
JavaScript
84 lines
2.5 KiB
JavaScript
describe('Control Page', function () {
|
|
var DeviceListPage = require('../devices')
|
|
var deviceListPage = new DeviceListPage()
|
|
|
|
var ControlPage = function () {
|
|
this.get = function () {
|
|
browser.get(protractor.getInstance().baseUrl + 'control')
|
|
}
|
|
this.kickDeviceButton = element.all(by.css('.kick-device')).first()
|
|
this.kickDevice = function () {
|
|
this.openDevicesDropDown()
|
|
this.kickDeviceButton.click()
|
|
}
|
|
this.devicesDropDown = element(by.css('.device-name-text'))
|
|
this.openDevicesDropDown = function () {
|
|
this.devicesDropDown.click()
|
|
}
|
|
}
|
|
|
|
var controlPage = new ControlPage()
|
|
|
|
it('should control an usable device', function () {
|
|
deviceListPage.controlAvailableDevice()
|
|
browser.getLocationAbsUrl().then(function (newUrl) {
|
|
expect(newUrl).toMatch(protractor.getInstance().baseUrl + 'control')
|
|
})
|
|
})
|
|
|
|
it('should have a kick button', function () {
|
|
expect(controlPage.kickDeviceButton, true)
|
|
})
|
|
|
|
|
|
describe('Dashboard', function () {
|
|
var DashboardTab = function () {
|
|
this.shellInput = element(by.model('command'))
|
|
this.shellResults = element.all(by.css('.shell-results')).first()
|
|
|
|
this.helloString = 'hello adb'
|
|
this.echoCommand = 'echo "' + this.helloString + '"'
|
|
this.clearCommand = 'clear'
|
|
this.openMenuCommand = 'input keyevent 3'
|
|
|
|
this.shellExecute = function (command) {
|
|
this.shellInput.sendKeys(command)
|
|
this.shellInput.sendKeys(protractor.Key.ENTER)
|
|
}
|
|
}
|
|
var dashboardTab = new DashboardTab()
|
|
|
|
describe('Shell', function () {
|
|
|
|
it('should echo "hello adb" to the adb shell', function () {
|
|
expect(dashboardTab.shellInput.isPresent()).toBe(true)
|
|
|
|
dashboardTab.shellExecute(dashboardTab.echoCommand)
|
|
|
|
expect(dashboardTab.shellResults.getText()).toBe(dashboardTab.helloString)
|
|
})
|
|
|
|
it('should clear adb shell input', function () {
|
|
dashboardTab.shellExecute(dashboardTab.clearCommand)
|
|
expect(dashboardTab.shellResults.getText()).toBeFalsy()
|
|
})
|
|
|
|
it('should open and close the menu button trough adb shell', function () {
|
|
dashboardTab.shellExecute(dashboardTab.openMenuCommand)
|
|
dashboardTab.shellExecute(dashboardTab.openMenuCommand)
|
|
})
|
|
|
|
})
|
|
})
|
|
|
|
|
|
it('should stop controlling an usable device', function () {
|
|
controlPage.kickDevice()
|
|
|
|
browser.getLocationAbsUrl().then(function (newUrl) {
|
|
expect(newUrl).toBe(protractor.getInstance().baseUrl + 'devices')
|
|
})
|
|
})
|
|
|
|
|
|
})
|