[ui-test] manufacturing item creation testing (#10009)
This commit is contained in:
parent
e355f99786
commit
73f969fd7f
85
erpnext/crm/doctype/item/test_item.js
Normal file
85
erpnext/crm/doctype/item/test_item.js
Normal file
@ -0,0 +1,85 @@
|
||||
QUnit.test("test: item", function (assert) {
|
||||
assert.expect(18);
|
||||
let done = assert.async();
|
||||
frappe.run_serially([
|
||||
// test item creation
|
||||
() => frappe.set_route("List", "Item"),
|
||||
|
||||
// Create a keyboard item
|
||||
() => frappe.tests.make(
|
||||
"Item", [
|
||||
{item_code: "Keyboard"},
|
||||
{item_group: "Products"},
|
||||
{is_stock_item: 1},
|
||||
{standard_rate: 1000},
|
||||
{opening_stock: 100}
|
||||
]
|
||||
),
|
||||
() => {
|
||||
assert.ok(cur_frm.doc.item_name.includes('Keyboard'),
|
||||
'Item Keyboard created correctly');
|
||||
assert.ok(cur_frm.doc.item_code.includes('Keyboard'),
|
||||
'item_code for Keyboard set correctly');
|
||||
assert.ok(cur_frm.doc.item_group.includes('Products'),
|
||||
'item_group for Keyboard set correctly');
|
||||
assert.equal(cur_frm.doc.is_stock_item, 1,
|
||||
'is_stock_item for Keyboard set correctly');
|
||||
assert.equal(cur_frm.doc.standard_rate, 1000,
|
||||
'standard_rate for Keyboard set correctly');
|
||||
assert.equal(cur_frm.doc.opening_stock, 100,
|
||||
'opening_stock for Keyboard set correctly');
|
||||
},
|
||||
|
||||
// Create a Screen item
|
||||
() => frappe.tests.make(
|
||||
"Item", [
|
||||
{item_code: "Screen"},
|
||||
{item_group: "Products"},
|
||||
{is_stock_item: 1},
|
||||
{standard_rate: 1000},
|
||||
{opening_stock: 100}
|
||||
]
|
||||
),
|
||||
() => {
|
||||
assert.ok(cur_frm.doc.item_name.includes('Screen'),
|
||||
'Item Screen created correctly');
|
||||
assert.ok(cur_frm.doc.item_code.includes('Screen'),
|
||||
'item_code for Screen set correctly');
|
||||
assert.ok(cur_frm.doc.item_group.includes('Products'),
|
||||
'item_group for Screen set correctly');
|
||||
assert.equal(cur_frm.doc.is_stock_item, 1,
|
||||
'is_stock_item for Screen set correctly');
|
||||
assert.equal(cur_frm.doc.standard_rate, 1000,
|
||||
'standard_rate for Screen set correctly');
|
||||
assert.equal(cur_frm.doc.opening_stock, 100,
|
||||
'opening_stock for Screen set correctly');
|
||||
},
|
||||
|
||||
// Create a CPU item
|
||||
() => frappe.tests.make(
|
||||
"Item", [
|
||||
{item_code: "CPU"},
|
||||
{item_group: "Products"},
|
||||
{is_stock_item: 1},
|
||||
{standard_rate: 1000},
|
||||
{opening_stock: 100}
|
||||
]
|
||||
),
|
||||
() => {
|
||||
assert.ok(cur_frm.doc.item_name.includes('CPU'),
|
||||
'Item CPU created correctly');
|
||||
assert.ok(cur_frm.doc.item_code.includes('CPU'),
|
||||
'item_code for CPU set correctly');
|
||||
assert.ok(cur_frm.doc.item_group.includes('Products'),
|
||||
'item_group for CPU set correctly');
|
||||
assert.equal(cur_frm.doc.is_stock_item, 1,
|
||||
'is_stock_item for CPU set correctly');
|
||||
assert.equal(cur_frm.doc.standard_rate, 1000,
|
||||
'standard_rate for CPU set correctly');
|
||||
assert.equal(cur_frm.doc.opening_stock, 100,
|
||||
'opening_stock for CPU set correctly');
|
||||
},
|
||||
|
||||
() => done()
|
||||
]);
|
||||
});
|
@ -2,4 +2,5 @@ erpnext/tests/ui/make_fixtures.js #long
|
||||
erpnext/accounts/doctype/account/test_account.js
|
||||
erpnext/crm/doctype/lead/test_lead.js
|
||||
erpnext/crm/doctype/opportunity/test_opportunity.js
|
||||
erpnext/selling/doctype/quotation/test_quotation.js
|
||||
erpnext/selling/doctype/quotation/test_quotation.js
|
||||
erpnext/crm/doctype/item/test_item.js
|
Loading…
Reference in New Issue
Block a user