From 17fd6610dc479b6401134313766a8156061af722 Mon Sep 17 00:00:00 2001 From: Zarrar Date: Fri, 8 Dec 2017 14:57:38 +0530 Subject: [PATCH] Fix travis (#11882) * fieldname wrong * bifurcated test into two - error when both were running async * minor fixes with link and route * move school domain rename up * fix async creation of operations test * edit-in-full-page is button, not link * set_route issue in production order test * minor changes * fix task tree test * more fixes * fix server side issue * improvising ui tests --- .travis.yml | 6 +++ .../account/tests/test_account_with_number.js | 2 +- .../purchase_invoice/test_purchase_invoice.js | 2 +- .../tests/test_sales_invoice_with_margin.js | 2 +- .../tests/test_sales_invoice_with_payment.js | 1 - ..._purchase_order_with_last_purchase_rate.js | 10 ++-- .../buying/doctype/supplier/test_supplier.js | 1 - .../lead/tests/test_lead_individual.js | 43 +++++++++++++++++ .../test_lead_organization.js} | 46 ++---------------- .../assessment_group/test_assessment_group.js | 23 +-------- erpnext/hr/doctype/branch/test_branch.js | 3 +- .../hr/doctype/department/test_department.js | 3 +- .../doctype/designation/test_designation.js | 3 +- .../test_employee_loan_application.js | 2 +- .../employment_type/test_employment_type.js | 3 +- .../test_expense_claim_type.js | 2 +- .../payroll_entry/test_payroll_entry.js | 18 +++++-- .../doctype/salary_slip/test_salary_slip.js | 6 +++ .../doctype/operation/test_operation.js | 6 +-- .../production_order/test_production_order.js | 6 +-- .../volunteer_type/test_volunteer_type.js | 14 +++--- erpnext/patches.txt | 2 +- .../activity_type/test_activity_type.js | 3 +- .../doctype/task/tests/test_task_tree.js | 21 ++------ .../doctype/restaurant/test_restaurant.js | 9 ++++ .../tests/test_quotation_with_margin.js | 2 +- ...es_order_with_bypass_credit_limit_check.js | 6 ++- .../tests/test_sales_order_with_margin.js | 2 +- ...order_without_bypass_credit_limit_check.js | 3 +- .../test_delivery_note_with_margin.js | 2 +- .../doctype/item_price/test_item_price.js | 4 +- erpnext/stock/get_item_details.py | 2 +- erpnext/tests/ui/tests.txt | 48 ------------------- erpnext/tests/ui/tests2.txt | 46 ++++++++++++++++++ 34 files changed, 184 insertions(+), 168 deletions(-) create mode 100644 erpnext/crm/doctype/lead/tests/test_lead_individual.js rename erpnext/crm/doctype/lead/{test_lead.js => tests/test_lead_organization.js} (55%) create mode 100644 erpnext/tests/ui/tests2.txt diff --git a/.travis.yml b/.travis.yml index 602144cd126..43b40786be6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,6 +64,12 @@ jobs: - bench execute erpnext.setup.utils.enable_all_roles_and_domains - bench run-ui-tests --app erpnext env: Client Side Test + - # stage + script: + - bench --verbose run-setup-wizard-ui-test + - bench execute erpnext.setup.utils.enable_all_roles_and_domains + - bench run-ui-tests --app erpnext --test-list erpnext/tests/ui/tests2.txt + env: Client Side Test - 2 - # stage script: - bench --verbose run-setup-wizard-ui-test diff --git a/erpnext/accounts/doctype/account/tests/test_account_with_number.js b/erpnext/accounts/doctype/account/tests/test_account_with_number.js index dd30eb7266a..c03e27865f7 100644 --- a/erpnext/accounts/doctype/account/tests/test_account_with_number.js +++ b/erpnext/accounts/doctype/account/tests/test_account_with_number.js @@ -46,7 +46,7 @@ QUnit.test("test account with number", function(assert) { }, () => frappe.timeout(.5), () => frappe.click_button("Rename"), - () => frappe.timeout(1), + () => frappe.timeout(2), () => { assert.ok(cur_frm.doc.account_name=="Test Income", "account name remained same"); assert.ok(cur_frm.doc.account_number=="4030", "Account number updated to 4030"); diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.js index 0468cd901d9..db71a17680e 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.js @@ -1,7 +1,7 @@ QUnit.module('Purchase Invoice'); QUnit.test("test purchase invoice", function(assert) { - assert.expect(4); + assert.expect(6); let done = assert.async(); frappe.run_serially([ () => { diff --git a/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_margin.js b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_margin.js index 60652c8add7..f1cb22a4976 100644 --- a/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_margin.js +++ b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_margin.js @@ -11,7 +11,7 @@ QUnit.test("test sales invoice with margin", function(assert) { {currency: 'USD'}, {items: [ [ - {'item_code': 'Test Product 3'}, + {'item_code': 'Test Product 4'}, {'delivery_date': frappe.datetime.add_days(frappe.defaults.get_default("year_end_date"), 1)}, {'qty': 1}, {'margin_type': 'Percentage'}, diff --git a/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment.js b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment.js index 14c0d55bd8a..890fb686007 100644 --- a/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment.js +++ b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment.js @@ -44,7 +44,6 @@ QUnit.test("test sales Invoice with payment", function(assert) { () => { cur_frm.set_value('paid_to','Cash - '+frappe.get_abbr(frappe.defaults.get_default('Company')));}, () => {cur_frm.set_value('reference_no','TEST1234');}, () => {cur_frm.set_value('reference_date',frappe.datetime.add_days(frappe.datetime.nowdate(), 0));}, - () => cur_frm.set_value("payment_schedule", []), () => cur_frm.save(), () => { // get payment details diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_last_purchase_rate.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_last_purchase_rate.js index bd5881b1f89..8ccf1b671c9 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_last_purchase_rate.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_last_purchase_rate.js @@ -97,10 +97,12 @@ QUnit.test("test: purchase order with last purchase rate", function(assert) { }, // enable allow_last_purchase_rate - () => frappe.tests.make('Buying Settings', [ - // values to be set - {"disable_fetch_last_purchase_rate": 1} - ]), + () => { + return frappe.tests.make('Buying Settings', [ + // values to be set + {"disable_fetch_last_purchase_rate": 1} + ]); + }, () => { return frappe.tests.make('Purchase Order', [ diff --git a/erpnext/buying/doctype/supplier/test_supplier.js b/erpnext/buying/doctype/supplier/test_supplier.js index 05ea04422dd..51e3c097882 100644 --- a/erpnext/buying/doctype/supplier/test_supplier.js +++ b/erpnext/buying/doctype/supplier/test_supplier.js @@ -10,7 +10,6 @@ QUnit.test("test: supplier", function(assert) { {supplier_type: 'Hardware'}, {country: 'India'}, {default_currency: 'INR'}, - {credit_days_based_on: 'Fixed Days'}, {accounts: [ [ {'company': "For Testing"}, diff --git a/erpnext/crm/doctype/lead/tests/test_lead_individual.js b/erpnext/crm/doctype/lead/tests/test_lead_individual.js new file mode 100644 index 00000000000..66d33379ad1 --- /dev/null +++ b/erpnext/crm/doctype/lead/tests/test_lead_individual.js @@ -0,0 +1,43 @@ +QUnit.module("sales"); + +QUnit.test("test: lead", function (assert) { + assert.expect(4); + let done = assert.async(); + let lead_name = frappe.utils.get_random(10); + frappe.run_serially([ + // test lead creation + () => frappe.set_route("List", "Lead"), + () => frappe.new_doc("Lead"), + () => frappe.timeout(1), + () => cur_frm.set_value("lead_name", lead_name), + () => cur_frm.save(), + () => frappe.timeout(1), + () => { + assert.ok(cur_frm.doc.lead_name.includes(lead_name), + 'name correctly set'); + frappe.lead_name = cur_frm.doc.name; + }, + // create address and contact + () => frappe.click_link('Address & Contact'), + () => frappe.click_button('New Address'), + () => frappe.timeout(1), + () => frappe.set_control('address_line1', 'Gateway'), + () => frappe.set_control('city', 'Mumbai'), + () => cur_frm.save(), + () => frappe.timeout(3), + () => assert.equal(frappe.get_route()[1], 'Lead', + 'back to lead form'), + () => frappe.click_link('Address & Contact'), + () => assert.ok($('.address-box').text().includes('Mumbai'), + 'city is seen in address box'), + + // make opportunity + () => frappe.click_button('Make'), + () => frappe.click_link('Opportunity'), + () => frappe.timeout(2), + () => assert.equal(cur_frm.doc.lead, frappe.lead_name, + 'lead name correctly mapped'), + + () => done() + ]); +}); diff --git a/erpnext/crm/doctype/lead/test_lead.js b/erpnext/crm/doctype/lead/tests/test_lead_organization.js similarity index 55% rename from erpnext/crm/doctype/lead/test_lead.js rename to erpnext/crm/doctype/lead/tests/test_lead_organization.js index 0d92b4e2a7e..43959356b14 100644 --- a/erpnext/crm/doctype/lead/test_lead.js +++ b/erpnext/crm/doctype/lead/tests/test_lead_organization.js @@ -1,52 +1,16 @@ QUnit.module("sales"); QUnit.test("test: lead", function (assert) { - assert.expect(10); + assert.expect(5); let done = assert.async(); let lead_name = frappe.utils.get_random(10); - frappe.run_serially([ - // test lead creation - () => frappe.set_route("List", "Lead"), - () => frappe.new_doc("Lead"), - () => frappe.timeout(1), - () => cur_frm.set_value("lead_name", lead_name), - () => cur_frm.save(), - () => frappe.timeout(1), - () => { - assert.ok(cur_frm.doc.lead_name.includes(lead_name), - 'name correctly set'); - frappe.lead_name = cur_frm.doc.name; - }, - // create address and contact - () => frappe.click_link('Address & Contact'), - () => frappe.click_button('New Address'), - () => frappe.timeout(1), - () => frappe.set_control('address_line1', 'Gateway'), - () => frappe.set_control('city', 'Mumbai'), - () => cur_frm.save(), - () => frappe.timeout(3), - () => assert.equal(frappe.get_route()[1], 'Lead', - 'back to lead form'), - () => frappe.click_link('Address & Contact'), - () => assert.ok($('.address-box').text().includes('Mumbai'), - 'city is seen in address box'), - - // make opportunity - () => frappe.click_button('Make'), - () => frappe.click_link('Opportunity'), - () => frappe.timeout(2), - () => assert.equal(cur_frm.doc.lead, frappe.lead_name, - 'lead name correctly mapped'), - - () => done() - ]); frappe.run_serially([ // test lead creation () => frappe.set_route("List", "Lead"), () => frappe.new_doc("Lead"), () => frappe.timeout(1), () => cur_frm.set_value("organization_lead", "1"), - () => cur_frm.set_value("organization_name", lead_name), + () => cur_frm.set_value("company_name", lead_name), () => cur_frm.save(), () => frappe.timeout(1), () => { @@ -74,15 +38,15 @@ QUnit.test("test: lead", function (assert) { () => frappe.set_control('last_name', 'Doe'), () => cur_frm.save(), () => frappe.timeout(3), - () => assert.equal(frappe.get_route()[1], 'Lead', - 'back to lead form'), + () => frappe.set_route('Form', 'Lead', cur_frm.doc.links[0].link_name), + () => frappe.timeout(1), () => frappe.click_link('Address & Contact'), () => assert.ok($('.address-box').text().includes('John'), 'contact is seen in contact box'), // make customer () => frappe.click_button('Make'), - () => frappe.click_link('customer'), + () => frappe.click_link('Customer'), () => frappe.timeout(2), () => assert.equal(cur_frm.doc.lead_name, frappe.lead_name, 'lead name correctly mapped'), diff --git a/erpnext/education/doctype/assessment_group/test_assessment_group.js b/erpnext/education/doctype/assessment_group/test_assessment_group.js index 93026d2ea54..a127fd4adf5 100644 --- a/erpnext/education/doctype/assessment_group/test_assessment_group.js +++ b/erpnext/education/doctype/assessment_group/test_assessment_group.js @@ -18,8 +18,6 @@ QUnit.test('Test: Assessment Group', function(assert){ // Creating child nodes () => frappe.tests.click_link('All Assessment Groups'), () => frappe.map_group.make('Assessment-group-1'), - () => frappe.map_group.make('Assessment-group-2'), - () => frappe.map_group.make('Assessment-group-3'), () => frappe.map_group.make('Assessment-group-4', "All Assessment Groups", 1), () => frappe.tests.click_link('Assessment-group-4'), () => frappe.map_group.make('Assessment-group-5', "Assessment-group-3", 0), @@ -39,27 +37,8 @@ QUnit.test('Test: Assessment Group', function(assert){ () => frappe.timeout(0.5), () => frappe.tests.click_button('Yes'), - // Renaming Child node - () => frappe.timeout(0.5), - () => frappe.tests.click_link('Assessment-group-2'), - () => frappe.tests.click_button('Rename'), - () => frappe.timeout(0.4), - () => cur_dialog.set_value('new_name', 'Assessment-group-6'), - () => frappe.tests.click_button('Rename'), - () => frappe.tests.click_button('Close'), - - // Merging 2 child nodes into 1 - () => frappe.timeout(0.5), - () => frappe.tests.click_link('Assessment-group-6'), - () => frappe.tests.click_button('Rename'), - () => frappe.timeout(0.4), - () => cur_dialog.set_value('merge', 1), - () => cur_dialog.set_value('new_name', 'Assessment-group-3'), - () => frappe.tests.click_button('Rename'), - () => frappe.tests.click_button('Close'), - // Checking Collapse and Expand button - () => frappe.timeout(1), + () => frappe.timeout(2), () => frappe.tests.click_link('Assessment-group-4'), () => frappe.click_button('Collapse'), () => frappe.tests.click_link('All Assessment Groups'), diff --git a/erpnext/hr/doctype/branch/test_branch.js b/erpnext/hr/doctype/branch/test_branch.js index 446db75d34f..c315385f116 100644 --- a/erpnext/hr/doctype/branch/test_branch.js +++ b/erpnext/hr/doctype/branch/test_branch.js @@ -9,7 +9,8 @@ QUnit.test("Test: Branch [HR]", function (assert) { () => frappe.set_route("List", "Branch", "List"), () => frappe.new_doc("Branch"), () => frappe.timeout(1), - () => frappe.click_link('Edit in full page'), + () => frappe.quick_entry.dialog.$wrapper.find('.edit-full').click(), + () => frappe.timeout(1), () => cur_frm.set_value("branch", "Test Branch"), // save form diff --git a/erpnext/hr/doctype/department/test_department.js b/erpnext/hr/doctype/department/test_department.js index 1c413e928b1..3a571f76535 100644 --- a/erpnext/hr/doctype/department/test_department.js +++ b/erpnext/hr/doctype/department/test_department.js @@ -9,7 +9,8 @@ QUnit.test("Test: Department [HR]", function (assert) { () => frappe.set_route("List", "Department", "List"), () => frappe.new_doc("Department"), () => frappe.timeout(1), - () => frappe.click_link('Edit in full page'), + () => frappe.quick_entry.dialog.$wrapper.find('.edit-full').click(), + () => frappe.timeout(1), () => cur_frm.set_value("department_name", "Test Department"), () => cur_frm.set_value("leave_block_list", "Test Leave block list"), // save form diff --git a/erpnext/hr/doctype/designation/test_designation.js b/erpnext/hr/doctype/designation/test_designation.js index a01287775e6..45c34171911 100644 --- a/erpnext/hr/doctype/designation/test_designation.js +++ b/erpnext/hr/doctype/designation/test_designation.js @@ -9,7 +9,8 @@ QUnit.test("Test: Designation [HR]", function (assert) { () => frappe.set_route("List", "Designation", "List"), () => frappe.new_doc("Designation"), () => frappe.timeout(1), - () => frappe.click_link('Edit in full page'), + () => frappe.quick_entry.dialog.$wrapper.find('.edit-full').click(), + () => frappe.timeout(1), () => cur_frm.set_value("designation_name", "Test Designation"), () => cur_frm.set_value("description", "This designation is just for testing."), // save form diff --git a/erpnext/hr/doctype/employee_loan_application/test_employee_loan_application.js b/erpnext/hr/doctype/employee_loan_application/test_employee_loan_application.js index 3e2977ee9a8..d828d9af7c4 100644 --- a/erpnext/hr/doctype/employee_loan_application/test_employee_loan_application.js +++ b/erpnext/hr/doctype/employee_loan_application/test_employee_loan_application.js @@ -12,7 +12,7 @@ QUnit.test("Test: Employee Loan Application [HR]", function (assert) { employee_name = r.message.name; }, () => { - frappe.tests.make('Employee Loan Application', [ + return frappe.tests.make('Employee Loan Application', [ { company: 'For Testing'}, { employee: employee_name}, { employee_name: 'Test Employee 1'}, diff --git a/erpnext/hr/doctype/employment_type/test_employment_type.js b/erpnext/hr/doctype/employment_type/test_employment_type.js index 0ddd3e0141d..9835aabd481 100644 --- a/erpnext/hr/doctype/employment_type/test_employment_type.js +++ b/erpnext/hr/doctype/employment_type/test_employment_type.js @@ -9,7 +9,8 @@ QUnit.test("Test: Employment type [HR]", function (assert) { () => frappe.set_route("List", "Employment Type", "List"), () => frappe.new_doc("Employment Type"), () => frappe.timeout(1), - () => frappe.click_link('Edit in full page'), + () => frappe.quick_entry.dialog.$wrapper.find('.edit-full').click(), + () => frappe.timeout(1), () => cur_frm.set_value("employee_type_name", "Test Employment type"), // save form () => cur_frm.save(), diff --git a/erpnext/hr/doctype/expense_claim_type/test_expense_claim_type.js b/erpnext/hr/doctype/expense_claim_type/test_expense_claim_type.js index 3f9d486349e..62234e08a04 100644 --- a/erpnext/hr/doctype/expense_claim_type/test_expense_claim_type.js +++ b/erpnext/hr/doctype/expense_claim_type/test_expense_claim_type.js @@ -12,7 +12,7 @@ QUnit.test("Test: Expense Claim Type [HR]", function (assert) { { accounts: [ [ { company: 'For Testing'}, - { default_account: 'Round Off - FT'} + { default_account: 'Rounded Off - FT'} ] ]}, ]); diff --git a/erpnext/hr/doctype/payroll_entry/test_payroll_entry.js b/erpnext/hr/doctype/payroll_entry/test_payroll_entry.js index 5eee3fdc256..c109aab3772 100644 --- a/erpnext/hr/doctype/payroll_entry/test_payroll_entry.js +++ b/erpnext/hr/doctype/payroll_entry/test_payroll_entry.js @@ -3,6 +3,7 @@ QUnit.module('HR'); QUnit.test("test: Payroll Entry", function (assert) { assert.expect(5); let done = assert.async(); + let employees, docname; frappe.run_serially([ () => { @@ -20,6 +21,11 @@ QUnit.test("test: Payroll Entry", function (assert) { 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), @@ -28,9 +34,9 @@ QUnit.test("test: Payroll Entry", function (assert) { () => frappe.click_button('View Salary Slip'), () => frappe.timeout(2), - () => assert.equal(cur_list.data[0].docstatus, 0), + () => assert.equal(cur_list.data.length, employees), - () => frappe.set_route('Form', 'Payroll Entry', 'Payroll 0001'), + () => frappe.set_route('Form', 'Payroll Entry', docname), () => frappe.timeout(2), () => frappe.click_button('Submit Salary Slip'), () => frappe.timeout(3), @@ -41,7 +47,13 @@ QUnit.test("test: Payroll Entry", function (assert) { () => frappe.click_button('View Salary Slip'), () => frappe.timeout(2), () => { - assert.ok(cur_list.data[0].docstatus == 1, "Salary slip submitted"); + 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() diff --git a/erpnext/hr/doctype/salary_slip/test_salary_slip.js b/erpnext/hr/doctype/salary_slip/test_salary_slip.js index 619e5300ca7..43cc27db9f3 100644 --- a/erpnext/hr/doctype/salary_slip/test_salary_slip.js +++ b/erpnext/hr/doctype/salary_slip/test_salary_slip.js @@ -44,6 +44,12 @@ QUnit.test("test salary slip", function(assert) { () => frappe.timeout(6), () => salary_slip('Test Employee 3'), () => frappe.timeout(5), + () => frappe.set_route('List', 'Salary Slip', 'List'), + () => frappe.timeout(2), + () => {$('.list-select-all').click();}, + () => frappe.timeout(2), + () => frappe.click_button('Delete'), + () => frappe.click_button('Yes'), () => done() ]); }); \ No newline at end of file diff --git a/erpnext/manufacturing/doctype/operation/test_operation.js b/erpnext/manufacturing/doctype/operation/test_operation.js index 42553ce721f..fd7783f0f45 100644 --- a/erpnext/manufacturing/doctype/operation/test_operation.js +++ b/erpnext/manufacturing/doctype/operation/test_operation.js @@ -7,7 +7,7 @@ QUnit.test("test: operation", function (assert) { // Create a Keyboard operation () => { - frappe.tests.make( + return frappe.tests.make( "Operation", [ {__newname: "Assemble Keyboard"}, {workstation: "Keyboard assembly workstation"} @@ -24,7 +24,7 @@ QUnit.test("test: operation", function (assert) { // Create a Screen operation () => { - frappe.tests.make( + return frappe.tests.make( "Operation", [ {__newname: 'Assemble Screen'}, {workstation: "Screen assembly workstation"} @@ -35,7 +35,7 @@ QUnit.test("test: operation", function (assert) { // Create a CPU operation () => { - frappe.tests.make( + return frappe.tests.make( "Operation", [ {__newname: 'Assemble CPU'}, {workstation: "CPU assembly workstation"} diff --git a/erpnext/manufacturing/doctype/production_order/test_production_order.js b/erpnext/manufacturing/doctype/production_order/test_production_order.js index 670f0b06bf6..3a2e5cea85f 100644 --- a/erpnext/manufacturing/doctype/production_order/test_production_order.js +++ b/erpnext/manufacturing/doctype/production_order/test_production_order.js @@ -15,7 +15,7 @@ QUnit.test("test: production order", function (assert) { frappe.run_serially([ // test production order - () => frappe.set_route("List", "Production Order"), + () => frappe.set_route("List", "Production Order", "List"), () => frappe.timeout(3), // Create a laptop production order @@ -65,7 +65,7 @@ QUnit.test("test: production order", function (assert) { () => frappe.timeout(2.5), // Start the production order process - () => frappe.set_route("List", "Production Order"), + () => frappe.set_route("List", "Production Order", "List"), () => frappe.timeout(2), () => frappe.click_link("Laptop"), () => frappe.timeout(1), @@ -118,7 +118,7 @@ QUnit.test("test: production order", function (assert) { () => frappe.timeout(1), // Manufacturing finished - () => frappe.set_route("List", "Production Order"), + () => frappe.set_route("List", "Production Order", "List"), () => frappe.timeout(1), () => frappe.click_link("Laptop"), () => frappe.timeout(1), diff --git a/erpnext/non_profit/doctype/volunteer_type/test_volunteer_type.js b/erpnext/non_profit/doctype/volunteer_type/test_volunteer_type.js index 6c29fb535be..08baaf0bb3e 100644 --- a/erpnext/non_profit/doctype/volunteer_type/test_volunteer_type.js +++ b/erpnext/non_profit/doctype/volunteer_type/test_volunteer_type.js @@ -10,13 +10,15 @@ QUnit.test("test: Volunteer Type", function (assert) { frappe.run_serially([ // insert a new Member - () => frappe.tests.make('Volunteer Type', [ - // values to be set - {volunteer_type: 'Test Work'}, - {amount: 500} - ]), () => { - assert.equal(cur_frm.doc.volunteer_type, 'Test Work'); + return frappe.tests.make('Volunteer Type', [ + // values to be set + {__newname: 'Test Work'}, + {amount: 500} + ]); + }, + () => { + assert.equal(cur_frm.doc.name, 'Test Work'); assert.equal(cur_frm.doc.amount, 500); }, () => done() diff --git a/erpnext/patches.txt b/erpnext/patches.txt index f6988ab3cf5..fe5ceda8ad9 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -1,5 +1,6 @@ execute:import unidecode # new requirement erpnext.patches.v8_0.move_perpetual_inventory_setting +erpnext.patches.v10_0.rename_schools_to_education erpnext.patches.v4_0.validate_v3_patch erpnext.patches.v4_0.fix_employee_user_id erpnext.patches.v4_0.remove_employee_role_if_no_employee @@ -470,7 +471,6 @@ erpnext.patches.v9_1.create_issue_opportunity_type erpnext.patches.v9_2.rename_translated_domains_in_en erpnext.patches.v9_0.set_shipping_type_for_existing_shipping_rules erpnext.patches.v9_0.update_multi_uom_fields_in_material_request -erpnext.patches.v10_0.rename_schools_to_education erpnext.patches.v9_2.repost_reserved_qty_for_production erpnext.patches.v9_2.remove_company_from_patient erpnext.patches.v9_2.set_item_name_in_production_order diff --git a/erpnext/projects/doctype/activity_type/test_activity_type.js b/erpnext/projects/doctype/activity_type/test_activity_type.js index 80231216716..62be972bb2b 100644 --- a/erpnext/projects/doctype/activity_type/test_activity_type.js +++ b/erpnext/projects/doctype/activity_type/test_activity_type.js @@ -8,7 +8,8 @@ QUnit.test("test: Activity Type", function (assert) { () => frappe.set_route("List", "Activity Type", "List"), () => frappe.new_doc("Activity Type"), () => frappe.timeout(1), - () => frappe.click_link('Edit in full page'), + () => frappe.quick_entry.dialog.$wrapper.find('.edit-full').click(), + () => frappe.timeout(1), () => cur_frm.set_value("activity_type", "Test Activity"), () => frappe.click_button('Save'), () => frappe.timeout(1), diff --git a/erpnext/projects/doctype/task/tests/test_task_tree.js b/erpnext/projects/doctype/task/tests/test_task_tree.js index 9cbcf851e33..27dccbfbed3 100644 --- a/erpnext/projects/doctype/task/tests/test_task_tree.js +++ b/erpnext/projects/doctype/task/tests/test_task_tree.js @@ -6,7 +6,7 @@ QUnit.test("test: Task Tree", function (assert) { let done = assert.async(); // number of asserts - assert.expect(5); + assert.expect(4); frappe.run_serially([ // insert a new Task @@ -21,9 +21,8 @@ QUnit.test("test: Task Tree", function (assert) { () => frappe.timeout(0.5), // Creating child nodes - () => frappe.tests.click_link('task'), + () => frappe.tests.click_link('All Tasks'), () => frappe.map_group.make('Test-1'), - () => frappe.map_group.make('Test-2'), () => frappe.map_group.make('Test-3', 1), () => frappe.timeout(1), () => frappe.tests.click_link('Test-3'), @@ -33,8 +32,9 @@ QUnit.test("test: Task Tree", function (assert) { () => frappe.timeout(0.5), () => frappe.tests.click_link('Test-1'), () => frappe.tests.click_button('Edit'), - () => frappe.timeout(0.5), - () => {assert.deepEqual(frappe.get_route(), ["Form", "Task", "Test-1"], "Edit route checks");}, + () => frappe.timeout(1), + () => frappe.db.get_value('Task', {'subject': 'Test-1'}, 'name'), + (task) => {assert.deepEqual(frappe.get_route(), ["Form", "Task", task.message.name], "Edit route checks");}, // Deleting child Node () => frappe.set_route('Tree', 'Task'), @@ -54,17 +54,6 @@ QUnit.test("test: Task Tree", function (assert) { () => {assert.equal(cur_dialog.title, 'Message', 'Error thrown correctly');}, () => frappe.tests.click_button('Close'), - // Renaming Child node - () => frappe.timeout(0.5), - () => frappe.tests.click_link('Test-2'), - () => frappe.tests.click_button('Rename'), - () => frappe.timeout(1), - () => cur_dialog.set_value('new_name', 'Test-5'), - () => frappe.timeout(1.5), - () => cur_dialog.get_primary_btn().click(), - () => frappe.timeout(1), - () => {assert.equal($(`a:contains("Test-5"):visible`).length, 1, 'Rename successfull');}, - // Add multiple child tasks () => frappe.tests.click_link('Test-3'), () => frappe.timeout(0.5), diff --git a/erpnext/restaurant/doctype/restaurant/test_restaurant.js b/erpnext/restaurant/doctype/restaurant/test_restaurant.js index f4a13432e25..26de5d04aaa 100644 --- a/erpnext/restaurant/doctype/restaurant/test_restaurant.js +++ b/erpnext/restaurant/doctype/restaurant/test_restaurant.js @@ -7,9 +7,18 @@ QUnit.test("test: Restaurant", function (assert) { // number of asserts assert.expect(2); + let customer = { + "Test Customer 1": [ + {customer_name: "Test Customer 1"} + ], + "Test Customer 2": [ + {customer_name: "Test Customer 2"} + ] + }; frappe.run_serially([ // insert a new Restaurant + () => frappe.tests.setup_doctype('Customer', customer), () => { return frappe.tests.make('Restaurant', [ // values to be set diff --git a/erpnext/selling/doctype/quotation/tests/test_quotation_with_margin.js b/erpnext/selling/doctype/quotation/tests/test_quotation_with_margin.js index 590a8283623..5b4224dfe9a 100644 --- a/erpnext/selling/doctype/quotation/tests/test_quotation_with_margin.js +++ b/erpnext/selling/doctype/quotation/tests/test_quotation_with_margin.js @@ -11,7 +11,7 @@ QUnit.test("test quotation with margin", function(assert) { {currency: 'USD'}, {items: [ [ - {'item_code': 'Test Product 3'}, + {'item_code': 'Test Product 4'}, {'delivery_date': frappe.datetime.add_days(frappe.defaults.get_default("year_end_date"), 1)}, {'qty': 1}, {'margin_type': 'Percentage'}, diff --git a/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_bypass_credit_limit_check.js b/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_bypass_credit_limit_check.js index 3ffb8257178..dbd58c19c56 100644 --- a/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_bypass_credit_limit_check.js +++ b/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_bypass_credit_limit_check.js @@ -7,7 +7,8 @@ QUnit.test("test_sales_order_with_bypass_credit_limit_check", function(assert) { frappe.run_serially([ () => frappe.new_doc('Customer'), () => frappe.timeout(1), - () => frappe.click_link('Edit in full page'), + () => frappe.quick_entry.dialog.$wrapper.find('.edit-full').click(), + () => frappe.timeout(1), () => cur_frm.set_value("customer_name", "Test Customer 10"), () => cur_frm.set_value("credit_limit", 100.00), () => cur_frm.set_value("bypass_credit_limit_check_at_sales_order", 1), @@ -17,7 +18,8 @@ QUnit.test("test_sales_order_with_bypass_credit_limit_check", function(assert) { () => frappe.new_doc('Item'), () => frappe.timeout(1), - () => frappe.click_link('Edit in full page'), + () => frappe.quick_entry.dialog.$wrapper.find('.edit-full').click(), + () => frappe.timeout(1), () => cur_frm.set_value("item_code", "Test Product 10"), () => cur_frm.set_value("item_group", "Products"), () => cur_frm.set_value("standard_rate", 100), diff --git a/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_margin.js b/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_margin.js index 8575b78ce33..74268685079 100644 --- a/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_margin.js +++ b/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_margin.js @@ -11,7 +11,7 @@ QUnit.test("test sales order with margin", function(assert) { {currency: 'USD'}, {items: [ [ - {'item_code': 'Test Product 3'}, + {'item_code': 'Test Product 4'}, {'delivery_date': frappe.datetime.add_days(frappe.defaults.get_default("year_end_date"), 1)}, {'qty': 1}, {'margin_type': 'Amount'}, diff --git a/erpnext/selling/doctype/sales_order/tests/test_sales_order_without_bypass_credit_limit_check.js b/erpnext/selling/doctype/sales_order/tests/test_sales_order_without_bypass_credit_limit_check.js index ea15edc0e1f..4e81fb065f6 100644 --- a/erpnext/selling/doctype/sales_order/tests/test_sales_order_without_bypass_credit_limit_check.js +++ b/erpnext/selling/doctype/sales_order/tests/test_sales_order_without_bypass_credit_limit_check.js @@ -7,7 +7,8 @@ QUnit.test("test_sales_order_without_bypass_credit_limit_check", function(assert frappe.run_serially([ () => frappe.new_doc('Customer'), () => frappe.timeout(1), - () => frappe.click_link('Edit in full page'), + () => frappe.quick_entry.dialog.$wrapper.find('.edit-full').click(), + () => frappe.timeout(1), () => cur_frm.set_value("customer_name", "Test Customer 11"), () => cur_frm.set_value("credit_limit", 100.00), () => cur_frm.set_value("bypass_credit_limit_check_at_sales_order", 0), diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note_with_margin.js b/erpnext/stock/doctype/delivery_note/test_delivery_note_with_margin.js index 67c9f38aff2..21eb35ce378 100644 --- a/erpnext/stock/doctype/delivery_note/test_delivery_note_with_margin.js +++ b/erpnext/stock/doctype/delivery_note/test_delivery_note_with_margin.js @@ -11,7 +11,7 @@ QUnit.test("test delivery note with margin", function(assert) { {currency: 'USD'}, {items: [ [ - {'item_code': 'Test Product 3'}, + {'item_code': 'Test Product 4'}, {'qty': 1}, {'margin_type': 'Amount'}, {'margin_rate_or_amount': 10} diff --git a/erpnext/stock/doctype/item_price/test_item_price.js b/erpnext/stock/doctype/item_price/test_item_price.js index 6383fb0518e..8f2f28906af 100644 --- a/erpnext/stock/doctype/item_price/test_item_price.js +++ b/erpnext/stock/doctype/item_price/test_item_price.js @@ -7,13 +7,13 @@ QUnit.test("test item price", function(assert) { () => { return frappe.tests.make('Item Price', [ {price_list:'Test-Selling-USD'}, - {item_code: 'Test Product 3'}, + {item_code: 'Test Product 4'}, {price_list_rate: 200} ]); }, () => cur_frm.save(), () => { - assert.ok(cur_frm.doc.item_name == 'Test Product 3', "Item name correct"); + assert.ok(cur_frm.doc.item_name == 'Test Product 4', "Item name correct"); assert.ok(cur_frm.doc.price_list_rate == 200, "Price list rate correct"); }, () => frappe.timeout(0.3), diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 2ceed97d558..0c9d0c74bd9 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -312,7 +312,7 @@ def get_price_list_rate(args, item_doc, out): out.price_list_rate = flt(price_list_rate) * flt(args.plc_conversion_rate) \ / flt(args.conversion_rate) - if args.price_list_uom_dependant == 0: + if not args.price_list_uom_dependant: out.price_list_rate = flt(out.price_list_rate * (args.conversion_factor or 1.0)) if not out.price_list_rate and args.transaction_type=="buying": diff --git a/erpnext/tests/ui/tests.txt b/erpnext/tests/ui/tests.txt index d02cae157cf..3749cb81695 100644 --- a/erpnext/tests/ui/tests.txt +++ b/erpnext/tests/ui/tests.txt @@ -1,5 +1,4 @@ erpnext/tests/ui/make_fixtures.js #long -erpnext/setup/doctype/company/tests/test_company.js erpnext/accounts/doctype/account/tests/test_account.js erpnext/accounts/doctype/account/tests/test_make_tax_account.js erpnext/accounts/doctype/account/tests/test_account_with_number.js @@ -7,9 +6,7 @@ erpnext/accounts/doctype/pricing_rule/test_pricing_rule.js erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.js erpnext/accounts/doctype/purchase_taxes_and_charges_template/test_purchase_taxes_and_charges_template.js erpnext/accounts/doctype/shipping_rule/test_shipping_rule.js -erpnext/crm/doctype/lead/test_lead.js erpnext/crm/doctype/opportunity/test_opportunity.js -erpnext/setup/doctype/company/tests/test_company_production.js erpnext/stock/doctype/item/tests/test_item.js erpnext/selling/doctype/quotation/tests/test_quotation_with_discount_on_grand_total.js erpnext/selling/doctype/quotation/tests/test_quotation_with_item_wise_discount.js @@ -42,13 +39,6 @@ erpnext/hr/doctype/leave_type/test_leave_type.js erpnext/hr/doctype/leave_control_panel/test_leave_control_panel.js erpnext/hr/doctype/leave_allocation/test_leave_allocation.js erpnext/hr/doctype/leave_application/test_leave_application.js -erpnext/education/doctype/academic_year/test_academic_year.js -erpnext/education/doctype/academic_term/test_academic_term.js -erpnext/education/doctype/education_settings/test_education_settings.js -erpnext/education/doctype/student_batch_name/test_student_batch_name.js -erpnext/education/doctype/student_category/test_student_category.js -erpnext/education/doctype/room/test_room.js -erpnext/education/doctype/instructor/test_instructor.js erpnext/stock/doctype/warehouse/test_warehouse.js erpnext/manufacturing/doctype/production_order/test_production_order.js #long erpnext/accounts/page/pos/test_pos.js @@ -95,26 +85,6 @@ erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_item_wise_d erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_taxes_and_charges.js erpnext/buying/doctype/purchase_order/tests/test_purchase_order_receipt.js erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.js -erpnext/education/doctype/grading_scale/test_grading_scale.js -erpnext/education/doctype/assessment_criteria_group/test_assessment_criteria_group.js -erpnext/education/doctype/assessment_criteria/test_assessment_criteria.js -erpnext/education/doctype/course/test_course.js -erpnext/education/doctype/program/test_program.js -erpnext/education/doctype/guardian/test_guardian.js -erpnext/education/doctype/student_admission/test_student_admission.js -erpnext/education/doctype/student_applicant/tests/test_student_applicant_dummy_data.js -erpnext/education/doctype/student_applicant/tests/test_student_applicant.js -erpnext/education/doctype/student_applicant/tests/test_student_applicant_options.js -erpnext/education/doctype/student_log/test_student_log.js -erpnext/education/doctype/student_group/test_student_group.js -erpnext/education/doctype/student_group_creation_tool/test_student_group_creation_tool.js -erpnext/education/doctype/student_leave_application/test_student_leave_application.js -erpnext/education/doctype/student_attendance_tool/test_student_attendance_tool.js -erpnext/education/doctype/student_attendance/test_student_attendance.js -erpnext/education/doctype/assessment_group/test_assessment_group.js -erpnext/education/doctype/assessment_plan/test_assessment_plan.js -erpnext/education/doctype/assessment_result/test_assessment_result.js -erpnext/education/doctype/assessment_result_tool/test_assessment_result_tool.js erpnext/accounts/doctype/journal_entry/test_journal_entry.js erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.js erpnext/accounts/doctype/payment_entry/tests/test_payment_entry.js @@ -129,10 +99,6 @@ erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_repack.js erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_serialize_item.js erpnext/accounts/doctype/payment_entry/tests/test_payment_against_invoice.js erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_last_purchase_rate.js -erpnext/restaurant/doctype/restaurant/test_restaurant.js -erpnext/restaurant/doctype/restaurant_table/test_restaurant_table.js -erpnext/restaurant/doctype/restaurant_menu/test_restaurant_menu.js -erpnext/restaurant/doctype/restaurant_order_entry/restaurant_order_entry.js erpnext/projects/doctype/task/tests/test_task_tree.js erpnext/stock/doctype/item_price/test_item_price.js erpnext/stock/doctype/delivery_note/test_delivery_note_with_margin.js @@ -141,17 +107,3 @@ erpnext/selling/doctype/quotation/tests/test_quotation_with_margin.js erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_margin.js erpnext/hr/doctype/payroll_entry/test_set_salary_components.js erpnext/hr/doctype/payroll_entry/test_payroll_entry.js -erpnext/agriculture/doctype/land_unit/test_land_unit.js -erpnext/agriculture/doctype/fertilizer/test_fertilizer.js -erpnext/agriculture/doctype/water_analysis/test_water_analysis.js -erpnext/agriculture/doctype/disease/test_disease.js -erpnext/agriculture/doctype/soil_texture/test_soil_texture.js -erpnext/agriculture/doctype/crop/test_crop.js -erpnext/agriculture/doctype/crop_cycle/test_crop_cycle.js -erpnext/non_profit/doctype/membership_type/test_membership_type.js -erpnext/non_profit/doctype/member/test_member.js -erpnext/non_profit/doctype/volunteer_type/test_volunteer_type.js -erpnext/non_profit/doctype/volunteer/test_volunteer.js -erpnext/non_profit/doctype/donor_type/test_donor_type.js -erpnext/non_profit/doctype/donor/test_donor.js -erpnext/non_profit/doctype/grant_application/test_grant_application.js \ No newline at end of file diff --git a/erpnext/tests/ui/tests2.txt b/erpnext/tests/ui/tests2.txt new file mode 100644 index 00000000000..e410a83b2e4 --- /dev/null +++ b/erpnext/tests/ui/tests2.txt @@ -0,0 +1,46 @@ +erpnext/setup/doctype/company/tests/test_company.js +erpnext/crm/doctype/lead/tests/test_lead_individual.js +erpnext/crm/doctype/lead/tests/test_lead_organization.js +erpnext/setup/doctype/company/tests/test_company_production.js +erpnext/hr/doctype/leave_block_list/test_leave_block_list.js +erpnext/hr/doctype/department/test_department.js +erpnext/hr/doctype/designation/test_designation.js +erpnext/education/doctype/academic_year/test_academic_year.js +erpnext/education/doctype/academic_term/test_academic_term.js +erpnext/education/doctype/education_settings/test_education_settings.js +erpnext/education/doctype/student_batch_name/test_student_batch_name.js +erpnext/education/doctype/student_category/test_student_category.js +erpnext/education/doctype/room/test_room.js +erpnext/education/doctype/instructor/test_instructor.js +erpnext/education/doctype/grading_scale/test_grading_scale.js +erpnext/education/doctype/assessment_criteria_group/test_assessment_criteria_group.js +erpnext/education/doctype/assessment_criteria/test_assessment_criteria.js +erpnext/education/doctype/course/test_course.js +erpnext/education/doctype/program/test_program.js +erpnext/education/doctype/guardian/test_guardian.js +erpnext/education/doctype/student_admission/test_student_admission.js +erpnext/education/doctype/student_applicant/tests/test_student_applicant_dummy_data.js +erpnext/education/doctype/student_applicant/tests/test_student_applicant.js +erpnext/education/doctype/student_applicant/tests/test_student_applicant_options.js +erpnext/education/doctype/student_log/test_student_log.js +erpnext/education/doctype/student_group/test_student_group.js +erpnext/education/doctype/student_group_creation_tool/test_student_group_creation_tool.js +erpnext/education/doctype/student_leave_application/test_student_leave_application.js +erpnext/education/doctype/student_attendance_tool/test_student_attendance_tool.js +erpnext/education/doctype/student_attendance/test_student_attendance.js +erpnext/education/doctype/assessment_group/test_assessment_group.js +erpnext/education/doctype/assessment_plan/test_assessment_plan.js +erpnext/education/doctype/assessment_result/test_assessment_result.js +erpnext/education/doctype/assessment_result_tool/test_assessment_result_tool.js +erpnext/projects/doctype/task/tests/test_task_tree.js +erpnext/restaurant/doctype/restaurant/test_restaurant.js +erpnext/restaurant/doctype/restaurant_table/test_restaurant_table.js +erpnext/restaurant/doctype/restaurant_menu/test_restaurant_menu.js +erpnext/restaurant/doctype/restaurant_order_entry/restaurant_order_entry.js +erpnext/non_profit/doctype/membership_type/test_membership_type.js +erpnext/non_profit/doctype/member/test_member.js +erpnext/non_profit/doctype/volunteer_type/test_volunteer_type.js +erpnext/non_profit/doctype/volunteer/test_volunteer.js +erpnext/non_profit/doctype/donor_type/test_donor_type.js +erpnext/non_profit/doctype/donor/test_donor.js +erpnext/non_profit/doctype/grant_application/test_grant_application.js \ No newline at end of file