From c67bf5026e801d72e2f6570160c0f3902174f841 Mon Sep 17 00:00:00 2001 From: Vishal Dhayagude Date: Thu, 27 Jul 2017 09:11:08 +0530 Subject: [PATCH] [UI Test] Create tax account in Charts of account (#10105) * [new]tax creation added * [new]path added test.txt --- .../doctype/account/test_make_tax_account.js | 46 +++++++++++++++++++ erpnext/tests/ui/tests.txt | 1 + 2 files changed, 47 insertions(+) create mode 100644 erpnext/accounts/doctype/account/test_make_tax_account.js diff --git a/erpnext/accounts/doctype/account/test_make_tax_account.js b/erpnext/accounts/doctype/account/test_make_tax_account.js new file mode 100644 index 00000000000..a0e09a13ce9 --- /dev/null +++ b/erpnext/accounts/doctype/account/test_make_tax_account.js @@ -0,0 +1,46 @@ +QUnit.module('accounts'); +QUnit.test("test account", assert => { + assert.expect(3); + let done = assert.async(); + frappe.run_serially([ + () => frappe.set_route('Tree', 'Account'), + () => frappe.click_button('Expand All'), + () => frappe.click_link('Duties and Taxes - '+ frappe.get_abbr(frappe.defaults.get_default("Company"))), + () => { + if($('a:contains("CGST"):visible').length == 0){ + return frappe.map_tax.make('CGST', 9); + } + }, + () => { + if($('a:contains("SGST"):visible').length == 0){ + return frappe.map_tax.make('SGST', 9); + } + }, + () => { + if($('a:contains("IGST"):visible').length == 0){ + return frappe.map_tax.make('IGST', 18); + } + }, + () => { + assert.ok($('a:contains("CGST"):visible').length!=0, "CGST Checked"); + assert.ok($('a:contains("SGST"):visible').length!=0, "SGST Checked"); + assert.ok($('a:contains("IGST"):visible').length!=0, "IGST Checked"); + }, + () => done() + ]); +}); + + +frappe.map_tax = { + make:function(text,rate){ + return frappe.run_serially([ + () => frappe.click_button('Add Child'), + () => frappe.timeout(0.2), + () => cur_dialog.set_value('account_name',text), + () => cur_dialog.set_value('account_type','Tax'), + () => cur_dialog.set_value('tax_rate',rate), + () => cur_dialog.set_value('account_currency','INR'), + () => frappe.click_button('Create New'), + ]); + } +}; diff --git a/erpnext/tests/ui/tests.txt b/erpnext/tests/ui/tests.txt index 0025e9fe42d..c46d6debb0f 100644 --- a/erpnext/tests/ui/tests.txt +++ b/erpnext/tests/ui/tests.txt @@ -1,6 +1,7 @@ erpnext/tests/ui/make_fixtures.js #long erpnext/setup/doctype/company/test_company.js erpnext/accounts/doctype/account/test_account.js +erpnext/accounts/doctype/account/test_make_tax_account.js erpnext/crm/doctype/lead/test_lead.js erpnext/crm/doctype/opportunity/test_opportunity.js erpnext/selling/doctype/quotation/test_quotation.js