diff --git a/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment_request.js b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment_request.js new file mode 100644 index 00000000000..7abfb415ca5 --- /dev/null +++ b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment_request.js @@ -0,0 +1,52 @@ +QUnit.module('Sales Invoice'); + +QUnit.test("test sales Invoice with payment request", 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"); + // 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(2), + () => frappe.tests.click_button('Close'), + () => frappe.tests.click_button('Make'), + () => frappe.tests.click_link('Payment Request'), + () => frappe.timeout(0.2), + () => { cur_frm.set_value('print_format','GST Tax Invoice');}, + () => { cur_frm.set_value('email_to','test@gmail.com');}, + () => cur_frm.save(), + () => { + // get payment details + assert.ok(cur_frm.doc.grand_total==590, "grand total Correct"); + }, + () => done() + ]); +}); + diff --git a/erpnext/tests/ui/tests.txt b/erpnext/tests/ui/tests.txt index 87e557148e7..5723b9e2be9 100644 --- a/erpnext/tests/ui/tests.txt +++ b/erpnext/tests/ui/tests.txt @@ -82,6 +82,7 @@ erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation.js erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation_for_taxes_and_charges.js erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice.js erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment.js +erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment_request.js erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.js erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation_for_item_wise_discount.js erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js