[UI Tests] Buying Module - Supplier quotations and Purchase orders (#10397)
* Get Supplier Quotation with item wise discount * Get purchase orders * Added paths * Codacy fix
This commit is contained in:
parent
0973161ae5
commit
f6544e95d4
@ -0,0 +1,67 @@
|
||||
QUnit.module('Buying');
|
||||
|
||||
QUnit.test("test: purchase order", function(assert) {
|
||||
assert.expect(11);
|
||||
let done = assert.async();
|
||||
|
||||
frappe.run_serially([
|
||||
() => {
|
||||
return frappe.tests.make('Purchase Order', [
|
||||
{supplier: 'Test Supplier'},
|
||||
{company: 'Wind Power LLC'},
|
||||
{is_subcontracted: 'No'},
|
||||
{buying_price_list: 'Test-Buying-USD'},
|
||||
{currency: 'USD'},
|
||||
{items: [
|
||||
[
|
||||
{"item_code": 'Test Product 4'},
|
||||
{"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)},
|
||||
{"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)},
|
||||
{"qty": 5},
|
||||
{"uom": 'Unit'},
|
||||
{"rate": 100},
|
||||
{"warehouse": 'Stores - WP'}
|
||||
]
|
||||
]},
|
||||
|
||||
{tc_name: 'Test Term 1'},
|
||||
{terms: 'This is a term.'}
|
||||
]);
|
||||
},
|
||||
|
||||
() => {
|
||||
// Get supplier details
|
||||
assert.ok(cur_frm.doc.supplier_name == 'Test Supplier', "Supplier name correct");
|
||||
assert.ok($('div.control-value.like-disabled-input.for-description').text().includes('Contact 3'), "Contact display correct");
|
||||
assert.ok(cur_frm.doc.contact_email == 'test@supplier.com', "Contact email correct");
|
||||
// Get item details
|
||||
assert.ok(cur_frm.doc.items[0].item_name == 'Test Product 4', "Item name correct");
|
||||
assert.ok(cur_frm.doc.items[0].description == 'Test Product 4', "Description correct");
|
||||
assert.ok(cur_frm.doc.items[0].qty == 5, "Quantity correct");
|
||||
// Calculate total
|
||||
assert.ok(cur_frm.doc.total == 500, "Total correct");
|
||||
// Get terms
|
||||
assert.ok(cur_frm.doc.terms == 'This is a term.', "Terms correct");
|
||||
},
|
||||
|
||||
() => cur_frm.print_doc(),
|
||||
() => frappe.timeout(1),
|
||||
() => {
|
||||
assert.ok($('.btn-print-print').is(':visible'), "Print Format Available");
|
||||
assert.ok($('div > div:nth-child(5) > div > div > table > tbody > tr > td:nth-child(4) > div').text().includes('Test Product 4'), "Print Preview Works");
|
||||
},
|
||||
|
||||
() => cur_frm.print_doc(),
|
||||
() => frappe.timeout(1),
|
||||
|
||||
() => frappe.tests.click_button('Submit'),
|
||||
() => frappe.tests.click_button('Yes'),
|
||||
() => frappe.timeout(0.3),
|
||||
|
||||
() => {
|
||||
assert.ok(cur_frm.doc.status == 'To Receive and Bill', "Submitted successfully");
|
||||
},
|
||||
|
||||
() => done()
|
||||
]);
|
||||
});
|
@ -0,0 +1,62 @@
|
||||
QUnit.module('Buying');
|
||||
|
||||
QUnit.test("test: purchase order with get items", function(assert) {
|
||||
assert.expect(4);
|
||||
let done = assert.async();
|
||||
|
||||
frappe.run_serially([
|
||||
() => {
|
||||
return frappe.tests.make('Purchase Order', [
|
||||
{supplier: 'Test Supplier'},
|
||||
{company: 'Wind Power LLC'},
|
||||
{is_subcontracted: 'No'},
|
||||
{buying_price_list: 'Test-Buying-USD'},
|
||||
{currency: 'USD'},
|
||||
{items: [
|
||||
[
|
||||
{"item_code": 'Test Product 4'},
|
||||
{"qty": 5},
|
||||
{"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)},
|
||||
{"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)},
|
||||
{"warehouse": 'Stores - WP'}
|
||||
]
|
||||
]}
|
||||
]);
|
||||
},
|
||||
|
||||
() => {
|
||||
assert.ok(cur_frm.doc.supplier_name == 'Test Supplier', "Supplier name correct");
|
||||
},
|
||||
|
||||
() => frappe.timeout(0.3),
|
||||
() => frappe.click_button('Get items from'),
|
||||
() => frappe.timeout(0.3),
|
||||
|
||||
() => frappe.click_link('Product Bundle'),
|
||||
() => frappe.timeout(0.5),
|
||||
|
||||
() => cur_dialog.set_value('product_bundle', 'Computer'),
|
||||
() => frappe.click_button('Get Items'),
|
||||
() => frappe.timeout(1),
|
||||
|
||||
// Check if items are fetched from Product Bundle
|
||||
() => {
|
||||
assert.ok(cur_frm.doc.items[1].item_name == 'CPU', "Product bundle item 1 correct");
|
||||
assert.ok(cur_frm.doc.items[2].item_name == 'Screen', "Product bundle item 2 correct");
|
||||
assert.ok(cur_frm.doc.items[3].item_name == 'Keyboard', "Product bundle item 3 correct");
|
||||
},
|
||||
|
||||
() => cur_frm.doc.items[1].warehouse = 'Stores - WP',
|
||||
() => cur_frm.doc.items[2].warehouse = 'Stores - WP',
|
||||
() => cur_frm.doc.items[3].warehouse = 'Stores - WP',
|
||||
|
||||
() => cur_frm.save(),
|
||||
() => frappe.timeout(1),
|
||||
|
||||
() => frappe.tests.click_button('Submit'),
|
||||
() => frappe.tests.click_button('Yes'),
|
||||
() => frappe.timeout(0.3),
|
||||
|
||||
() => done()
|
||||
]);
|
||||
});
|
@ -0,0 +1,40 @@
|
||||
QUnit.module('Buying');
|
||||
|
||||
QUnit.test("test: purchase order with multi UOM", function(assert) {
|
||||
assert.expect(3);
|
||||
let done = assert.async();
|
||||
|
||||
frappe.run_serially([
|
||||
() => {
|
||||
return frappe.tests.make('Purchase Order', [
|
||||
{supplier: 'Test Supplier'},
|
||||
{company: 'Wind Power LLC'},
|
||||
{is_subcontracted: 'No'},
|
||||
{items: [
|
||||
[
|
||||
{"item_code": 'Test Product 4'},
|
||||
{"qty": 5},
|
||||
{"uom": 'Unit'},
|
||||
{"rate": 100},
|
||||
{"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)},
|
||||
{"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)},
|
||||
{"warehouse": 'Stores - WP'}
|
||||
]
|
||||
]}
|
||||
]);
|
||||
},
|
||||
|
||||
() => {
|
||||
assert.ok(cur_frm.doc.supplier_name == 'Test Supplier', "Supplier name correct");
|
||||
assert.ok(cur_frm.doc.items[0].item_name == 'Test Product 4', "Item name correct");
|
||||
assert.ok(cur_frm.doc.items[0].uom == 'Unit', "Multi UOM correct");
|
||||
},
|
||||
|
||||
() => frappe.timeout(1),
|
||||
() => frappe.tests.click_button('Submit'),
|
||||
() => frappe.tests.click_button('Yes'),
|
||||
() => frappe.timeout(0.3),
|
||||
|
||||
() => done()
|
||||
]);
|
||||
});
|
@ -0,0 +1,34 @@
|
||||
QUnit.module('Buying');
|
||||
|
||||
QUnit.test("test: supplier quotation with item wise discount", function(assert){
|
||||
assert.expect(2);
|
||||
let done = assert.async();
|
||||
|
||||
frappe.run_serially([
|
||||
() => {
|
||||
return frappe.tests.make('Supplier Quotation', [
|
||||
{supplier: 'Test Supplier'},
|
||||
{company: 'Test Company'},
|
||||
{items: [
|
||||
[
|
||||
{"item_code": 'Test Product 4'},
|
||||
{"qty": 5},
|
||||
{"uom": 'Unit'},
|
||||
{"warehouse": 'All Warehouses - TC'},
|
||||
{'discount_percentage': 10},
|
||||
]
|
||||
]}
|
||||
]);
|
||||
},
|
||||
|
||||
() => {
|
||||
assert.ok(cur_frm.doc.total == 900, "Total correct");
|
||||
assert.ok(cur_frm.doc.grand_total == 900, "Grand total correct");
|
||||
},
|
||||
|
||||
() => frappe.tests.click_button('Submit'),
|
||||
() => frappe.tests.click_button('Yes'),
|
||||
() => frappe.timeout(0.3),
|
||||
() => done()
|
||||
]);
|
||||
});
|
@ -83,4 +83,8 @@ erpnext/buying/doctype/supplier/test_supplier.js
|
||||
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
|
||||
erpnext/accounts/doctype/sales_invoice/test_sales_invoice.js
|
||||
erpnext/accounts/doctype/sales_invoice/test_sales_invoice.js
|
||||
erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation_for_item_wise_discount.js
|
||||
erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js
|
||||
erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_multi_uom.js
|
||||
erpnext/buying/doctype/purchase_order/tests/test_purchase_order_get_items.js
|
Loading…
x
Reference in New Issue
Block a user