From 192587fe56e6ec5a106769e1d4084035f7cbff42 Mon Sep 17 00:00:00 2001 From: tunde Date: Tue, 26 Sep 2017 01:32:08 +0100 Subject: [PATCH] UI test cases --- .../doctype/purchase_invoice/test_purchase_invoice.js | 6 +++++- .../doctype/sales_invoice/test_sales_invoice.js | 10 +++++++--- .../tests/test_sales_invoice_with_payment.js | 4 +++- .../selling/doctype/quotation/tests/test_quotation.js | 5 ++++- .../doctype/sales_order/tests/test_sales_order.js | 5 ++++- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.js index 6e33e1d7f2c..06a3e28d25e 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.js @@ -19,7 +19,8 @@ QUnit.test("test purchase invoice", function(assert) { {contact_person: 'Contact 3-Test Supplier'}, {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'} ]); }, () => cur_frm.save(), @@ -33,6 +34,9 @@ QUnit.test("test purchase invoice", function(assert) { // grand_total Calculated assert.ok(cur_frm.doc.grand_total==590, "Grad Total correct"); + 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"); + }, () => frappe.tests.click_button('Submit'), () => frappe.tests.click_button('Yes'), diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.js index f7a4488cd17..b4be3ba67cb 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.js @@ -1,7 +1,7 @@ QUnit.module('Sales Invoice'); QUnit.test("test sales Invoice", function(assert) { - assert.expect(4); + assert.expect(6); let done = assert.async(); frappe.run_serially([ () => { @@ -19,7 +19,8 @@ QUnit.test("test sales Invoice", 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'} ]); }, () => cur_frm.save(), @@ -31,7 +32,10 @@ QUnit.test("test sales Invoice", function(assert) { // 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"); + assert.ok(cur_frm.doc.grand_total==590, "Grand Total correct"); + + 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"); }, () => frappe.tests.click_button('Submit'), diff --git a/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment.js b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment.js index 736443e2609..14c0d55bd8a 100644 --- a/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment.js +++ b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment.js @@ -19,7 +19,8 @@ QUnit.test("test sales Invoice with payment", 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'} ]); }, () => cur_frm.save(), @@ -43,6 +44,7 @@ QUnit.test("test sales Invoice with payment", function(assert) { () => { cur_frm.set_value('paid_to','Cash - '+frappe.get_abbr(frappe.defaults.get_default('Company')));}, () => {cur_frm.set_value('reference_no','TEST1234');}, () => {cur_frm.set_value('reference_date',frappe.datetime.add_days(frappe.datetime.nowdate(), 0));}, + () => cur_frm.set_value("payment_schedule", []), () => cur_frm.save(), () => { // get payment details diff --git a/erpnext/selling/doctype/quotation/tests/test_quotation.js b/erpnext/selling/doctype/quotation/tests/test_quotation.js index 37491ed8fd4..d69d799d0de 100644 --- a/erpnext/selling/doctype/quotation/tests/test_quotation.js +++ b/erpnext/selling/doctype/quotation/tests/test_quotation.js @@ -1,5 +1,5 @@ QUnit.test("test: quotation", function (assert) { - assert.expect(10); + assert.expect(12); let done = assert.async(); frappe.run_serially([ () => { @@ -49,6 +49,9 @@ QUnit.test("test: quotation", function (assert) { // Check Terms and Condtions assert.ok(cur_frm.doc.tc_name == "Test Term 1", "Terms and Conditions Checked"); + 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"); + }, () => done() ]); 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 12661e3663f..8e813db7ad2 100644 --- a/erpnext/selling/doctype/sales_order/tests/test_sales_order.js +++ b/erpnext/selling/doctype/sales_order/tests/test_sales_order.js @@ -1,7 +1,7 @@ QUnit.module('Sales Order'); QUnit.test("test sales order", function(assert) { - assert.expect(10); + assert.expect(12); let done = assert.async(); frappe.run_serially([ () => { @@ -50,6 +50,9 @@ QUnit.test("test sales order", function(assert) { () => cur_frm.print_doc(), () => frappe.timeout(1), () => { + 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"); + 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");