[ui-testing] added test for production order (#10138)

* temporary commit for switching branches

* [ui-tests] added bill_of_materials test

* added warehouses required for production order

* [ui-test] added production order test

* debugging travis failure
This commit is contained in:
Ameya Shenoy
2017-07-31 11:02:28 +05:30
committed by Rushabh Mehta
parent e09b507b6c
commit 4e91f28ce5
7 changed files with 94 additions and 6 deletions

View File

@@ -12,6 +12,7 @@ QUnit.test("test: item", function (assert) {
{item: "Laptop"},
{quantity: 1},
{with_operations: 1},
{company: "Razer Blade"},
{operations: [
[
{operation: "Assemble CPU"},

View File

@@ -0,0 +1,41 @@
QUnit.test("test: production order", function (assert) {
assert.expect(2);
let done = assert.async();
let laptop_quantity = 5;
let single_laptop_cost = 1340; // Calculated in workstation (time * per_hour_cost) for every item
frappe.run_serially([
// test production order
() => frappe.set_route("List", "Production Order"),
() => frappe.timeout(0.5),
// Create a laptop production order
() => frappe.new_doc("Production Order"),
() => frappe.timeout(1),
() => cur_frm.set_value("production_item", "Laptop"),
() => frappe.timeout(2),
() => cur_frm.set_value("company", "Razer Blade"),
() => frappe.timeout(2),
() => cur_frm.set_value("qty", laptop_quantity),
() => frappe.timeout(2),
() => cur_frm.set_value("scrap_warehouse", "Laptop Scrap Warehouse - RB"),
() => frappe.timeout(1),
() => cur_frm.set_value("wip_warehouse", "Work In Progress - RB"),
() => frappe.timeout(1),
() => cur_frm.set_value("fg_warehouse", "Finished Goods - RB"),
() => cur_frm.save(),
() => frappe.timeout(1),
() => {
assert.equal(cur_frm.doc.planned_operating_cost, cur_frm.doc.total_operating_cost, "Total and Planned Cost is equal");
assert.equal(cur_frm.doc.planned_operating_cost, laptop_quantity*single_laptop_cost, "Total cost is calculated correctly "+cur_frm.doc.planned_operating_cost);
},
() => cur_frm.savesubmit(),
() => frappe.timeout(1),
() => frappe.click_button('Yes'),
() => frappe.timeout(1),
() => done()
]);
});