[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

@ -18,7 +18,8 @@ QUnit.test("test: item", function (assert) {
{item_group: "Products"}, {item_group: "Products"},
{is_stock_item: is_stock_item}, {is_stock_item: is_stock_item},
{standard_rate: keyboard_cost}, {standard_rate: keyboard_cost},
{opening_stock: no_of_items_to_stock} {opening_stock: no_of_items_to_stock},
{default_warehouse: "Stores - RB"}
] ]
), ),
() => { () => {
@ -43,7 +44,8 @@ QUnit.test("test: item", function (assert) {
{item_group: "Products"}, {item_group: "Products"},
{is_stock_item: is_stock_item}, {is_stock_item: is_stock_item},
{standard_rate: screen_cost}, {standard_rate: screen_cost},
{opening_stock: no_of_items_to_stock} {opening_stock: no_of_items_to_stock},
{default_warehouse: "Stores - RB"}
] ]
), ),
@ -54,7 +56,8 @@ QUnit.test("test: item", function (assert) {
{item_group: "Products"}, {item_group: "Products"},
{is_stock_item: is_stock_item}, {is_stock_item: is_stock_item},
{standard_rate: CPU_cost}, {standard_rate: CPU_cost},
{opening_stock: no_of_items_to_stock} {opening_stock: no_of_items_to_stock},
{default_warehouse: "Stores - RB"}
] ]
), ),
@ -62,7 +65,8 @@ QUnit.test("test: item", function (assert) {
() => frappe.tests.make( () => frappe.tests.make(
"Item", [ "Item", [
{item_code: "Laptop"}, {item_code: "Laptop"},
{item_group: "Products"} {item_group: "Products"},
{default_warehouse: "Stores - RB"}
] ]
), ),
() => frappe.tests.make( () => frappe.tests.make(
@ -80,7 +84,8 @@ QUnit.test("test: item", function (assert) {
{item_group: "Products"}, {item_group: "Products"},
{is_stock_item: is_stock_item}, {is_stock_item: is_stock_item},
{standard_rate: scrap_cost}, {standard_rate: scrap_cost},
{opening_stock: no_of_items_to_stock} {opening_stock: no_of_items_to_stock},
{default_warehouse: "Stores - RB"}
] ]
), ),

View File

@ -12,6 +12,7 @@ QUnit.test("test: item", function (assert) {
{item: "Laptop"}, {item: "Laptop"},
{quantity: 1}, {quantity: 1},
{with_operations: 1}, {with_operations: 1},
{company: "Razer Blade"},
{operations: [ {operations: [
[ [
{operation: "Assemble CPU"}, {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()
]);
});

View File

@ -0,0 +1,19 @@
QUnit.test("Test: Company", function (assert) {
assert.expect(0);
let done = assert.async();
frappe.run_serially([
// Added company for Production Order testing
() => frappe.set_route("List", "Company"),
() => frappe.new_doc("Company"),
() => frappe.timeout(1),
() => cur_frm.set_value("company_name", "Razer Blade"),
() => cur_frm.set_value("abbr", "RB"),
() => cur_frm.set_value("default_currency", "USD"),
() => cur_frm.save(),
() => frappe.timeout(1),
() => done()
]);
});

View File

@ -0,0 +1,19 @@
QUnit.test("test: warehouse", function (assert) {
assert.expect(0);
let done = assert.async();
frappe.run_serially([
// test warehouse creation
() => frappe.set_route("List", "Warehouse"),
// Create a Laptop Scrap Warehouse
() => frappe.tests.make(
"Warehouse", [
{warehouse_name: "Laptop Scrap Warehouse"},
{company: "Razer Blade"}
]
),
() => done()
]);
});

View File

@ -1,11 +1,12 @@
erpnext/tests/ui/make_fixtures.js #long erpnext/tests/ui/make_fixtures.js #long
erpnext/setup/doctype/company/test_company.js erpnext/setup/doctype/company/tests/test_company.js
erpnext/accounts/doctype/account/test_account.js erpnext/accounts/doctype/account/test_account.js
erpnext/accounts/doctype/account/test_make_tax_account.js erpnext/accounts/doctype/account/test_make_tax_account.js
erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.js erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.js
erpnext/crm/doctype/lead/test_lead.js erpnext/crm/doctype/lead/test_lead.js
erpnext/crm/doctype/opportunity/test_opportunity.js erpnext/crm/doctype/opportunity/test_opportunity.js
erpnext/selling/doctype/quotation/test_quotation.js erpnext/selling/doctype/quotation/test_quotation.js
erpnext/setup/doctype/company/tests/test_company_production.js
erpnext/crm/doctype/item/test_item.js erpnext/crm/doctype/item/test_item.js
erpnext/manufacturing/doctype/workstation/test_workstation.js erpnext/manufacturing/doctype/workstation/test_workstation.js
erpnext/manufacturing/doctype/operation/test_operation.js erpnext/manufacturing/doctype/operation/test_operation.js
@ -31,5 +32,7 @@ erpnext/schools/doctype/student_batch_name/test_student_batch_name.js
erpnext/schools/doctype/student_category/test_student_category.js erpnext/schools/doctype/student_category/test_student_category.js
erpnext/schools/doctype/room/test_room.js erpnext/schools/doctype/room/test_room.js
erpnext/schools/doctype/instructor/test_instructor.js erpnext/schools/doctype/instructor/test_instructor.js
erpnext/stock/doctype/warehouse/test_warehouse.js
erpnext/manufacturing/doctype/production_order/test_production_order.js
erpnext/accounts/page/pos/test_pos.js erpnext/accounts/page/pos/test_pos.js
erpnext/selling/doctype/product_bundle/test_product_bundle.js erpnext/selling/doctype/product_bundle/test_product_bundle.js