From f9e4893d9dfa6b38e48eb183b483b4a439788879 Mon Sep 17 00:00:00 2001 From: Vishal Dhayagude Date: Wed, 2 Aug 2017 17:16:46 +0530 Subject: [PATCH] [UI Test] Test added for Shipping Rule (#10229) * [UI Test] Test added for Shipping Rule * [fix]Travis Failed --- .../shipping_rule/test_shipping_rule.js | 35 +++++++++++++++++++ .../tests/test_student_applicant_options.js | 1 + erpnext/tests/ui/tests.txt | 1 + 3 files changed, 37 insertions(+) create mode 100644 erpnext/accounts/doctype/shipping_rule/test_shipping_rule.js diff --git a/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.js b/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.js new file mode 100644 index 00000000000..9c72aebf609 --- /dev/null +++ b/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.js @@ -0,0 +1,35 @@ +QUnit.module('Shipping Rule'); + +QUnit.test("test Shipping Rule", function(assert) { + assert.expect(1); + let done = assert.async(); + frappe.run_serially([ + () => { + return frappe.tests.make("Shipping Rule", [ + {label: "Next Day Shipping"}, + {conditions:[ + [ + {from_value:1}, + {to_value:200}, + {shipping_amount:100} + ], + [ + {from_value:201}, + {to_value:2000}, + {shipping_amount:50} + ], + ]}, + {countries:[ + [ + {country:'India'} + ] + ]}, + {account:'Accounts Payable - '+frappe.get_abbr(frappe.defaults.get_default("Company"))}, + {cost_center:'Main - '+frappe.get_abbr(frappe.defaults.get_default("Company"))} + ]); + }, + () => {assert.ok(cur_frm.doc.name=='Next Day Shipping');}, + () => done() + ]); +}); + diff --git a/erpnext/schools/doctype/student_applicant/tests/test_student_applicant_options.js b/erpnext/schools/doctype/student_applicant/tests/test_student_applicant_options.js index 59b2b368032..61f36e2cbf5 100644 --- a/erpnext/schools/doctype/student_applicant/tests/test_student_applicant_options.js +++ b/erpnext/schools/doctype/student_applicant/tests/test_student_applicant_options.js @@ -7,6 +7,7 @@ QUnit.test('test student applicant', function(assert){ let testing_status; frappe.run_serially([ () => frappe.set_route('Form', 'School House/New School House'), + () => frappe.timeout(0.5), () => cur_frm.doc.house_name = 'Test_house', () => cur_frm.save(), () => frappe.set_route('List', 'Student Applicant'), diff --git a/erpnext/tests/ui/tests.txt b/erpnext/tests/ui/tests.txt index c21c6717637..a685d2b95d0 100644 --- a/erpnext/tests/ui/tests.txt +++ b/erpnext/tests/ui/tests.txt @@ -3,6 +3,7 @@ erpnext/setup/doctype/company/tests/test_company.js erpnext/accounts/doctype/account/test_account.js erpnext/accounts/doctype/account/test_make_tax_account.js erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.js +erpnext/accounts/doctype/shipping_rule/test_shipping_rule.js erpnext/crm/doctype/lead/test_lead.js erpnext/crm/doctype/opportunity/test_opportunity.js erpnext/selling/doctype/quotation/test_quotation.js