From b4f5f1443863b6ceb40ff6d4a717e37421044032 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 20 Oct 2017 11:26:17 +0530 Subject: [PATCH] Timeout increased for setting __newname (#11252) * Timeout increased for setting __newname * UI test fixes * fixed ui test for PO * ui tests * ui tests * ui tests * ui tests * ui tests --- .../purchase_order/test_purchase_order.js | 23 ------------------- .../tests/test_purchase_order.js | 6 ++--- .../tests/test_request_for_quotation.js | 5 ++-- .../buying/doctype/supplier/test_supplier.js | 3 ++- .../test_supplier_quotation.js | 23 ------------------- .../tests/test_supplier_quotation.js | 1 + .../doctype/offer_letter/test_offer_letter.js | 2 +- .../doctype/salary_slip/test_salary_slip.js | 4 ++-- .../salary_structure/test_salary_structure.js | 15 +++++++----- .../doctype/operation/test_operation.js | 6 ++--- .../doctype/restaurant/test_restaurant.js | 2 ++ .../restaurant_menu/test_restaurant_menu.js | 2 ++ 12 files changed, 28 insertions(+), 64 deletions(-) delete mode 100644 erpnext/buying/doctype/purchase_order/test_purchase_order.js delete mode 100644 erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.js diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.js b/erpnext/buying/doctype/purchase_order/test_purchase_order.js deleted file mode 100644 index e9db270b4f..0000000000 --- a/erpnext/buying/doctype/purchase_order/test_purchase_order.js +++ /dev/null @@ -1,23 +0,0 @@ -/* eslint-disable */ -// rename this file from _test_[name] to test_[name] to activate -// and remove above this line - -QUnit.test("test: Purchase Order", function (assert) { - let done = assert.async(); - - // number of asserts - assert.expect(1); - - frappe.run_serially('Purchase Order', [ - // insert a new Purchase Order - () => frappe.tests.make([ - // values to be set - {key: 'value'} - ]), - () => { - assert.equal(cur_frm.doc.key, 'value'); - }, - () => done() - ]); - -}); diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js index 6605a65170..d65fe990cb 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js @@ -1,7 +1,7 @@ QUnit.module('Buying'); QUnit.test("test: purchase order", function(assert) { - assert.expect(11); + assert.expect(17); let done = assert.async(); frappe.run_serially([ @@ -53,7 +53,7 @@ QUnit.test("test: purchase order", function(assert) { assert.ok(cur_frm.doc.items[1].qty == 2, "Quantity correct"); assert.ok(cur_frm.doc.items[1].schedule_date == cur_frm.doc.schedule_date, "Schedule Date correct"); // Calculate total - assert.ok(cur_frm.doc.total == 500, "Total correct"); + assert.ok(cur_frm.doc.total == 700, "Total correct"); // Get terms assert.ok(cur_frm.doc.terms == 'This is a term.', "Terms correct"); }, @@ -70,7 +70,7 @@ QUnit.test("test: purchase order", function(assert) { () => frappe.tests.click_button('Submit'), () => frappe.tests.click_button('Yes'), - () => frappe.timeout(0.3), + () => frappe.timeout(1), () => { assert.ok(cur_frm.doc.status == 'To Receive and Bill', "Submitted successfully"); diff --git a/erpnext/buying/doctype/request_for_quotation/tests/test_request_for_quotation.js b/erpnext/buying/doctype/request_for_quotation/tests/test_request_for_quotation.js index a4d68aa946..1fcfe75bb0 100644 --- a/erpnext/buying/doctype/request_for_quotation/tests/test_request_for_quotation.js +++ b/erpnext/buying/doctype/request_for_quotation/tests/test_request_for_quotation.js @@ -27,6 +27,7 @@ QUnit.test("test: request_for_quotation", function(assert) { {tc_name: 'Test Term 1'} ]); }, + () => frappe.timeout(3), () => { assert.ok(cur_frm.doc.transaction_date == date, "Date correct"); assert.ok(cur_frm.doc.company == cur_frm.doc.company, "Company correct"); @@ -38,7 +39,7 @@ QUnit.test("test: request_for_quotation", function(assert) { assert.ok(cur_frm.doc.message_for_supplier == 'Please supply the specified items at the best possible rates', "Reply correct"); assert.ok(cur_frm.doc.tc_name == 'Test Term 1', "Term name correct"); }, - () => frappe.timeout(0.3), + () => frappe.timeout(3), () => cur_frm.print_doc(), () => frappe.timeout(1), () => { @@ -65,7 +66,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(4), + () => frappe.timeout(6), () => { 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"); }, diff --git a/erpnext/buying/doctype/supplier/test_supplier.js b/erpnext/buying/doctype/supplier/test_supplier.js index 99a5bc616d..05ea04422d 100644 --- a/erpnext/buying/doctype/supplier/test_supplier.js +++ b/erpnext/buying/doctype/supplier/test_supplier.js @@ -56,7 +56,8 @@ QUnit.test("test: supplier", function(assert) { () => frappe.click_button('New Contact'), () => { return frappe.tests.set_form_values(cur_frm, [ - {first_name: "Contact 3"} + {first_name: "Contact 3"}, + {email_id: "test@supplier.com"} ]); }, () => cur_frm.save(), diff --git a/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.js b/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.js deleted file mode 100644 index 7097a6dcb2..0000000000 --- a/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.js +++ /dev/null @@ -1,23 +0,0 @@ -/* eslint-disable */ -// rename this file from _test_[name] to test_[name] to activate -// and remove above this line - -QUnit.test("test: Supplier Quotation", function (assert) { - let done = assert.async(); - - // number of asserts - assert.expect(1); - - frappe.run_serially('Supplier Quotation', [ - // insert a new Supplier Quotation - () => frappe.tests.make([ - // values to be set - {key: 'value'} - ]), - () => { - assert.equal(cur_frm.doc.key, 'value'); - }, - () => done() - ]); - -}); diff --git a/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation.js b/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation.js index 76be06c6fb..54117fedae 100644 --- a/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation.js +++ b/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation.js @@ -27,6 +27,7 @@ QUnit.test("test: supplier quotation", function(assert) { {terms: 'This is a term'} ]); }, + () => frappe.timeout(3), () => { // Get Supplier details assert.ok(cur_frm.doc.supplier == 'Test Supplier', "Supplier correct"); diff --git a/erpnext/hr/doctype/offer_letter/test_offer_letter.js b/erpnext/hr/doctype/offer_letter/test_offer_letter.js index 2069532612..5b61d64eb5 100644 --- a/erpnext/hr/doctype/offer_letter/test_offer_letter.js +++ b/erpnext/hr/doctype/offer_letter/test_offer_letter.js @@ -27,7 +27,7 @@ QUnit.test("Test: Offer Letter [HR]", function (assert) { ]}, ]); }, - () => frappe.timeout(8), + () => frappe.timeout(12), () => frappe.click_button('Submit'), () => frappe.timeout(2), () => frappe.click_button('Yes'), diff --git a/erpnext/hr/doctype/salary_slip/test_salary_slip.js b/erpnext/hr/doctype/salary_slip/test_salary_slip.js index a49c973d13..619e5300ca 100644 --- a/erpnext/hr/doctype/salary_slip/test_salary_slip.js +++ b/erpnext/hr/doctype/salary_slip/test_salary_slip.js @@ -15,7 +15,7 @@ QUnit.test("test salary slip", function(assert) { { employee: employee_name} ]); }, - () => frappe.timeout(1), + () => frappe.timeout(3), () => { // To check if all the calculations are correctly done if(ename === 'Test Employee 1') @@ -43,7 +43,7 @@ QUnit.test("test salary slip", function(assert) { () => salary_slip('Test Employee 1'), () => frappe.timeout(6), () => salary_slip('Test Employee 3'), - () => frappe.timeout(3), + () => frappe.timeout(5), () => done() ]); }); \ No newline at end of file diff --git a/erpnext/hr/doctype/salary_structure/test_salary_structure.js b/erpnext/hr/doctype/salary_structure/test_salary_structure.js index 5e028cfa06..542fa50354 100644 --- a/erpnext/hr/doctype/salary_structure/test_salary_structure.js +++ b/erpnext/hr/doctype/salary_structure/test_salary_structure.js @@ -1,5 +1,5 @@ QUnit.test("test Salary Structure", function(assert) { - assert.expect(6); + assert.expect(7); let done = assert.async(); let employee_name1; @@ -9,6 +9,7 @@ QUnit.test("test Salary Structure", function(assert) { employee_name1 = r.name; } ), + () => frappe.timeout(5), () => frappe.db.get_value('Employee', {'employee_name': "Test Employee 3"}, 'name', (r) => { // Creating Salary Structure for employees); @@ -48,12 +49,14 @@ QUnit.test("test Salary Structure", function(assert) { ]); } ), - () => frappe.timeout(3), + () => frappe.timeout(15), () => { - // To check if all the fields are correctly set - assert.ok(cur_frm.doc.employees[0].employee_name.includes('Test Employee 1') && - cur_frm.doc.employees[1].employee_name.includes('Test Employee 3'), - 'Employee names are correctly set'); + // 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'); diff --git a/erpnext/manufacturing/doctype/operation/test_operation.js b/erpnext/manufacturing/doctype/operation/test_operation.js index 5aafe42ab9..42553ce721 100644 --- a/erpnext/manufacturing/doctype/operation/test_operation.js +++ b/erpnext/manufacturing/doctype/operation/test_operation.js @@ -14,7 +14,7 @@ QUnit.test("test: operation", function (assert) { ] ); }, - () => frappe.timeout(1), + () => frappe.timeout(3), () => { assert.ok(cur_frm.docname.includes('Assemble Keyboard'), 'Assemble Keyboard created successfully'); @@ -31,7 +31,7 @@ QUnit.test("test: operation", function (assert) { ] ); }, - () => frappe.timeout(1), + () => frappe.timeout(3), // Create a CPU operation () => { @@ -42,7 +42,7 @@ QUnit.test("test: operation", function (assert) { ] ); }, - () => frappe.timeout(1), + () => frappe.timeout(3), () => done() ]); diff --git a/erpnext/restaurant/doctype/restaurant/test_restaurant.js b/erpnext/restaurant/doctype/restaurant/test_restaurant.js index 1cc7c7f069..6e1f1413e8 100644 --- a/erpnext/restaurant/doctype/restaurant/test_restaurant.js +++ b/erpnext/restaurant/doctype/restaurant/test_restaurant.js @@ -18,6 +18,7 @@ QUnit.test("test: Restaurant", function (assert) { {invoice_series_prefix: 'Test-Rest-1-Inv-'} ]) }, + () => frappe.timeout(3), () => { assert.equal(cur_frm.doc.company, 'Test Company'); }, @@ -29,6 +30,7 @@ QUnit.test("test: Restaurant", function (assert) { {invoice_series_prefix: 'Test-Rest-3-Inv-'} ]); }, + () => frappe.timeout(3), () => { assert.equal(cur_frm.doc.company, 'Test Company'); }, diff --git a/erpnext/restaurant/doctype/restaurant_menu/test_restaurant_menu.js b/erpnext/restaurant/doctype/restaurant_menu/test_restaurant_menu.js index 25057d8334..7dca139693 100644 --- a/erpnext/restaurant/doctype/restaurant_menu/test_restaurant_menu.js +++ b/erpnext/restaurant/doctype/restaurant_menu/test_restaurant_menu.js @@ -50,6 +50,7 @@ QUnit.test("test: Restaurant Menu", function (assert) { ]} ]); }, + () => frappe.timeout(2), () => { return frappe.tests.make("Restaurant Menu", [ {__newname: 'Restaurant Menu 2'}, @@ -66,6 +67,7 @@ QUnit.test("test: Restaurant Menu", function (assert) { ]} ]); }, + () => frappe.timeout(2), () => frappe.set_route('Form', 'Restaurant', 'Test Restaurant 1'), () => cur_frm.set_value('active_menu', 'Restaurant Menu 1'), () => cur_frm.save(),