[UI test] Buying module - Get Supplier Quotations (#10375)

* Get quotations for Suppliers

* Calculate taxes and charges for Supplier quotations

* Added paths for tests

* Codacy fix

* Improvised the page route function
diff --git a/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation.js b/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation.js
new file mode 100644
index 0000000..81e512b
--- /dev/null
+++ b/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation.js
@@ -0,0 +1,75 @@
+QUnit.module('Buying');
+
+QUnit.test("test: supplier quotation", function(assert) {
+	assert.expect(11);
+	let done = assert.async();
+	let date;
+
+	frappe.run_serially([
+		() => {
+			date = frappe.datetime.add_days(frappe.datetime.now_date(), 10);
+			return frappe.tests.make('Supplier Quotation', [
+				{supplier: 'Test Supplier'},
+				{transaction_date: date},
+				{company: 'Wind Power LLC'},
+				{buying_price_list: 'Test-Buying-USD'},
+				{currency: 'USD'},
+				{items: [
+					[
+						{"item_code": 'Test Product 4'},
+						{"qty": 5},
+						{"uom": 'Unit'},
+						{"rate": 200},
+						{"warehouse": 'All Warehouses - WP'}
+					]
+				]},
+				{apply_discount_on: 'Grand Total'},
+				{additional_discount_percentage: 10},
+				{tc_name: 'Test Term 1'},
+				{terms: 'This is a term'}
+			]);
+		},
+		() => {
+			// Get Supplier details
+			assert.ok(cur_frm.doc.supplier == 'Test Supplier', "Supplier correct");
+			assert.ok(cur_frm.doc.company == 'Wind Power LLC', "Company correct");
+			// Get Contact details
+			assert.ok(cur_frm.doc.contact_display == 'Contact 3', "Conatct correct");
+			assert.ok(cur_frm.doc.contact_email == 'test@supplier.com', "Email correct");
+			// Get uom
+			assert.ok(cur_frm.doc.items[0].uom == 'Unit', "Multi uom correct");
+			assert.ok(cur_frm.doc.total ==  1000, "Total correct");
+			// Calculate total after discount
+			assert.ok(cur_frm.doc.grand_total ==  900, "Grand total correct");
+			// Get terms
+			assert.ok(cur_frm.doc.tc_name == 'Test Term 1', "Terms correct");
+		},
+
+		() => cur_frm.print_doc(),
+		() => frappe.timeout(1),
+		() => {
+			assert.ok($('.btn-print-print').is(':visible'), "Print Format Available");
+			assert.ok($("table > tbody > tr > td:nth-child(3) > div").text().includes("Test Product 4"), "Print Preview Works As Expected");
+		},
+		() => cur_frm.print_doc(),
+		() => frappe.timeout(1),
+		() => frappe.click_button('Get items from'),
+		() => frappe.timeout(0.3),
+		() => frappe.click_link('Material Request'),
+		() => frappe.timeout(0.3),
+		() => frappe.click_button('Get Items'),
+		() => frappe.timeout(1),
+		() => {
+			// Get item from Material Requests
+			assert.ok(cur_frm.doc.items[1].item_name == 'Test Product 1', "Getting items from material requests work");
+		},
+
+		() => cur_frm.save(),
+		() => frappe.timeout(1),
+		() => frappe.tests.click_button('Submit'),
+		() => frappe.tests.click_button('Yes'),
+		() => frappe.timeout(0.3),
+
+		() => done()
+	]);
+});
\ No newline at end of file
diff --git a/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation_for_taxes_and_charges.js b/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation_for_taxes_and_charges.js
new file mode 100644
index 0000000..e1e393b
--- /dev/null
+++ b/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation_for_taxes_and_charges.js
@@ -0,0 +1,62 @@
+QUnit.module('Buying');
+
+QUnit.test("test: supplier quotation with taxes and charges", function(assert) {
+	assert.expect(3);
+	let done = assert.async();
+	let supplier_quotation_name;
+
+	frappe.run_serially([
+		() => {
+			return frappe.tests.make('Supplier Quotation', [
+				{supplier: 'Test Supplier'},
+				{items: [
+					[
+						{"item_code": 'Test Product 4'},
+						{"qty": 5},
+						{"rate": 100},
+						{"warehouse": 'Stores - WP'},
+					]
+				]},
+			]);
+		},
+		() => {supplier_quotation_name = cur_frm.doc.name;},
+		() => frappe.set_route('Form', 'Purchase Taxes and Charges Template', 'New Purchase Taxes and Charges Template'),
+		() => frappe.timeout(1),
+		() => {
+			return frappe.tests.set_form_values(cur_frm, [
+				{title:'TEST In State GST'},
+				{taxes: [
+					[
+						{"charge_type": 'On Net Total'},
+						{"account_head": 'CGST - WP'}
+					],
+					[
+						{"charge_type": 'On Net Total'},
+						{"account_head": 'SGST - WP'}
+					]
+				]},
+			]);
+		},
+		() => cur_frm.save(),
+		() => frappe.set_route('Form', 'Supplier Quotation', supplier_quotation_name),
+		() => frappe.timeout(1),
+		() => {
+			return frappe.tests.set_form_values(cur_frm, [
+				{taxes_and_charges:'TEST In State GST'}
+			]);
+		},
+
+		() => {
+			assert.ok(cur_frm.doc.taxes[0].account_head=='CGST - '+frappe.get_abbr(frappe.defaults.get_default('Company')), " Account Head abbr correct");
+			assert.ok(cur_frm.doc.total_taxes_and_charges == 45, "Taxes and charges correct");
+			assert.ok(cur_frm.doc.grand_total == 545, "Grand total correct");
+		},
+
+		() => cur_frm.save(),
+		() => frappe.timeout(0.3),
+		() => frappe.tests.click_button('Submit'),
+		() => frappe.tests.click_button('Yes'),
+		() => frappe.timeout(0.3),
+		() => done()
+	]);
+});
\ No newline at end of file
diff --git a/erpnext/tests/ui/tests.txt b/erpnext/tests/ui/tests.txt
index e962ea6..0bc61fa 100644
--- a/erpnext/tests/ui/tests.txt
+++ b/erpnext/tests/ui/tests.txt
@@ -80,4 +80,6 @@
 erpnext/schools/doctype/assessment_result/test_assessment_result.js
 erpnext/schools/doctype/assessment_result_tool/test_assessment_result_tool.js
 erpnext/buying/doctype/supplier/test_supplier.js
-erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.js
\ No newline at end of file
+erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.js
+erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation.js
+erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation_for_taxes_and_charges.js
\ No newline at end of file