diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.js b/erpnext/selling/page/point_of_sale/point_of_sale.js index 6bbb267271..0e6ecdd7d0 100644 --- a/erpnext/selling/page/point_of_sale/point_of_sale.js +++ b/erpnext/selling/page/point_of_sale/point_of_sale.js @@ -507,8 +507,10 @@ class POSCart { df: { fieldtype: 'Link', label: 'Customer', + fieldname: 'customer', options: 'Customer', reqd: 1, + default: this.frm.doc.customer, onchange: () => { this.events.on_customer_change(this.customer_field.get_value()); } diff --git a/erpnext/selling/page/point_of_sale/test_point_of_sale.js b/erpnext/selling/page/point_of_sale/test_point_of_sale.js new file mode 100644 index 0000000000..a178e5c2c2 --- /dev/null +++ b/erpnext/selling/page/point_of_sale/test_point_of_sale.js @@ -0,0 +1,38 @@ +QUnit.test("test:Point of Sales", function(assert) { + assert.expect(1); + let done = assert.async(); + + frappe.run_serially([ + () => frappe.set_route('point-of-sale'), + () => frappe.timeout(2), + () => frappe.set_control('customer', 'Test Customer'), + () => frappe.timeout(0.2), + () => cur_frm.set_value('customer', 'Test Customer'), + () => frappe.timeout(2), + () => frappe.click_link('Test FG Item 2'), + () => frappe.timeout(0.2), + () => frappe.click_element(`.cart-items [title="_Test FG Item 2"]`), + () => frappe.timeout(0.2), + () => frappe.click_element(`.number-pad [data-value="Rate"]`), + () => frappe.timeout(0.2), + () => frappe.click_element(`.number-pad [data-value="2"]`), + () => frappe.timeout(0.2), + () => frappe.click_element(`.number-pad [data-value="5"]`), + () => frappe.timeout(0.2), + () => frappe.click_element(`.number-pad [data-value="0"]`), + () => frappe.timeout(0.2), + () => frappe.click_element(`.number-pad [data-value="Pay"]`), + () => frappe.timeout(0.2), + () => frappe.click_element(`.frappe-control [data-value="4"]`), + () => frappe.timeout(0.2), + () => frappe.click_element(`.frappe-control [data-value="5"]`), + () => frappe.timeout(0.2), + () => frappe.click_element(`.frappe-control [data-value="0"]`), + () => frappe.timeout(0.2), + () => frappe.click_button('Submit'), + () => frappe.click_button('Yes'), + () => frappe.timeout(5), + () => assert.ok(cur_frm.doc.docstatus==1, "Sales invoice created successfully"), + () => done() + ]); +}); \ No newline at end of file diff --git a/erpnext/tests/ui/tests.txt b/erpnext/tests/ui/tests.txt index 653aeecc66..e76c67ea8f 100644 --- a/erpnext/tests/ui/tests.txt +++ b/erpnext/tests/ui/tests.txt @@ -50,6 +50,7 @@ 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/test_point_of_sale.js erpnext/accounts/page/pos/test_pos.js erpnext/selling/doctype/product_bundle/test_product_bundle.js erpnext/stock/doctype/delivery_note/test_delivery_note.js