update to tests

This commit is contained in:
Rushabh Mehta 2014-05-03 16:22:25 +05:30
parent 75042fd502
commit 24a3ec57e3
3 changed files with 100 additions and 13 deletions

View File

@ -365,7 +365,7 @@ frappe.wiz.Wizard = Class.extend({
this.parent = $('<div class="setup-wizard-wrapper">').appendTo(this.parent);
},
get_message: function(html) {
return $(repl('<div class="panel panel-default">\
return $(repl('<div class="panel panel-default" data-state="setup-complete">\
<div class="panel-body" style="padding: 40px;">%(html)s</div>\
</div>', {html:html}))
},
@ -430,7 +430,9 @@ frappe.wiz.Wizard = Class.extend({
frappe.wiz.WizardSlide = Class.extend({
init: function(opts) {
$.extend(this, opts);
this.$wrapper = $("<div>").appendTo(this.wiz.parent);
this.$wrapper = $("<div>")
.appendTo(this.wiz.parent)
.attr("data-slide-id", this.id);
},
make: function() {
var me = this;

View File

@ -15,6 +15,7 @@ import install_fixtures
@frappe.whitelist()
def setup_account(args=None):
if frappe.db.sql("select name from tabCompany"):
frappe.throw(_("Setup Already Complete!!"))
@ -260,16 +261,22 @@ def create_taxes(args):
# replace % in case someone also enters the % symbol
tax_rate = (args.get("tax_rate_" + str(i)) or "").replace("%", "")
frappe.get_doc({
"doctype":"Account",
"company": args.get("company_name"),
"parent_account": "Duties and Taxes - " + args.get("company_abbr"),
"account_name": args.get("tax_" + str(i)),
"group_or_ledger": "Ledger",
"report_type": "Balance Sheet",
"account_type": "Tax",
"tax_rate": flt(tax_rate) if tax_rate else None
}).insert()
try:
frappe.get_doc({
"doctype":"Account",
"company": args.get("company_name"),
"parent_account": "Duties and Taxes - " + args.get("company_abbr"),
"account_name": args.get("tax_" + str(i)),
"group_or_ledger": "Ledger",
"report_type": "Balance Sheet",
"account_type": "Tax",
"tax_rate": flt(tax_rate) if tax_rate else None
}).insert()
except frappe.NameError, e:
if e.args[2][0]==1062:
pass
else:
raise
def create_items(args):
for i in xrange(1,6):

View File

@ -14,11 +14,89 @@ from __future__ import unicode_literals
import frappe
from frappe.utils import sel
import time
def start():
sel.start(verbose=True)
try:
run()
finally:
sel.close()
def run():
def next_slide(idx, selector="next-btn"):
sel.find('[data-slide-id="{0}"] .{1}'.format(idx, selector))[0].click()
sel.wait_for_ajax()
sel.start(verbose=True, driver="Firefox")
sel.input_wait = 0.2
sel.login("#page-setup-wizard")
# slide 1
next_slide("0")
sel.set_field("first_name", "Test")
sel.set_field("last_name", "User")
sel.set_field("email", "test@erpnext.com")
sel.set_field("password", "test")
next_slide("1")
sel.set_select("country", "India")
next_slide("2")
sel.set_field("company_name", "Wind Power LLC")
sel.set_field("fy_start_date", "01-04-2014")
sel.set_field("company_tagline", "Wind Power For Everyone")
next_slide("3")
next_slide("4")
sel.set_field("tax_1", "VAT")
sel.set_field("tax_rate_1", "12.5")
sel.set_field("tax_2", "Service Tax")
sel.set_field("tax_rate_2", "10.36")
next_slide("5")
sel.set_field("customer_1", "Asian Junction")
sel.set_field("customer_contact_1", "January Vaclavik")
sel.set_field("customer_2", "Life Plan Counselling")
sel.set_field("customer_contact_2", "Jana Tobeolisa")
sel.set_field("customer_3", "Two Pesos")
sel.set_field("customer_contact_3", "Satomi Shigeki")
sel.set_field("customer_4", "Intelacard")
sel.set_field("customer_contact_4", "Hans Rasmussen")
next_slide("6")
sel.set_field("item_1", "Wind Turbine A")
sel.set_field("item_2", "Wind Turbine B")
sel.set_field("item_3", "Wind Turbine C")
next_slide("7")
sel.set_field("supplier_1", "Helios Air")
sel.set_field("supplier_contact_1", "Quimey Osorio")
sel.set_field("supplier_2", "Ks Merchandise")
sel.set_field("supplier_contact_2", "Edgarda Salcedo")
sel.set_field("supplier_3", "Eagle Hardware")
sel.set_field("supplier_contact_3", "Hafsteinn Bjarnarsonar")
next_slide("8")
sel.set_field("item_buy_1", "Bearing Pipe")
sel.set_field("item_buy_2", "Bearing Assembly")
sel.set_field("item_buy_3", "Base Plate")
sel.set_field("item_buy_4", "Coil")
next_slide("9", "complete-btn")
sel.wait('[data-state="setup-complete"]')
w = raw_input("quit?")
# complete setup
# new customer