[ui-test] added test for bill_of_materials (#10063)

* temporary commit for switching branches

* [ui-tests] added bill_of_materials test

* fixed minor codacy problems

* added minor requested changes
This commit is contained in:
Ameya Shenoy 2017-07-25 15:23:58 +05:30 committed by Rushabh Mehta
parent 2ffe878999
commit 08450878f1
2 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,62 @@
QUnit.test("test: item", function (assert) {
assert.expect(1);
let done = assert.async();
frappe.run_serially([
// test item creation
() => frappe.set_route("List", "Item"),
// Create a BOM for a laptop
() => frappe.tests.make(
"BOM", [
{item: "Laptop"},
{quantity: 1},
{with_operations: 1},
{operations: [
[
{operation: "Assemble CPU"},
{time_in_mins: 60},
],
[
{operation: "Assemble Keyboard"},
{time_in_mins: 30},
],
[
{operation: "Assemble Screen"},
{time_in_mins: 30},
]
]},
{scrap_items: [
[
{item_code: "Scrap item"}
]
]},
{items: [
[
{item_code: "CPU"},
{qty: 1}
],
[
{item_code: "Keyboard"},
{qty: 1}
],
[
{item_code: "Screen"},
{qty: 1}
]
]},
]
),
() => cur_frm.savesubmit(),
() => frappe.timeout(1),
() => frappe.click_button('Yes'),
() => frappe.timeout(1),
() => {
assert.ok(cur_frm.doc.operating_cost + cur_frm.doc.raw_material_cost -
cur_frm.doc.scrap_material_cost == cur_frm.doc.total_cost, 'Total_Cost calculated correctly');
},
() => done()
]);
});

View File

@ -8,3 +8,4 @@ erpnext/manufacturing/doctype/workstation/test_workstation.js
erpnext/manufacturing/doctype/operation/test_operation.js
erpnext/hr/doctype/holiday_list/test_holiday_list.js
erpnext/hr/doctype/branch/test_branch.js
erpnext/manufacturing/doctype/bom/test_bom.js