From 1b6c3f1a39119577040394bb6789952d818f3441 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 28 May 2015 21:46:40 -0400 Subject: [PATCH] [fix] selenium test and changed Creation Document No to a Dynamic Link --- .travis.yml | 12 ++++++--- .../stock/doctype/serial_no/serial_no.json | 9 ++++--- erpnext/stock/doctype/serial_no/serial_no.py | 3 +++ erpnext/tests/test_client.py | 25 +++++++++++++++++++ test_sites/test_site/site_config.json | 10 +++++--- 5 files changed, 48 insertions(+), 11 deletions(-) create mode 100644 erpnext/tests/test_client.py diff --git a/.travis.yml b/.travis.yml index ace0f7c4c3..f6c4eeecd9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,10 @@ python: services: - mysql +before_install: + - "export DISPLAY=:99.0" + - "sh -e /etc/init.d/xvfb start" + install: - sudo apt-get purge -y mysql-common - wget https://raw.githubusercontent.com/frappe/bench/master/install_scripts/setup_frappe.sh @@ -22,7 +26,9 @@ script: - bench use test_site - bench reinstall - bench build-website - - bench --verbose run-tests + - bench serve & + - sleep 10 + - bench --verbose run-tests --driver Firefox before_script: - mysql -e 'create database test_frappe' @@ -33,6 +39,6 @@ notifications: webhooks: urls: - https://webhooks.gitter.im/e/92b3bea86d8c5397beef - on_success: always - on_failure: always + on_success: always + on_failure: always on_start: never diff --git a/erpnext/stock/doctype/serial_no/serial_no.json b/erpnext/stock/doctype/serial_no/serial_no.json index 9d31f091c9..3ef2e15085 100644 --- a/erpnext/stock/doctype/serial_no/serial_no.json +++ b/erpnext/stock/doctype/serial_no/serial_no.json @@ -151,19 +151,20 @@ }, { "fieldname": "purchase_document_type", - "fieldtype": "Select", + "fieldtype": "Link", "label": "Creation Document Type", "no_copy": 1, - "options": "\nPurchase Receipt\nStock Entry\nSerial No", + "options": "DocType", "permlevel": 0, "read_only": 1 }, { "fieldname": "purchase_document_no", - "fieldtype": "Data", + "fieldtype": "Dynamic Link", "hidden": 0, "label": "Creation Document No", "no_copy": 1, + "options": "purchase_document_type", "permlevel": 0, "read_only": 1 }, @@ -417,7 +418,7 @@ "icon": "icon-barcode", "idx": 1, "in_create": 0, - "modified": "2015-02-20 05:08:12.961403", + "modified": "2015-05-28 21:35:58.378231", "modified_by": "Administrator", "module": "Stock", "name": "Serial No", diff --git a/erpnext/stock/doctype/serial_no/serial_no.py b/erpnext/stock/doctype/serial_no/serial_no.py index 59a0667c5c..0b0246eae4 100644 --- a/erpnext/stock/doctype/serial_no/serial_no.py +++ b/erpnext/stock/doctype/serial_no/serial_no.py @@ -34,6 +34,9 @@ class SerialNo(StockController): self.validate_item() self.on_stock_ledger_entry() + valid_purchase_document_type = ("Purchase Receipt", "Stock Entry", "Serial No") + self.validate_value("purchase_document_type", "in", valid_purchase_document_type) + def set_maintenance_status(self): if not self.warranty_expiry_date and not self.amc_expiry_date: self.maintenance_status = None diff --git a/erpnext/tests/test_client.py b/erpnext/tests/test_client.py new file mode 100644 index 0000000000..ef412bf93b --- /dev/null +++ b/erpnext/tests/test_client.py @@ -0,0 +1,25 @@ +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt +from __future__ import unicode_literals + +import unittest, frappe +from frappe.utils import sel +from frappe.utils import formatdate + +selenium_tests = True + +class TestLogin(unittest.TestCase): + def setUp(self): + sel.login() + + def test_material_request(self): + sel.new_doc("Stock", "Material Request") + sel.set_field("company", "_Test Company") + sel.add_child("items") + sel.set_field("item_code", "_Test Item") + sel.set_field("qty", "1") + sel.set_field("warehouse", "_Test Warehouse - _TC") + sel.set_field("schedule_date", formatdate()) + sel.done_add_child("items") + sel.primary_action() + sel.wait_for_state("clean") diff --git a/test_sites/test_site/site_config.json b/test_sites/test_site/site_config.json index 96f3446606..7d1194af75 100644 --- a/test_sites/test_site/site_config.json +++ b/test_sites/test_site/site_config.json @@ -1,10 +1,12 @@ { "db_name": "test_frappe", "db_password": "test_frappe", + "auto_email_id": "test@example.com", + "mail_server": "smtp.example.com", + "mail_login": "test@example.com", + "mail_password": "test", "admin_password": "admin", - "auto_email_id": "admin@example.com", - "host_name": "http://localhost:8888", - "auto_email_id": "admin@example.com", - "mute_emails": 1, + "run_selenium_tests": 1, + "host_name": "http://localhost:8000", "install_apps": ["erpnext"] }