[UI Test] UI test for Repack and Sales Invoice with Serialize item Added (#10583)

* [UI Test] UI test for Repack and Sales Invoice with Serialize item Added

* [Fix] Fixed path for sales invoice"
This commit is contained in:
Vishal Dhayagude 2017-08-31 14:47:56 +05:30 committed by Makarand Bauskar
parent 1458d7fea6
commit 1252c30edf
3 changed files with 89 additions and 0 deletions

View File

@ -0,0 +1,45 @@
QUnit.module('Sales Invoice');
QUnit.test("test sales Invoice with serialize item", function(assert) {
assert.expect(5);
let done = assert.async();
frappe.run_serially([
() => {
return frappe.tests.make('Sales Invoice', [
{customer: 'Test Customer 1'},
{items: [
[
{'qty': 2},
{'item_code': 'Test Product 4'},
]
]},
{update_stock:1},
{customer_address: 'Test1-Billing'},
{shipping_address_name: 'Test1-Shipping'},
{contact_person: 'Contact 1-Test Customer 1'},
{taxes_and_charges: 'TEST In State GST'},
{tc_name: 'Test Term 1'},
{terms: 'This is Test'}
]);
},
() => cur_frm.save(),
() => {
// get_item_details
assert.ok(cur_frm.doc.items[0].item_name=='Test Product 4', "Item name correct");
// get tax details
assert.ok(cur_frm.doc.taxes_and_charges=='TEST In State GST', "Tax details correct");
// get tax account head details
assert.ok(cur_frm.doc.taxes[0].account_head=='CGST - '+frappe.get_abbr(frappe.defaults.get_default('Company')), " Account Head abbr correct");
// get batch number
assert.ok(cur_frm.doc.items[0].batch_no=='TEST-BATCH-001', " Batch Details correct");
// grand_total Calculated
assert.ok(cur_frm.doc.grand_total==218, "Grad Total correct");
},
() => frappe.tests.click_button('Submit'),
() => frappe.tests.click_button('Yes'),
() => frappe.timeout(0.3),
() => done()
]);
});

View File

@ -0,0 +1,42 @@
QUnit.module('Stock');
QUnit.test("test repack", function(assert) {
assert.expect(2);
let done = assert.async();
frappe.run_serially([
() => {
return frappe.tests.make('Stock Entry', [
{purpose:'Repack'},
{items: [
[
{'item_code': 'Test Product 1'},
{'qty': 1},
{'s_warehouse':'Stores - '+frappe.get_abbr(frappe.defaults.get_default('Company'))},
],
[
{'item_code': 'Test Product 2'},
{'qty': 1},
{'s_warehouse':'Stores - '+frappe.get_abbr(frappe.defaults.get_default('Company'))},
],
[
{'item_code': 'Test Product 3'},
{'qty': 1},
{'t_warehouse':'Work In Progress - '+frappe.get_abbr(frappe.defaults.get_default('Company'))},
],
]},
]);
},
() => cur_frm.save(),
() => frappe.click_button('Update Rate and Availability'),
() => {
// get_item_details
assert.ok(cur_frm.doc.total_outgoing_value==250, " Outgoing Value correct");
assert.ok(cur_frm.doc.total_incoming_value==250, " Incoming Value correct");
},
() => frappe.tests.click_button('Submit'),
() => frappe.tests.click_button('Yes'),
() => frappe.timeout(0.3),
() => done()
]);
});

View File

@ -123,3 +123,5 @@ erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_receipt_fo
erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_transfer_for_manufacture.js
erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_subcontract.js
erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_issue_with_serialize_item.js
erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_repack.js
erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_serialize_item.js