Skip to content
Snippets Groups Projects
Commit b0ad84ca authored by mpukhliak's avatar mpukhliak
Browse files

SSDM-9324 9. Sample Hierarchy as Table

parent 30b2f949
No related branches found
No related tags found
No related merge requests found
......@@ -10,8 +10,10 @@ var UserTests = new function() {
.then(() => this.creationSampleForm())
//7. Sample Form - Edit: Add a Photo and Parents/Children
.then(() => this.editSampleForm())
// 8. Sample Hierarchy as Graph
//8. Sample Hierarchy as Graph
.then(() => this.sampleHierarchyAsGraph())
//9. Sample Hierarchy as Table
.then(() => this.sampleHierarchyAsTable())
//13. Inventory Table - Imports for Create - Automatic Codes
.then(() => this.importsAutomaticCodes())
//14. Inventory Table - Imports for Create - Given Codes
......@@ -177,21 +179,63 @@ var UserTests = new function() {
}
this.sampleHierarchyAsGraph = function() {
return new Promise(function executor(resolve, reject) {
var e = EventUtil;
Promise.resolve().then(() => e.waitForId("options-menu-btn-sample-view-bacteria"))
.then(() => e.click("options-menu-btn-sample-view-bacteria"))
// show Hierarchy Graph
.then(() => e.waitForId("hierarchy-graph"))
.then(() => e.click("hierarchy-graph"))
// check parents and children
.then(() => e.waitForId("bac1"))
.then(() => e.waitForId("bac2"))
.then(() => e.waitForId("bac3"))
.then(() => e.waitForId("bac4"))
.then(() => resolve());
});
}
return new Promise(function executor(resolve, reject) {
var e = EventUtil;
Promise.resolve().then(() => e.waitForId("options-menu-btn-sample-view-bacteria"))
.then(() => e.click("options-menu-btn-sample-view-bacteria"))
// show Hierarchy Graph
.then(() => e.waitForId("hierarchy-graph"))
.then(() => e.click("hierarchy-graph"))
// check parents and children
.then(() => e.waitForId("bac1"))
.then(() => e.waitForId("bac2"))
.then(() => e.waitForId("bac3"))
.then(() => e.waitForId("bac4"))
.then(() => resolve());
});
}
this.sampleHierarchyAsTable = function() {
var parentAnnotations = "<b>Code</b>: BAC1, <b>Comments</b>: mother<br><br><b>Code</b>: BAC2, <b>Comments</b>: father";
var childrenAnnotations = "<b>Code</b>: BAC4";
return new Promise(function executor(resolve, reject) {
var e = EventUtil;
// return to bacteria 3
Promise.resolve().then(() => e.waitForId("_MATERIALS_BACTERIA_BACTERIA_COLLECTION"))
.then(() => e.click("_MATERIALS_BACTERIA_BACTERIA_COLLECTION"))
.then(() => e.waitForId("bac3-column-id"))
.then(() => e.click("bac3-column-id"))
// show Hierarchy Graph
.then(() => e.waitForId("options-menu-btn-sample-view-bacteria"))
.then(() => e.click("options-menu-btn-sample-view-bacteria"))
.then(() => e.waitForId("hierarchy-table"))
.then(() => e.click("hierarchy-table"))
.then(() => e.sleep(2000))
// show Identifier
.then(() => e.waitForId("columns-dropdown-id"))
.then(() => e.click("columns-dropdown-id"))
.then(() => e.waitForId("identifier-cln"))
.then(() => e.click("identifier-cln"))
.then(() => e.click("columns-dropdown-id"))
// check parents and children
.then(() => e.waitForId("bac1"))
.then(() => e.waitForId("bac2"))
.then(() => e.waitForId("bac3"))
.then(() => e.equalTo("children-annotations-bac3", childrenAnnotations, true, false))
.then(() => e.waitForId("bac4"))
// show the Parent/Annotations column
.then(() => e.waitForId("columns-dropdown-id"))
.then(() => e.click("columns-dropdown-id"))
.then(() => e.waitForId("parentannotations-cln"))
.then(() => e.click("parentannotations-cln"))
.then(() => e.click("columns-dropdown-id"))
// check parents comments
.then(() => e.waitForId("parent-annotations-bac3"))
.then(() => e.equalTo("parent-annotations-bac3", parentAnnotations, true, false))
.then(() => resolve());
});
}
this.importsAutomaticCodes = function() {
var baseURL = location.protocol + '//' + location.host + location.pathname;
......
......@@ -97,7 +97,8 @@ function HierarchyTableView(controller, model) {
property : 'identifier',
sortable : true,
render : function(data) {
return FormUtil.getFormLink(data.identifier, "Sample", data.permId, null);
var id = data.code.toLowerCase();
return FormUtil.getFormLink(data.identifier, "Sample", data.permId, null, id);
}
});
}
......@@ -127,7 +128,10 @@ function HierarchyTableView(controller, model) {
property : 'parentAnnotations',
sortable : true,
render : function(data) {
return _this._annotationsRenderer(_this._model.relationShipsMap[data.permId].parents, data.entity);
var id = "parent-annotations-" + data.entity.code.toLowerCase();
var $component = $("<div>", { id : id });
$component.append(_this._annotationsRenderer(_this._model.relationShipsMap[data.permId].parents, data.entity));
return $component;
}
});
columns.push({
......@@ -135,7 +139,10 @@ function HierarchyTableView(controller, model) {
property : 'childrenAnnotations',
sortable : true,
render : function(data) {
return _this._annotationsRenderer(_this._model.relationShipsMap[data.permId].children, data.entity);
var id = "children-annotations-" + data.entity.code.toLowerCase();
var $component = $("<div>", { id : id });
$component.append(_this._annotationsRenderer(_this._model.relationShipsMap[data.permId].children, data.entity));
return $component;
}
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment