1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-03 17:59:28 +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:
Gunther Brunner 2014-08-26 15:59:44 +09:00
parent 3a9b193f68
commit a08d9e26f0
10 changed files with 48 additions and 27 deletions

View file

@ -60,9 +60,16 @@ gulp.task('webdriver_update', protractor.webdriver_update)
gulp.task('webdriver_standalone', protractor.webdriver_standalone) gulp.task('webdriver_standalone', protractor.webdriver_standalone)
gulp.task('protractor', function (callback) { gulp.task('protractor', function (callback) {
var args
var suite = gutil.env.suite
if (typeof suite === 'string') {
args = ['--suite', suite]
}
gulp.src(["./res/test/e2e/**/*.js"]) gulp.src(["./res/test/e2e/**/*.js"])
.pipe(protractor.protractor({ .pipe(protractor.protractor({
configFile: protractorConfig configFile: protractorConfig,
args: args
})) }))
.on('error', function (e) { .on('error', function (e) {
console.log(e) console.log(e)

View file

@ -1,11 +1,11 @@
describe('KeycodesService', function() { //describe('KeycodesService', function() {
//
beforeEach(angular.mock.module(require('./').name)); // beforeEach(angular.mock.module(require('./').name));
//
it('should ...', inject(function(KeycodesService) { // it('should ...', inject(function(KeycodesService) {
//
//expect(KeycodesService.doSomething()).toEqual('something'); // //expect(KeycodesService.doSomething()).toEqual('something');
//
})); // }));
//
}) //})

View file

@ -1,5 +1,5 @@
describe('Control Page', function () { describe('Control Page', function () {
var DeviceListPage = require('./app-devices') var DeviceListPage = require('../devices')
var deviceListPage = new DeviceListPage() var deviceListPage = new DeviceListPage()
var ControlPage = function () { var ControlPage = function () {
@ -8,8 +8,13 @@ describe('Control Page', function () {
} }
this.kickDeviceButton = element.all(by.css('.kick-device')).first() this.kickDeviceButton = element.all(by.css('.kick-device')).first()
this.kickDevice = function () { this.kickDevice = function () {
this.openDevicesDropDown()
this.kickDeviceButton.click() this.kickDeviceButton.click()
} }
this.devicesDropDown = element(by.css('.device-name-text'))
this.openDevicesDropDown = function () {
this.devicesDropDown.click()
}
} }
var controlPage = new ControlPage() var controlPage = new ControlPage()
@ -25,13 +30,13 @@ describe('Control Page', function () {
expect(controlPage.kickDeviceButton, true) expect(controlPage.kickDeviceButton, true)
}) })
//it('should stop controlling an usable device', function () { it('should stop controlling an usable device', function () {
// controlPage.kickDevice() controlPage.kickDevice()
//
// browser.getLocationAbsUrl().then(function (newUrl) { browser.getLocationAbsUrl().then(function (newUrl) {
// expect(newUrl).toBe(protractor.getInstance().baseUrl + 'devices') expect(newUrl).toBe(protractor.getInstance().baseUrl + 'devices')
// }) })
//}) })
describe('Dashboard', function () { describe('Dashboard', function () {
describe('Shell', function () { describe('Shell', function () {

View file

@ -1,7 +1,7 @@
describe('Device Page', function () { describe('Device Page', function () {
describe('List', function () { describe('List', function () {
var DeviceListPage = require('./app-devices') var DeviceListPage = require('./')
var deviceListPage = new DeviceListPage() var deviceListPage = new DeviceListPage()
it('should go to Devices List page', function () { it('should go to Devices List page', function () {

View file

@ -1,5 +1,5 @@
describe('Login Page', function () { describe('Login Page', function () {
var LoginPage = require('./app-login') var LoginPage = require('./')
var loginPage = new LoginPage() var loginPage = new LoginPage()
it('should login with auth-mock', function () { it('should login with auth-mock', function () {

View file

@ -1,18 +1,27 @@
// Reference: https://github.com/angular/protractor/blob/master/referenceConf.js // Reference: https://github.com/angular/protractor/blob/master/referenceConf.js
var LoginPage = require('./e2e/app-login.js') var LoginPage = require('./e2e/login')
exports.config = { exports.config = {
chromeOnly: true,
baseUrl: 'http://localhost:7100/#!/', baseUrl: 'http://localhost:7100/#!/',
specs: ['res/test/e2e/**/*-spec.js'], suites: {
control: 'e2e/control/**/*-spec.js',
devices: 'e2e/devices/**/*-spec.js',
help: 'e2e/help/**/*-spec.js',
login: 'e2e/login/**/*-spec.js',
settings: 'e2e/settings/**/*-spec.js'
},
jasmineNodeOpts: { jasmineNodeOpts: {
showColors: true, showColors: true,
defaultTimeoutInterval: 30000 defaultTimeoutInterval: 30000
}, },
capabilities: { capabilities: {
browserName: 'chrome' browserName: 'chrome',
chromeOptions: {
args: ['--test-type'] // Prevent security warning bug in ChromeDriver
}
}, },
onPrepare: function() { chromeOnly: true,
onPrepare: function () {
var loginPage = new LoginPage() var loginPage = new LoginPage()
loginPage.login() loginPage.login()
//browser.driver.wait(loginPage.login) //browser.driver.wait(loginPage.login)