[UI Test Recruitment] To test Recruitment in HR module (#10441)

* Tests for Recruitment

* Codacy fix
This commit is contained in:
Utkarsh Goswami 2017-08-18 11:57:01 +05:30 committed by Makarand Bauskar
parent 2890fa74a2
commit ca63cc6439
4 changed files with 110 additions and 0 deletions

View File

@ -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()
]);
});

View File

@ -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()
]);
});

View File

@ -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()
]);
});

View File

@ -67,6 +67,9 @@ erpnext/schools/doctype/course/test_course.js
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