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

This commit is contained in:
Shreya Shah 2017-08-10 16:20:47 +05:30 committed by Makarand Bauskar
parent a854ea00a5
commit 5ae39ae79a
2 changed files with 75 additions and 0 deletions

View File

@ -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()
]);
});

View File

@ -77,3 +77,4 @@ erpnext/schools/doctype/assessment_plan/test_assessment_plan.js
erpnext/schools/doctype/assessment_result/test_assessment_result.js erpnext/schools/doctype/assessment_result/test_assessment_result.js
erpnext/schools/doctype/assessment_result_tool/test_assessment_result_tool.js erpnext/schools/doctype/assessment_result_tool/test_assessment_result_tool.js
erpnext/buying/doctype/supplier/test_supplier.js erpnext/buying/doctype/supplier/test_supplier.js
erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.js