From 569011fb2136ea8f142a10df4d17ba663ef8bbce Mon Sep 17 00:00:00 2001 From: Vishal Dhayagude Date: Fri, 28 Jul 2017 19:36:50 +0530 Subject: [PATCH] [UI Test] Test for Product Bundle added (#10158) --- erpnext/crm/doctype/item/test_item.js | 7 ++++ .../product_bundle/test_product_bundle.js | 36 +++++++++++++++++++ erpnext/tests/ui/tests.txt | 3 +- 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 erpnext/selling/doctype/product_bundle/test_product_bundle.js diff --git a/erpnext/crm/doctype/item/test_item.js b/erpnext/crm/doctype/item/test_item.js index 2f50ebedc3..704e762b1c 100644 --- a/erpnext/crm/doctype/item/test_item.js +++ b/erpnext/crm/doctype/item/test_item.js @@ -65,6 +65,13 @@ QUnit.test("test: item", function (assert) { {item_group: "Products"} ] ), + () => frappe.tests.make( + "Item", [ + {item_code: "Computer"}, + {item_group: "Products"}, + {is_stock_item: 0}, + ] + ), // Create a scrap item () => frappe.tests.make( diff --git a/erpnext/selling/doctype/product_bundle/test_product_bundle.js b/erpnext/selling/doctype/product_bundle/test_product_bundle.js new file mode 100644 index 0000000000..ba5ba0dc3b --- /dev/null +++ b/erpnext/selling/doctype/product_bundle/test_product_bundle.js @@ -0,0 +1,36 @@ +QUnit.test("test sales order", function(assert) { + assert.expect(4); + let done = assert.async(); + frappe.run_serially([ + () => { + return frappe.tests.make('Product Bundle', [ + {new_item_code: 'Computer'}, + {items: [ + [ + {item_code:'CPU'}, + {qty:1} + ], + [ + {item_code:'Screen'}, + {qty:1} + ], + [ + {item_code:'Keyboard'}, + {qty:1} + ] + ]}, + ]); + }, + () => cur_frm.save(), + () => { + // get_item_details + assert.ok(cur_frm.doc.items[0].item_code=='CPU', "Item Code correct"); + assert.ok(cur_frm.doc.items[1].item_code=='Screen', "Item Code correct"); + assert.ok(cur_frm.doc.items[2].item_code=='Keyboard', "Item Code correct"); + assert.ok(cur_frm.doc.new_item_code == "Computer", "Parent Item correct"); + }, + () => frappe.timeout(0.3), + () => done() + ]); +}); + diff --git a/erpnext/tests/ui/tests.txt b/erpnext/tests/ui/tests.txt index b86f1eefd4..60ca47cfda 100644 --- a/erpnext/tests/ui/tests.txt +++ b/erpnext/tests/ui/tests.txt @@ -29,4 +29,5 @@ erpnext/schools/doctype/school_settings/test_school_settings.js erpnext/schools/doctype/student_batch_name/test_student_batch_name.js erpnext/schools/doctype/student_category/test_student_category.js erpnext/schools/doctype/room/test_room.js -erpnext/schools/doctype/instructor/test_instructor.js \ No newline at end of file +erpnext/schools/doctype/instructor/test_instructor.js +erpnext/selling/doctype/product_bundle/test_product_bundle.js \ No newline at end of file