[ui test] test for department, designation, company and leave block list (#10085)

* added test for required items

* minor fixes for travis

* name changed

* added test for employment type

* travis fixes
This commit is contained in:
Utkarsh Yadav 2017-07-26 13:14:34 +05:30 committed by Rushabh Mehta
parent cda6206c1f
commit b8a4a584e6
8 changed files with 125 additions and 5 deletions

View File

@ -10,12 +10,12 @@ QUnit.test("Test: Branch [HR]", function (assert) {
() => frappe.new_doc("Branch"),
() => frappe.timeout(1),
() => frappe.click_link('Edit in full page'),
() => cur_frm.set_value("branch", "Branch test"),
() => cur_frm.set_value("branch", "Test Branch"),
// save form
() => cur_frm.save(),
() => frappe.timeout(1),
() => assert.equal("Branch test", cur_frm.doc.branch,
() => assert.equal("Test Branch", cur_frm.doc.branch,
'name of branch correctly saved'),
() => done()
]);

View File

@ -0,0 +1,22 @@
QUnit.module('hr');
QUnit.test("Test: Department [HR]", function (assert) {
assert.expect(1);
let done = assert.async();
frappe.run_serially([
// test department creation
() => frappe.set_route("List", "Department", "List"),
() => frappe.new_doc("Department"),
() => frappe.timeout(1),
() => frappe.click_link('Edit in full page'),
() => cur_frm.set_value("department_name", "Test Department"),
() => cur_frm.set_value("leave_block_list", "Test Leave block list"),
// save form
() => cur_frm.save(),
() => frappe.timeout(1),
() => assert.equal("Test Department", cur_frm.doc.department_name,
'name of department correctly saved'),
() => done()
]);
});

View File

@ -0,0 +1,22 @@
QUnit.module('hr');
QUnit.test("Test: Designation [HR]", function (assert) {
assert.expect(1);
let done = assert.async();
frappe.run_serially([
// test designation creation
() => frappe.set_route("List", "Designation", "List"),
() => frappe.new_doc("Designation"),
() => frappe.timeout(1),
() => frappe.click_link('Edit in full page'),
() => cur_frm.set_value("designation_name", "Test Designation"),
() => cur_frm.set_value("description", "This designation is just for testing."),
// save form
() => cur_frm.save(),
() => frappe.timeout(1),
() => assert.equal("Test Designation", cur_frm.doc.designation_name,
'name of designation correctly saved'),
() => done()
]);
});

View File

@ -0,0 +1,21 @@
QUnit.module('hr');
QUnit.test("Test: Employment type [HR]", function (assert) {
assert.expect(1);
let done = assert.async();
frappe.run_serially([
// test employment type creation
() => frappe.set_route("List", "Employment Type", "List"),
() => frappe.new_doc("Employment Type"),
() => frappe.timeout(1),
() => frappe.click_link('Edit in full page'),
() => cur_frm.set_value("employee_type_name", "Test Employment type"),
// save form
() => cur_frm.save(),
() => frappe.timeout(1),
() => assert.equal("Test Employment type", cur_frm.doc.employee_type_name,
'name of employment type correctly saved'),
() => done()
]);
});

View File

@ -10,7 +10,7 @@ QUnit.test("Test: Holiday list [HR]", function (assert) {
() => frappe.set_route("List", "Holiday List", "List"),
() => frappe.new_doc("Holiday List"),
() => frappe.timeout(1),
() => cur_frm.set_value("holiday_list_name", "Holiday list test"),
() => cur_frm.set_value("holiday_list_name", "Test Holiday list"),
() => cur_frm.set_value("from_date", date),
() => cur_frm.set_value("weekly_off", "Sunday"), // holiday list for sundays
() => frappe.click_button('Get Weekly Off Dates'),
@ -18,7 +18,7 @@ QUnit.test("Test: Holiday list [HR]", function (assert) {
// save form
() => cur_frm.save(),
() => frappe.timeout(1),
() => assert.equal("Holiday list test", cur_frm.doc.holiday_list_name,
() => assert.equal("Test Holiday list", cur_frm.doc.holiday_list_name,
'name of holiday list correctly saved'),
// check if holiday list contains correct days

View File

@ -0,0 +1,27 @@
QUnit.module('hr');
QUnit.test("Test: Leave block list [HR]", function (assert) {
assert.expect(1);
let done = assert.async();
let today_date = frappe.datetime.nowdate();
frappe.run_serially([
// test leave block list creation
() => frappe.set_route("List", "Leave Block List", "List"),
() => frappe.new_doc("Leave Block List"),
() => frappe.timeout(1),
() => cur_frm.set_value("leave_block_list_name", "Test Leave block list"),
() => cur_frm.set_value("company", "Test Company"),
() => frappe.click_button('Add Row'),
() => {
cur_frm.fields_dict.leave_block_list_dates.grid.grid_rows[0].doc.block_date = today_date;
cur_frm.fields_dict.leave_block_list_dates.grid.grid_rows[0].doc.reason = "Blocked leave test";
},
// save form
() => cur_frm.save(),
() => frappe.timeout(1),
() => assert.equal("Test Leave block list", cur_frm.doc.leave_block_list_name,
'name of blocked leave list correctly saved'),
() => done()
]);
});

View File

@ -0,0 +1,23 @@
QUnit.module('setup');
QUnit.test("Test: Company [SetUp]", function (assert) {
assert.expect(1);
let done = assert.async();
frappe.run_serially([
// test company creation
() => frappe.set_route("List", "Company", "List"),
() => frappe.new_doc("Company"),
() => frappe.timeout(1),
() => cur_frm.set_value("company_name", "Test Company"),
() => cur_frm.set_value("abbr", "TC"),
() => cur_frm.set_value("domain", "Services"),
() => cur_frm.set_value("default_currency", "INR"),
// save form
() => cur_frm.save(),
() => frappe.timeout(1),
() => assert.equal("Test Company", cur_frm.doc.company_name,
'name of company correctly saved'),
() => done()
]);
});

View File

@ -1,4 +1,5 @@
erpnext/tests/ui/make_fixtures.js #long
erpnext/setup/doctype/company/test_company.js
erpnext/accounts/doctype/account/test_account.js
erpnext/crm/doctype/lead/test_lead.js
erpnext/crm/doctype/opportunity/test_opportunity.js
@ -6,6 +7,10 @@ erpnext/selling/doctype/quotation/test_quotation.js
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/hr/doctype/holiday_list/test_holiday_list.js
erpnext/hr/doctype/branch/test_branch.js
erpnext/manufacturing/doctype/bom/test_bom.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