[UI Test] Multiple UI Test for Quotation (#10330)

This commit is contained in:
Vishal Dhayagude 2017-08-08 18:22:53 +05:30 committed by Nabin Hait
parent 96e52be5f1
commit 135560e170
7 changed files with 201 additions and 1 deletions

View File

@ -0,0 +1,42 @@
QUnit.module('Quotation');
QUnit.test("test quotation with additional discount in grand total", function(assert) {
assert.expect(2);
let done = assert.async();
frappe.run_serially([
() => {
return frappe.tests.make('Quotation', [
{customer: 'Test Customer 1'},
{items: [
[
{'delivery_date': frappe.datetime.add_days(frappe.defaults.get_default("year_end_date"), 1)},
{'qty': 5},
{'item_code': 'Test Product 4'},
]
]},
{customer_address: 'Test1-Billing'},
{shipping_address_name: 'Test1-Shipping'},
{contact_person: 'Contact 1-Test Customer 1'}
]);
},
() => {
return frappe.tests.set_form_values(cur_frm, [
{apply_discount_on:'Grand Total'},
{additional_discount_percentage:10}
]);
},
() => cur_frm.save(),
() => {
// get_item_details
assert.ok(cur_frm.doc.items[0].item_name=='Test Product 4', "Item name correct");
// get grand_total details
assert.ok(cur_frm.doc.grand_total== 450, "Grand total correct ");
},
() => frappe.tests.click_button('Submit'),
() => frappe.tests.click_button('Yes'),
() => frappe.timeout(0.3),
() => done()
]);
});

View File

@ -0,0 +1,38 @@
QUnit.module('Quotation');
QUnit.test("test quotation with item wise discount", function(assert) {
assert.expect(2);
let done = assert.async();
frappe.run_serially([
() => {
return frappe.tests.make('Quotation', [
{customer: 'Test Customer 1'},
{items: [
[
{'delivery_date': frappe.datetime.add_days(frappe.defaults.get_default("year_end_date"), 1)},
{'qty': 5},
{'item_code': 'Test Product 4'},
{'discount_percentage': 10},
{'margin_type': 'Percentage'}
]
]},
{customer_address: 'Test1-Billing'},
{shipping_address_name: 'Test1-Shipping'},
{contact_person: 'Contact 1-Test Customer 1'}
]);
},
() => cur_frm.save(),
() => {
// get_item_details
assert.ok(cur_frm.doc.items[0].item_name=='Test Product 4', "Item name correct");
// get grand_total details
assert.ok(cur_frm.doc.grand_total== 450, "Grand total correct ");
},
() => frappe.tests.click_button('Submit'),
() => frappe.tests.click_button('Yes'),
() => frappe.timeout(0.3),
() => done()
]);
});

View File

@ -0,0 +1,39 @@
QUnit.module('Quotation');
QUnit.test("test quotation with multi uom", function(assert) {
assert.expect(3);
let done = assert.async();
frappe.run_serially([
() => {
return frappe.tests.make('Quotation', [
{customer: 'Test Customer 1'},
{items: [
[
{'delivery_date': frappe.datetime.add_days(frappe.defaults.get_default("year_end_date"), 1)},
{'qty': 5},
{'item_code': 'Test Product 4'},
{'uom': 'unit'},
]
]},
{customer_address: 'Test1-Billing'},
{shipping_address_name: 'Test1-Shipping'},
{contact_person: 'Contact 1-Test Customer 1'}
]);
},
() => cur_frm.save(),
() => {
// get_item_details
assert.ok(cur_frm.doc.items[0].item_name=='Test Product 4', "Item name correct");
// get uom details
assert.ok(cur_frm.doc.items[0].uom=='Unit', "Multi Uom correct");
// get grand_total details
assert.ok(cur_frm.doc.grand_total== 5000, "Grand total correct ");
},
() => frappe.tests.click_button('Submit'),
() => frappe.tests.click_button('Yes'),
() => frappe.timeout(0.3),
() => done()
]);
});

View File

@ -0,0 +1,35 @@
QUnit.module('Quotation');
QUnit.test("test quotation with shipping rule", function(assert) {
assert.expect(2);
let done = assert.async();
frappe.run_serially([
() => {
return frappe.tests.make('Quotation', [
{customer: 'Test Customer 1'},
{items: [
[
{'delivery_date': frappe.datetime.add_days(frappe.defaults.get_default("year_end_date"), 1)},
{'qty': 5},
{'item_code': 'Test Product 4'},
]
]},
{customer_address: 'Test1-Billing'},
{shipping_address_name: 'Test1-Shipping'},
{contact_person: 'Contact 1-Test Customer 1'},
{shipping_rule:'Next Day Shipping'}
]);
},
() => cur_frm.save(),
() => {
// get_item_details
assert.ok(cur_frm.doc.items[0].item_name=='Test Product 4', "Item name correct");
// get grand_total details
assert.ok(cur_frm.doc.grand_total== 550, "Grand total correct ");
},
() => frappe.tests.click_button('Submit'),
() => frappe.tests.click_button('Yes'),
() => frappe.timeout(0.3),
() => done()
]);
});

View File

@ -0,0 +1,41 @@
QUnit.module('Quotation');
QUnit.test("test quotation with taxes and charges", function(assert) {
assert.expect(3);
let done = assert.async();
frappe.run_serially([
() => {
return frappe.tests.make('Quotation', [
{customer: 'Test Customer 1'},
{items: [
[
{'delivery_date': frappe.datetime.add_days(frappe.defaults.get_default("year_end_date"), 1)},
{'qty': 5},
{'item_code': 'Test Product 4'},
]
]},
{customer_address: 'Test1-Billing'},
{shipping_address_name: 'Test1-Shipping'},
{contact_person: 'Contact 1-Test Customer 1'},
{taxes_and_charges: 'TEST In State GST'},
{tc_name: 'Test Term 1'},
{terms: 'This is Test'}
]);
},
() => cur_frm.save(),
() => {
// get_item_details
assert.ok(cur_frm.doc.items[0].item_name=='Test Product 4', "Item name correct");
// get tax details
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");
},
() => frappe.tests.click_button('Submit'),
() => frappe.tests.click_button('Yes'),
() => frappe.timeout(0.3),
() => done()
]);
});

View File

@ -7,9 +7,14 @@ erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_c
erpnext/accounts/doctype/shipping_rule/test_shipping_rule.js erpnext/accounts/doctype/shipping_rule/test_shipping_rule.js
erpnext/crm/doctype/lead/test_lead.js erpnext/crm/doctype/lead/test_lead.js
erpnext/crm/doctype/opportunity/test_opportunity.js erpnext/crm/doctype/opportunity/test_opportunity.js
erpnext/selling/doctype/quotation/test_quotation.js
erpnext/setup/doctype/company/tests/test_company_production.js erpnext/setup/doctype/company/tests/test_company_production.js
erpnext/crm/doctype/item/test_item.js erpnext/crm/doctype/item/test_item.js
erpnext/selling/doctype/quotation/tests/test_quotation_with_discount_on_grand_total.js
erpnext/selling/doctype/quotation/tests/test_quotation_with_item_wise_discount.js
erpnext/selling/doctype/quotation/tests/test_quotation_with_multi_uom.js
erpnext/selling/doctype/quotation/tests/test_quotation_with_taxes_and_charges.js
erpnext/selling/doctype/quotation/tests/test_quotation_with_shipping_rule.js
erpnext/selling/doctype/quotation/tests/test_quotation.js
erpnext/selling/doctype/sales_order/tests/test_sales_order.js erpnext/selling/doctype/sales_order/tests/test_sales_order.js
erpnext/selling/doctype/sales_order/tests/test_sales_order_with_multiple_delivery_date.js erpnext/selling/doctype/sales_order/tests/test_sales_order_with_multiple_delivery_date.js
erpnext/selling/doctype/sales_order/tests/test_sales_order_with_item_wise_discount.js erpnext/selling/doctype/sales_order/tests/test_sales_order_with_item_wise_discount.js