openmct/protractor/common/RightMenu.js

117 lines
4.4 KiB
JavaScript
Raw Normal View History

/*****************************************************************************
* Open MCT, Copyright (c) 2014-2016, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
2015-07-29 19:55:15 +00:00
var RightMenu = (function () {
function RightMenu() {
}
2015-08-07 18:28:18 +00:00
function carrotMyItem(){
var MyItem = ">\nF\nMy Items"
element.all(by.repeater('child in composition')).filter(function (ele){
return ele.getText().then(function(text) {
return text === MyItem;
});
}).all(by.css('.ui-symbol.view-control.ng-binding.ng-scope')).click();
}
2015-07-29 19:55:15 +00:00
//RightMenu Click on Object
RightMenu.prototype.delete = function (name, flag) {
2015-07-29 20:22:14 +00:00
if(typeof flag === 'undefined'){
2015-07-29 19:55:15 +00:00
flag = true;
}
if(flag === true){
2015-08-07 18:28:18 +00:00
carrotMyItem();
2015-07-29 19:55:15 +00:00
}
browser.sleep(1000)
var object = element.all(by.repeater('child in composition')).filter(function (ele){
return ele.getText().then(function(text) {
return text === name;
});
});
browser.sleep(1000)
browser.actions().mouseMove(object.get(0)).perform();
browser.actions().click(protractor.Button.RIGHT).perform();
browser.sleep(1000)
2015-08-07 18:28:18 +00:00
element.all(by.css('.ng-binding')).filter(function (ele){
2015-07-29 19:55:15 +00:00
return ele.getText().then(function (text) {
return text == "Z\nRemove";
})
}).click();
browser.sleep(1000)
element.all(by.repeater('child in composition')).filter(function (ele){
return ele.getText().then(function(text) {
return text === name;
});
}).then(function (folder) {
expect(folder.length).toBe(0);
});
};
RightMenu.prototype.reset = function (name) {
2015-08-07 18:28:18 +00:00
carrotMyItem();
2015-07-29 19:55:15 +00:00
browser.sleep(1000)
var object = element.all(by.repeater('child in composition')).filter(function (ele){
return ele.getText().then(function(text) {
return text === name;
});
}).click();
browser.sleep(1000)
browser.actions().mouseMove(object.get(0)).perform();
browser.actions().click(protractor.Button.RIGHT).perform();
browser.sleep(1000)
var remove = element.all(by.css('.ng-binding')).filter(function (ele){
return ele.getText().then(function (text) {
return text == "r\nRestart at 0";
})
}).click();
2015-08-07 18:28:18 +00:00
browser.sleep(1000)
2015-07-29 19:55:15 +00:00
};
2015-08-07 18:28:18 +00:00
//click '<', true==yes false==no
2015-07-29 19:55:15 +00:00
RightMenu.prototype.select = function(name, flag){
if(typeof flag == "undefined"){
flag = true;
}
if(flag == true){
2015-08-07 18:28:18 +00:00
carrotMyItem();
2015-07-29 19:55:15 +00:00
}
browser.sleep(1000)
return element.all(by.repeater('child in composition')).filter(function (ele){
return ele.getText().then(function(text) {
return text === name;
});
});
};
RightMenu.prototype.dragDrop = function(name){
var object = element.all(by.repeater('child in composition')).filter(function (ele){
return ele.getText().then(function(text) {
return text === name;
});
});
var folder = object.get(0);
var panel = element(by.css('.items-holder.grid.abs.ng-scope'));
browser.actions().dragAndDrop(folder, panel).perform();
};
return RightMenu;
})();
module.exports = RightMenu;