[UI Test Recruitment] To test Recruitment in HR module (#10441)
* Tests for Recruitment
* Codacy fix
diff --git a/erpnext/hr/doctype/job_applicant/test_job_applicant.js b/erpnext/hr/doctype/job_applicant/test_job_applicant.js
new file mode 100644
index 0000000..b5391c8
--- /dev/null
+++ b/erpnext/hr/doctype/job_applicant/test_job_applicant.js
@@ -0,0 +1,29 @@
+QUnit.module('hr');
+
+QUnit.test("Test: Job Opening [HR]", function (assert) {
+ assert.expect(2);
+ let done = assert.async();
+
+ frappe.run_serially([
+ // Job Applicant creation
+ () => {
+ frappe.tests.make('Job Applicant', [
+ { applicant_name: 'Utkarsh Goswami'},
+ { email_id: 'goswamiutkarsh0@gmail.com'},
+ { job_title: 'software-developer'},
+ { cover_letter: 'Highly skilled in designing, testing, and developing software.'+
+ ' This is just a test.'}
+ ]);
+ },
+ () => frappe.timeout(4),
+ () => frappe.set_route('List','Job Applicant'),
+ () => frappe.timeout(3),
+ () => {
+ assert.ok(cur_list.data.length==1, 'Job Applicant created successfully');
+ assert.ok(cur_list.data[0].name=='Utkarsh Goswami - goswamiutkarsh0@gmail.com - software-developer',
+ 'Correct job applicant with valid job title');
+ },
+ () => done()
+ ]);
+});
+
diff --git a/erpnext/hr/doctype/job_opening/test_job_opening.js b/erpnext/hr/doctype/job_opening/test_job_opening.js
new file mode 100644
index 0000000..b9e6c0a
--- /dev/null
+++ b/erpnext/hr/doctype/job_opening/test_job_opening.js
@@ -0,0 +1,27 @@
+QUnit.module('hr');
+
+QUnit.test("Test: Job Opening [HR]", function (assert) {
+ assert.expect(2);
+ let done = assert.async();
+
+ frappe.run_serially([
+ // Job Opening creation
+ () => {
+ frappe.tests.make('Job Opening', [
+ { job_title: 'Software Developer'},
+ { description:
+ 'You might be responsible for writing and coding individual'+
+ ' programmes or providing an entirely new software resource.'}
+ ]);
+ },
+ () => frappe.timeout(4),
+ () => frappe.set_route('List','Job Opening'),
+ () => frappe.timeout(3),
+ () => {
+ assert.ok(cur_list.data.length==1, 'Job Opening created successfully');
+ assert.ok(cur_list.data[0].job_title=='Software Developer', 'Job title Correctly set');
+ },
+ () => done()
+ ]);
+});
+
diff --git a/erpnext/hr/doctype/offer_letter/test_offer_letter.js b/erpnext/hr/doctype/offer_letter/test_offer_letter.js
new file mode 100644
index 0000000..2069532
--- /dev/null
+++ b/erpnext/hr/doctype/offer_letter/test_offer_letter.js
@@ -0,0 +1,51 @@
+QUnit.module('hr');
+
+QUnit.test("Test: Offer Letter [HR]", function (assert) {
+ assert.expect(3);
+ let done = assert.async();
+ frappe.run_serially([
+ // Offer Letter Creation
+ () => {
+ frappe.tests.make('Offer Letter', [
+ { job_applicant: 'Utkarsh Goswami - goswamiutkarsh0@gmail.com - software-developer'},
+ { applicant_name: 'Utkarsh Goswami'},
+ { status: 'Accepted'},
+ { designation: 'Software Developer'},
+ { offer_terms: [
+ [
+ {offer_term: 'Responsibilities'},
+ {value: 'Design, installation, testing and maintenance of software systems.'}
+ ],
+ [
+ {offer_term: 'Department'},
+ {value: 'Research & Development'}
+ ],
+ [
+ {offer_term: 'Probationary Period'},
+ {value: 'The Probation period is for 3 months.'}
+ ]
+ ]},
+ ]);
+ },
+ () => frappe.timeout(8),
+ () => frappe.click_button('Submit'),
+ () => frappe.timeout(2),
+ () => frappe.click_button('Yes'),
+ () => frappe.timeout(8),
+ () => {
+ // To check if the fields are correctly set
+ assert.ok(cur_frm.get_field('status').value=='Accepted',
+ 'Status of job offer is correct');
+ assert.ok(cur_frm.get_field('designation').value=='Software Developer',
+ 'Designation of applicant is correct');
+ },
+ () => frappe.set_route('List','Offer Letter','List'),
+ () => frappe.timeout(2),
+ // Checking the submission of and offer letter
+ () => {
+ assert.ok(cur_list.data[0].docstatus==1,'Offer Letter Submitted successfully');
+ },
+ () => frappe.timeout(4),
+ () => done()
+ ]);
+});
\ No newline at end of file
diff --git a/erpnext/tests/ui/tests.txt b/erpnext/tests/ui/tests.txt
index dffbbaf..d34bb4e 100644
--- a/erpnext/tests/ui/tests.txt
+++ b/erpnext/tests/ui/tests.txt
@@ -67,6 +67,9 @@
erpnext/schools/doctype/program/test_program.js
erpnext/hr/doctype/salary_structure/test_salary_structure.js
erpnext/hr/doctype/salary_slip/test_salary_slip.js
+erpnext/hr/doctype/job_opening/test_job_opening.js
+erpnext/hr/doctype/job_applicant/test_job_applicant.js
+erpnext/hr/doctype/offer_letter/test_offer_letter.js
erpnext/schools/doctype/guardian/test_guardian.js
erpnext/schools/doctype/student_admission/test_student_admission.js
erpnext/schools/doctype/student_applicant/tests/test_student_applicant_dummy_data.js