mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-20 03:47:11 +00:00
chore: drop deprecated qunit tests
This commit is contained in:
committed by
Ankush Menat
parent
107b404105
commit
f5d5281119
@@ -1,62 +0,0 @@
|
||||
QUnit.module('HR');
|
||||
|
||||
QUnit.test("test: Payroll Entry", function (assert) {
|
||||
assert.expect(5);
|
||||
let done = assert.async();
|
||||
let employees, docname;
|
||||
|
||||
frappe.run_serially([
|
||||
() => {
|
||||
return frappe.tests.make('Payroll Entry', [
|
||||
{company: 'For Testing'},
|
||||
{posting_date: frappe.datetime.add_days(frappe.datetime.nowdate(), 0)},
|
||||
{payroll_frequency: 'Monthly'},
|
||||
{cost_center: 'Main - '+frappe.get_abbr(frappe.defaults.get_default("Company"))}
|
||||
]);
|
||||
},
|
||||
|
||||
() => frappe.timeout(1),
|
||||
() => {
|
||||
assert.equal(cur_frm.doc.company, 'For Testing');
|
||||
assert.equal(cur_frm.doc.posting_date, frappe.datetime.add_days(frappe.datetime.nowdate(), 0));
|
||||
assert.equal(cur_frm.doc.cost_center, 'Main - FT');
|
||||
},
|
||||
() => frappe.click_button('Get Employee Details'),
|
||||
() => {
|
||||
employees = cur_frm.doc.employees.length;
|
||||
docname = cur_frm.doc.name;
|
||||
},
|
||||
|
||||
() => frappe.click_button('Submit'),
|
||||
() => frappe.timeout(1),
|
||||
() => frappe.click_button('Yes'),
|
||||
() => frappe.timeout(5),
|
||||
|
||||
() => frappe.click_button('View Salary Slip'),
|
||||
() => frappe.timeout(2),
|
||||
() => assert.equal(cur_list.data.length, employees),
|
||||
|
||||
() => frappe.set_route('Form', 'Payroll Entry', docname),
|
||||
() => frappe.timeout(2),
|
||||
() => frappe.click_button('Submit Salary Slip'),
|
||||
() => frappe.click_button('Yes'),
|
||||
() => frappe.timeout(5),
|
||||
|
||||
() => frappe.click_button('Close'),
|
||||
() => frappe.timeout(1),
|
||||
|
||||
() => frappe.click_button('View Salary Slip'),
|
||||
() => frappe.timeout(2),
|
||||
() => {
|
||||
let count = 0;
|
||||
for(var i = 0; i < employees; i++) {
|
||||
if(cur_list.data[i].docstatus == 1){
|
||||
count++;
|
||||
}
|
||||
}
|
||||
assert.equal(count, employees, "Salary Slip submitted for all employees");
|
||||
},
|
||||
|
||||
() => done()
|
||||
]);
|
||||
});
|
||||
@@ -1,61 +0,0 @@
|
||||
QUnit.module('HR');
|
||||
|
||||
QUnit.test("test: Set Salary Components", function (assert) {
|
||||
assert.expect(5);
|
||||
let done = assert.async();
|
||||
|
||||
frappe.run_serially([
|
||||
() => frappe.set_route('Form', 'Salary Component', 'Leave Encashment'),
|
||||
() => {
|
||||
var row = frappe.model.add_child(cur_frm.doc, "Salary Component Account", "accounts");
|
||||
row.company = 'For Testing';
|
||||
row.account = 'Salary - FT';
|
||||
},
|
||||
|
||||
() => cur_frm.save(),
|
||||
() => frappe.timeout(2),
|
||||
() => assert.equal(cur_frm.doc.accounts[0].account, 'Salary - FT'),
|
||||
|
||||
() => frappe.set_route('Form', 'Salary Component', 'Basic'),
|
||||
() => {
|
||||
var row = frappe.model.add_child(cur_frm.doc, "Salary Component Account", "accounts");
|
||||
row.company = 'For Testing';
|
||||
row.account = 'Salary - FT';
|
||||
},
|
||||
|
||||
() => cur_frm.save(),
|
||||
() => frappe.timeout(2),
|
||||
() => assert.equal(cur_frm.doc.accounts[0].account, 'Salary - FT'),
|
||||
|
||||
() => frappe.set_route('Form', 'Salary Component', 'Income Tax'),
|
||||
() => {
|
||||
var row = frappe.model.add_child(cur_frm.doc, "Salary Component Account", "accounts");
|
||||
row.company = 'For Testing';
|
||||
row.account = 'Salary - FT';
|
||||
},
|
||||
|
||||
() => cur_frm.save(),
|
||||
() => frappe.timeout(2),
|
||||
() => assert.equal(cur_frm.doc.accounts[0].account, 'Salary - FT'),
|
||||
|
||||
() => frappe.set_route('Form', 'Salary Component', 'Arrear'),
|
||||
() => {
|
||||
var row = frappe.model.add_child(cur_frm.doc, "Salary Component Account", "accounts");
|
||||
row.company = 'For Testing';
|
||||
row.account = 'Salary - FT';
|
||||
},
|
||||
|
||||
() => cur_frm.save(),
|
||||
() => frappe.timeout(2),
|
||||
() => assert.equal(cur_frm.doc.accounts[0].account, 'Salary - FT'),
|
||||
|
||||
() => frappe.set_route('Form', 'Company', 'For Testing'),
|
||||
() => cur_frm.set_value('default_payroll_payable_account', 'Payroll Payable - FT'),
|
||||
() => cur_frm.save(),
|
||||
() => frappe.timeout(2),
|
||||
() => assert.equal(cur_frm.doc.default_payroll_payable_account, 'Payroll Payable - FT'),
|
||||
|
||||
() => done()
|
||||
|
||||
]);
|
||||
});
|
||||
@@ -1,55 +0,0 @@
|
||||
QUnit.test("test salary slip", function(assert) {
|
||||
assert.expect(6);
|
||||
let done = assert.async();
|
||||
let employee_name;
|
||||
|
||||
let salary_slip = (ename) => {
|
||||
frappe.run_serially([
|
||||
() => frappe.db.get_value('Employee', {'employee_name': ename}, 'name'),
|
||||
(r) => {
|
||||
employee_name = r.message.name;
|
||||
},
|
||||
() => {
|
||||
// Creating a salary slip for a employee
|
||||
frappe.tests.make('Salary Slip', [
|
||||
{ employee: employee_name}
|
||||
]);
|
||||
},
|
||||
() => frappe.timeout(3),
|
||||
() => {
|
||||
// To check if all the calculations are correctly done
|
||||
if(ename === 'Test Employee 1')
|
||||
{
|
||||
assert.ok(cur_frm.doc.gross_pay==24000,
|
||||
'Gross amount for first employee is correctly calculated');
|
||||
assert.ok(cur_frm.doc.total_deduction==4800,
|
||||
'Deduction amount for first employee is correctly calculated');
|
||||
assert.ok(cur_frm.doc.net_pay==19200,
|
||||
'Net amount for first employee is correctly calculated');
|
||||
}
|
||||
if(ename === 'Test Employee 3')
|
||||
{
|
||||
assert.ok(cur_frm.doc.gross_pay==28800,
|
||||
'Gross amount for second employee is correctly calculated');
|
||||
assert.ok(cur_frm.doc.total_deduction==5760,
|
||||
'Deduction amount for second employee is correctly calculated');
|
||||
assert.ok(cur_frm.doc.net_pay==23040,
|
||||
'Net amount for second employee is correctly calculated');
|
||||
}
|
||||
},
|
||||
]);
|
||||
};
|
||||
frappe.run_serially([
|
||||
() => salary_slip('Test Employee 1'),
|
||||
() => frappe.timeout(6),
|
||||
() => salary_slip('Test Employee 3'),
|
||||
() => frappe.timeout(5),
|
||||
() => frappe.set_route('List', 'Salary Slip', 'List'),
|
||||
() => frappe.timeout(2),
|
||||
() => {$('.list-row-checkbox').click();},
|
||||
() => frappe.timeout(2),
|
||||
() => frappe.click_button('Delete'),
|
||||
() => frappe.click_button('Yes'),
|
||||
() => done()
|
||||
]);
|
||||
});
|
||||
@@ -1,78 +0,0 @@
|
||||
QUnit.test("test Salary Structure", function(assert) {
|
||||
assert.expect(7);
|
||||
let done = assert.async();
|
||||
let employee_name1;
|
||||
|
||||
frappe.run_serially([
|
||||
() => frappe.db.get_value('Employee', {'employee_name': "Test Employee 1"}, 'name',
|
||||
(r) => {
|
||||
employee_name1 = r.name;
|
||||
}
|
||||
),
|
||||
() => frappe.timeout(5),
|
||||
() => frappe.db.get_value('Employee', {'employee_name': "Test Employee 3"}, 'name',
|
||||
(r) => {
|
||||
// Creating Salary Structure for employees);
|
||||
return frappe.tests.make('Salary Structure', [
|
||||
{ __newname: 'Test Salary Structure'},
|
||||
{ company: 'For Testing'},
|
||||
{ payroll_frequency: 'Monthly'},
|
||||
{ employees: [
|
||||
[
|
||||
{employee: employee_name1},
|
||||
{from_date: '2017-07-01'},
|
||||
{base: 25000}
|
||||
],
|
||||
[
|
||||
{employee: r.name},
|
||||
{from_date: '2017-07-01'},
|
||||
{base: 30000}
|
||||
]
|
||||
]},
|
||||
{ earnings: [
|
||||
[
|
||||
{salary_component: 'Basic'},
|
||||
{formula: 'base * .80'}
|
||||
],
|
||||
[
|
||||
{salary_component: 'Leave Encashment'},
|
||||
{formula: 'B * .20'}
|
||||
]
|
||||
]},
|
||||
{ deductions: [
|
||||
[
|
||||
{salary_component: 'Income Tax'},
|
||||
{formula: '(B+LE) * .20'}
|
||||
]
|
||||
]},
|
||||
{ payment_account: 'CASH - FT'},
|
||||
]);
|
||||
}
|
||||
),
|
||||
() => frappe.timeout(15),
|
||||
() => {
|
||||
// To check if all the fields are correctly set
|
||||
assert.ok(cur_frm.doc.employees[0].employee_name=='Test Employee 1',
|
||||
'Employee 1 name correctly set');
|
||||
|
||||
assert.ok(cur_frm.doc.employees[1].employee_name=='Test Employee 3',
|
||||
'Employee 2 name correctly set');
|
||||
|
||||
assert.ok(cur_frm.doc.employees[0].base==25000,
|
||||
'Base value for first employee is correctly set');
|
||||
|
||||
assert.ok(cur_frm.doc.employees[1].base==30000,
|
||||
'Base value for second employee is correctly set');
|
||||
|
||||
assert.ok(cur_frm.doc.earnings[0].formula.includes('base * .80'),
|
||||
'Formula for earnings as Basic is correctly set');
|
||||
|
||||
assert.ok(cur_frm.doc.earnings[1].formula.includes('B * .20'),
|
||||
'Formula for earnings as Leave Encashment is correctly set');
|
||||
|
||||
assert.ok(cur_frm.doc.deductions[0].formula.includes('(B+LE) * .20'),
|
||||
'Formula for deductions as Income Tax is correctly set');
|
||||
},
|
||||
() => done()
|
||||
]);
|
||||
});
|
||||
Reference in New Issue
Block a user