[ui test] employee attendance tool and attendance in HR (#10112)
* added test for attendance tool * added test for attendance * minor changes * minor changes * path added in tests.txt * codacy fixes
This commit is contained in:
parent
296603a861
commit
b8b01928d3
41
erpnext/hr/doctype/attendance/test_attendance.js
Normal file
41
erpnext/hr/doctype/attendance/test_attendance.js
Normal file
@ -0,0 +1,41 @@
|
||||
QUnit.module('hr');
|
||||
|
||||
QUnit.test("Test: Attendance [HR]", function (assert) {
|
||||
assert.expect(4);
|
||||
let done = assert.async();
|
||||
let employee_code;
|
||||
|
||||
frappe.run_serially([
|
||||
// get employee's auto generated name
|
||||
() => frappe.set_route("List", "Employee", "List"),
|
||||
() => frappe.timeout(0.5),
|
||||
() => frappe.click_link('Test Employee'),
|
||||
() => frappe.timeout(0.5),
|
||||
() => employee_code = frappe.get_route()[2],
|
||||
// test attendance creation for one employee
|
||||
() => frappe.set_route("List", "Attendance", "List"),
|
||||
() => frappe.timeout(0.5),
|
||||
() => frappe.new_doc("Attendance"),
|
||||
() => frappe.timeout(1),
|
||||
() => assert.equal("Attendance", cur_frm.doctype,
|
||||
"Form for new Attendance opened successfully."),
|
||||
// set values in form
|
||||
() => cur_frm.set_value("company", "Test Company"),
|
||||
() => cur_frm.set_value("employee", employee_code),
|
||||
() => cur_frm.save(),
|
||||
() => frappe.timeout(1),
|
||||
// check docstatus of attendance before submit [Draft]
|
||||
() => assert.equal("0", cur_frm.doc.docstatus,
|
||||
"attendance is currently drafted"),
|
||||
// check docstatus of attendance after submit [Present]
|
||||
() => cur_frm.savesubmit(),
|
||||
() => frappe.timeout(0.5),
|
||||
() => frappe.click_button('Yes'),
|
||||
() => assert.equal("1", cur_frm.doc.docstatus,
|
||||
"attendance is saved after submit"),
|
||||
// check if auto filled date is present day
|
||||
() => assert.equal(frappe.datetime.nowdate(), cur_frm.doc.attendance_date,
|
||||
"attendance for Present day is marked"),
|
||||
() => done()
|
||||
]);
|
||||
});
|
@ -12,6 +12,7 @@ QUnit.test("Test: Employee [HR]", function (assert) {
|
||||
() => frappe.timeout(1),
|
||||
() => cur_frm.set_value("employee_name", "Test Employee"),
|
||||
() => cur_frm.set_value("salutation", "Ms"),
|
||||
() => cur_frm.set_value("company", "Test Company"),
|
||||
() => 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"),
|
||||
|
@ -0,0 +1,32 @@
|
||||
QUnit.module('hr');
|
||||
|
||||
QUnit.test("Test: Employee attendance tool [HR]", function (assert) {
|
||||
assert.expect(3);
|
||||
let done = assert.async();
|
||||
let attendance_date = frappe.datetime.add_days(frappe.datetime.nowdate(), -1); // previous day
|
||||
|
||||
frappe.run_serially([
|
||||
() => frappe.set_route("Form", "Employee Attendance Tool"),
|
||||
() => frappe.timeout(0.5),
|
||||
() => assert.equal("Employee Attendance Tool", cur_frm.doctype,
|
||||
"Form for Employee Attendance Tool opened successfully."),
|
||||
// set values in form
|
||||
() => cur_frm.set_value("date", attendance_date),
|
||||
() => cur_frm.set_value("branch", "Test Branch"),
|
||||
() => cur_frm.set_value("department", "Test Department"),
|
||||
() => cur_frm.set_value("company", "Test Company"),
|
||||
() => frappe.timeout(0.5),
|
||||
() => frappe.click_check('Test Employee'),
|
||||
() => frappe.tests.click_button('Mark Present'),
|
||||
// check if attendance is marked
|
||||
() => frappe.set_route("List", "Attendance", "List"),
|
||||
() => frappe.timeout(1),
|
||||
() => {
|
||||
assert.equal("Test Employee", cur_list.data[0].employee_name,
|
||||
"attendance marked correctly saved");
|
||||
assert.equal(attendance_date, cur_list.data[0].attendance_date,
|
||||
"attendance date is set correctly");
|
||||
},
|
||||
() => done()
|
||||
]);
|
||||
});
|
@ -9,12 +9,13 @@ erpnext/crm/doctype/item/test_item.js
|
||||
erpnext/manufacturing/doctype/workstation/test_workstation.js
|
||||
erpnext/manufacturing/doctype/operation/test_operation.js
|
||||
erpnext/manufacturing/doctype/bom/test_bom.js
|
||||
erpnext/projects/doctype/project/project_timesheet.js
|
||||
erpnext/hr/doctype/holiday_list/test_holiday_list.js
|
||||
erpnext/hr/doctype/branch/test_branch.js
|
||||
erpnext/manufacturing/doctype/bom/test_bom.js
|
||||
erpnext/projects/doctype/project/project_timesheet.js
|
||||
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
|
||||
erpnext/hr/doctype/employee_attendance_tool/test_employee_attendance_tool.js
|
||||
erpnext/hr/doctype/attendance/test_attendance.js
|
Loading…
x
Reference in New Issue
Block a user