[Enhance] selector by class name in for UI test cases (#4022)

This commit is contained in:
rohitwaghchaure 2017-08-31 18:16:06 +05:30 committed by Makarand Bauskar
parent 677abfb57e
commit 824094830c

View file

@ -22,6 +22,16 @@ frappe.click_link = function(text, idx) {
return frappe.timeout(0.5);
};
frappe.click_element = function(selector, idx) {
// Selector by class name like $(`.cart-items`)
let element = $(`${selector}`);
if(!element.length) {
throw `did not find any link containing ${selector}`;
}
element.get(idx || 0).click();
return frappe.timeout(0.5);
};
frappe.set_control= function(fieldname, value) {
let control = $(`.form-control[data-fieldname="${fieldname}"]:visible`);
if(!control.length) {