Fixed salary structure tests

This commit is contained in:
Nabin Hait 2017-09-14 19:07:30 +05:30
parent 427172c941
commit 2f64f0f5fa

View File

@ -1,18 +1,18 @@
QUnit.test("test Salary Structure", function(assert) {
assert.expect(6);
assert.expect(12);
let done = assert.async();
let employee_name1;
let salary_structure = (ename1,ename2) => {
frappe.run_serially([
() => frappe.db.get_value('Employee', {'employee_name': ename1}, 'name'),
() => frappe.db.get_value('Employee', {'employee_name': "Test Employee 1"}, 'name',
(r) => {
employee_name1 = r.message.name;
},
() => frappe.db.get_value('Employee', {'employee_name': ename2}, 'name'),
employee_name1 = r.name;
}
),
() => frappe.db.get_value('Employee', {'employee_name': "Test Employee 3"}, 'name',
(r) => {
// Creating Salary Structure for employees);
frappe.tests.make('Salary Structure', [
return frappe.tests.make('Salary Structure', [
{ company: 'For Testing'},
{ payroll_frequency: 'Monthly'},
{ employees: [
@ -22,7 +22,7 @@ QUnit.test("test Salary Structure", function(assert) {
{base: 25000}
],
[
{employee: r.message.name},
{employee: r.name},
{from_date: '2017-07-01'},
{base: 30000}
]
@ -45,11 +45,13 @@ QUnit.test("test Salary Structure", function(assert) {
]},
{ payment_account: 'CASH - FT'},
]);
},
() => frappe.timeout(12),
}
),
() => frappe.timeout(18),
() => cur_dialog.set_value('value','Test Salary Structure'),
() => frappe.timeout(2),
() => frappe.timeout(1),
() => frappe.click_button('Create'),
() => frappe.timeout(1),
() => {
// To check if all the fields are correctly set
assert.ok(cur_frm.doc.employees[0].employee_name.includes('Test Employee 1') &&
@ -71,11 +73,6 @@ QUnit.test("test Salary Structure", function(assert) {
assert.ok(cur_frm.doc.deductions[0].formula.includes('(B+LE) * .20'),
'Formula for deductions as Income Tax is correctly set');
},
]);
};
frappe.run_serially([
() => salary_structure('Test Employee 1','Test Employee 3'),
() => frappe.timeout(16),
() => done()
]);
});