Exemplo n.º 1
0
class RZCase(unittest.TestCase):
    URL = Config().get('URL')

    def sub_setUp(self):
        # 初始页面是main page,传入浏览器类型打开浏览器
        self.page = RZLoginPage().get(self.URL,
                                      maximize_window=False,
                                      implicitly_wait=20)

    def sub_tearDown(self):
        self.page.quit()

    def test_03_travel_application(self):
        '''出差申请单元测试'''
        self.sub_setUp()
        self.page = RZLoginPage(self.page)
        self.page.userlogin()
        travelapplication = TravelAppLocators(self.page)
        travelapplication.enter_travel_butten()
        sleep(2)
        travelapplication.enter_travel_place()
        travelapplication.enter_travel_reason()
        travelapplication.enter_date_time()
        ele = travelapplication.sucess_content
        self.assertIn('提交成功', ele)
        self.sub_tearDown()
Exemplo n.º 2
0
class TestRenZi(unittest.TestCase):
    URL = Config().get('URL')
    excel = DATA_PATH + '/baidu.xlsx'

    def sub_setUp(self):
        # 初始页面是main page,传入浏览器类型打开浏览器
        self.page = RZLoginPage(browser_type='Chrome').get(
            self.URL, maximize_window=False)

    def sub_tearDown(self):
        self.page.quit()

    def test_login(self):
        datas = ExcelReader(self.excel).data
        for d in datas:
            with self.subTest(data=d):
                self.sub_setUp()
                self.page.userlogin(d['username'], d['password'])
                try:
                    self.page = RZLoginPage(self.page)  # 页面跳转到result page
                    loginname = self.page.result_name()
                    target_value = d['target_value']
                    self.assertIn(target_value, loginname)
                    logger.info(loginname)
                except AssertionError as e:
                    logger.warning(e)
                self.sub_tearDown()
Exemplo n.º 3
0
class RZCase(unittest.TestCase):
    URL = Config().get('URL')

    def sub_setUp(self):
        # 初始页面是main page,传入浏览器类型打开浏览器
        self.page = RZLoginPage().get(self.URL,
                                      maximize_window=False,
                                      implicitly_wait=20)

    def sub_tearDown(self):
        self.page.quit()

    def test_02_oa_application(self):
        '''外出申请单元测试'''
        self.sub_setUp()
        self.page = RZLoginPage(self.page)
        self.page.userlogin()
        oaapplication = OutApplyLocators(self.page)
        oaapplication.enter_outApply_button()
        sleep(2)
        oaapplication.outApply_reason()
        oaapplication.enter_date_time()
        ele = oaapplication.success_content
        self.assertIn('提交成功', ele)
        self.sub_tearDown()
Exemplo n.º 4
0
class RZCase(unittest.TestCase):
    URL = Config().get('URL')

    def sub_setUp(self):
        # 初始页面是main page,传入浏览器类型打开浏览器
        self.page = RZLoginPage().get(self.URL,
                                      maximize_window=False,
                                      implicitly_wait=20)

    def sub_tearDown(self):
        self.page.quit()

    def test_02_oa_application(self):
        '''离职申请单元测试'''
        self.sub_setUp()
        self.page = RZLoginPage(self.page)
        self.page.userlogin()
        qtapplication = QuitApplyLocators(self.page)
        qtapplication.enter_quitApply_button()
        sleep(2)
        qtapplication.quitApply_Email()
        sleep(1)
        qtapplication.quitApply_Reason()
        qtapplication.quitApply_Describe()
        sleep(2)
        qtapplication.quitApply_Outstanding()
        sleep(2)
        qtapplication.quitApply_FuturePlanning()
        sleep(2)
        qtapplication.quitApply_OtherSuggestions()
        sleep(2)
        qtapplication.quitApply_AddOperation()
        sleep(2)
        qtapplication.quitApply_Deliver()
        sleep(2)
        qtapplication.quitApply_Deliver_content()
        sleep(2)
        qtapplication.quitApply_Submit()
        self.sub_tearDown()
Exemplo n.º 5
0
class RZCase(unittest.TestCase):
    URL = Config().get('URL')

    def sub_setUp(self):
        # 初始页面是main page,传入浏览器类型打开浏览器
        self.page = RZLoginPage().get(self.URL,
                                      maximize_window=False,
                                      implicitly_wait=20)

    def sub_tearDown(self):
        self.page.quit()

    def test_02_oa_application(self):
        '''调出申请单元测试'''
        self.sub_setUp()
        self.page = RZLoginPage(self.page)
        self.page.userlogin()
        reapplication = reApplyLocators(self.page)
        reapplication.enter_reApply_button()
        sleep(2)
        reapplication.enter_reApply_button()
        sleep(2)
        reapplication.reApply_click_depart()
        sleep(2)
        reapplication.reApplydepart()
        sleep(4)
        reapplication.reApplyposition()
        sleep(2)
        reapplication.reApplyreason()
        sleep(2)
        reapplication.reApply_add()
        sleep(2)
        reapplication.reApply_Deliver()
        sleep(2)
        reapplication.reApply_Deliver_content()
        sleep(2)
        reapplication.reApply_Submit()
        self.sub_tearDown()
Exemplo n.º 6
0
            sleep(4)
            self.find_element(*self.travel_submit).click()
            sleep(2)
            self.content = self.driver.find_element(
                *self.travel_submit_content).text  #get_attribute('innerHTML')
            print("**************")
            print(self.content)
            sleep(7)
            if self.content == '提交成功':
                self.sucess_content = self.content
                break
            else:
                self.find_element(*self.travel_startdate1).clear()
                self.find_element(*self.travel_enddate1).clear()
                x = x + 1
                my_date = (datetime.now() +
                           timedelta(days=x)).strftime("%Y-%m-%d")


if __name__ == '__main__':
    URL = Config().get('URL')
    page = RZLoginPage(browser_type='Chrome').get(URL, maximize_window=False)
    page.userlogin()
    result = TravelAppLocators(page)
    result.enter_travel_butten()
    sleep(2)
    result.enter_travel_place()
    result.enter_travel_reason()
    result.enter_date_time()
    page.quit()