From 1252c30edf368cb251bc2198b0da888d14b376c5 Mon Sep 17 00:00:00 2001 From: Vishal Dhayagude Date: Thu, 31 Aug 2017 14:47:56 +0530 Subject: [PATCH] [UI Test] UI test for Repack and Sales Invoice with Serialize item Added (#10583) * [UI Test] UI test for Repack and Sales Invoice with Serialize item Added * [Fix] Fixed path for sales invoice" --- .../test_sales_invoice_with_serialize_item.js | 45 +++++++++++++++++++ .../tests/test_stock_entry_for_repack.js | 42 +++++++++++++++++ erpnext/tests/ui/tests.txt | 2 + 3 files changed, 89 insertions(+) create mode 100644 erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_serialize_item.js create mode 100644 erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_repack.js diff --git a/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_serialize_item.js b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_serialize_item.js new file mode 100644 index 0000000000..60059841cd --- /dev/null +++ b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_serialize_item.js @@ -0,0 +1,45 @@ +QUnit.module('Sales Invoice'); + +QUnit.test("test sales Invoice with serialize item", function(assert) { + assert.expect(5); + let done = assert.async(); + frappe.run_serially([ + () => { + return frappe.tests.make('Sales Invoice', [ + {customer: 'Test Customer 1'}, + {items: [ + [ + {'qty': 2}, + {'item_code': 'Test Product 4'}, + ] + ]}, + {update_stock:1}, + {customer_address: 'Test1-Billing'}, + {shipping_address_name: 'Test1-Shipping'}, + {contact_person: 'Contact 1-Test Customer 1'}, + {taxes_and_charges: 'TEST In State GST'}, + {tc_name: 'Test Term 1'}, + {terms: 'This is Test'} + ]); + }, + () => cur_frm.save(), + () => { + // get_item_details + assert.ok(cur_frm.doc.items[0].item_name=='Test Product 4', "Item name correct"); + // get tax details + assert.ok(cur_frm.doc.taxes_and_charges=='TEST In State GST', "Tax details correct"); + // get tax account head details + assert.ok(cur_frm.doc.taxes[0].account_head=='CGST - '+frappe.get_abbr(frappe.defaults.get_default('Company')), " Account Head abbr correct"); + // get batch number + assert.ok(cur_frm.doc.items[0].batch_no=='TEST-BATCH-001', " Batch Details correct"); + // grand_total Calculated + assert.ok(cur_frm.doc.grand_total==218, "Grad Total correct"); + + }, + () => frappe.tests.click_button('Submit'), + () => frappe.tests.click_button('Yes'), + () => frappe.timeout(0.3), + () => done() + ]); +}); + diff --git a/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_repack.js b/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_repack.js new file mode 100644 index 0000000000..699634df6d --- /dev/null +++ b/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_repack.js @@ -0,0 +1,42 @@ +QUnit.module('Stock'); + +QUnit.test("test repack", function(assert) { + assert.expect(2); + let done = assert.async(); + frappe.run_serially([ + () => { + return frappe.tests.make('Stock Entry', [ + {purpose:'Repack'}, + {items: [ + [ + {'item_code': 'Test Product 1'}, + {'qty': 1}, + {'s_warehouse':'Stores - '+frappe.get_abbr(frappe.defaults.get_default('Company'))}, + ], + [ + {'item_code': 'Test Product 2'}, + {'qty': 1}, + {'s_warehouse':'Stores - '+frappe.get_abbr(frappe.defaults.get_default('Company'))}, + ], + [ + {'item_code': 'Test Product 3'}, + {'qty': 1}, + {'t_warehouse':'Work In Progress - '+frappe.get_abbr(frappe.defaults.get_default('Company'))}, + ], + ]}, + ]); + }, + () => cur_frm.save(), + () => frappe.click_button('Update Rate and Availability'), + () => { + // get_item_details + assert.ok(cur_frm.doc.total_outgoing_value==250, " Outgoing Value correct"); + assert.ok(cur_frm.doc.total_incoming_value==250, " 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 91bb3113d7..880263f6ce 100644 --- a/erpnext/tests/ui/tests.txt +++ b/erpnext/tests/ui/tests.txt @@ -123,3 +123,5 @@ erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_receipt_fo 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 erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_issue_with_serialize_item.js +erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_repack.js +erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_serialize_item.js \ No newline at end of file