From ed0b107a9fc1d634d2a2fde4b5af5e66ee611f1b Mon Sep 17 00:00:00 2001 From: Vishal Dhayagude Date: Wed, 2 Aug 2017 17:31:20 +0530 Subject: [PATCH] [UI Test] UI test added for Pricing Rule (#10237) * [UI Test] UI test added for Pricing Rule * [mod]minor chages in pricing rule test * [fix] codacy fixed --- .../doctype/pricing_rule/test_pricing_rule.js | 28 +++++++++++++++++++ erpnext/tests/ui/tests.txt | 1 + 2 files changed, 29 insertions(+) create mode 100644 erpnext/accounts/doctype/pricing_rule/test_pricing_rule.js diff --git a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.js b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.js new file mode 100644 index 00000000000..4d34033f6b0 --- /dev/null +++ b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.js @@ -0,0 +1,28 @@ +QUnit.module('Pricing Rule"'); + +QUnit.test("test pricing rule", function(assert) { + assert.expect(2); + let done = assert.async(); + frappe.run_serially([ + () => { + return frappe.tests.make("Pricing Rule", [ + {title: 'Test Pricing Rule'}, + {item_code:'Test Product 2'}, + {selling:1}, + {applicable_for:'Customer'}, + {customer:'Test Customer 3'}, + {min_qty:1}, + {max_qty:20}, + {valid_upto: frappe.datetime.add_days(frappe.defaults.get_default("year_end_date"), 1)}, + {discount_percentage:10}, + {for_price_list:'Standard Selling'} + ]); + }, + () => { + assert.ok(cur_frm.doc.item_code=='Test Product 2'); + assert.ok(cur_frm.doc.customer=='Test Customer 3'); + }, + () => done() + ]); +}); + diff --git a/erpnext/tests/ui/tests.txt b/erpnext/tests/ui/tests.txt index a685d2b95d0..fb86b7c24bf 100644 --- a/erpnext/tests/ui/tests.txt +++ b/erpnext/tests/ui/tests.txt @@ -2,6 +2,7 @@ erpnext/tests/ui/make_fixtures.js #long 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/pricing_rule/test_pricing_rule.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