Test for training (#10545)
This commit is contained in:
parent
8de7c0245c
commit
9a04da27b0
55
erpnext/hr/doctype/training_event/test_training_event.js
Normal file
55
erpnext/hr/doctype/training_event/test_training_event.js
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
QUnit.module('hr');
|
||||||
|
|
||||||
|
QUnit.test("Test: Training Event [HR]", function (assert) {
|
||||||
|
assert.expect(4);
|
||||||
|
let done = assert.async();
|
||||||
|
let employee_name;
|
||||||
|
|
||||||
|
frappe.run_serially([
|
||||||
|
// Creation of Training Event
|
||||||
|
() => frappe.db.get_value('Employee', {'employee_name': 'Test Employee 1'}, 'name'),
|
||||||
|
(r) => {
|
||||||
|
employee_name = r.message.name;
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
frappe.tests.make('Training Event', [
|
||||||
|
{ event_name: 'Test Training Event 1'},
|
||||||
|
{ location: 'Mumbai'},
|
||||||
|
{ start_time: '2017-09-01 11:00:0'},
|
||||||
|
{ end_time: '2017-09-01 17:00:0'},
|
||||||
|
{ introduction: 'This is just a test'},
|
||||||
|
{ employees: [
|
||||||
|
[
|
||||||
|
{employee: employee_name},
|
||||||
|
{employee_name: 'Test Employee 1'}
|
||||||
|
]
|
||||||
|
]},
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
() => frappe.timeout(7),
|
||||||
|
() => frappe.click_button('Submit'),
|
||||||
|
() => frappe.timeout(1),
|
||||||
|
() => frappe.click_button('Yes'),
|
||||||
|
() => frappe.timeout(8),
|
||||||
|
() => {
|
||||||
|
// To check if the fields are correctly set
|
||||||
|
assert.ok(cur_frm.get_field('event_name').value == 'Test Training Event 1',
|
||||||
|
'Event created successfully');
|
||||||
|
|
||||||
|
assert.ok(cur_frm.get_field('event_status').value=='Scheduled',
|
||||||
|
'Status of event is correctly set');
|
||||||
|
|
||||||
|
assert.ok(cur_frm.doc.employees[0].employee_name=='Test Employee 1',
|
||||||
|
'Attendee Employee is correctly set');
|
||||||
|
},
|
||||||
|
|
||||||
|
() => frappe.set_route('List','Training Event','List'),
|
||||||
|
() => frappe.timeout(2),
|
||||||
|
// Checking the submission of Training Event
|
||||||
|
() => {
|
||||||
|
assert.ok(cur_list.data[0].docstatus==1,'Training Event Submitted successfully');
|
||||||
|
},
|
||||||
|
() => frappe.timeout(2),
|
||||||
|
() => done()
|
||||||
|
]);
|
||||||
|
});
|
@ -0,0 +1,52 @@
|
|||||||
|
QUnit.module('hr');
|
||||||
|
|
||||||
|
QUnit.test("Test: Training Feedback [HR]", function (assert) {
|
||||||
|
assert.expect(3);
|
||||||
|
let done = assert.async();
|
||||||
|
let employee_name;
|
||||||
|
|
||||||
|
frappe.run_serially([
|
||||||
|
// Creating Training Feedback
|
||||||
|
() => frappe.set_route('List','Training Feedback','List'),
|
||||||
|
() => frappe.timeout(0.3),
|
||||||
|
() => frappe.click_button('Make a new Training Feedback'),
|
||||||
|
() => frappe.timeout(1),
|
||||||
|
() => frappe.db.get_value('Employee', {'employee_name': 'Test Employee 1'}, 'name'),
|
||||||
|
(r) => {
|
||||||
|
employee_name = r.message.name;
|
||||||
|
},
|
||||||
|
() => cur_frm.set_value('employee',employee_name),
|
||||||
|
() => cur_frm.set_value('employee_name','Test Employee 1'),
|
||||||
|
() => cur_frm.set_value('training_event','Test Training Event 1'),
|
||||||
|
() => cur_frm.set_value('event_name','Test Training Event 1'),
|
||||||
|
() => cur_frm.set_value('feedback','Great Experience. This is just a test.'),
|
||||||
|
() => frappe.timeout(1),
|
||||||
|
() => cur_frm.save(),
|
||||||
|
() => frappe.timeout(1),
|
||||||
|
() => cur_frm.save(),
|
||||||
|
|
||||||
|
// Submitting the feedback
|
||||||
|
() => frappe.click_button('Submit'),
|
||||||
|
() => frappe.click_button('Yes'),
|
||||||
|
() => frappe.timeout(3),
|
||||||
|
|
||||||
|
// Checking if the feedback is given by correct employee
|
||||||
|
() => {
|
||||||
|
assert.equal('Test Employee 1',cur_frm.get_field('employee_name').value,
|
||||||
|
'Feedback is given by correct employee');
|
||||||
|
|
||||||
|
assert.equal('Test Training Event 1',cur_frm.get_field('training_event').value,
|
||||||
|
'Feedback is given for correct event');
|
||||||
|
},
|
||||||
|
|
||||||
|
() => frappe.set_route('List','Training Feedback','List'),
|
||||||
|
() => frappe.timeout(2),
|
||||||
|
|
||||||
|
// Checking the submission of Training Result
|
||||||
|
() => {
|
||||||
|
assert.ok(cur_list.data[0].docstatus==1,'Training Feedback Submitted successfully');
|
||||||
|
},
|
||||||
|
() => done()
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,53 @@
|
|||||||
|
QUnit.module('hr');
|
||||||
|
|
||||||
|
QUnit.test("Test: Training Result [HR]", function (assert) {
|
||||||
|
assert.expect(5);
|
||||||
|
let done = assert.async();
|
||||||
|
frappe.run_serially([
|
||||||
|
// Creating Training Result
|
||||||
|
() => frappe.set_route('List','Training Result','List'),
|
||||||
|
() => frappe.timeout(0.3),
|
||||||
|
() => frappe.click_button('Make a new Training Result'),
|
||||||
|
() => {
|
||||||
|
cur_frm.set_value('training_event','Test Training Event 1');
|
||||||
|
},
|
||||||
|
() => frappe.timeout(1),
|
||||||
|
() => frappe.model.set_value('Training Result Employee','New Training Result Employee 1','hours',4),
|
||||||
|
() => frappe.model.set_value('Training Result Employee','New Training Result Employee 1','grade','A'),
|
||||||
|
() => frappe.model.set_value('Training Result Employee','New Training Result Employee 1','comments','Nice Seminar'),
|
||||||
|
() => frappe.timeout(1),
|
||||||
|
() => cur_frm.save(),
|
||||||
|
() => frappe.timeout(1),
|
||||||
|
() => cur_frm.save(),
|
||||||
|
|
||||||
|
// Submitting the Training Result
|
||||||
|
() => frappe.click_button('Submit'),
|
||||||
|
() => frappe.click_button('Yes'),
|
||||||
|
() => frappe.timeout(4),
|
||||||
|
|
||||||
|
// Checking if the fields are correctly set
|
||||||
|
() => {
|
||||||
|
assert.equal('Test Training Event 1',cur_frm.get_field('training_event').value,
|
||||||
|
'Training Result is created');
|
||||||
|
|
||||||
|
assert.equal('Test Employee 1',cur_frm.doc.employees[0].employee_name,
|
||||||
|
'Training Result is created for correct employee');
|
||||||
|
|
||||||
|
assert.equal(4,cur_frm.doc.employees[0].hours,
|
||||||
|
'Hours field is correctly calculated');
|
||||||
|
|
||||||
|
assert.equal('A',cur_frm.doc.employees[0].grade,
|
||||||
|
'Grade field is correctly set');
|
||||||
|
},
|
||||||
|
|
||||||
|
() => frappe.set_route('List','Training Result','List'),
|
||||||
|
() => frappe.timeout(2),
|
||||||
|
|
||||||
|
// Checking the submission of Training Result
|
||||||
|
() => {
|
||||||
|
assert.ok(cur_list.data[0].docstatus==1,'Training Result Submitted successfully');
|
||||||
|
},
|
||||||
|
() => done()
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
@ -68,6 +68,9 @@ erpnext/hr/doctype/job_applicant/test_job_applicant.js
|
|||||||
erpnext/hr/doctype/offer_letter/test_offer_letter.js
|
erpnext/hr/doctype/offer_letter/test_offer_letter.js
|
||||||
erpnext/hr/doctype/appraisal_template/test_appraisal_template.js
|
erpnext/hr/doctype/appraisal_template/test_appraisal_template.js
|
||||||
erpnext/hr/doctype/appraisal/test_appraisal.js
|
erpnext/hr/doctype/appraisal/test_appraisal.js
|
||||||
|
erpnext/hr/doctype/training_event/test_training_event.js
|
||||||
|
erpnext/hr/doctype/training_result_employee/test_training_result.js
|
||||||
|
erpnext/hr/doctype/training_feedback/test_training_feedback.js
|
||||||
erpnext/buying/doctype/supplier/test_supplier.js
|
erpnext/buying/doctype/supplier/test_supplier.js
|
||||||
erpnext/buying/doctype/request_for_quotation/tests/test_request_for_quotation.js
|
erpnext/buying/doctype/request_for_quotation/tests/test_request_for_quotation.js
|
||||||
erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation.js
|
erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation.js
|
||||||
|
Loading…
x
Reference in New Issue
Block a user