diff --git a/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_subcontract.js b/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_subcontract.js new file mode 100644 index 0000000000..131d3ca1de --- /dev/null +++ b/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_subcontract.js @@ -0,0 +1,34 @@ +QUnit.module('Stock'); + +QUnit.test("test material Transfer to manufacture", function(assert) { + assert.expect(3); + let done = assert.async(); + frappe.run_serially([ + () => { + return frappe.tests.make('Stock Entry', [ + {purpose:'Subcontract'}, + {from_warehouse:'Work In Progress - '+frappe.get_abbr(frappe.defaults.get_default('Company'))}, + {to_warehouse:'Finished Goods - '+frappe.get_abbr(frappe.defaults.get_default('Company'))}, + {items: [ + [ + {'item_code': 'Test Product 1'}, + {'qty': 1}, + ] + ]}, + ]); + }, + () => cur_frm.save(), + () => frappe.click_button('Update Rate and Availability'), + () => { + // get_item_details + assert.ok(cur_frm.doc.items[0].item_name=='Test Product 1', "Item name correct"); + assert.ok(cur_frm.doc.total_outgoing_value==100, " Outgoing Value correct"); + assert.ok(cur_frm.doc.total_incoming_value==100, " Incoming Value correct"); + }, + () => frappe.tests.click_button('Submit'), + () => frappe.tests.click_button('Yes'), + () => frappe.timeout(0.3), + () => done() + ]); +}); + diff --git a/erpnext/tests/ui/tests.txt b/erpnext/tests/ui/tests.txt index 4e1deb5b4b..826b956f38 100644 --- a/erpnext/tests/ui/tests.txt +++ b/erpnext/tests/ui/tests.txt @@ -119,4 +119,5 @@ erpnext/accounts/doctype/payment_entry/tests/test_payment_entry.js erpnext/selling/doctype/quotation/tests/test_quotation_submit_cancel_amend.js erpnext/stock/doctype/batch/test_batch.js erpnext/accounts/doctype/bank_reconciliation/test_bank_reconciliation.js -erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_transfer_for_manufacture.js \ No newline at end of file +erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_transfer_for_manufacture.js +erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_subcontract.js \ No newline at end of file