Skip to content

Commit 43ef4e9

Browse files
authored
Added first UI tests (frappe#9532)
* [wip] * [tests] wip * [ui-tests] first-cut * [minor] remove old tests
1 parent 65f6f2a commit 43ef4e9

File tree

14 files changed

+104
-150
lines changed

14 files changed

+104
-150
lines changed

.eslintrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
"getCookies": true,
132132
"get_url_arg": true,
133133
"get_server_fields": true,
134-
"set_multiple": true
134+
"set_multiple": true,
135+
"QUnit": true
135136
}
136137
}

erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -3238,7 +3238,7 @@
32383238
"in_filter": 0,
32393239
"in_global_search": 0,
32403240
"in_list_view": 0,
3241-
"in_standard_filter": 0,
3241+
"in_standard_filter": 1,
32423242
"label": "Status",
32433243
"length": 0,
32443244
"no_copy": 0,
@@ -3767,10 +3767,11 @@
37673767
"istable": 0,
37683768
"max_attachments": 0,
37693769
"menu_index": 0,
3770-
"modified": "2017-06-13 14:28:57.930167",
3770+
"modified": "2017-06-29 10:48:09.707735",
37713771
"modified_by": "Administrator",
37723772
"module": "Accounts",
37733773
"name": "Purchase Invoice",
3774+
"name_case": "Title Case",
37743775
"owner": "Administrator",
37753776
"permissions": [
37763777
{

erpnext/accounts/doctype/sales_invoice/sales_invoice.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,19 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
7171
});
7272

7373
if(!from_delivery_note && !is_delivered_by_supplier) {
74-
cur_frm.add_custom_button(__('Delivery'), cur_frm.cscript['Make Delivery Note'],
75-
__("Make"));
74+
cur_frm.add_custom_button(__('Delivery'),
75+
cur_frm.cscript['Make Delivery Note'], __("Make"));
7676
}
7777
}
7878

7979
if(doc.outstanding_amount!=0 && !cint(doc.is_return)) {
80-
cur_frm.add_custom_button(__('Payment'), this.make_payment_entry, __("Make"));
80+
cur_frm.add_custom_button(__('Payment'),
81+
this.make_payment_entry, __("Make"));
8182
}
8283

8384
if(doc.outstanding_amount>0 && !cint(doc.is_return)) {
84-
cur_frm.add_custom_button(__('Payment Request'), this.make_payment_request, __("Make"));
85+
cur_frm.add_custom_button(__('Payment Request'),
86+
this.make_payment_request, __("Make"));
8587
}
8688

8789

