def test_1_1_register(self): welcome_page = page.WelcomePage(self.driver) welcome_page.click_x_button() login_page = page.LoginPage(self.driver) login_page.swipe_to_botton() login_page.click_regist_button() register_page = page.RegisterPage(self.driver) #account test case : 234/ [email protected] / [email protected] register_page.send_account('234') assert register_page.check_error_message(u'信箱格式錯誤'),'error message error.' register_page.send_account('*****@*****.**') assert register_page.check_error_message(u'該信箱已註冊, 輸入密碼直接登入'),'message error.' register_page.send_account('*****@*****.**') assert register_page.check_error_message(u'該信箱尚未啟用, 輸入密碼直接註冊'),'message error.' #password test case: 234/ 12345678910123456 register_page.send_password('234') assert register_page.check_error_message(u'密碼長度 < 8'),'error message error.' register_page.send_password('12345678910123456') assert register_page.check_error_message(u'密碼長度 > 15'),'error message error.' #passwordconfirm : 1234567891012345(123) register_page.send_password('123456789101234') register_page.send_password_confirm('123') assert register_page.check_error_message(u'密碼與確認密碼不同'),'error message error.'
def test_3_scene(self): welcome_page = page.WelcomePage(self.driver) welcome_page.click_x_button() login_page = page.LoginPage(self.driver) login_page.send_account_info('*****@*****.**', '12345678') security_page = page.SecurityPage(self.driver) assert security_page.check_security_logo_appear(),'security not appear.' bottom_banner = page.BottomBanner(self.driver) bottom_banner.click_bottom_button('情境') scene_page = page.ScenePage(self.driver) scene_page.add_new_scene("AutoTest") bottom_banner.click_bottom_button('設定') bottom_banner.click_bottom_button('情境') assert scene_page.check_out_scene('AutoTest'), "Add scene fail." scene_page.edit_scene("AutoTest",'AutoTest01') bottom_banner.click_bottom_button('設定') bottom_banner.click_bottom_button('情境') assert scene_page.check_out_scene('AutoTest01'), "Edit scene fail." scene_page.delete_scene('AutoTest01') #delete region test theResult = False if scene_page.check_out_scene('AutoTest01') == False: theResult = True assert theResult,"delete region fail."
def test_4_repeat_binding(self): welcome_page = page.WelcomePage(self.driver) welcome_page.click_x_button() login_page = page.LoginPage(self.driver) login_page.send_account_info('*****@*****.**', '12345678') security_page = page.SecurityPage(self.driver) security_page = page.SecurityPage(self.driver) binding_page = page.BindingPage(self.driver) bottom_banner = page.BottomBanner(self.driver) setting_page = page.SettingPage(self.driver) security_page = page.SecurityPage(self.driver) if security_page.check_security_logo_appear() == False: binding_page.send_binding_info('a79f','72067944','f835ddf7a79f') binding_page.click_send_button() assert security_page.check_security_logo_appear(),'security logo not appear.' testTimes = 3 # repeat times is here while testTimes > 0: bottom_banner.click_bottom_button('設定') setting_page.unbinding_device() login_page.click_send_button() binding_page.send_binding_info('a79f','72067944','f835ddf7a79f') binding_page.click_send_button() assert security_page.check_security_logo_appear(),'security logo not appear.' testTimes = testTimes-1
def test_2_region(self): welcome_page = page.WelcomePage(self.driver) welcome_page.click_x_button() login_page = page.LoginPage(self.driver) login_page.send_account_info('*****@*****.**', '12345678') security_page = page.SecurityPage(self.driver) assert security_page.check_security_logo_appear(),'security logo not appear.' #add new region test bottom_banner = page.BottomBanner(self.driver) bottom_banner.click_bottom_button('區域') region_page = page.RegionPage(self.driver) region_page.add_new_region('AutoTest') assert region_page.check_out_region('AutoTest'), "Add region fail." #edit region test region_page.edit_region('AutoTest','AutoTest01') assert region_page.check_out_region('AutoTest01'), "Edit region fail." #delete region test region_page.delete_region('AutoTest01') theResult = False if region_page.check_out_region('AutoTest01') == False: theResult = True assert theResult,"delete region fail."
def test_1_2_login(self): welcome_page = page.WelcomePage(self.driver) welcome_page.click_x_button() login_page = page.LoginPage(self.driver) login_page.send_account_info('*****@*****.**', '12345678') bottom_banner = page.BottomBanner(self.driver) bottom_banner.click_bottom_button('設定') setting_page = page.SettingPage(self.driver) assert setting_page.check_login_name(u'*****@*****.**'), 'login fail'
def setUp(self): self.driver = webdriver.Chrome(executable_path=r'C:\chromedriver.exe') self.driver.maximize_window() self.driver.get(credentials.WEBSITE) welcome_page = page.WelcomePage(self.driver) assert welcome_page.welcomePageCheck( ), "Welcome page text did not match" welcome_page.clickGoToApp() login_page = page.LoginPage(self.driver) assert login_page.loginPageCheck(), "Login page text did not match" login_page.email_text_element = credentials.USER login_page.pass_text_element = credentials.PASS login_page.clickLogin()
def test_5_logout(self): welcome_page = page.WelcomePage(self.driver) welcome_page.click_x_button() login_page = page.LoginPage(self.driver) login_page.send_account_info('*****@*****.**', '12345678') bottom_banner = page.BottomBanner(self.driver) bottom_banner.click_bottom_button('設定') setting_page = page.SettingPage(self.driver) assert setting_page.check_login_name(u'*****@*****.**'), 'login fail' setting_page.logout() assert login_page.check_Litenet_logo(),'logout fail.' self.driver.remove_app('com.gemteks.litenet')
def go_to_search(self): page.WelcomePage(self.driver).tape_search()
def test_ring_call(self): welcome_page = page.WelcomePage(self.driver) login_page = page.LoginPage(self.driver) calling_page = page.CallingPage(self.driver) security_page = page.SecurityPage(self.driver) # LiteNet login welcome_page.click_x_button() login_page.send_account_info('*****@*****.**', 'gemtek123') assert security_page.check_security_logo_appear(), 'security logo not appear.' Host = '10.5.182.210' tn = telnetlib.Telnet(Host, port=4005, timeout=10) tn.set_debuglevel(2) sleep(2) tn.write("A") sleep(2) tn.write("a") sleep(2) tn.close() timestr = time.strftime('%Y/%m/%d %H:%M:%S', time.localtime(time.time())) print "The time of click ring is:" + str(timestr) # # ser = serial.Serial("/dev/tty.usbserial", 9600, timeout=1) # if (ser.isOpen() == False): # ser.open() # ser.read() # ser.write("A") # sleep(1) # ser.write("a") # sleep(1) # ser.close() # # # if ser.is_open: # print 'open' # else: # print 'close' # timestr = time.strftime('%Y/%m/%d %H:%M:%S', time.localtime(time.time())) # print "The time of click ring is:" + str(timestr) times = 500 while times > 0: # LiteNet Receive call assert calling_page.check_ring_page(), 'no ringing appear' calling_page.answer_call() assert calling_page.check_calling(), 'current contact name not appear' calling_page.hangup() assert security_page.check_security_logo_appear(), 'Litenet hangup problem' time1 = 500 - times + 1 timestr = time.strftime('%Y/%m/%d %H:%M:%S', time.localtime(time.time())) print "\n no. " + str(time1) + " call pass, time :" + str(timestr) times = times - 1 sleep(15) tn = telnetlib.Telnet(Host, port=4005, timeout=10) tn.set_debuglevel(2) sleep(2) tn.write("A") sleep(2) tn.write("a") sleep(2) tn.close() timestr = time.strftime('%Y/%m/%d %H:%M:%S', time.localtime(time.time())) print "The time of click ring is:" + str(timestr)