예제 #1
0
 def setUp(self):
     self.myDriver = Init().openLoginPage()
     self.getValue = GetValues()
     self.getScreenshot = GetScreenshots(self.myDriver)
     self.getScreenshot.getScreenshot("LoginPage")
     self.testInit = TestInit(self.myDriver)
class TestClueTransferCustomer(unittest.TestCase):
    
    def setUp(self):
        self.myDriver=Init().openLoginPage()
        self.getScreenshot=GetScreenshots(self.myDriver)
        self.getValue=GetValues()
        self.testInit=TestInit(self.myDriver)
        self.testInit.login()
        
    def testClueTransferCustomer(self):
        #Open View Clue Page
        viewclueoption=self.getValue.getPageElementValue(4, 11)
        self.myDriver.find_element_by_link_text(viewclueoption).click()
        self.myDriver.implicitly_wait(5)
        sleep(3)
        verifyviewcluepage=self.getValue.getTestDataValue(6, 5)
        assert verifyviewcluepage in self.myDriver.page_source
        
        #Click Transfer Option
        transferoption_xpath=self.getValue.getPageElementValue(16, 2)+self.getValue.getTestDataValue(5, 2)+self.getValue.getPageElementValue(17, 2)
        self.myDriver.find_element_by_xpath(transferoption_xpath).click()
        self.myDriver.implicitly_wait(5)
        sleep(3)

        
        #switch web windows
        handles = self.myDriver.window_handles
        self.myDriver.switch_to.window(handles[1])
        verifyaddcustomer=self.getValue.getTestDataValue(9, 5)
        assert verifyaddcustomer in self.myDriver.page_source
        self.getScreenshot.getScreenshot("AddCustomPage")
        
        #Input customer information
        customername_xpath=self.getValue.getPageElementValue(18, 2)
        customername=self.getValue.getTestDataValue(10, 2)
        self.myDriver.find_element_by_xpath(customername_xpath).send_keys(customername)
        
        comindustry_xpath=self.getValue.getPageElementValue(19, 2)
        self.myDriver.find_element_by_xpath(comindustry_xpath).click()
        
        customerorigin_xpath=self.getValue.getPageElementValue(20, 2)
        customeroriginselection_xpath=self.getValue.getPageElementValue(21, 2)
        self.myDriver.find_element_by_xpath(customerorigin_xpath).click()
        self.myDriver.find_element_by_xpath(customeroriginselection_xpath).click()
        
        companypro_xpath=self.getValue.getPageElementValue(22, 2)
        self.myDriver.find_element_by_xpath(companypro_xpath).click()
        
        contactname_xpath=self.getValue.getPageElementValue(23, 2)
        contactname=self.getValue.getTestDataValue(10, 2)
        self.myDriver.find_element_by_xpath(contactname_xpath).send_keys(contactname)
        
        numofemp_xpath=self.getValue.getPageElementValue(24, 2)
        numofempselection_xpath=self.getValue.getPageElementValue(25, 2)
        self.myDriver.find_element_by_xpath(numofemp_xpath).click()
        self.myDriver.find_element_by_xpath(numofempselection_xpath).click()
        
        createbusiness_xpath=self.getValue.getPageElementValue(26, 2)
        self.myDriver.find_element_by_xpath(createbusiness_xpath).click()
        
        savebtn_xpath=self.getValue.getPageElementValue(27, 2)
        self.myDriver.find_element_by_xpath(savebtn_xpath).click()
        
        self.myDriver.implicitly_wait(5)
        sleep(3)
        verifyaddcusresult = self.getValue.getTestDataValue(10, 5)
        assert verifyaddcusresult in self.myDriver.page_source
        self.getScreenshot.getScreenshot("AddCustomerResult")
        
        #backto previous window
        self.testInit.closeCurrentTab()
        self.myDriver.switch_to.window(handles[0])

    def tearDown(self):
        self.testInit.logOff()
        self.testInit.closeCurrentBrowser()
