home integration test
parent
da12bdde93
commit
79ad02ea6e
|
@ -8,7 +8,7 @@ SortProjectsDirective = (currentUserService) ->
|
||||||
axis: "y"
|
axis: "y"
|
||||||
opacity: .95
|
opacity: .95
|
||||||
placeholder: 'placeholder'
|
placeholder: 'placeholder'
|
||||||
cancel: '.project-name'
|
cancel: '.project-name'
|
||||||
})
|
})
|
||||||
|
|
||||||
el.on "sortstop", (event, ui) ->
|
el.on "sortstop", (event, ui) ->
|
||||||
|
|
|
@ -7,5 +7,79 @@ chai.use(chaiAsPromised);
|
||||||
var expect = chai.expect;
|
var expect = chai.expect;
|
||||||
|
|
||||||
describe('home', function() {
|
describe('home', function() {
|
||||||
|
before(function(){
|
||||||
|
browser.get('http://localhost:9001/');
|
||||||
|
|
||||||
|
return utils.common.waitLoader().then(function() {
|
||||||
|
return utils.common.takeScreenshot("home", "dashboard");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('working on filled', function() {
|
||||||
|
return expect($$('.working-on div[tg-duty]').count()).to.be.eventually.above(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('watching filled', function() {
|
||||||
|
return expect($$('.watching div[tg-duty]').count()).to.be.eventually.above(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('project list filled', function() {
|
||||||
|
return expect($$('.home-project-list-single').count()).to.be.eventually.above(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('projects list', function() {
|
||||||
|
before(function() {
|
||||||
|
browser.get('http://localhost:9001/projects/');
|
||||||
|
|
||||||
|
return utils.common.waitLoader().then(function() {
|
||||||
|
return utils.common.takeScreenshot("home", "projects");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('open create project lightbox', function() {
|
||||||
|
$('.master .create-project-btn').click();
|
||||||
|
|
||||||
|
return expect(utils.lightbox.open('div[tg-lb-create-project]')).to.be.eventually.equal(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('close create project lightbox', function() {
|
||||||
|
$('div[tg-lb-create-project] .icon-delete').click();
|
||||||
|
|
||||||
|
return expect(utils.lightbox.close('div[tg-lb-create-project]')).to.be.eventually.equal(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("project drag and drop", function() {
|
||||||
|
var draggedElementText;
|
||||||
|
|
||||||
|
before(function() {
|
||||||
|
browser.get('http://localhost:9001/projects/');
|
||||||
|
|
||||||
|
var dragableElements = element.all(by.css('.project-list-single'));
|
||||||
|
var dragElement = dragableElements.get(3);
|
||||||
|
var dragElementLink = dragElement.element(by.css('a'));
|
||||||
|
|
||||||
|
return utils.common.waitLoader()
|
||||||
|
.then(function() {
|
||||||
|
return dragElementLink.getText()
|
||||||
|
})
|
||||||
|
.then(function(_draggedElementText_) {
|
||||||
|
draggedElementText = _draggedElementText_;
|
||||||
|
|
||||||
|
return utils.common.drag(dragElement, dragableElements.get(0))
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('projects list has the new order', function() {
|
||||||
|
var firstElement = $$('.project-list-single a').first().getText();
|
||||||
|
|
||||||
|
expect(firstElement).to.be.eventually.equal(draggedElementText);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('projects menu has the new order', function() {
|
||||||
|
var firstElementText = $$('div[tg-dropdown-project-list] ul a').first().getInnerHtml();
|
||||||
|
|
||||||
|
expect(firstElementText).to.be.eventually.equal(draggedElementText);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -75,3 +75,22 @@ common.prepare = function() {
|
||||||
|
|
||||||
return common.closeCookies()
|
return common.closeCookies()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
common.dragEnd = function(elm) {
|
||||||
|
return browser.wait(function() {
|
||||||
|
return element.all(by.css('.ui-sortable-helper')).count()
|
||||||
|
.then(function(count) {
|
||||||
|
return count === 0;
|
||||||
|
});
|
||||||
|
}, 1000);
|
||||||
|
};
|
||||||
|
|
||||||
|
common.drag = function(elm, location) {
|
||||||
|
return browser
|
||||||
|
.actions()
|
||||||
|
.dragAndDrop(elm, location)
|
||||||
|
.perform()
|
||||||
|
.then(function() {
|
||||||
|
return common.dragEnd();
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
|
@ -6,18 +6,14 @@ var transition = 300;
|
||||||
lightbox.open = function(el) {
|
lightbox.open = function(el) {
|
||||||
var deferred = protractor.promise.defer();
|
var deferred = protractor.promise.defer();
|
||||||
|
|
||||||
if (typeof el == 'string' || el instanceof String) {
|
|
||||||
el = $(el);
|
|
||||||
}
|
|
||||||
|
|
||||||
browser
|
browser
|
||||||
.wait(function() {
|
.wait(function() {
|
||||||
return common.hasClass(el, 'open')
|
return common.hasClass($(el), 'open')
|
||||||
}, 2000)
|
}, 2000)
|
||||||
.then(function(open) {
|
.then(function(open) {
|
||||||
return browser.sleep(transition).then(function() {
|
return browser.sleep(transition).then(function() {
|
||||||
if (open) {
|
if (open) {
|
||||||
deferred.fulfill(open);
|
deferred.fulfill(true);
|
||||||
} else {
|
} else {
|
||||||
deferred.reject(new Error('Lightbox doesn\'t open'));
|
deferred.reject(new Error('Lightbox doesn\'t open'));
|
||||||
}
|
}
|
||||||
|
@ -28,13 +24,24 @@ lightbox.open = function(el) {
|
||||||
};
|
};
|
||||||
|
|
||||||
lightbox.close = function(el) {
|
lightbox.close = function(el) {
|
||||||
if (typeof el == 'string' || el instanceof String) {
|
var deferred = protractor.promise.defer();
|
||||||
el = $(el);
|
|
||||||
}
|
|
||||||
|
|
||||||
return browser.wait(function() {
|
$(el).isPresent().then(function(present) {
|
||||||
return common.hasClass(el, 'open').then(function(open) {
|
if (!present) {
|
||||||
return !open;
|
deferred.fulfill(true);
|
||||||
});
|
} else {
|
||||||
}, 2000);
|
return browser.wait(function() {
|
||||||
|
return common.hasClass($(el), 'open').then(function(open) {
|
||||||
|
return !open;
|
||||||
|
});
|
||||||
|
}, 2000)
|
||||||
|
.then(function() {
|
||||||
|
return deferred.fulfill(true);
|
||||||
|
}, function() {
|
||||||
|
deferred.reject(new Error('Lightbox doesn\'t close'));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return deferred.promise;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue