diff --git a/frappe/custom/doctype/customize_form/test_customize_form.js b/frappe/custom/doctype/customize_form/test_customize_form.js index 144d11a9ae..a1431fdb5a 100644 --- a/frappe/custom/doctype/customize_form/test_customize_form.js +++ b/frappe/custom/doctype/customize_form/test_customize_form.js @@ -8,13 +8,24 @@ QUnit.test("test customize form", function(assert) { frappe.run_serially([ () => frappe.set_route('Form', 'Customize Form'), () => cur_frm.set_value('doc_type', 'ToDo'), - () => frappe.timeout(2), - - () => assert.equal(cur_frm.doc.fields[1].fieldname, 'status'), - + () => { + // find the status column as there may be other custom fields like + // kanban etc. + frappe.row_idx = 0; + cur_frm.doc.fields.every((d, i) => { + if(d.fieldname==='status') { + frappe.row_idx = i; + return false; + } else { + return true; + } + }); + assert.equal(cur_frm.doc.fields[frappe.row_idx].fieldname, 'status', + 'check if selected field is "status"'); + }, // open "status" row - () => cur_frm.fields_dict.fields.grid.grid_rows[1].toggle_view(), + () => cur_frm.fields_dict.fields.grid.grid_rows[frappe.row_idx].toggle_view(), () => frappe.timeout(0.5), // try deleting it @@ -25,7 +36,8 @@ QUnit.test("test customize form", function(assert) { () => frappe.timeout(0.5), // status still exists - () => assert.equal(cur_frm.doc.fields[1].fieldname, 'status'), + () => assert.equal(cur_frm.doc.fields[frappe.row_idx].fieldname, 'status', + 'check if selected field is still "status"'), () => done() ]); });