예제 #3
0
class TestCreateClue(unittest.TestCase):
    def setUp(self):
        self.getValue = GetValues()
        self.myDriver = Init().openLoginPage()
        self.getScreenshot = GetScreenshots(self.myDriver)
        self.testInit = TestInit(self.myDriver)
        self.testInit.login()

    def testCreateClue(self):
        createclueoption_linktext = self.getValue.getPageElementValue(3, 11)
        self.myDriver.find_element_by_link_text(
            createclueoption_linktext).click()
        sleep(3)
        self.getScreenshot.getScreenshot("CreateCluePage")

        #input clue information
        comname_id = self.getValue.getPageElementValue(3, 5)
        comname = self.getValue.getTestDataValue(5, 2)
        self.myDriver.find_element_by_id(comname_id).send_keys(comname)

        contactname_id = self.getValue.getPageElementValue(4, 5)
        contactname = self.getValue.getTestDataValue(6, 2)
        self.myDriver.find_element_by_id(contactname_id).send_keys(contactname)

        saltname_xpath = self.getValue.getPageElementValue(7, 2)
        saltnameselection_xpath = self.getValue.getPageElementValue(8, 2)
        self.myDriver.find_element_by_xpath(saltname_xpath).click()
        self.myDriver.find_element_by_xpath(saltnameselection_xpath).click()

        mobile_id = self.getValue.getPageElementValue(5, 5)
        mobile = self.getValue.getTestDataValue(7, 2)
        self.myDriver.find_element_by_id(mobile_id).send_keys(mobile)

        email_xpath = self.getValue.getPageElementValue(9, 2)
        email = self.getValue.getTestDataValue(8, 2)
        self.myDriver.find_element_by_xpath(email_xpath).send_keys(email)

        #click save button
        savebtn_xpath = self.getValue.getPageElementValue(10, 2)
        self.myDriver.find_element_by_xpath(savebtn_xpath).click()

        self.myDriver.implicitly_wait(5)
        sleep(3)
        self.getScreenshot.getScreenshot("CreateClueResult")
        createclueresult = self.getValue.getTestDataValue(5, 5)
        assert createclueresult in self.myDriver.page_source

    def tearDown(self):
        self.testInit.logOff()
        self.testInit.closeCurrentBrowser()
예제 #4
0
class TestClueModify(unittest.TestCase):
    
    def setUp(self):
        self.myDriver=Init().openLoginPage()
        self.getScreenshot=GetScreenshots(self.myDriver)
        self.getValue=GetValues()
        self.testInit=TestInit(self.myDriver)
        self.testInit.login()
        
    def testCludModify(self):
        #Open View Clue Page
        viewclueoption=self.getValue.getPageElementValue(4, 11)
        self.myDriver.find_element_by_link_text(viewclueoption).click()
        self.myDriver.implicitly_wait(5)
        sleep(3)
        verifyviewcluepage=self.getValue.getTestDataValue(6, 5)
        assert verifyviewcluepage in self.myDriver.page_source
        
        #click Modify option to goto modify page
        cludemodify_xpath=self.getValue.getPageElementValue(11, 2)+self.getValue.getTestDataValue(5, 2)+self.getValue.getPageElementValue(12, 2)
        self.myDriver.find_element_by_xpath(cludemodify_xpath).click()
        self.myDriver.implicitly_wait(5)
        sleep(3)
        verifycludmodifypage=self.getValue.getTestDataValue(7, 5)
        assert verifycludmodifypage in self.myDriver.page_source
        self.getScreenshot.getScreenshot("CludModifyPage")
        
        #Input Clue Modify - text information
        textarea_xpath=self.getValue.getPageElementValue(13, 2)
        textarea_content=self.getValue.getTestDataValue(9, 2)
        self.myDriver.find_element_by_xpath(textarea_xpath).clear()
        self.myDriver.find_element_by_xpath(textarea_xpath).send_keys(textarea_content)
        
        #Input Clue Modify - next contact time information
        Next_Step_Time=(datetime.datetime.now() + datetime.timedelta(days = +10)).strftime("%Y-%m-%d")
        nexttimebox_xpath=self.getValue.getPageElementValue(14, 2)
        self.myDriver.find_element_by_xpath(nexttimebox_xpath).clear()
        self.myDriver.find_element_by_xpath(nexttimebox_xpath).send_keys(Next_Step_Time)
        self.myDriver.find_element_by_xpath(nexttimebox_xpath).send_keys(Keys.ENTER)
        
        self.myDriver.implicitly_wait(5)
        sleep(3)
        self.getScreenshot.getScreenshot("CludeModifResult")
        verifycluemodifyresult=self.getValue.getTestDataValue(8, 5)
        assert verifycluemodifyresult in self.myDriver.page_source
        
        # Back to view clue page
        backbtn_xpath=self.getValue.getPageElementValue(15, 2)
        self.myDriver.find_element_by_xpath(backbtn_xpath).click()
        self.myDriver.implicitly_wait(5)
        sleep(3)
        
    def tearDown(self):
        self.testInit.logOff()
        self.testInit.closeCurrentBrowser()