diff --git a/erpnext/schools/doctype/assessment_criteria/test_assessment_criteria.js b/erpnext/schools/doctype/assessment_criteria/test_assessment_criteria.js new file mode 100644 index 0000000000..6c0540eebb --- /dev/null +++ b/erpnext/schools/doctype/assessment_criteria/test_assessment_criteria.js @@ -0,0 +1,16 @@ +// School Assessment module +QUnit.module('schools'); + +QUnit.test('Test: Assessment Criteria', function(assert){ + assert.expect(0); + let done = assert.async(); + frappe.run_serially([ + () => { + return frappe.tests.make('Assessment Criteria', [ + {assessment_criteria: 'Pass'}, + {assessment_criteria_group: 'Reservation'} + ]); + }, + () => done() + ]); +}); \ No newline at end of file diff --git a/erpnext/schools/doctype/assessment_criteria_group/test_assessment_criteria_group.js b/erpnext/schools/doctype/assessment_criteria_group/test_assessment_criteria_group.js new file mode 100644 index 0000000000..92dba1dfd8 --- /dev/null +++ b/erpnext/schools/doctype/assessment_criteria_group/test_assessment_criteria_group.js @@ -0,0 +1,15 @@ +// School Assessment module +QUnit.module('schools'); + +QUnit.test('Test: Assessment Criteria Group', function(assert){ + assert.expect(0); + let done = assert.async(); + frappe.run_serially([ + () => { + return frappe.tests.make('Assessment Criteria Group', [ + {assessment_criteria_group: 'Reservation'} + ]); + }, + () => done() + ]); +}); \ No newline at end of file diff --git a/erpnext/schools/doctype/course/test_course.js b/erpnext/schools/doctype/course/test_course.js new file mode 100644 index 0000000000..48667309ce --- /dev/null +++ b/erpnext/schools/doctype/course/test_course.js @@ -0,0 +1,36 @@ +// Testing Setup Module in Schools +QUnit.module('schools'); + +QUnit.test('test course', function(assert) { + assert.expect(8); + let done = assert.async(); + frappe.run_serially([ + () => { + return frappe.tests.make('Course', [ + {course_name: 'Test_Subject'}, + {course_code: 'Test_Sub'}, + {department: 'Test Department'}, + {course_abbreviation: 'Test_Sub'}, + {course_intro: 'Test Subject Intro'}, + {default_grading_scale: 'GTU'}, + {assessment_criteria: [ + [ + {assessment_criteria: 'Pass'}, + {weightage: 100} + ] + ]} + ]); + }, + () => { + assert.ok(cur_frm.doc.course_name == 'Test_Subject', 'Course name correctly set'); + assert.ok(cur_frm.doc.course_code == 'Test_Sub', 'Course code correctly set'); + assert.ok(cur_frm.doc.department == 'Test Department', 'Department selected correctly'); + assert.ok(cur_frm.doc.course_abbreviation == 'Test_Sub'); + assert.ok(cur_frm.doc.course_intro == 'Test Subject Intro'); + assert.ok(cur_frm.doc.default_grading_scale == 'GTU', 'Grading scale selected correctly'); + assert.ok(cur_frm.doc.assessment_criteria[0].assessment_criteria == 'Pass', 'Assessment criteria selected correctly'); + assert.ok(cur_frm.doc.assessment_criteria[0].weightage == '100'); + }, + () => done() + ]); +}); \ No newline at end of file diff --git a/erpnext/schools/doctype/grading_scale/test_grading_scale.js b/erpnext/schools/doctype/grading_scale/test_grading_scale.js new file mode 100644 index 0000000000..6539343a31 --- /dev/null +++ b/erpnext/schools/doctype/grading_scale/test_grading_scale.js @@ -0,0 +1,28 @@ +// School Assessment module +QUnit.module('schools'); + +QUnit.test('Test: Grading Scale', function(assert){ + assert.expect(0); + let done = assert.async(); + frappe.run_serially([ + () => { + return frappe.tests.make('Grading Scale', [ + {grading_scale_name: 'GTU'}, + {description: 'The score will be set according to 10 based system.'}, + {intervals: [ + [ + {grade_code: 'AA'}, + {threshold: '90'}, + {grade_description: 'Distinction'} + ], + [ + {grade_code: 'FF'}, + {threshold: '0'}, + {grade_description: 'Fail'} + ] + ]} + ]); + }, + () => done() + ]); +}); \ No newline at end of file diff --git a/erpnext/schools/doctype/program/test_program.js b/erpnext/schools/doctype/program/test_program.js new file mode 100644 index 0000000000..16bc932101 --- /dev/null +++ b/erpnext/schools/doctype/program/test_program.js @@ -0,0 +1,78 @@ +// Testing Setup Module in Schools +QUnit.module('schools'); + +QUnit.test('Test: Program', function(assert){ + assert.expect(11); + let done = assert.async(); + let fee_structure_code; + frappe.run_serially([ + () => { + return frappe.tests.make('Program', [ + {program_name: 'Standard Test'}, + {program_code: 'Standard Test'}, + {department: 'Test Department'}, + {program_abbreviation: 'Standard Test'}, + {courses: [ + [ + {course: 'Test_Sub'}, + {required: true} + ] + ]} + ]); + }, + + () => cur_frm.save(), + // Setting up Fee Category to select in Program doctype + () => { + return frappe.tests.make('Fee Category', [ + {category_name: 'Reservation'}, + {description: 'Special Provision'} + ]); + }, + // Setting up Fee Structure to be selected in Program doctype + () => { + return frappe.tests.make('Fee Structure', [ + {program: 'Standard Test'}, + {academic_term: '2016-17 (Semester 1)'}, + {student_category: 'Reservation'}, + {components: [ + [ + {fees_category: 'Reservation'}, + {amount: 20000} + ] + ]} + ]); + }, + () => {fee_structure_code = frappe.get_route()[2];}, // Storing naming convention of Fee Structure entry + () => frappe.set_route('Form', ('Program/Standard Test')), // Routing to our current Program doctype + + () => $('.shaded-section~ .visible-section+ .visible-section .grid-add-row').trigger('click'), // clicking on Add Row button + // Storing data that were inter-dependent + () => cur_frm.doc.fees[0].academic_term = '2016-17 (Semester 1)', + () => cur_frm.doc.fees[0].student_category = 'Reservation', + () => cur_frm.doc.fees[0].due_date = '2016-08-20', + () => $('.error').trigger('click'), + () => $('.bold.input-sm').trigger('focus'), + () => frappe.timeout(1), + () => $('.bold.input-sm').trigger('focus'), + () => $('.bold.input-sm').val(fee_structure_code), + () => $('.bold.input-sm').trigger('focus'), + () => frappe.timeout(1), + () => cur_frm.save(), + + () => { + assert.ok(cur_frm.doc.program_name == 'Standard Test'); + assert.ok(cur_frm.doc.program_code == 'Standard Test'); + assert.ok(cur_frm.doc.department == 'Test Department'); + assert.ok(cur_frm.doc.program_abbreviation == 'Standard Test'); + assert.ok(cur_frm.doc.courses[0].course == 'Test_Sub'); + assert.ok(cur_frm.doc.courses[0].required == true); + assert.ok(cur_frm.doc.fees[0].academic_term == '2016-17 (Semester 1)'); + assert.ok(cur_frm.doc.fees[0].fee_structure == fee_structure_code); + assert.ok(cur_frm.doc.fees[0].student_category == 'Reservation'); + assert.ok(cur_frm.doc.fees[0].due_date == '2016-08-20'); + assert.ok(cur_frm.doc.fees[0].amount == 20000); + }, + () => done() + ]); +}); \ No newline at end of file diff --git a/erpnext/tests/ui/tests.txt b/erpnext/tests/ui/tests.txt index 3943144e2e..4acdf3c8e1 100644 --- a/erpnext/tests/ui/tests.txt +++ b/erpnext/tests/ui/tests.txt @@ -36,3 +36,8 @@ erpnext/stock/doctype/warehouse/test_warehouse.js erpnext/manufacturing/doctype/production_order/test_production_order.js erpnext/accounts/page/pos/test_pos.js erpnext/selling/doctype/product_bundle/test_product_bundle.js +erpnext/schools/doctype/grading_scale/test_grading_scale.js +erpnext/schools/doctype/assessment_criteria_group/test_assessment_criteria_group.js +erpnext/schools/doctype/assessment_criteria/test_assessment_criteria.js +erpnext/schools/doctype/course/test_course.js +erpnext/schools/doctype/program/test_program.js