From d348c12bdba4f8173408ddac8c0bdd56dc420eb4 Mon Sep 17 00:00:00 2001 From: tunde Date: Thu, 28 Sep 2017 09:46:31 +0100 Subject: [PATCH] fix sales order ui test --- .../sales_order/tests/test_sales_order.js | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) 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 8e813db7ad2..939261c0c55 100644 --- a/erpnext/selling/doctype/sales_order/tests/test_sales_order.js +++ b/erpnext/selling/doctype/sales_order/tests/test_sales_order.js @@ -26,11 +26,10 @@ QUnit.test("test sales order", function(assert) { () => { return frappe.tests.set_form_values(cur_frm, [ {selling_price_list:'Test-Selling-USD'}, - {currency: 'USD'}, - {payment_schedule: []} + {currency: 'USD'} ]); }, - () => frappe.timeout(1), + () => frappe.timeout(1.5), () => { // get_item_details assert.ok(cur_frm.doc.items[0].item_name=='Test Product 3', "Item name correct"); @@ -38,21 +37,24 @@ QUnit.test("test sales order", function(assert) { 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"); - // calculate totals - assert.ok(cur_frm.doc.items[0].price_list_rate==250, "Item 1 price_list_rate"); - assert.ok(cur_frm.doc.net_total== 1280.75, "net total correct "); - assert.ok(cur_frm.doc.base_grand_total== flt(1511.29* cur_frm.doc.conversion_rate, precision('base_grand_total')), "base round total correct "); - assert.ok(cur_frm.doc.grand_total== 1511.29 , "grand total correct "); - assert.ok(cur_frm.doc.rounded_total== 1511.30, "rounded total correct "); }, () => cur_frm.save(), () => frappe.timeout(1), () => cur_frm.print_doc(), () => frappe.timeout(1), () => { + // Payment Terms assert.ok(cur_frm.doc.payment_terms_template, "Payment Terms Template is correct"); assert.ok(cur_frm.doc.payment_schedule.length > 0, "Payment Term Schedule is not empty"); + // totals + assert.ok(cur_frm.doc.items[0].price_list_rate==250, "Item 1 price_list_rate"); + assert.ok(cur_frm.doc.net_total== 1280.75, "net total correct "); + assert.ok(cur_frm.doc.base_grand_total== flt(1511.29* cur_frm.doc.conversion_rate, precision('base_grand_total')), String(flt(1511.29* cur_frm.doc.conversion_rate, precision('base_grand_total')) + ' ' + cur_frm.doc.base_grand_total)); + assert.ok(cur_frm.doc.grand_total== 1511.29 , "grand total correct "); + assert.ok(cur_frm.doc.rounded_total== 1511.30, "rounded total correct "); + + // print format assert.ok($('.btn-print-print').is(':visible'), "Print Format Available"); frappe.timeout(1); assert.ok($(".section-break+ .section-break .column-break:nth-child(1) .data-field:nth-child(1) .value").text().includes("Billing Street 1"), "Print Preview Works As Expected");