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
This commit is contained in:
Nabin Hait 2017-10-20 11:26:17 +05:30 committed by GitHub
parent bb60a59b96
commit b4f5f14438
12 changed files with 28 additions and 64 deletions

View File

@ -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()
]);
});

View File

@ -1,7 +1,7 @@
QUnit.module('Buying'); QUnit.module('Buying');
QUnit.test("test: purchase order", function(assert) { QUnit.test("test: purchase order", function(assert) {
assert.expect(11); assert.expect(17);
let done = assert.async(); let done = assert.async();
frappe.run_serially([ 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].qty == 2, "Quantity correct");
assert.ok(cur_frm.doc.items[1].schedule_date == cur_frm.doc.schedule_date, "Schedule Date correct"); assert.ok(cur_frm.doc.items[1].schedule_date == cur_frm.doc.schedule_date, "Schedule Date correct");
// Calculate total // Calculate total
assert.ok(cur_frm.doc.total == 500, "Total correct"); assert.ok(cur_frm.doc.total == 700, "Total correct");
// Get terms // Get terms
assert.ok(cur_frm.doc.terms == 'This is a term.', "Terms correct"); 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('Submit'),
() => frappe.tests.click_button('Yes'), () => frappe.tests.click_button('Yes'),
() => frappe.timeout(0.3), () => frappe.timeout(1),
() => { () => {
assert.ok(cur_frm.doc.status == 'To Receive and Bill', "Submitted successfully"); assert.ok(cur_frm.doc.status == 'To Receive and Bill', "Submitted successfully");

View File

@ -27,6 +27,7 @@ QUnit.test("test: request_for_quotation", function(assert) {
{tc_name: 'Test Term 1'} {tc_name: 'Test Term 1'}
]); ]);
}, },
() => frappe.timeout(3),
() => { () => {
assert.ok(cur_frm.doc.transaction_date == date, "Date correct"); assert.ok(cur_frm.doc.transaction_date == date, "Date correct");
assert.ok(cur_frm.doc.company == cur_frm.doc.company, "Company 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.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"); assert.ok(cur_frm.doc.tc_name == 'Test Term 1', "Term name correct");
}, },
() => frappe.timeout(0.3), () => frappe.timeout(3),
() => cur_frm.print_doc(), () => cur_frm.print_doc(),
() => frappe.timeout(1), () => 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"); assert.ok(cur_frm.doc.docstatus == 1, "Quotation request submitted");
}, },
() => frappe.click_button('Send Supplier Emails'), () => 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"); 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");
}, },

View File

@ -56,7 +56,8 @@ QUnit.test("test: supplier", function(assert) {
() => frappe.click_button('New Contact'), () => frappe.click_button('New Contact'),
() => { () => {
return frappe.tests.set_form_values(cur_frm, [ return frappe.tests.set_form_values(cur_frm, [
{first_name: "Contact 3"} {first_name: "Contact 3"},
{email_id: "test@supplier.com"}
]); ]);
}, },
() => cur_frm.save(), () => cur_frm.save(),

View File

@ -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()
]);
});

View File

@ -27,6 +27,7 @@ QUnit.test("test: supplier quotation", function(assert) {
{terms: 'This is a term'} {terms: 'This is a term'}
]); ]);
}, },
() => frappe.timeout(3),
() => { () => {
// Get Supplier details // Get Supplier details
assert.ok(cur_frm.doc.supplier == 'Test Supplier', "Supplier correct"); assert.ok(cur_frm.doc.supplier == 'Test Supplier', "Supplier correct");

View File

@ -27,7 +27,7 @@ QUnit.test("Test: Offer Letter [HR]", function (assert) {
]}, ]},
]); ]);
}, },
() => frappe.timeout(8), () => frappe.timeout(12),
() => frappe.click_button('Submit'), () => frappe.click_button('Submit'),
() => frappe.timeout(2), () => frappe.timeout(2),
() => frappe.click_button('Yes'), () => frappe.click_button('Yes'),

View File

