Fixed multiple ui tests

This commit is contained in:
Nabin Hait 2017-09-12 15:40:33 +05:30
parent 80b902cea6
commit de9eebe51c
10 changed files with 58 additions and 33 deletions

View File

@ -65,7 +65,7 @@ QUnit.test("test: request_for_quotation", function(assert) {
assert.ok(cur_frm.doc.docstatus == 1, "Quotation request submitted");
},
() => frappe.click_button('Send Supplier Emails'),
() => frappe.timeout(3),
() => frappe.timeout(4),
() => {
assert.ok($('div.modal.fade.in > div.modal-dialog > div > div.modal-body.ui-front > div.msgprint').text().includes("Email sent to supplier Test Supplier"), "Send emails working");
},

View File

@ -14,8 +14,12 @@ QUnit.test("Test: Attendance [HR]", function (assert) {
"Form for new Attendance opened successfully."),
// set values in form
() => cur_frm.set_value("company", "Test Company"),
() => frappe.db.get_value('Employee', {'employee_name':'Test Employee 1'}, 'name'),
(employee) => cur_frm.set_value("employee", employee.message.name),
() => {
frappe.db.get_value('Employee', {'employee_name':'Test Employee 1'}, 'name', function(r) {
cur_frm.set_value("employee", r.name)
});
},
() => frappe.timeout(1),
() => cur_frm.save(),
() => frappe.timeout(1),
// check docstatus of attendance before submit [Draft]

View File

@ -38,9 +38,23 @@ QUnit.test("Test: Employee attendance tool [HR]", function (assert) {
() => frappe.set_route("List", "Attendance", "List"),
() => frappe.timeout(1),
() => {
let marked_attendance = cur_list.data.filter(d => d.attendance_date == date_of_attendance);
assert.equal(marked_attendance.length, 3,
'all the attendance are marked for correct date');
return frappe.call({
method: "frappe.client.get_list",
args: {
doctype: "Employee",
filters: {
"branch": "Test Branch",
"department": "Test Department",
"company": "Test Company",
"status": "Active"
}
},
callback: function(r) {
let marked_attendance = cur_list.data.filter(d => d.attendance_date == date_of_attendance);
assert.equal(marked_attendance.length, r.message.length,
'all the attendance are marked for correct date');
}
});
},
() => done()
]);

View File

@ -10,8 +10,12 @@ QUnit.test("Test: Leave allocation [HR]", function (assert) {
() => frappe.set_route("List", "Leave Allocation", "List"),
() => frappe.new_doc("Leave Allocation"),
() => frappe.timeout(1),
() => frappe.db.get_value('Employee', {'employee_name':'Test Employee 1'}, 'name'),
(employee) => cur_frm.set_value("employee", employee.message.name),
() => {
frappe.db.get_value('Employee', {'employee_name':'Test Employee 1'}, 'name', function(r) {
cur_frm.set_value("employee", r.name)
});
},
() => frappe.timeout(1),
() => cur_frm.set_value("leave_type", "Test Leave type"),
() => cur_frm.set_value("to_date", frappe.datetime.add_months(today_date, 2)), // for two months
() => cur_frm.set_value("description", "This is just for testing"),

View File

@ -21,15 +21,29 @@ QUnit.test("Test: Leave control panel [HR]", function (assert) {
// allocate leaves
() => frappe.click_button('Allocate'),
() => frappe.timeout(1),
() => assert.equal("Message", cur_dialog.title,
"leave alloction message shown"),
() => assert.equal("Message", cur_dialog.title, "leave alloction message shown"),
() => frappe.click_button('Close'),
() => frappe.set_route("List", "Leave Allocation", "List"),
() => frappe.timeout(1),
() => {
let leave_allocated = cur_list.data.filter(d => d.leave_type == "Test Leave type");
assert.equal(3, leave_allocated.length,
'leave allocation successfully done for all the employees');
return frappe.call({
method: "frappe.client.get_list",
args: {
doctype: "Employee",
filters: {
"branch": "Test Branch",
"department": "Test Department",
"company": "Test Company",
"designation": "Test Designation",
"status": "Active"
}
},
callback: function(r) {
let leave_allocated = cur_list.data.filter(d => d.leave_type == "Test Leave type");
assert.equal(r.message.length, leave_allocated.length,
'leave allocation successfully done for all the employees');
}
});
},
() => done()
]);

View File

@ -30,7 +30,7 @@ QUnit.test("test: quotation", function (assert) {
() => cur_frm.doc.items[0].rate = 200,
() => frappe.timeout(0.3),
() => cur_frm.set_value("tc_name", "Test Term 1"),
() => frappe.timeout(0.3),
() => frappe.timeout(0.5),
() => cur_frm.save(),
() => {
// Check Address and Contact Info

View File

@ -27,7 +27,12 @@ QUnit.test("test sales order", function(assert) {
},
() => {
return frappe.tests.set_form_values(cur_frm, [
{selling_price_list:'Test-Selling-USD'},
{selling_price_list:'Test-Selling-USD'}
]);
},
() => frappe.timeout(.5),
() => {
return frappe.tests.set_form_values(cur_frm, [
{currency: 'USD'},
{apply_discount_on:'Grand Total'},
{additional_discount_percentage:10}

View File

@ -1,17 +0,0 @@
QUnit.test("test:POS Settings", function(assert) {
assert.expect(1);
let done = assert.async();
frappe.run_serially([
() => frappe.set_route('Form', 'POS Settings'),
() => cur_frm.set_value('use_pos_in_offline_mode', 0),
() => frappe.timeout(0.2),
() => cur_frm.save(),
() => frappe.timeout(1),
() => frappe.ui.toolbar.clear_cache(),
() => frappe.timeout(10),
() => assert.ok(cur_frm.doc.use_pos_in_offline_mode==0, "Enabled online"),
() => frappe.timeout(2),
() => done()
]);
});

View File

@ -17,12 +17,14 @@ def run_setup_wizard_test():
# Language slide
driver.set_select("language", "English (United States)")
driver.wait_for_ajax(True)
driver.wait_for('.next-btn', timeout=100)
driver.wait_till_clickable(".next-btn").click()
# Region slide
driver.wait_for_ajax(True)
driver.set_select("country", "India")
driver.wait_for_ajax(True)
driver.wait_for('.next-btn', timeout=100)
driver.wait_till_clickable(".next-btn").click()
# Profile slide

View File

@ -50,7 +50,6 @@ erpnext/schools/doctype/room/test_room.js
erpnext/schools/doctype/instructor/test_instructor.js
erpnext/stock/doctype/warehouse/test_warehouse.js
erpnext/manufacturing/doctype/production_order/test_production_order.js #long
erpnext/selling/page/point_of_sale/tests/test_pos_settings.js
erpnext/selling/page/point_of_sale/tests/test_point_of_sale.js
erpnext/accounts/page/pos/test_pos.js
erpnext/selling/doctype/product_bundle/test_product_bundle.js