@@ -481,7 +483,7 @@ frappe.ui.form.on('Sales Invoice', {
481483
'Delivery Note': 'Delivery',
482484
'Sales Invoice': 'Sales Return',
483485
'Payment Request': 'Payment Request',
484-
'Payment': 'Payment Entry'
486+
'Payment Entry': 'Payment'
485487
},
486488
frm.fields_dict["timesheets"].grid.get_field("time_sheet").get_query = function(doc, cdt, cdn){
487489
return{

erpnext/accounts/doctype/sales_invoice/sales_invoice.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -2511,7 +2511,7 @@
25112511
"in_filter": 0,
25122512
"in_global_search": 0,
25132513
"in_list_view": 0,
2514-
"in_standard_filter": 1,
2514+
"in_standard_filter": 0,
25152515
"label": "Outstanding Amount",
25162516
"length": 0,
25172517
"no_copy": 1,
@@ -3597,7 +3597,7 @@
35973597
"in_filter": 0,
35983598
"in_global_search": 0,
35993599
"in_list_view": 0,
3600-
"in_standard_filter": 0,
3600+
"in_standard_filter": 1,
36013601
"label": "Status",
36023602
"length": 0,
36033603
"no_copy": 1,
@@ -4627,10 +4627,11 @@
46274627
"istable": 0,
46284628
"max_attachments": 0,
46294629
"menu_index": 0,
4630-
"modified": "2017-06-22 14:45:35.257640",
4630+
"modified": "2017-06-29 10:47:49.522969",
46314631
"modified_by": "Administrator",
46324632
"module": "Accounts",
46334633
"name": "Sales Invoice",
4634+
"name_case": "Title Case",
46344635
"owner": "Administrator",
46354636
"permissions": [
46364637
{

erpnext/public/js/controllers/accounts.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ if(!erpnext.taxes.flags[cur_frm.cscript.tax_table]) {
215215
erpnext.taxes.set_conditional_mandatory_rate_or_amount(open_form);
216216
} else {
217217
// apply in current row
218-
erpnext.taxes.set_conditional_mandatory_rate_or_amount(frm.get_field('taxes').grid.get_grid_row(cdn));
218+
erpnext.taxes.set_conditional_mandatory_rate_or_amount(frm.get_field('taxes').grid.get_row(cdn));
219219
}
220220
});
221221

erpnext/selling/doctype/customer/customer.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
"unique": 0
108108
},
109109
{
110+
"allow_bulk_edit": 0,
110111
"allow_on_submit": 0,
111112
"bold": 1,
112113
"collapsible": 0,
@@ -168,10 +169,12 @@
168169
"unique": 0
169170
},
170171
{
172+
"allow_bulk_edit": 0,
171173
"allow_on_submit": 0,
172174
"bold": 0,
173175
"collapsible": 0,
174176
"columns": 0,
177+
"default": "Company",
175178
"fieldname": "customer_type",
176179
"fieldtype": "Select",
177180
"hidden": 0,
@@ -186,7 +189,7 @@
186189
"no_copy": 0,
187190
"oldfieldname": "customer_type",
188191
"oldfieldtype": "Select",
189-
"options": "\nCompany\nIndividual",
192+
"options": "Company\nIndividual",
190193
"permlevel": 0,
191194
"print_hide": 0,
192195
"print_hide_if_no_value": 0,
@@ -1197,7 +1200,7 @@
11971200
"issingle": 0,
11981201
"istable": 0,
11991202
"max_attachments": 0,
1200-
"modified": "2017-06-13 14:29:11.114613",
1203+
"modified": "2017-06-28 14:55:39.910819",
12011204
"modified_by": "Administrator",
12021205
"module": "Selling",
12031206
"name": "Customer",

erpnext/setup/utils.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ def before_tests():
4141
"email" :"[email protected]",
4242
"password" :"test",
4343
"chart_of_accounts" : "Standard",
44-
"domain" : "Manufacturing",
45-
44+
"domain" : "Manufacturing"
4645
})
4746

4847
frappe.db.sql("delete from `tabLeave Allocation`")

erpnext/startup/boot.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
from __future__ import unicode_literals
66
import frappe
7+
from frappe.utils.nestedset import get_root_of
78

89
def boot_session(bootinfo):
910
"""boot session - send website info if guest"""
10-
import frappe
1111

1212
bootinfo.custom_css = frappe.db.get_value('Style Settings', None, 'custom_css') or ''
1313
bootinfo.website_settings = frappe.get_doc('Website Settings')
@@ -16,6 +16,8 @@ def boot_session(bootinfo):
1616
update_page_info(bootinfo)
1717

1818
load_country_and_currency(bootinfo)
19+
bootinfo.sysdefaults.territory = get_root_of('Territory')
20+
bootinfo.sysdefaults.customer_group = get_root_of('Customer Group')
1921

2022
bootinfo.notification_settings = frappe.get_doc("Notification Control",
2123
"Notification Control")

erpnext/stock/doctype/item/item.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ def on_trash(self):
524524

525525
def before_rename(self, old_name, new_name, merge=False):
526526
if self.item_name==old_name:
527-
self.item_name=new_name
527+
frappe.db.set_value("Item", old_name, "item_name", new_name)
528528

529529
if merge:
530530
# Validate properties before merging

erpnext/tests/sel_tests.py

-106
This file was deleted.

erpnext/tests/test_client.py

-25
This file was deleted.

erpnext/tests/test_init.py

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
test_records = frappe.get_test_records('Company')
88

9-
109
class TestInit(unittest.TestCase):
1110
def test_encode_company_abbr(self):
1211
company = frappe.new_doc("Company")

erpnext/tests/ui/test_fixtures.js

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
$.extend(frappe.test_data, {
2+
'Customer': {
3+
'Test Customer 1': [
4+
{customer_name: 'Test Customer 1'}
5+
],
6+
'Test Customer 2': [
7+
{customer_name: 'Test Customer 2'}
8+
],
9+
'Test Customer 3': [
10+
{customer_name: 'Test Customer 3'}
11+
],
12+
},
13+
'Item': {
14+
'Test Product 1': [
15+
{item_code: 'Test Product 1'},
16+
{item_group: 'Products'},
17+
{is_stock_item: 1},
18+
{standard_rate: 100},
19+
{opening_stock: 100},
20+
],
21+
'Test Product 2': [
22+
{item_code: 'Test Product 2'},
23+
{item_group: 'Products'},
24+
{is_stock_item: 1},
25+
{standard_rate: 150},
26+
{opening_stock: 200},
27+
],
28+
'Test Product 3': [
29+
{item_code: 'Test Product 3'},
30+
{item_group: 'Products'},
31+
{is_stock_item: 1},
32+
{standard_rate: 250},
33+
{opening_stock: 100},
34+
],
35+
'Test Service 1': [
36+
{item_code: 'Test Service 1'},
37+
{item_group: 'Services'},
38+
{is_stock_item: 0},
39+
{standard_rate: 200}
40+
],
41+
'Test Service 2': [
42+
{item_code: 'Test Service 2'},
43+
{item_group: 'Services'},
44+
{is_stock_item: 0},
45+
{standard_rate: 300}
46+
]
47+
}
48+
});

0 commit comments

Comments
 (0)