test :test case for setting opportunity as lost

This commit is contained in:
deepeshgarg007 2018-12-29 22:11:19 +05:30
parent d9a768a88f
commit dc218ebeeb

View File

@ -4,7 +4,33 @@
from __future__ import unicode_literals
import frappe
import unittest
import unittest, time
from frappe.utils.selenium_testdriver import TestDriver
from erpnext.crm.doctype.opportunity.test_opportunity import make_opportunity
class TestLostReason(unittest.TestCase):
pass
def setUp(self):
self.driver = TestDriver()
def test_opportunity_lost(self):
doc = make_opportunity(with_items=0)
doc.save()
self.assertEqual(doc.status, "Open")
self.driver.set_route('Form', 'Opportinuty', doc.name)
time.sleep(2)
lost = self.driver.find('.form-inner-toolbar')[1]
lost.click()
time.sleep(2)
self.driver.set_text_editor('order_lost_reason', 'Test reason for detailed reason')
self.driver.click_primary_action()
self.assertEqual(doc.status, "Lost")
self.assertEqual(doc.order_lost_reason, "Test reason for detailed reason")
def tearDown(self):
self.driver.close()