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