[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
diff --git a/erpnext/hr/doctype/branch/test_branch.js b/erpnext/hr/doctype/branch/test_branch.js
index 25ea2fc..446db75 100644
--- a/erpnext/hr/doctype/branch/test_branch.js
+++ b/erpnext/hr/doctype/branch/test_branch.js
@@ -10,12 +10,12 @@
() => 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()
]);
diff --git a/erpnext/hr/doctype/department/test_department.js b/erpnext/hr/doctype/department/test_department.js
new file mode 100644
index 0000000..1c413e9
--- /dev/null
+++ b/erpnext/hr/doctype/department/test_department.js
@@ -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()
+ ]);
+});
\ No newline at end of file
diff --git a/erpnext/hr/doctype/designation/test_designation.js b/erpnext/hr/doctype/designation/test_designation.js
new file mode 100644
index 0000000..a012877
--- /dev/null
+++ b/erpnext/hr/doctype/designation/test_designation.js
@@ -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()
+ ]);
+});
\ No newline at end of file
diff --git a/erpnext/hr/doctype/employment_type/test_employment_type.js b/erpnext/hr/doctype/employment_type/test_employment_type.js
new file mode 100644
index 0000000..0ddd3e0
--- /dev/null
+++ b/erpnext/hr/doctype/employment_type/test_employment_type.js
@@ -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()
+ ]);
+});
\ No newline at end of file
diff --git a/erpnext/hr/doctype/holiday_list/test_holiday_list.js b/erpnext/hr/doctype/holiday_list/test_holiday_list.js
index ed75285..bfcafa9 100644
--- a/erpnext/hr/doctype/holiday_list/test_holiday_list.js
+++ b/erpnext/hr/doctype/holiday_list/test_holiday_list.js
@@ -10,7 +10,7 @@
() => 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 @@
// 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
diff --git a/erpnext/hr/doctype/leave_block_list/test_leave_block_list.js b/erpnext/hr/doctype/leave_block_list/test_leave_block_list.js
new file mode 100644
index 0000000..1241d3d
--- /dev/null
+++ b/erpnext/hr/doctype/leave_block_list/test_leave_block_list.js
@@ -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()
+ ]);
+});
\ No newline at end of file
diff --git a/erpnext/setup/doctype/company/test_company.js b/erpnext/setup/doctype/company/test_company.js
new file mode 100644
index 0000000..afa3296
--- /dev/null
+++ b/erpnext/setup/doctype/company/test_company.js
@@ -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()
+ ]);
+});
\ No newline at end of file
diff --git a/erpnext/tests/ui/tests.txt b/erpnext/tests/ui/tests.txt
index 047ee9c..7c2a76b 100644
--- a/erpnext/tests/ui/tests.txt
+++ b/erpnext/tests/ui/tests.txt
@@ -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/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
\ No newline at end of file
+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
\ No newline at end of file