fix admin e2e tests

stable
Juanfran 2016-09-27 09:58:33 +02:00 committed by David Barragán Merino
parent 1bc2eb0344
commit 4da7d44d0e
8 changed files with 39 additions and 18 deletions

View File

@ -16,7 +16,7 @@ section.custom-fields-table.basic-table
.table-body .table-body
.js-sortable .js-sortable
div( .e2e-item(
ng-repeat="attr in customAttributes track by attr.id" ng-repeat="attr in customAttributes track by attr.id"
tg-bind-scope tg-bind-scope
) )

View File

@ -72,7 +72,7 @@ section
) )
p(translate="ADMIN.PROJECT_VALUES_TAGS.EMPTY_SEARCH") p(translate="ADMIN.PROJECT_VALUES_TAGS.EMPTY_SEARCH")
div( div.e2e-tag-row(
ng-repeat="tag in projectTags" ng-repeat="tag in projectTags"
tg-bind-scope tg-bind-scope
) )

View File

@ -40,7 +40,15 @@ helper.getTagsSection = function(item) {
return { return {
el: section, el: section,
rows: function() { rows: function() {
return section.$$('.table-main'); return section.$$('.e2e-tag-row');
},
edit: async function(row) {
let editButton = row.$('.edit-value');
return browser.actions()
.mouseMove(editButton)
.click()
.perform();
} }
}; };
}; };
@ -48,7 +56,7 @@ helper.getTagsSection = function(item) {
helper.getTagsFilter = function() { helper.getTagsFilter = function() {
return $('.table-header .e2e-tags-filter'); return $('.table-header .e2e-tags-filter');
} };
helper.getStatusNames = function(section) { helper.getStatusNames = function(section) {
return section.$$('.status-name span').getText(); return section.$$('.status-name span').getText();
@ -111,12 +119,12 @@ helper.getGenericForm = function(form) {
}; };
obj.colorBox = function() { obj.colorBox = function() {
return form.$('.edition .current-color'); return form.$('.edition .e2e-open-color-selector');
} };
obj.colorText = function() { obj.colorText = function() {
return form.$('.select-color input'); return form.$('.color-selector-dropdown input');
} };
return obj; return obj;
}; };

View File

@ -47,11 +47,11 @@ helper.drag = function(indexType, indexCustomField, indexNewPosition) {
let customField = helper.getCustomFiledsByType(indexType).get(indexCustomField).$('.e2e-drag'); let customField = helper.getCustomFiledsByType(indexType).get(indexCustomField).$('.e2e-drag');
let newPosition = helper.getCustomFiledsByType(indexType).get(indexNewPosition); let newPosition = helper.getCustomFiledsByType(indexType).get(indexNewPosition);
return utils.common.drag(customField, newPosition, 0, 40); return utils.common.drag(customField, newPosition, 5, 25);
}; };
helper.getCustomFiledsByType = function(indexType) { helper.getCustomFiledsByType = function(indexType) {
return $$('div[tg-project-custom-attributes]').get(indexType).$$('.js-sortable > div'); return $$('div[tg-project-custom-attributes]').get(indexType).$$('.e2e-item');
}; };
helper.delete = async function(indexType, indexCustomField) { helper.delete = async function(indexType, indexCustomField) {

View File

@ -58,11 +58,14 @@ helper.getChangeOwnerLb = function() {
return utils.lightbox.close(el); return utils.lightbox.close(el);
}, },
search: function(q) { search: function(q) {
el.$$('input').get(0).sendKeys(q); return el.$$('input').get(0).sendKeys(q);
}, },
select: function(index) { select: function(index) {
el.$$('.user-list-single').get(index).click(); el.$$('.user-list-single').get(index).click();
}, },
getUserName: function(index) {
return el.$$('.user-list-single').get(index).$('.user-list-name').getText();
},
addComment: function(text) { addComment: function(text) {
el.$('.add-comment a').click(); el.$('.add-comment a').click();
el.$('textarea').sendKeys(text); el.$('textarea').sendKeys(text);
@ -74,3 +77,7 @@ helper.getChangeOwnerLb = function() {
return obj; return obj;
}; };
helper.enableAddTags = function() {
$('.add-tag-button').click();
};

View File

@ -22,7 +22,9 @@ describe('attributes - tags', function() {
let rows = section.rows(); let rows = section.rows();
let row = rows.get(0); let row = rows.get(0);
let form = adminAttributesHelper.getGenericForm(row.$('form')); section.edit(row);
let form = adminAttributesHelper.getGenericForm(row.$$('form').first());
var colorBox = form.colorBox(); var colorBox = form.colorBox();
await colorBox.click(); await colorBox.click();
@ -35,7 +37,7 @@ describe('attributes - tags', function() {
section = adminAttributesHelper.getTagsSection(0); section = adminAttributesHelper.getTagsSection(0);
rows = section.rows(); rows = section.rows();
row = rows.get(0); row = rows.get(0);
let backgroundColor = await row.$$('.edition .current-color').get(0).getCssValue('background-color'); let backgroundColor = await row.$$('.e2e-open-color-selector').get(0).getCssValue('background-color');
expect(backgroundColor).to.be.equal('rgba(0, 0, 0, 1)'); expect(backgroundColor).to.be.equal('rgba(0, 0, 0, 1)');
utils.common.takeScreenshot('attributes', 'tag edited is black'); utils.common.takeScreenshot('attributes', 'tag edited is black');
}); });
@ -44,12 +46,11 @@ describe('attributes - tags', function() {
let tagsFilter = adminAttributesHelper.getTagsFilter(); let tagsFilter = adminAttributesHelper.getTagsFilter();
await tagsFilter.clear(); await tagsFilter.clear();
await tagsFilter.sendKeys('ad'); await tagsFilter.sendKeys('ad');
await browser.sleep(5000);
let section = adminAttributesHelper.getTagsSection(0); let section = adminAttributesHelper.getTagsSection(0);
let rows = section.rows(); let rows = section.rows();
let count = await rows.count(); let count = await rows.count();
expect(count).to.be.equal(2); expect(count).to.be.equal(2);
}); });
}); });

View File

@ -78,7 +78,7 @@ describe('modules', function() {
}); });
it('enable videoconference', async function() { it('enable videoconference', async function() {
let functionality = $$('.module').get(4); let functionality = $$('.module').get(5);
let input = functionality.$('.check input'); let input = functionality.$('.check input');

View File

@ -18,7 +18,9 @@ describe('project detail', function() {
}); });
it('edit tag, description and project settings', async function() { it('edit tag, description and project settings', async function() {
let tag = $('.tag-input'); adminHelper.enableAddTags();
let tag = $('.e2e-add-tag-input');
tag.sendKeys('aaa'); tag.sendKeys('aaa');
browser.actions().sendKeys(protractor.Key.ENTER).perform(); browser.actions().sendKeys(protractor.Key.ENTER).perform();
@ -105,7 +107,10 @@ describe('project detail', function() {
await lb.waitOpen(); await lb.waitOpen();
lb.search('Alicia Flores'); let username = lb.getUserName(0);
await lb.search(username);
lb.select(0); lb.select(0);
lb.addComment('text'); lb.addComment('text');