[UI Tests] All sales order test in tests folders (#10211)
* [new] Sales order with_discount, multi_uom, delivery_date added * [fix] All sales order test in tests folder
This commit is contained in:
parent
564e8b74dc
commit
316477b422
@ -0,0 +1,37 @@
|
||||
QUnit.module('Sales Order');
|
||||
|
||||
QUnit.test("test sales order", function(assert) {
|
||||
assert.expect(2);
|
||||
let done = assert.async();
|
||||
frappe.run_serially([
|
||||
() => {
|
||||
return frappe.tests.make('Sales Order', [
|
||||
{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()
|
||||
]);
|
||||
});
|
@ -0,0 +1,38 @@
|
||||
QUnit.module('Sales Order');
|
||||
|
||||
QUnit.test("test sales order", function(assert) {
|
||||
assert.expect(3);
|
||||
let done = assert.async();
|
||||
frappe.run_serially([
|
||||
() => {
|
||||
return frappe.tests.make('Sales Order', [
|
||||
{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()
|
||||
]);
|
||||
});
|
@ -0,0 +1,59 @@
|
||||
/* eslint-disable */
|
||||
// rename this file from _test_[name] to test_[name] to activate
|
||||
// and remove above this line
|
||||
|
||||
QUnit.test("test: Sales Order", function (assert) {
|
||||
assert.expect(2);
|
||||
let done = assert.async();
|
||||
let delivery_date = frappe.datetime.add_days(frappe.defaults.get_default("year_end_date"), 1);
|
||||
|
||||
frappe.run_serially([
|
||||
// insert a new Sales Order
|
||||
() => {
|
||||
return frappe.tests.make('Sales Order', [
|
||||
{customer: "Test Customer 1"},
|
||||
{delivery_date: delivery_date},
|
||||
{order_type: 'Sales'},
|
||||
{items: [
|
||||
[
|
||||
{"item_code": "Test Product 1"},
|
||||
{"qty": 5},
|
||||
{'rate': 100},
|
||||
]]
|
||||
}
|
||||
])
|
||||
},
|
||||
() => {
|
||||
assert.ok(cur_frm.doc.items[0].delivery_date == delivery_date);
|
||||
},
|
||||
() => frappe.timeout(1),
|
||||
// make SO without delivery date in parent,
|
||||
// parent delivery date should be set based on final delivery date entered in item
|
||||
() => {
|
||||
return frappe.tests.make('Sales Order', [
|
||||
{customer: "Test Customer 1"},
|
||||
{order_type: 'Sales'},
|
||||
{items: [
|
||||
[
|
||||
{"item_code": "Test Product 1"},
|
||||
{"qty": 5},
|
||||
{'rate': 100},
|
||||
{'delivery_date': delivery_date}
|
||||
],
|
||||
[
|
||||
{"item_code": "Test Product 2"},
|
||||
{"qty": 5},
|
||||
{'rate': 100},
|
||||
{'delivery_date': frappe.datetime.add_days(delivery_date, 5)}
|
||||
]]
|
||||
}
|
||||
])
|
||||
},
|
||||
() => cur_frm.save(),
|
||||
() => frappe.timeout(1),
|
||||
() => {
|
||||
assert.ok(cur_frm.doc.delivery_date == frappe.datetime.add_days(delivery_date, 5));
|
||||
},
|
||||
() => done()
|
||||
]);
|
||||
});
|
@ -8,7 +8,10 @@ erpnext/crm/doctype/opportunity/test_opportunity.js
|
||||
erpnext/selling/doctype/quotation/test_quotation.js
|
||||
erpnext/setup/doctype/company/tests/test_company_production.js
|
||||
erpnext/crm/doctype/item/test_item.js
|
||||
erpnext/selling/doctype/sales_order/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_item_wise_discount.js
|
||||
erpnext/selling/doctype/sales_order/tests/test_sales_order_with_multi_uom.js
|
||||
erpnext/manufacturing/doctype/workstation/test_workstation.js
|
||||
erpnext/manufacturing/doctype/operation/test_operation.js
|
||||
erpnext/manufacturing/doctype/bom/test_bom.js
|
||||
|
Loading…
x
Reference in New Issue
Block a user