Merge pull request #2293 from opf/fix/flickering_protractor_test

Flickering protractor test
pull/2311/head
Alex Coles 10 years ago
commit fe7c8b63f0
  1. 18
      frontend/app/api/hal-api-resource.js
  2. 6
      frontend/app/api/index.js
  3. 22
      frontend/tests/integration/work-package-details-spec.js

@ -28,11 +28,27 @@
require('hyperagent'); require('hyperagent');
module.exports = function HALAPIResource($q, PathHelper) { module.exports = function HALAPIResource($timeout, $q, PathHelper) {
'use strict'; 'use strict';
var HALAPIResource = { var HALAPIResource = {
configure: function() { configure: function() {
Hyperagent.configure('ajax', function(settings) {
var deferred = $q.defer(),
resolve = settings.success,
reject = settings.error;
settings.success = deferred.resolve;
settings.reject = deferred.reject;
deferred.promise.then(function(response) {
$timeout(function() { resolve(response); });
}, function(reason) {
$timeout(function() { reject(reason); });
});
return jQuery.ajax(settings);
});
Hyperagent.configure('defer', $q.defer); Hyperagent.configure('defer', $q.defer);
}, },

@ -26,4 +26,8 @@
// See doc/COPYRIGHT.rdoc for more details. // See doc/COPYRIGHT.rdoc for more details.
//++ //++
angular.module('openproject.api').factory('HALAPIResource', require('./hal-api-resource')); angular.module('openproject.api')
.factory('HALAPIResource', ['$timeout',
'$q',
'PathHelper', require('./hal-api-resource')
]);

@ -37,18 +37,22 @@ var WorkPackageDetailsPane = require('./pages/work-package-details-pane.js');
/*jshint expr: true*/ /*jshint expr: true*/
describe('OpenProject', function() { describe('OpenProject', function() {
var page = new WorkPackageDetailsPane(819, 'overview'); context('details pane is visible', function() {
before(function() {
var page = new WorkPackageDetailsPane(819, 'overview');
page.get();
});
it('should show work packages details pane', function() { it('should show work packages details pane', function() {
page.get(); expect($('.work-packages--details').isPresent()).to.eventually.be.true;
expect($('.work-packages--details').isPresent()).to.eventually.be.true; });
}); });
describe('editable', function() { describe('editable', function() {
context('subject', function() { context('subject', function() {
context('work package with updateImmediately link', function() { context('work package with updateImmediately link', function() {
beforeEach(function() { beforeEach(function() {
page = new WorkPackageDetailsPane(819, 'overview'); var page = new WorkPackageDetailsPane(819, 'overview');
page.get(); page.get();
}); });
it('should render an editable subject', function() { it('should render an editable subject', function() {
@ -57,7 +61,7 @@ describe('OpenProject', function() {
}); });
context('work package without updateImmediately link', function() { context('work package without updateImmediately link', function() {
beforeEach(function() { beforeEach(function() {
page = new WorkPackageDetailsPane(820, 'overview'); var page = new WorkPackageDetailsPane(820, 'overview');
page.get(); page.get();
}); });
it('should not render an editable subject', function() { it('should not render an editable subject', function() {
@ -66,7 +70,7 @@ describe('OpenProject', function() {
}); });
context('work package with a wrong version', function() { context('work package with a wrong version', function() {
beforeEach(function() { beforeEach(function() {
page = new WorkPackageDetailsPane(821, 'overview'); var page = new WorkPackageDetailsPane(821, 'overview');
page.get(); page.get();
$('h2 .inplace-editor .ined-read-value').then(function(e) { $('h2 .inplace-editor .ined-read-value').then(function(e) {
e.click(); e.click();
@ -80,7 +84,7 @@ describe('OpenProject', function() {
}); });
context('description', function() { context('description', function() {
beforeEach(function() { beforeEach(function() {
page = new WorkPackageDetailsPane(819, 'overview'); var page = new WorkPackageDetailsPane(819, 'overview');
page.get(); page.get();
}); });
describe('read state', function() { describe('read state', function() {
@ -121,7 +125,7 @@ describe('OpenProject', function() {
}); });
context('status', function() { context('status', function() {
beforeEach(function() { beforeEach(function() {
page = new WorkPackageDetailsPane(819, 'overview'); var page = new WorkPackageDetailsPane(819, 'overview');
page.get(); page.get();
}); });
describe('read state', function() { describe('read state', function() {

Loading…
Cancel
Save