@ -15,7 +15,7 @@ QUnit.test("test salary slip", function(assert) {
{ employee: employee_name} { employee: employee_name}
]); ]);
}, },
() => frappe.timeout(1), () => frappe.timeout(3),
() => { () => {
// To check if all the calculations are correctly done // To check if all the calculations are correctly done
if(ename === 'Test Employee 1') if(ename === 'Test Employee 1')
@ -43,7 +43,7 @@ QUnit.test("test salary slip", function(assert) {
() => salary_slip('Test Employee 1'), () => salary_slip('Test Employee 1'),
() => frappe.timeout(6), () => frappe.timeout(6),
() => salary_slip('Test Employee 3'), () => salary_slip('Test Employee 3'),
() => frappe.timeout(3), () => frappe.timeout(5),
() => done() () => done()
]); ]);
}); });

View File

@ -1,5 +1,5 @@
QUnit.test("test Salary Structure", function(assert) { QUnit.test("test Salary Structure", function(assert) {
assert.expect(6); assert.expect(7);
let done = assert.async(); let done = assert.async();
let employee_name1; let employee_name1;
@ -9,6 +9,7 @@ QUnit.test("test Salary Structure", function(assert) {
employee_name1 = r.name; employee_name1 = r.name;
} }
), ),
() => frappe.timeout(5),
() => frappe.db.get_value('Employee', {'employee_name': "Test Employee 3"}, 'name', () => frappe.db.get_value('Employee', {'employee_name': "Test Employee 3"}, 'name',
(r) => { (r) => {
// Creating Salary Structure for employees); // 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 // To check if all the fields are correctly set
assert.ok(cur_frm.doc.employees[0].employee_name.includes('Test Employee 1') && assert.ok(cur_frm.doc.employees[0].employee_name=='Test Employee 1',
cur_frm.doc.employees[1].employee_name.includes('Test Employee 3'), 'Employee 1 name correctly set');
'Employee names are 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, assert.ok(cur_frm.doc.employees[0].base==25000,
'Base value for first employee is correctly set'); 'Base value for first employee is correctly set');

View File

@ -14,7 +14,7 @@ QUnit.test("test: operation", function (assert) {
] ]
); );
}, },
() => frappe.timeout(1), () => frappe.timeout(3),
() => { () => {
assert.ok(cur_frm.docname.includes('Assemble Keyboard'), assert.ok(cur_frm.docname.includes('Assemble Keyboard'),
'Assemble Keyboard created successfully'); 'Assemble Keyboard created successfully');
@ -31,7 +31,7 @@ QUnit.test("test: operation", function (assert) {
] ]
); );
}, },
() => frappe.timeout(1), () => frappe.timeout(3),
// Create a CPU operation // Create a CPU operation
() => { () => {
@ -42,7 +42,7 @@ QUnit.test("test: operation", function (assert) {
] ]
); );
}, },
() => frappe.timeout(1), () => frappe.timeout(3),
() => done() () => done()
]); ]);

View File

@ -18,6 +18,7 @@ QUnit.test("test: Restaurant", function (assert) {
{invoice_series_prefix: 'Test-Rest-1-Inv-'} {invoice_series_prefix: 'Test-Rest-1-Inv-'}
]) ])
}, },
() => frappe.timeout(3),
() => { () => {
assert.equal(cur_frm.doc.company, 'Test Company'); 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-'} {invoice_series_prefix: 'Test-Rest-3-Inv-'}
]); ]);
}, },
() => frappe.timeout(3),
() => { () => {
assert.equal(cur_frm.doc.company, 'Test Company'); assert.equal(cur_frm.doc.company, 'Test Company');
}, },

View File

@ -50,6 +50,7 @@ QUnit.test("test: Restaurant Menu", function (assert) {
]} ]}
]); ]);
}, },
() => frappe.timeout(2),
() => { () => {
return frappe.tests.make("Restaurant Menu", [ return frappe.tests.make("Restaurant Menu", [
{__newname: 'Restaurant Menu 2'}, {__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'), () => frappe.set_route('Form', 'Restaurant', 'Test Restaurant 1'),
() => cur_frm.set_value('active_menu', 'Restaurant Menu 1'), () => cur_frm.set_value('active_menu', 'Restaurant Menu 1'),
() => cur_frm.save(), () => cur_frm.save(),