[UI Test] UI Test for Purchase Receipt Added (#10434)

This commit is contained in:
Vishal Dhayagude 2017-08-18 11:55:14 +05:30 committed by Makarand Bauskar
parent 780f11ec16
commit 2890fa74a2
2 changed files with 37 additions and 17 deletions

View File

@ -1,23 +1,42 @@
/* eslint-disable */
// rename this file from _test_[name] to test_[name] to activate
// and remove above this line
QUnit.module('Stock');
QUnit.test("test: Purchase Receipt", function (assert) {
QUnit.test("test Purchase Receipt", function(assert) {
assert.expect(4);
let done = assert.async();
// number of asserts
assert.expect(1);
frappe.run_serially('Purchase Receipt', [
// insert a new Purchase Receipt
() => frappe.tests.make([
// values to be set
{key: 'value'}
]),
frappe.run_serially([
() => {
assert.equal(cur_frm.doc.key, 'value');
return frappe.tests.make('Purchase Receipt', [
{supplier: 'Test Supplier'},
{items: [
[
{'received_qty': 5},
{'qty': 4},
{'item_code': 'Test Product 1'},
{'uom': 'Nos'},
{'warehouse':'Stores - '+frappe.get_abbr(frappe.defaults.get_default('Company'))},
{'rejected_warehouse':'Work In Progress - '+frappe.get_abbr(frappe.defaults.get_default('Company'))},
]
]},
{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 1', "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");
// grand_total Calculated
assert.ok(cur_frm.doc.grand_total==472, "Grad Total correct");
},
() => frappe.tests.click_button('Submit'),
() => frappe.tests.click_button('Yes'),
() => frappe.timeout(0.3),
() => done()
]);
});

View File

@ -95,4 +95,5 @@ erpnext/buying/doctype/purchase_order/tests/test_purchase_order_get_items.js
erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_discount_on_grand_total.js
erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_item_wise_discount.js
erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_taxes_and_charges.js
erpnext/buying/doctype/purchase_order/tests/test_purchase_order_receipt.js
erpnext/buying/doctype/purchase_order/tests/test_purchase_order_receipt.js
erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.js