From 541d3f95672c1d7364e25af1a859e212e1e16b5b Mon Sep 17 00:00:00 2001 From: tunde Date: Mon, 25 Sep 2017 17:41:22 +0100 Subject: [PATCH] fix ui tests --- .../doctype/quotation/tests/test_quotation.js | 6 ++++-- ..._quotation_with_discount_on_grand_total.js | 6 ++++-- .../sales_order/tests/test_sales_order.js | 6 ++++-- ...ales_order_with_discount_on_grand_total.js | 6 ++++-- ...est_sales_order_with_item_wise_discount.js | 3 ++- erpnext/tests/ui/make_fixtures.js | 19 +++++++++++++++++++ 6 files changed, 37 insertions(+), 9 deletions(-) diff --git a/erpnext/selling/doctype/quotation/tests/test_quotation.js b/erpnext/selling/doctype/quotation/tests/test_quotation.js index 1683fa56883..37491ed8fd4 100644 --- a/erpnext/selling/doctype/quotation/tests/test_quotation.js +++ b/erpnext/selling/doctype/quotation/tests/test_quotation.js @@ -10,7 +10,8 @@ QUnit.test("test: quotation", function (assert) { {"item_code": "Test Product 1"}, {"qty": 5} ]] - } + }, + {payment_terms_template: '_Test Payment Term Template UI'} ]); }, () => { @@ -18,7 +19,7 @@ QUnit.test("test: quotation", function (assert) { assert.ok(cur_frm.doc.items[0].item_name == "Test Product 1", "Added Test Product 1"); // calculate_taxes_and_totals - assert.ok(cur_frm.doc.grand_total === 500, "Total Amount is correct"); + assert.ok(cur_frm.doc.grand_total === 500, String(cur_frm.doc.grand_total)); }, () => cur_frm.set_value("customer_address", "Test1-Billing"), () => cur_frm.set_value("shipping_address_name", "Test1-Warehouse"), @@ -30,6 +31,7 @@ QUnit.test("test: quotation", function (assert) { () => cur_frm.doc.items[0].rate = 200, () => frappe.timeout(0.3), () => cur_frm.set_value("tc_name", "Test Term 1"), + () => cur_frm.set_value("payment_schedule", []), () => frappe.timeout(0.5), () => cur_frm.save(), () => { diff --git a/erpnext/selling/doctype/quotation/tests/test_quotation_with_discount_on_grand_total.js b/erpnext/selling/doctype/quotation/tests/test_quotation_with_discount_on_grand_total.js index b7b5a470d69..aeb5d1b9eb7 100644 --- a/erpnext/selling/doctype/quotation/tests/test_quotation_with_discount_on_grand_total.js +++ b/erpnext/selling/doctype/quotation/tests/test_quotation_with_discount_on_grand_total.js @@ -16,13 +16,15 @@ QUnit.test("test quotation with additional discount in grand total", function(as ]}, {customer_address: 'Test1-Billing'}, {shipping_address_name: 'Test1-Shipping'}, - {contact_person: 'Contact 1-Test Customer 1'} + {contact_person: 'Contact 1-Test Customer 1'}, + {payment_terms_template: '_Test Payment Term Template UI'} ]); }, () => { return frappe.tests.set_form_values(cur_frm, [ {apply_discount_on:'Grand Total'}, - {additional_discount_percentage:10} + {additional_discount_percentage:10}, + {payment_schedule: []} ]); }, () => cur_frm.save(), diff --git a/erpnext/selling/doctype/sales_order/tests/test_sales_order.js b/erpnext/selling/doctype/sales_order/tests/test_sales_order.js index daa81318818..12661e3663f 100644 --- a/erpnext/selling/doctype/sales_order/tests/test_sales_order.js +++ b/erpnext/selling/doctype/sales_order/tests/test_sales_order.js @@ -19,13 +19,15 @@ QUnit.test("test sales order", function(assert) { {contact_person: 'Contact 1-Test Customer 1'}, {taxes_and_charges: 'TEST In State GST'}, {tc_name: 'Test Term 1'}, - {terms: 'This is Test'} + {terms: 'This is Test'}, + {payment_terms_template: '_Test Payment Term Template UI'} ]); }, () => { return frappe.tests.set_form_values(cur_frm, [ {selling_price_list:'Test-Selling-USD'}, - {currency: 'USD'} + {currency: 'USD'}, + {payment_schedule: []} ]); }, () => frappe.timeout(1), diff --git a/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_discount_on_grand_total.js b/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_discount_on_grand_total.js index 3247c85d971..de61a6112c1 100644 --- a/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_discount_on_grand_total.js +++ b/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_discount_on_grand_total.js @@ -16,13 +16,15 @@ QUnit.test("test sales order with additional discount in grand total", function( ]}, {customer_address: 'Test1-Billing'}, {shipping_address_name: 'Test1-Shipping'}, - {contact_person: 'Contact 1-Test Customer 1'} + {contact_person: 'Contact 1-Test Customer 1'}, + {payment_terms_template: '_Test Payment Term Template UI'} ]); }, () => { return frappe.tests.set_form_values(cur_frm, [ {apply_discount_on:'Grand Total'}, - {additional_discount_percentage:10} + {additional_discount_percentage:10}, + {payment_schedule: []} ]); }, () => cur_frm.save(), diff --git a/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_item_wise_discount.js b/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_item_wise_discount.js index c745374fcc1..2c481083086 100644 --- a/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_item_wise_discount.js +++ b/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_item_wise_discount.js @@ -18,7 +18,8 @@ QUnit.test("test sales order", function(assert) { ]}, {customer_address: 'Test1-Billing'}, {shipping_address_name: 'Test1-Shipping'}, - {contact_person: 'Contact 1-Test Customer 1'} + {contact_person: 'Contact 1-Test Customer 1'}, + {payment_terms_template: '_Test Payment Term Template UI'} ]); }, () => cur_frm.save(), diff --git a/erpnext/tests/ui/make_fixtures.js b/erpnext/tests/ui/make_fixtures.js index 0bd74915c29..78ec8f16dbf 100644 --- a/erpnext/tests/ui/make_fixtures.js +++ b/erpnext/tests/ui/make_fixtures.js @@ -217,6 +217,25 @@ $.extend(frappe.test_data, { {price_list: '_Test Price List'}, {price_list_rate: 200} ] + }, + "Payment Term": { + "_Test Payment Term": [ + {payment_term_name: '_Test Payment Term'}, + {due_date_based_on: 'Day(s) after invoice date'}, + {invoice_portion: 100}, + {credit_days: 0} + ] + }, + "Payment Terms Template": { + "_Test Payment Term Template UI": [ + {template_name: "_Test Payment Term Template UI"}, + {terms: [ + [ + {payment_term: '_Test Payment Term'}, + {invoice_portion: 100} + ] + ]} + ] } });