e2e attributes
parent
9f68cbc8d5
commit
d192a6ab03
|
@ -0,0 +1,123 @@
|
|||
var utils = require('../../../utils');
|
||||
|
||||
var adminAttributesHelper = require('../../../helpers').adminAttributes;
|
||||
|
||||
var chai = require('chai');
|
||||
var chaiAsPromised = require('chai-as-promised');
|
||||
|
||||
chai.use(chaiAsPromised);
|
||||
var expect = chai.expect;
|
||||
|
||||
describe('attributes - custom fields', function() {
|
||||
before(async function(){
|
||||
browser.get('http://localhost:9001/project/project-0/admin/project-values/custom-fields');
|
||||
|
||||
await utils.common.waitLoader();
|
||||
|
||||
utils.common.takeScreenshot('attributes', 'custom-fields');
|
||||
});
|
||||
|
||||
it('new', async function() {
|
||||
let section = adminAttributesHelper.getSection(0);
|
||||
let rows = section.rows();
|
||||
let count = await rows.count();
|
||||
|
||||
let formWrapper = section.openNew();
|
||||
|
||||
let form = adminAttributesHelper.getCustomFieldsForm(formWrapper);
|
||||
|
||||
await form.name().sendKeys('test test');
|
||||
|
||||
await form.save();
|
||||
|
||||
await browser.waitForAngular();
|
||||
|
||||
let newCount = await rows.count();
|
||||
|
||||
expect(newCount).to.be.equal(count + 1);
|
||||
});
|
||||
|
||||
it('duplicate', async function() {
|
||||
let section = adminAttributesHelper.getSection(0);
|
||||
let rows = section.rows();
|
||||
let count = await rows.count();
|
||||
|
||||
let formWrapper = section.openNew();
|
||||
|
||||
let form = adminAttributesHelper.getCustomFieldsForm(formWrapper);
|
||||
|
||||
await form.name().sendKeys('test test');
|
||||
|
||||
await form.save();
|
||||
|
||||
await browser.waitForAngular();
|
||||
|
||||
let newCount = await rows.count();
|
||||
|
||||
let errors = await form.errors().count();
|
||||
|
||||
utils.common.takeScreenshot('attributes', 'status-error');
|
||||
|
||||
expect(errors).to.be.equal(1);
|
||||
expect(newCount).to.be.equal(count);
|
||||
});
|
||||
|
||||
it('delete', async function() {
|
||||
let section = adminAttributesHelper.getSection(0);
|
||||
let rows = section.rows();
|
||||
|
||||
let count = await rows.count();
|
||||
|
||||
let row = rows.get(count - 1);
|
||||
|
||||
section.delete(row);
|
||||
|
||||
let el = $('.lightbox-generic-ask');
|
||||
|
||||
await utils.lightbox.open(el);
|
||||
|
||||
utils.common.takeScreenshot('attributes', 'delete-custom-field');
|
||||
|
||||
el.$('.button-green').click();
|
||||
|
||||
await utils.lightbox.close(el);
|
||||
|
||||
let newCount = await rows.count();
|
||||
|
||||
expect(newCount).to.be.equal(count - 1);
|
||||
});
|
||||
|
||||
it('edit', async function() {
|
||||
let section = adminAttributesHelper.getSection(0);
|
||||
let rows = section.rows();
|
||||
let row = rows.get(0);
|
||||
|
||||
await section.edit(row);
|
||||
|
||||
let form = adminAttributesHelper.getCustomFieldsForm(row.$('form'));
|
||||
|
||||
let newCfName = 'test test' + Date.now();
|
||||
await form.name().clear();
|
||||
await form.name().sendKeys(newCfName);
|
||||
|
||||
await form.save();
|
||||
|
||||
await browser.waitForAngular();
|
||||
|
||||
let newCfs = await adminAttributesHelper.getCustomFieldsNames(section.el);
|
||||
|
||||
expect(newCfs.indexOf(newCfName)).to.be.not.equal(-1);
|
||||
});
|
||||
|
||||
it('drag', async function() {
|
||||
let section = adminAttributesHelper.getSection(0);
|
||||
let rows = section.rows();
|
||||
let cfs = await adminAttributesHelper.getCustomFieldsNames(section.el);
|
||||
|
||||
await utils.common.drag(rows.get(0), rows.get(2));
|
||||
|
||||
let newCfs = await adminAttributesHelper.getCustomFieldsNames(section.el);
|
||||
|
||||
expect(cfs[0]).to.be.equal(newCfs[1]);
|
||||
});
|
||||
});
|
|
@ -0,0 +1,100 @@
|
|||
var utils = require('../../../utils');
|
||||
|
||||
var adminAttributesHelper = require('../../../helpers').adminAttributes;
|
||||
|
||||
var chai = require('chai');
|
||||
var chaiAsPromised = require('chai-as-promised');
|
||||
|
||||
chai.use(chaiAsPromised);
|
||||
var expect = chai.expect;
|
||||
|
||||
describe('attributes - points', function() {
|
||||
before(async function(){
|
||||
browser.get('http://localhost:9001/project/project-0/admin/project-values/points');
|
||||
|
||||
await utils.common.waitLoader();
|
||||
|
||||
utils.common.takeScreenshot('attributes', 'points');
|
||||
});
|
||||
|
||||
it('new', async function() {
|
||||
let section = adminAttributesHelper.getSection(0);
|
||||
let rows = section.rows();
|
||||
let count = await rows.count();
|
||||
|
||||
let formWrapper = section.openNew();
|
||||
|
||||
let form = adminAttributesHelper.getPointsForm(formWrapper);
|
||||
|
||||
await form.name().sendKeys('test test');
|
||||
await form.value().sendKeys('2');
|
||||
|
||||
await form.save();
|
||||
|
||||
await browser.waitForAngular();
|
||||
|
||||
let newCount = await rows.count();
|
||||
|
||||
expect(newCount).to.be.equal(count + 1);
|
||||
});
|
||||
|
||||
it('delete', async function() {
|
||||
let section = adminAttributesHelper.getSection(0);
|
||||
let rows = section.rows();
|
||||
|
||||
let count = await rows.count();
|
||||
|
||||
let row = rows.get(count - 1);
|
||||
|
||||
section.delete(row);
|
||||
|
||||
let el = $('.lightbox-ask-choice');
|
||||
|
||||
await utils.lightbox.open(el);
|
||||
|
||||
utils.common.takeScreenshot('attributes', 'delete-point');
|
||||
|
||||
el.$('.button-green').click();
|
||||
|
||||
await utils.lightbox.close(el);
|
||||
|
||||
let newCount = await rows.count();
|
||||
|
||||
expect(newCount).to.be.equal(count - 1);
|
||||
});
|
||||
|
||||
it('edit', async function() {
|
||||
let section = adminAttributesHelper.getSection(0);
|
||||
let rows = section.rows();
|
||||
|
||||
let row = rows.get(0);
|
||||
|
||||
await section.edit(row);
|
||||
|
||||
let form = adminAttributesHelper.getPointsForm(row.$('form'));
|
||||
|
||||
let newStatusName = 'test test' + Date.now();
|
||||
|
||||
await form.name().clear();
|
||||
await form.name().sendKeys(newStatusName);
|
||||
await form.save();
|
||||
|
||||
await browser.waitForAngular();
|
||||
|
||||
let newStatuses = await adminAttributesHelper.getPointsNames(section.el);
|
||||
|
||||
expect(newStatuses.indexOf(newStatusName)).to.be.not.equal(-1);
|
||||
});
|
||||
|
||||
it('drag', async function() {
|
||||
let section = adminAttributesHelper.getSection(0);
|
||||
let rows = section.rows();
|
||||
let points = await adminAttributesHelper.getPointsNames(section.el);
|
||||
|
||||
await utils.common.drag(rows.get(0), rows.get(2));
|
||||
|
||||
let newPoints = await adminAttributesHelper.getPointsNames(section.el);
|
||||
|
||||
expect(points[0]).to.be.equal(newPoints[1]);
|
||||
});
|
||||
});
|
|
@ -0,0 +1,98 @@
|
|||
var utils = require('../../../utils');
|
||||
|
||||
var adminAttributesHelper = require('../../../helpers').adminAttributes;
|
||||
|
||||
var chai = require('chai');
|
||||
var chaiAsPromised = require('chai-as-promised');
|
||||
|
||||
chai.use(chaiAsPromised);
|
||||
var expect = chai.expect;
|
||||
|
||||
describe('attributes - priorities', function() {
|
||||
before(async function(){
|
||||
browser.get('http://localhost:9001/project/project-0/admin/project-values/priorities');
|
||||
|
||||
await utils.common.waitLoader();
|
||||
|
||||
utils.common.takeScreenshot('attributes', 'priorities');
|
||||
});
|
||||
|
||||
it('new priority', async function() {
|
||||
let section = adminAttributesHelper.getSection(0);
|
||||
let rows = section.rows();
|
||||
let count = await rows.count();
|
||||
|
||||
let formWrapper = section.openNew();
|
||||
|
||||
let form = adminAttributesHelper.getPrioritiesForm(formWrapper);
|
||||
|
||||
await form.name().sendKeys('test test');
|
||||
|
||||
await form.save();
|
||||
|
||||
await browser.waitForAngular();
|
||||
|
||||
let newCount = await rows.count();
|
||||
|
||||
expect(newCount).to.be.equal(count + 1);
|
||||
});
|
||||
|
||||
it('delete', async function() {
|
||||
let section = adminAttributesHelper.getSection(0);
|
||||
let rows = section.rows();
|
||||
|
||||
let count = await rows.count();
|
||||
|
||||
let row = rows.get(count - 1);
|
||||
|
||||
section.delete(row);
|
||||
|
||||
let el = $('.lightbox-ask-choice');
|
||||
|
||||
await utils.lightbox.open(el);
|
||||
|
||||
utils.common.takeScreenshot('attributes', 'delete-priority');
|
||||
|
||||
el.$('.button-green').click();
|
||||
|
||||
await utils.lightbox.close(el);
|
||||
|
||||
let newCount = await rows.count();
|
||||
|
||||
expect(newCount).to.be.equal(count - 1);
|
||||
});
|
||||
|
||||
it('edit', async function() {
|
||||
let section = adminAttributesHelper.getSection(0);
|
||||
let rows = section.rows();
|
||||
let row = rows.get(0);
|
||||
|
||||
await section.edit(row);
|
||||
|
||||
let form = adminAttributesHelper.getPrioritiesForm(row.$('form'));
|
||||
|
||||
let newPriorityName = 'test test' + Date.now();
|
||||
await form.name().clear();
|
||||
await form.name().sendKeys(newPriorityName);
|
||||
|
||||
await form.save();
|
||||
|
||||
await browser.waitForAngular();
|
||||
|
||||
let newPriorities = await adminAttributesHelper.getPrioritiesNames(section.el);
|
||||
|
||||
expect(newPriorities.indexOf(newPriorityName)).to.be.not.equal(-1);
|
||||
});
|
||||
|
||||
it('drag', async function() {
|
||||
let section = adminAttributesHelper.getSection(0);
|
||||
let rows = section.rows();
|
||||
let priorities = await adminAttributesHelper.getPrioritiesNames(section.el);
|
||||
|
||||
await utils.common.drag(rows.get(0), rows.get(2));
|
||||
|
||||
let newPriorities = await adminAttributesHelper.getPrioritiesNames(section.el);
|
||||
|
||||
expect(priorities[0]).to.be.equal(newPriorities[1]);
|
||||
});
|
||||
});
|
|
@ -0,0 +1,124 @@
|
|||
var utils = require('../../../utils');
|
||||
|
||||
var adminAttributesHelper = require('../../../helpers').adminAttributes;
|
||||
|
||||
var chai = require('chai');
|
||||
var chaiAsPromised = require('chai-as-promised');
|
||||
|
||||
chai.use(chaiAsPromised);
|
||||
var expect = chai.expect;
|
||||
|
||||
describe('attributes - status', function() {
|
||||
before(async function(){
|
||||
browser.get('http://localhost:9001/project/project-0/admin/project-values/status');
|
||||
|
||||
await utils.common.waitLoader();
|
||||
|
||||
utils.common.takeScreenshot('attributes', 'status');
|
||||
});
|
||||
|
||||
it('new status', async function() {
|
||||
let section = adminAttributesHelper.getSection(0);
|
||||
let rows = section.rows();
|
||||
let count = await rows.count();
|
||||
|
||||
let formWrapper = section.openNew();
|
||||
|
||||
let form = adminAttributesHelper.getStatusForm(formWrapper);
|
||||
|
||||
await form.status().sendKeys('test test');
|
||||
|
||||
await form.save();
|
||||
|
||||
await browser.waitForAngular();
|
||||
|
||||
let newCount = await rows.count();
|
||||
|
||||
expect(newCount).to.be.equal(count + 1);
|
||||
});
|
||||
|
||||
it('duplicate status', async function() {
|
||||
let section = adminAttributesHelper.getSection(0);
|
||||
let rows = section.rows();
|
||||
let count = await rows.count();
|
||||
|
||||
let formWrapper = section.openNew();
|
||||
|
||||
let form = adminAttributesHelper.getStatusForm(formWrapper);
|
||||
|
||||
await form.status().sendKeys('test test');
|
||||
|
||||
await form.save();
|
||||
|
||||
await browser.waitForAngular();
|
||||
|
||||
let newCount = await rows.count();
|
||||
|
||||
let errors = await form.errors().count();
|
||||
|
||||
utils.common.takeScreenshot('attributes', 'status-error');
|
||||
|
||||
expect(errors).to.be.equal(1);
|
||||
expect(newCount).to.be.equal(count);
|
||||
});
|
||||
|
||||
it('delete', async function() {
|
||||
let section = adminAttributesHelper.getSection(0);
|
||||
let rows = section.rows();
|
||||
|
||||
let count = await rows.count();
|
||||
|
||||
let row = rows.get(count - 1);
|
||||
|
||||
section.delete(row);
|
||||
|
||||
let el = $('.lightbox-ask-choice');
|
||||
|
||||
await utils.lightbox.open(el);
|
||||
|
||||
utils.common.takeScreenshot('attributes', 'delete-status');
|
||||
|
||||
el.$('.button-green').click();
|
||||
|
||||
await browser.waitForAngular();
|
||||
|
||||
let newCount = await rows.count();
|
||||
|
||||
expect(newCount).to.be.equal(count - 1);
|
||||
});
|
||||
|
||||
it('edit', async function() {
|
||||
let section = adminAttributesHelper.getSection(0);
|
||||
let rows = section.rows();
|
||||
|
||||
let row = rows.get(0);
|
||||
|
||||
await section.edit(row);
|
||||
|
||||
let form = adminAttributesHelper.getStatusForm(row.$('form'));
|
||||
|
||||
let newStatusName = 'test test' + Date.now();
|
||||
|
||||
await form.status().clear();
|
||||
await form.status().sendKeys(newStatusName);
|
||||
await form.save();
|
||||
|
||||
await browser.waitForAngular();
|
||||
|
||||
let newStatuses = await adminAttributesHelper.getStatusNames(section.el);
|
||||
|
||||
expect(newStatuses.indexOf(newStatusName)).to.be.not.equal(-1);
|
||||
});
|
||||
|
||||
it('drag', async function() {
|
||||
let section = adminAttributesHelper.getSection(0);
|
||||
let rows = section.rows();
|
||||
let statuses = await adminAttributesHelper.getStatusNames(section.el);
|
||||
|
||||
await utils.common.drag(rows.get(0), rows.get(2));
|
||||
|
||||
let newStatuses = await adminAttributesHelper.getStatusNames(section.el);
|
||||
|
||||
expect(statuses[0]).to.be.equal(newStatuses[1]);
|
||||
});
|
||||
});
|
|
@ -0,0 +1,116 @@
|
|||
var utils = require('../utils');
|
||||
|
||||
var helper = module.exports;
|
||||
|
||||
helper.getSection = function(item) {
|
||||
let section = $$('.admin-attributes-section').get(item);
|
||||
|
||||
return {
|
||||
el: section,
|
||||
openNew: function() {
|
||||
section.$('.show-add-new').click();
|
||||
|
||||
return section.$$('form').last();
|
||||
},
|
||||
rows: function() {
|
||||
return section.$$('.ui-sortable > div');
|
||||
},
|
||||
delete: function(row) {
|
||||
let deleteButton = row.$$('.icon-delete').first();
|
||||
|
||||
return browser.actions()
|
||||
.mouseMove(deleteButton)
|
||||
.click()
|
||||
.perform();
|
||||
},
|
||||
edit: async function(row) {
|
||||
let editButton = row.$('.icon-edit');
|
||||
|
||||
return browser.actions()
|
||||
.mouseMove(editButton)
|
||||
.click()
|
||||
.perform();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
helper.getStatusNames = function(section) {
|
||||
return section.$$('.status-name span').getText();
|
||||
};
|
||||
|
||||
helper.getForm = function(form) {
|
||||
return {
|
||||
save: function() {
|
||||
let saveButton = form.$('.icon-floppy');
|
||||
|
||||
browser.actions()
|
||||
.mouseMove(saveButton)
|
||||
.click()
|
||||
.perform();
|
||||
|
||||
// debounce
|
||||
return browser.sleep(2000);
|
||||
},
|
||||
errors: function() {
|
||||
return form.$$('.checksley-error-list li');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
helper.getStatusForm = function(form) {
|
||||
let obj = Object.create(helper.getForm(form));
|
||||
|
||||
obj.form = form;
|
||||
|
||||
obj.status = function() {
|
||||
return this.form.$('.status-name input');
|
||||
};
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
helper.getPointsNames = function(section) {
|
||||
return section.$$('.project-values-body .project-values-name span').getText();
|
||||
};
|
||||
|
||||
helper.getPointsForm = function(form) {
|
||||
let obj = Object.create(helper.getForm(form));
|
||||
|
||||
obj.name = function() {
|
||||
return form.$('.project-values-name input');
|
||||
};
|
||||
|
||||
obj.value = function() {
|
||||
return form.$('.project-values-value input');
|
||||
};
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
helper.getPrioritiesForm = function(form) {
|
||||
let obj = Object.create(helper.getForm(form));
|
||||
|
||||
obj.name = function() {
|
||||
return form.$('.status-name input');
|
||||
};
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
helper.getPrioritiesNames = function(section) {
|
||||
return section.$$('.status-name span').getText();
|
||||
};
|
||||
|
||||
helper.getCustomFieldsForm = function(form) {
|
||||
let obj = Object.create(helper.getForm(form));
|
||||
|
||||
obj.name = function() {
|
||||
return form.$('.custom-name input');
|
||||
};
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
helper.getCustomFieldsNames = function(section) {
|
||||
return section.$$('.table-body .custom-name span').getText();
|
||||
};
|
|
@ -6,3 +6,4 @@ module.exports.wiki = require("./wiki-helper");
|
|||
module.exports.detail = require("./detail-helper");
|
||||
module.exports.usDetail = require("./us-detail-helper");
|
||||
module.exports.taskDetail = require("./task-detail-helper");
|
||||
module.exports.adminAttributes = require("./admin-attributes-helper");
|
||||
|
|
|
@ -101,14 +101,58 @@ common.dragEnd = function(elm) {
|
|||
}, 1000);
|
||||
};
|
||||
|
||||
common.drag = function(elm, location) {
|
||||
return browser
|
||||
.actions()
|
||||
.dragAndDrop(elm, location)
|
||||
.perform()
|
||||
.then(function() {
|
||||
return common.dragEnd();
|
||||
});
|
||||
common.drag = function(elm, elm2, duration=500) {
|
||||
return new Promise(async function(resolve) {
|
||||
let init = await elm.getLocation();
|
||||
let dest = await elm2.getLocation();
|
||||
|
||||
let startTime = new Date().getTime();
|
||||
let fromX = init.x;
|
||||
let toX = dest.x;
|
||||
|
||||
let fromY = init.y;
|
||||
let toY = dest.y;
|
||||
|
||||
let deltaX = toX - fromX;
|
||||
let deltaY = toY - fromY;
|
||||
|
||||
let lastPos = {x: fromX, y: fromY};
|
||||
|
||||
browser.actions()
|
||||
.mouseMove(elm)
|
||||
.mouseDown()
|
||||
.perform();
|
||||
|
||||
let interval = setInterval(() => {
|
||||
let elapsed = new Date().getTime() - startTime;
|
||||
let factor = Math.min(elapsed / duration, 1);
|
||||
|
||||
let newX = parseInt(fromX + deltaX * factor, 10);
|
||||
let newY = parseInt(fromY + deltaY * factor, 10);
|
||||
|
||||
let pos = {};
|
||||
pos.x = newX - lastPos.x;
|
||||
pos.y = newY - lastPos.y;
|
||||
|
||||
lastPos.x = newX;
|
||||
lastPos.y = newY;
|
||||
|
||||
if (lastPos.x === toX && lastPos.y === toY) {
|
||||
clearInterval(interval);
|
||||
|
||||
browser.actions()
|
||||
.mouseMove(pos)
|
||||
.mouseUp()
|
||||
.perform()
|
||||
.then(common.dragEnd)
|
||||
.then(resolve);
|
||||
} else {
|
||||
browser.actions()
|
||||
.mouseMove(pos)
|
||||
.perform();
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
};
|
||||
|
||||
common.transitionend = function(selector, property) {
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
var startTime = new Date().getTime();
|
||||
var duration = 500;
|
||||
var from = 2;
|
||||
var to = 10;
|
||||
var delta = to - from;
|
||||
|
||||
function next() {
|
||||
var elapsed = new Date().getTime() - startTime;
|
||||
var factor = Math.min(elapsed / duration, 1);
|
||||
|
||||
console.log(from + delta * factor);
|
||||
}
|
||||
|
||||
|
||||
setInterval(function(){
|
||||
next();
|
||||
}, 50);
|
Loading…
Reference in New Issue