More fixes for UI tests

This commit is contained in:
Nabin Hait 2017-09-15 21:22:16 +05:30
parent 628ca2a2ec
commit 21617da619
2 changed files with 15 additions and 9 deletions

View File

@ -9,9 +9,9 @@ QUnit.test("test payment entry", function(assert) {
{customer: 'Test Customer 1'}, {customer: 'Test Customer 1'},
{items: [ {items: [
[ [
{'item_code': 'Test Product 1'},
{'qty': 1}, {'qty': 1},
{'rate': 101}, {'rate': 101},
{'item_code': 'Test Product 1'},
] ]
]} ]}
]); ]);
@ -19,11 +19,12 @@ QUnit.test("test payment entry", function(assert) {
() => cur_frm.save(), () => cur_frm.save(),
() => frappe.tests.click_button('Submit'), () => frappe.tests.click_button('Submit'),
() => frappe.tests.click_button('Yes'), () => frappe.tests.click_button('Yes'),
() => frappe.timeout(0.5), () => frappe.timeout(1),
() => frappe.tests.click_button('Close'), () => frappe.tests.click_button('Close'),
() => frappe.timeout(0.5), () => frappe.timeout(1),
() => frappe.click_button('Make'), () => frappe.click_button('Make'),
() => frappe.click_link('Payment', 1), () => frappe.timeout(1),
() => frappe.click_link('Payment'),
() => frappe.timeout(2), () => frappe.timeout(2),
() => { () => {
assert.equal(frappe.get_route()[1], 'Payment Entry', assert.equal(frappe.get_route()[1], 'Payment Entry',
@ -35,16 +36,19 @@ QUnit.test("test payment entry", function(assert) {
assert.equal(cur_frm.doc.references[0].allocated_amount, 101, assert.equal(cur_frm.doc.references[0].allocated_amount, 101,
'amount allocated against sales invoice'); 'amount allocated against sales invoice');
}, },
() => frappe.timeout(1),
() => cur_frm.set_value('paid_amount', 100), () => cur_frm.set_value('paid_amount', 100),
() => frappe.timeout(1),
() => { () => {
cur_frm.doc.references[0].allocated_amount = 101; frappe.model.set_value("Payment Entry Reference", cur_frm.doc.references[0].name,
"allocated_amount", 101);
}, },
() => frappe.timeout(1),
() => frappe.click_button('Write Off Difference Amount'), () => frappe.click_button('Write Off Difference Amount'),
() => frappe.timeout(1),
() => { () => {
assert.equal(cur_frm.doc.difference_amount, 0, assert.equal(cur_frm.doc.difference_amount, 0, 'difference amount is zero');
'difference amount is zero'); assert.equal(cur_frm.doc.deductions[0].amount, 1, 'Write off amount = 1');
assert.equal(cur_frm.doc.deductions[0].amount, 1,
'Write off amount = 1');
}, },
() => done() () => done()
]); ]);

View File

@ -56,6 +56,8 @@ def run_setup_wizard_test():
time.sleep(1) time.sleep(1)
frappe.db.set_default('in_selenium', None) frappe.db.set_default('in_selenium', None)
frappe.db.set_value("Company", "For Testing", "write_off_account", "Write Off - FT")
frappe.db.set_value("Company", "For Testing", "exchange_gain_loss_account", "Exchange Gain/Loss - FT")
frappe.db.commit() frappe.db.commit()
driver.close() driver.close()