From 7186131d6549527a0553f7d1cf823dae64fdad2f Mon Sep 17 00:00:00 2001 From: Vishal Dhayagude Date: Mon, 14 Aug 2017 12:22:04 +0530 Subject: [PATCH] [UI Test] sales invoice (#10394) * [UI Test] Sales Invoice * [UI Test] Sales Invoice --- .../sales_invoice/test_sales_invoice.js | 43 +++++++++++++++++++ erpnext/tests/ui/tests.txt | 3 +- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 erpnext/accounts/doctype/sales_invoice/test_sales_invoice.js diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.js new file mode 100644 index 0000000000..35b255875e --- /dev/null +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.js @@ -0,0 +1,43 @@ +QUnit.module('Sales Invoice'); + +QUnit.test("test sales Invoice", function(assert) { + assert.expect(4); + let done = assert.async(); + frappe.run_serially([ + () => { + return frappe.tests.make('Sales Invoice', [ + {customer: 'Test Customer 1'}, + {items: [ + [ + {'qty': 5}, + {'item_code': 'Test Product 1'}, + ] + ]}, + {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 1', "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"); + // grand_total Calculated + assert.ok(cur_frm.doc.grand_total==590, "Grad Total 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 0bc61fa88d..68cfad6542 100644 --- a/erpnext/tests/ui/tests.txt +++ b/erpnext/tests/ui/tests.txt @@ -82,4 +82,5 @@ erpnext/schools/doctype/assessment_result_tool/test_assessment_result_tool.js erpnext/buying/doctype/supplier/test_supplier.js erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.js erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation.js -erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation_for_taxes_and_charges.js \ No newline at end of file +erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation_for_taxes_and_charges.js +erpnext/accounts/doctype/sales_invoice/test_sales_invoice.js \ No newline at end of file