[ui test] Employee in HR (#10103)

* added test for employee

* names changed

* path added in tests.txt
This commit is contained in:
Utkarsh Yadav 2017-07-26 16:32:16 +05:30 committed by Rushabh Mehta
parent 40937083bf
commit 53b877bd8f
2 changed files with 39 additions and 1 deletions

View File

@ -0,0 +1,38 @@
QUnit.module('hr');
QUnit.test("Test: Employee [HR]", function (assert) {
assert.expect(3);
let done = assert.async();
let today_date = frappe.datetime.nowdate();
frappe.run_serially([
// test employee creation
() => frappe.set_route("List", "Employee", "List"),
() => frappe.new_doc("Employee"),
() => frappe.timeout(1),
() => cur_frm.set_value("employee_name", "Test Employee"),
() => cur_frm.set_value("salutation", "Ms"),
() => cur_frm.set_value("date_of_joining", frappe.datetime.add_months(today_date, -2)), // joined 2 month from now
() => cur_frm.set_value("date_of_birth", frappe.datetime.add_months(today_date, -240)), // age is 20 years
() => cur_frm.set_value("employment_type", "Test Employment type"),
() => cur_frm.set_value("holiday_list", "Test Holiday list"),
() => cur_frm.set_value("branch", "Test Branch"),
() => cur_frm.set_value("department", "Test Department"),
() => cur_frm.set_value("designation", "Test Designation"),
() => frappe.click_button('Add Row'),
() => cur_frm.fields_dict.leave_approvers.grid.grid_rows[0].doc.leave_approver="Administrator",
// save data
() => cur_frm.save(),
() => frappe.timeout(1),
// check name of employee
() => assert.equal("Test Employee", cur_frm.doc.employee_name,
'name of employee correctly saved'),
// check auto filled gender according to salutation
() => assert.equal("Female", cur_frm.doc.gender,
'gender correctly saved as per salutation'),
// check auto filled retirement date [60 years from DOB]
() => assert.equal(frappe.datetime.add_months(today_date, 480), cur_frm.doc.date_of_retirement, // 40 years from now
'retirement date correctly saved as per date of birth'),
() => done()
]);
});

View File

@ -16,4 +16,4 @@ erpnext/hr/doctype/leave_block_list/test_leave_block_list.js
erpnext/hr/doctype/department/test_department.js
erpnext/hr/doctype/designation/test_designation.js
erpnext/hr/doctype/employment_type/test_employment_type.js
erpnext/hr/doctype/employee/test_employee.js