Get Quotation requests and send emails to suppliers (#10356)

diff --git a/erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.js b/erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.js
new file mode 100644
index 0000000..75760bf
--- /dev/null
+++ b/erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.js
@@ -0,0 +1,74 @@
+QUnit.module('Buying');
+
+QUnit.test("test: request_for_quotation", function(assert) {
+	assert.expect(14);
+	let done = assert.async();
+	let date;
+	frappe.run_serially([
+		() => {
+			date = frappe.datetime.add_days(frappe.datetime.now_date(), 10);
+			return frappe.tests.make('Request for Quotation', [
+				{transaction_date: date},
+				{company: 'Test Company'},
+				{suppliers: [
+					[
+						{"supplier": 'Test Supplier'},
+						{"email_id": 'test@supplier.com'}
+					]
+				]},
+				{items: [
+					[
+						{"item_code": 'Test Product 4'},
+						{"qty": 5},
+						{"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(),20)},
+						{"warehouse": 'All Warehouses - TC'}
+					]
+				]},
+				{message_for_supplier: 'Please supply the specified items at the best possible rates'},
+				{tc_name: 'Test Term 1'}
+			]);
+		},
+		() => {
+			assert.ok(cur_frm.doc.transaction_date ==  date, "Date correct");
+			assert.ok(cur_frm.doc.company == 'Test Company', "Company correct");
+			assert.ok(cur_frm.doc.suppliers[0].supplier_name == 'Test Supplier', "Supplier name correct");
+			assert.ok(cur_frm.doc.suppliers[0].contact == 'Contact 3-Test Supplier', "Contact correct");
+			assert.ok(cur_frm.doc.suppliers[0].email_id == 'test@supplier.com', "Email id correct");
+			assert.ok(cur_frm.doc.items[0].item_name == 'Test Product 4', "Item Name correct");
+			assert.ok(cur_frm.doc.items[0].warehouse == 'All Warehouses - TC', "Warehouse correct");
+			assert.ok(cur_frm.doc.message_for_supplier == 'Please supply the specified items at the best possible rates', "Reply correct");
+			assert.ok(cur_frm.doc.tc_name == 'Test Term 1', "Term name correct");
+		},
+		() => frappe.timeout(0.3),
+		() => cur_frm.print_doc(),
+		() => frappe.timeout(1),
+		() => {
+			assert.ok($('.btn-print-print').is(':visible'), "Print Format Available");
+			assert.ok($('.section-break+ .section-break .column-break:nth-child(1) .value').text().includes("Test Product 4"), "Print Preview Works");
+		},
+		() => cur_frm.print_doc(),
+		() => frappe.timeout(1),
+		() => frappe.click_button('Get items from'),
+		() => frappe.timeout(0.3),
+		() => frappe.click_link('Material Request'),
+		() => frappe.timeout(1),
+		() => {
+			assert.ok($('h4').text().includes('Select Material Requests'), "Getting items from material requests work");
+		},
+		() => frappe.click_button('Close'),
+		() => frappe.timeout(1),
+		() => frappe.tests.click_button('Submit'),
+		() => frappe.tests.click_button('Yes'),
+		() => frappe.timeout(1),
+		() => {
+			assert.ok(cur_frm.doc.docstatus == 1, "Quotation request submitted");
+		},
+		() => frappe.click_button('Send Supplier Emails'),
+		() => frappe.timeout(3),
+		() => {
+			assert.ok($('div.modal.fade.in > div.modal-dialog > div > div.modal-body.ui-front > div.msgprint').text().includes("Email sent to supplier Test Supplier"), "Send emails working");
+		},
+		() => frappe.click_button('Close'),
+		() => done()
+	]);
+});
\ No newline at end of file
diff --git a/erpnext/tests/ui/tests.txt b/erpnext/tests/ui/tests.txt
index 5634935..0dc19ba 100644
--- a/erpnext/tests/ui/tests.txt
+++ b/erpnext/tests/ui/tests.txt
@@ -77,3 +77,4 @@
 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