[UI Test] Sales Order with Shipping Rule and Pricing Rule Added (#10270)
* [UI Test] Sales Order with Shipping Rule Added
* [UI Test] Sales Order with Pricing Rule Added
diff --git a/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_pricing_rule.js b/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_pricing_rule.js
new file mode 100644
index 0000000..e91fb01
--- /dev/null
+++ b/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_pricing_rule.js
@@ -0,0 +1,34 @@
+QUnit.module('Sales Order');
+
+QUnit.test("test sales order with shipping rule", function(assert) {
+ assert.expect(2);
+ let done = assert.async();
+ frappe.run_serially([
+ () => {
+ return frappe.tests.make('Sales Order', [
+ {customer: 'Test Customer 3'},
+ {items: [
+ [
+ {'delivery_date': frappe.datetime.add_days(frappe.defaults.get_default("year_end_date"), 1)},
+ {'qty': 5},
+ {'item_code': 'Test Product 2'},
+ ]
+ ]},
+ {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 2', "Item name correct");
+ // get grand_total details
+ assert.ok(cur_frm.doc.grand_total== 675, "Grand total correct ");
+ },
+ () => frappe.tests.click_button('Submit'),
+ () => frappe.tests.click_button('Yes'),
+ () => frappe.timeout(0.3),
+ () => done()
+ ]);
+});
diff --git a/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_shipping_rule.js b/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_shipping_rule.js
new file mode 100644
index 0000000..7d1211f
--- /dev/null
+++ b/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_shipping_rule.js
@@ -0,0 +1,35 @@
+QUnit.module('Sales Order');
+
+QUnit.test("test sales order with shipping rule", 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'},
+ ]
+ ]},
+ {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()
+ ]);
+});
diff --git a/erpnext/tests/ui/tests.txt b/erpnext/tests/ui/tests.txt
index adfc67d..bc930b8 100644
--- a/erpnext/tests/ui/tests.txt
+++ b/erpnext/tests/ui/tests.txt
@@ -16,6 +16,8 @@
erpnext/selling/doctype/sales_order/tests/test_sales_order_with_multi_uom.js
erpnext/selling/doctype/sales_order/tests/test_sales_order_with_discount_on_grand_total.js
erpnext/selling/doctype/sales_order/tests/test_sales_order_with_taxes_and_charges.js
+erpnext/selling/doctype/sales_order/tests/test_sales_order_with_shipping_rule.js
+erpnext/selling/doctype/sales_order/tests/test_sales_order_with_pricing_rule.js
erpnext/manufacturing/doctype/workstation/test_workstation.js
erpnext/manufacturing/doctype/operation/test_operation.js
erpnext/manufacturing/doctype/bom/test_bom.js