class SimpleAndroidTests(unittest.TestCase): #check if the necessary folders are present, if not create def check_dir(self, dir_path): if not os.path.isdir(dir_path): print "Creating the log dir" os.mkdir(dir_path) def adb_dump_data(self, udid, reference, step, adb_dump_dir): #save teh sys dump of the phone self.adb_activities.get_dumpsys(udid, reference, step, adb_dump_dir) #Get the cpu info cpu_usage = self.adb_activities.get_cpuinfo(udid) #Get mem info mem_usage = self.adb_activities.get_mem_info(udid, self.package) #Device temp temperature = self.adb_activities.get_device_temp(udid) print step, cpu_usage, mem_usage, temperature return [step, cpu_usage, mem_usage, temperature] def setUp(self): self.reference = str(int(round(time.time() * 1000))) self.package = "com.globo.globotv" #device id as 1st argument self.udid = sys.argv[1] self.os = 'Android' #logs folder self.logs_dir = os.getcwd() + "/logs" print self.logs_dir self.check_dir(self.logs_dir) self.logs_dir = self.logs_dir + "/" + self.reference os.mkdir(self.logs_dir) #adb_dump folder self.adb_dump_dir = os.getcwd() + "/adb_dump" self.check_dir(self.adb_dump_dir) self.adb_dump_dir = self.adb_dump_dir + "/" + self.reference os.mkdir(self.adb_dump_dir) self.adb_activities = AdbDdata() self.alerts = SendAlert() self.array_of_data_list = [] #Befre test function self.adb_activities.before_test(self.udid) self.capture_cap = sys.argv[3] #desired caps for the app desired_caps = {} desired_caps['platformName'] = self.os desired_caps['udid'] = self.udid desired_caps['deviceName'] = self.udid desired_caps['appPackage'] = self.package desired_caps['appActivity'] = "com.globo.globotv.splash.SplashActivity" desired_caps['noReset'] = True desired_caps['automationName'] = "uiautomator2" desired_caps['newCommandTimeout'] = 600 if self.capture_cap == "1": desired_caps['headspin.capture'] = True else: desired_caps['headspin.capture'] = False desired_caps['no-reset'] = True appium_input = sys.argv[2] if appium_input.isdigit(): self.url = ('http://127.0.0.1:' + appium_input + '/wd/hub') else: self.url = appium_input #launching app self.driver = webdriver.Remote(self.url, desired_caps) self.start_app = int(round(time.time() * 1000)) #initialising variables self.status = "Fail_launch" self.app_launch_time = 0 self.status_dic = {} self.kpi_dic = {} self.app_launch_time = 0 self.home_pg_load_time = 0 self.initial_video_play = 0 self.sub_video_play = 0 self.title_check = False self.progress_check = False self.test_name = "Continue_Assistindo" self.kpi_count = 6 self.pass_count = 0 self.fail_count = 0 def tearDown(self): #incrementing kpi count print "Pass count is %s" % self.pass_count if self.pass_count != self.kpi_count: self.fail_count = self.kpi_count - self.pass_count else: self.fail_count = 0 print "Fail count is %s " % self.fail_count #After function self.adb_activities.after_test(self.udid, self.reference, self.driver, self.status) if self.capture_cap == "1": self.session_id = self.driver.session_id print self.session_id else: self.session_id = None #Insert to app table insert = MysqlDataInsert() insert.globo_continuar_metrics( self.driver, self.app_launch_time, self.home_pg_load_time, self.initial_video_play, self.title_check, self.progress_check, self.sub_video_play, self.pass_count, self.fail_count, self.status, self.reference, self.session_id, self.test_name) path = os.getcwd() + "/logs/" if self.status == "Pass": screenshot_name = str(self.reference) + '_' + self.udid + ".png" log_file_name = str(self.reference) + '_' + self.udid + ".log" else: log_file_name = str( self.reference) + '_' + self.udid + "_error.log" screenshot_name = str( self.reference) + '_' + self.udid + "_error.png" screenshot_path = path + "/" + screenshot_name log_path = path + "/" + log_file_name log_url = "https://s3-us-west-2.amazonaws.com/grafana-images.headspin.io/globo/" + log_file_name png_url = "https://s3-us-west-2.amazonaws.com/grafana-images.headspin.io/globo/" + screenshot_name self.threshold = 5000 if not all( i < self.threshold for i in list(self.kpi_dic.values())) or self.status != "Pass": slack_messge = [] message_to_be_send = "" if not all(i < self.threshold for i in list(self.kpi_dic.values())): for key, value in self.kpi_dic.items(): if value > self.threshold: slack_messge.append('{} : {}'.format(key, value)) for text in slack_messge: message_to_be_send = message_to_be_send + text + "\n" print message_to_be_send message_to_be_send = self.os + "\n" + self.udid + "\n" + message_to_be_send + "\n" + "Device_log url:" + log_url + "\n" + "Device screenshot url:" + png_url #slack alert self.alerts.slack_alert(message_to_be_send) #Mail ALert self.alerts.email_alert(message_to_be_send) self.driver.quit() def videoplay_check(self, sec): self.driver.implicitly_wait(5) t_end = time.time() + sec while time.time() < t_end: try: screen_size = self.driver.get_window_size() width = screen_size['width'] height = screen_size['height'] tap_x = width * 0.5 tap_y = height * 0.23 self.driver.tap([(tap_x, tap_y)]) player_control = self.driver.find_element_by_id( "com.globo.globotv:id/media_control") sleep(5) except: spinner = self.driver.find_element_by_id( 'com.globo.globotv:id/progress_bar') print "Video Interrupted" self.video_play() def video_play(self): self.driver.implicitly_wait(1) t_end = time.time() + 10 while time.time() < t_end: try: spinner = self.driver.find_element_by_id( 'com.globo.globotv:id/progress_bar') print "Spinner!!" except: break def test_login(self): self.driver.implicitly_wait(60) #Launching app agora_tab = self.driver.find_element_by_android_uiautomator( 'new UiSelector().description("Agora")') launched_app = int(round(time.time() * 1000)) #calcualting launch time self.app_launch_time = launched_app - self.start_app print("App Launch Time is %s ms" % self.app_launch_time) d = {'globo_launch_time': self.app_launch_time} self.kpi_dic.update(d) #incrementing pass count self.pass_count += 1 #library tab view time self.status = "Fail_login" user_icon = self.driver.find_element_by_id( "com.globo.globotv:id/menu_profile_custom_view_profile") user_icon.click() #Log out try: self.driver.implicitly_wait(5) logout = self.driver.find_element_by_android_uiautomator( 'new UiSelector().text("Sair")') logout.click() #Confirm log out yes_btn = self.driver.find_element_by_id('android:id/button1') yes_btn.click() #Click on te account button self.driver.implicitly_wait(10) user_icon = self.driver.find_element_by_id( "com.globo.globotv:id/menu_profile_custom_view_profile") user_icon.click() except: pass self.driver.implicitly_wait(10) try: entrar = self.driver.find_element_by_id( 'com.globo.globotv:id/activity_profile_text_view_get_int') entrar.click() except: user_icon = self.driver.find_element_by_id( "com.globo.globotv:id/menu_profile_custom_view_profile") user_icon.click() entrar = self.driver.find_element_by_id( 'com.globo.globotv:id/activity_profile_text_view_get_int') entrar.click() self.driver.implicitly_wait(10) try: none_of_the_above = self.driver.find_element_by_id( "com.google.android.gms:id/cancel") none_of_the_above.click() except: pass sleep(5) self.driver.implicitly_wait(60) email_id_tf = self.driver.find_element_by_class_name( 'android.widget.EditText') email_id_tf.set_value('laurent_headspin') #password password_tf = self.driver.find_elements_by_class_name( 'android.widget.EditText')[1] password_tf.set_value('Globo@321') sleep(5) button = self.driver.find_element_by_android_uiautomator( 'new UiSelector().text("ENTRAR")') location = button.location size = button.size self.x_tap = location['x'] + int(size['width'] / 2) self.y_tap = location['y'] + int(size['height'] / 2) sleep(2) self.driver.tap([(self.x_tap, self.y_tap)]) self.status = "Fail_page_load_post_login" back_btn = self.driver.find_element_by_android_uiautomator( 'new UiSelector().description("Navigate up")') back_btn.click() home_page_load_start = int(round(time.time() * 1000)) self.driver.implicitly_wait(0.5) t_end = time.time() + 60 while time.time() < t_end: try: self.driver.find_element_by_class_name( 'android.widget.ProgressBar') except: break self.driver.implicitly_wait(50) home_page = self.driver.find_element_by_android_uiautomator( 'new UiSelector().description("Agora")') home_page_load_end = int(round(time.time() * 1000)) self.home_pg_load_time = home_page_load_end - home_page_load_start d = {'globo_post_login_home_load_time': self.home_pg_load_time} self.kpi_dic.update(d) self.pass_count += 1 print "Home page loading time ", self.home_pg_load_time sleep(4) #Choose a title from home page categories_tab = self.driver.find_element_by_android_uiautomator( 'new UiSelector().description("Categorias")') categories_tab.click() sleep(2) series = self.driver.find_elements_by_id( 'com.globo.globotv:id/view_holder_categories_image_view_cover')[1] series.click() sleep(2) screen_size = self.driver.get_window_size() width = screen_size['width'] height = screen_size['height'] swipe_start_x = width / 2 swipe_start_y = height * 0.7 swipe_end_x = width / 2 swipe_end_y = height * 0.3 self.driver.implicitly_wait(5) self.driver.swipe(swipe_start_x, swipe_start_y, swipe_end_x, swipe_end_y, 1000) while True: try: title_button = self.driver.find_element_by_id( "com.globo.globotv:id/custom_view_title_image_view_poster") break except: self.driver.swipe(swipe_start_x, swipe_start_y, swipe_end_x, swipe_end_y, 1000) continue actions = TouchAction(self.driver) actions.tap(title_button).perform() self.driver.implicitly_wait(50) title_name = self.driver.find_element_by_id( "com.globo.globotv:id/activity_title_text_view_title") #title_encode = title_name.text.decode('iso-8859-1') #get_title_name = title_encode.encode('utf-8') get_title_name = title_name.text print get_title_name Details_tab = self.driver.find_element_by_android_uiautomator( 'new UiSelector().text("Detalhes")') Details_tab.click() Spec_headline1 = self.driver.find_element_by_id( 'com.globo.globotv:id/fragment_title_details_text_view_specifications' ).text # Spec_genres1 = self.driver.find_element_by_id('com.globo.globotv:id/fragment_title_details_text_view_subset').text Spec_country1 = self.driver.find_element_by_id( 'com.globo.globotv:id/fragment_title_details_text_view_country' ).text sleep(2) play_button = self.driver.find_element_by_id( "com.globo.globotv:id/activity_title_button_one") play_button.click() self.status = "Fail_video_Play" video_start = int(round(time.time() * 1000)) self.driver.implicitly_wait(1) t_end = time.time() + 60 while time.time() < t_end: try: spinner = self.driver.find_element_by_id( 'com.globo.globotv:id/progress_bar') print "Spinner!!" except: print "Not displayed" break self.driver.implicitly_wait(1) t_end = time.time() + 60 while time.time() < t_end: try: spinner = self.driver.find_element_by_id( 'com.globo.globotv:id/progress_bar') print "Spinner!!" except: video_end = int(round(time.time() * 1000)) print "Not displayed" break self.initial_video_play = video_end - video_start self.driver.implicitly_wait(5) try: self.driver.find_element_by_id("android:id/button1").click() sleep(2) play_button.click() video_second = int(round(time.time() * 1000)) self.driver.implicitly_wait(1) t_end = time.time() + 60 while time.time() < t_end: try: spinner = self.driver.find_element_by_id( 'com.globo.globotv:id/progress_bar') print "Spinner!!" except: print "Not displayed" break self.driver.implicitly_wait(1) t_end = time.time() + 60 while time.time() < t_end: try: spinner = self.driver.find_element_by_id( 'com.globo.globotv:id/progress_bar') print "Spinner!!" except: video_play = int(round(time.time() * 1000)) print "Not displayed" break self.initial_video_play = video_play - video_second except: pass print "Initial Video load time ", self.initial_video_play self.pass_count += 1 d = {'globo_initial_play': self.initial_video_play} self.kpi_dic.update(d) #Watch the Video for 1 minute self.videoplay_check(80) self.driver.implicitly_wait(50) navigate_up = self.driver.find_element_by_android_uiautomator( 'new UiSelector().descriptionContains("Navigate up")') navigate_up.click() self.status = "Fail_get_progress" get_title_progress = self.driver.find_element_by_id( "com.globo.globotv:id/activity_title_progress").text print get_title_progress sleep(2) navigate_up = self.driver.find_element_by_android_uiautomator( 'new UiSelector().descriptionContains("Navigate up")') navigate_up.click() #closing and relaunching app self.driver.close_app() sleep(10) self.driver.launch_app() #App relaunched #Searching for the same title search_button = self.driver.find_element_by_id( "com.globo.globotv:id/menu_bottom_navigation_view_item_search") search_button.click() search_bar = self.driver.find_element_by_id( "com.globo.globotv:id/search_src_text") search_bar.click() search_bar.send_keys(get_title_name) self.driver.press_keycode(66) i = 0 while i < len( self.driver.find_elements_by_id( "com.globo.globotv:id/view_holder_custom_view_rails_custom_view_title" )): title_select = self.driver.find_elements_by_id( "com.globo.globotv:id/view_holder_custom_view_rails_custom_view_title" )[i] title_select.click() self.status = "Fail_title_check" self.title_check = False search_title = self.driver.find_element_by_id( "com.globo.globotv:id/activity_title_text_view_title") search_title_name = search_title.text print search_title_name Details_tab = self.driver.find_element_by_android_uiautomator( 'new UiSelector().text("Detalhes")') Details_tab.click() Spec_headline2 = self.driver.find_element_by_id( 'com.globo.globotv:id/fragment_title_details_text_view_specifications' ).text #Spec_genres2 = self.driver.find_element_by_id('com.globo.globotv:id/fragment_title_details_text_view_subset').text Spec_country2 = self.driver.find_element_by_id( 'com.globo.globotv:id/fragment_title_details_text_view_country' ).text if (search_title_name == get_title_name) and ( Spec_headline1 == Spec_headline2) and (Spec_country1 == Spec_country2): print "Title found" self.title_check = True self.pass_count = self.pass_count + 1 break else: i += 1 navigate_up = self.driver.find_element_by_android_uiautomator( 'new UiSelector().descriptionContains("Navigate up")') navigate_up.click() sleep(2) self.status = "Fail_progress_check" self.progress_check = False search_title_progress = self.driver.find_element_by_id( "com.globo.globotv:id/activity_title_progress") search_title_progress = search_title_progress.text print search_title_progress if search_title_progress == get_title_progress: print "Progress time verified" self.progress_check = True self.pass_count = self.pass_count + 1 continue_button = self.driver.find_element_by_id( "com.globo.globotv:id/activity_title_button_one") continue_button.click() sub_start = int(round(time.time() * 1000)) self.driver.implicitly_wait(1) t_end = time.time() + 60 while time.time() < t_end: try: spinner = self.driver.find_element_by_id( 'com.globo.globotv:id/progress_bar') print "Spinner!!" except: print "Not displayed" break self.driver.implicitly_wait(1) t_end = time.time() + 60 while time.time() < t_end: try: spinner = self.driver.find_element_by_id( 'com.globo.globotv:id/progress_bar') print "Spinner!!" except: sub_end = int(round(time.time() * 1000)) print "Not displayed" break print " Video Resumed " self.sub_video_play = sub_end - sub_start print "subsequent video load time ", self.sub_video_play self.pass_count += 1 sleep(10) if self.progress_check == False: self.status = "Fail_progress_check" elif self.title_check == False: self.status = "Fail_title_check" else: self.status = "Pass"
class SimpleAndroidTests(unittest.TestCase): #check if the necessary folders are present, if not create def check_dir(self, dir_path): if not os.path.isdir(dir_path): print "Creating the log dir" os.mkdir(dir_path) def adb_dump_data(self, udid, reference, step, adb_dump_dir): #save teh sys dump of the phone self.adb_activities.get_dumpsys(udid, reference, step, adb_dump_dir) #Get the cpu info cpu_usage = self.adb_activities.get_cpuinfo(udid) #Get mem info mem_usage = self.adb_activities.get_mem_info(udid, self.package) #Device temp temperature = self.adb_activities.get_device_temp(udid) print step, cpu_usage, mem_usage, temperature return [step, cpu_usage, mem_usage, temperature] def setUp(self): self.reference = str(int(round(time.time() * 1000))) self.package = "com.globo.globotv" #device id as 1st argument self.udid = sys.argv[1] self.os = 'Android' #logs folder self.logs_dir = os.getcwd() + "/logs" print self.logs_dir self.check_dir(self.logs_dir) self.logs_dir = self.logs_dir + "/" + self.reference os.mkdir(self.logs_dir) #adb_dump folder self.adb_dump_dir = os.getcwd() + "/adb_dump" self.check_dir(self.adb_dump_dir) self.adb_dump_dir = self.adb_dump_dir + "/" + self.reference os.mkdir(self.adb_dump_dir) self.adb_activities = AdbDdata() self.alerts = SendAlert() self.array_of_data_list = [] adb_data = self.adb_dump_data(self.udid, self.reference, "Before_Test", self.adb_dump_dir) self.array_of_data_list.append(adb_data) #Befre test function self.adb_activities.before_test(self.udid) self.capture_cap = sys.argv[3] #desired caps for the app desired_caps = {} desired_caps['platformName'] = self.os desired_caps['udid'] = self.udid desired_caps['deviceName'] = self.udid desired_caps['appPackage'] = self.package desired_caps['appActivity'] = "com.globo.globotv.splash.SplashActivity" desired_caps['noReset'] = True # desired_caps['headspin:controlLock']= True desired_caps['automationName'] = "uiautomator2" desired_caps['newCommandTimeout'] = 600 if self.capture_cap == "1": desired_caps['headspin:capture.video'] = True desired_caps['headspin:capture.network'] = False # desired_caps['headspin.capture'] = True else: desired_caps['headspin.capture'] = False desired_caps['no-reset'] = True #appium input as 2nd argument appium_input = sys.argv[2] if appium_input.isdigit(): self.url = ('http://127.0.0.1:' + appium_input + '/wd/hub') else: self.url = appium_input #launching app self.driver = webdriver.Remote(self.url, desired_caps) self.start_app = int(round(time.time() * 1000)) #initialising variables self.status = "Fail_launch" self.app_launch_time = 0 self.status_dic = {} self.kpi_dic = {} self.app_launch_time = 0 self.video_laod_time = 0 self.download_start_time = 0 self.dowload_check = False self.kpi_count = 4 self.pass_count = 0 self.fail_count = 0 def tearDown(self): #incrementing kpi count print "Pass count is %s" % self.pass_count if self.pass_count != self.kpi_count: self.fail_count = self.kpi_count - self.pass_count else: self.fail_count = 0 print "Fail count is %s " % self.fail_count #After function self.adb_activities.after_test(self.udid, self.reference, self.driver, self.status) if self.capture_cap == "1": self.session_id = self.driver.session_id print self.session_id else: self.session_id = None #Insert to app table insert = MysqlDataInsert() # insert.globo_kpi_metrics(self.driver, self.app_launch_time, self.home_pg_load_time, self.series_load_time, self.video_laod_time, self.buffer_in_video, self.pass_count,self.fail_count,self.status,self.reference,self.session_id) path = os.getcwd() + "/logs/" if self.status == "Pass": screenshot_name = str(self.reference) + '_' + self.udid + ".png" log_file_name = str(self.reference) + '_' + self.udid + ".log" else: log_file_name = str( self.reference) + '_' + self.udid + "_error.log" screenshot_name = str( self.reference) + '_' + self.udid + "_error.png" screenshot_path = path + "/" + screenshot_name log_path = path + "/" + log_file_name log_url = "https://s3-us-west-2.amazonaws.com/grafana-images.headspin.io/globo/" + log_file_name png_url = "https://s3-us-west-2.amazonaws.com/grafana-images.headspin.io/globo/" + screenshot_name self.threshold = 5000 if not all( i < self.threshold for i in list(self.kpi_dic.values())) or self.status != "Pass": slack_messge = [] message_to_be_send = "" if not all(i < self.threshold for i in list(self.kpi_dic.values())): for key, value in self.kpi_dic.items(): if value > self.threshold: slack_messge.append('{} : {}'.format(key, value)) for text in slack_messge: message_to_be_send = message_to_be_send + text + "\n" print message_to_be_send message_to_be_send = self.os + "\n" + self.udid + "\n" + message_to_be_send + "\n" + "Device_log url:" + log_url + "\n" + "Device screenshot url:" + png_url #slack alert self.alerts.slack_alert(message_to_be_send) #Mail ALert self.alerts.email_alert(message_to_be_send) #data_list is [step,cpuinfo, meminfo, temp] adb_data = self.adb_dump_data(self.udid, self.reference, "After_Test", self.adb_dump_dir) self.array_of_data_list.append(adb_data) #data_list is [step,cpuinfo, meminfo, temp] for data_list in self.array_of_data_list: insert.globo_device_details(self.driver, data_list, self.status, self.reference) self.driver.quit() def test_login(self): self.driver.implicitly_wait(60) #Launching app home_page_image = self.driver.find_element_by_id( 'com.globo.globotv:id/custom_view_premium_highlights_image_view_background' ) launched_app = int(round(time.time() * 1000)) #calcualting launch time self.app_launch_time = launched_app - self.start_app print("App Launch Time is %s ms" % self.app_launch_time) d = {'globo_launch_time': self.app_launch_time} self.kpi_dic.update(d) #incrementing pass count self.pass_count += 1 categories_tab = self.driver.find_element_by_android_uiautomator( 'new UiSelector().text("Categorias")') categories_tab.click() novelas = self.driver.find_element_by_android_uiautomator( 'new UiSelector().text("Novelas")') novelas.click() first_poster = self.driver.find_elements_by_id( 'com.globo.globotv:id/custom_view_title_image_view_poster')[0] first_poster.click() thumb = self.driver.find_element_by_id("com.globo.globotv:id/thumb") title = self.driver.find_element_by_id("com.globo.globotv:id/title") thumb = self.driver.find_element_by_id("com.globo.globotv:id/thumb") thumb.click() self.status = "Fail_video_play" self.driver.implicitly_wait(1) t_end = time.time() + 60 video_start = int(round(time.time() * 1000)) while time.time() < t_end: try: spinner = self.driver.find_element_by_id( 'com.globo.globotv:id/progress_bar') print "Spinner!!" except: print "Not displayed" break self.driver.implicitly_wait(1) t_end = time.time() + 60 while time.time() < t_end: try: spinner = self.driver.find_element_by_id( 'com.globo.globotv:id/progress_bar') print "Spinner!!" except: print "Not displayed" break video_end = int(round(time.time() * 1000)) self.video_laod_time = video_end - video_start print "Video load time ", self.video_laod_time self.pass_count += 1 d = {'globo_video_load_time': self.video_laod_time} self.kpi_dic.update(d) sleep(5) self.status = "Fail_Download" donwload_button = self.driver.find_element_by_id( "com.globo.globotv:id/custom_view_download_status_content_root") donwload_button.click() start_download = int(round(time.time() * 1000)) download_progress = self.driver.find_element_by_id( "com.globo.globotv:id/custom_view_download_status_status_progress_bar" ) end_download = int(round(time.time() * 1000)) self.download_start_time = end_download - start_download print " Download start time ", self.download_start_time self.pass_count += 1 d = {'globo_download_start_time': self.download_start_time} self.kpi_dic.update(d) sleep(5) navigate_up = self.driver.find_element_by_android_uiautomator( 'new UiSelector().description("Navigate up")') navigate_up.click() sleep(3) self.status = "Fail_Download_Verify" download_tab = self.driver.find_element_by_android_uiautomator( 'new UiSelector().text("Downloads")') download_tab.click() download_title = self.driver.find_element_by_id( "com.globo.globotv:id/view_holder_download_text_view_title") download_title.click() title_name = self.driver.find_element_by_id( "com.globo.globotv:id/custom_view_video_text_view_title") print "Title found on download list" self.dowload_check = True self.pass_count += 1 sleep(2) progress = self.driver.find_element_by_id( "com.globo.globotv:id/custom_view_download_status_status_progress_bar" ) progress.click() accept_button = self.driver.find_element_by_id("android:id/button1") accept_button.click() sleep(2) self.status = "Pass"
class Globo_1hour_video(unittest.TestCase): #check if the necessary folders are present, if not create def check_dir(self, dir_path): if not os.path.isdir(dir_path): print "Creating the log dir" os.mkdir(dir_path) def adb_dump_data(self, udid, reference, step, adb_dump_dir): #save the sys dump of the phone self.adb_activities.get_dumpsys(udid, reference, step, adb_dump_dir) #Get the cpu info cpu_usage = self.adb_activities.get_cpuinfo(udid) #Get mem info mem_usage = self.adb_activities.get_mem_info(udid, self.package) #Device temp temperature = self.adb_activities.get_device_temp(udid) print step, cpu_usage, mem_usage, temperature return [step, cpu_usage, mem_usage, temperature] def setUp(self): self.reference = str(int(round(time.time() * 1000))) self.package = "com.globo.globotv" #device id as 1st argument self.udid = sys.argv[1] self.os = 'Android' #logs folder self.logs_dir = os.getcwd() + "/logs" print self.logs_dir self.check_dir(self.logs_dir) self.logs_dir = self.logs_dir + "/" + self.reference os.mkdir(self.logs_dir) #adb_dump folder self.adb_dump_dir = os.getcwd() + "/adb_dump" self.check_dir(self.adb_dump_dir) self.adb_dump_dir = self.adb_dump_dir + "/" + self.reference os.mkdir(self.adb_dump_dir) self.adb_activities = AdbDdata() self.alerts = SendAlert() self.array_of_data_list = [] #Before test function self.adb_activities.before_test(self.udid) self.capture_cap = sys.argv[3] #desired caps for the app desired_caps = {} desired_caps['platformName'] = self.os desired_caps['udid'] = self.udid desired_caps['deviceName'] = self.udid desired_caps['appPackage'] = self.package desired_caps['appActivity'] = "com.globo.globotv.splash.SplashActivity" desired_caps['noReset'] = True desired_caps['automationName'] = "uiautomator2" desired_caps['newCommandTimeout'] = 1200 if self.capture_cap == "1": desired_caps['headspin:capture.video'] = True else: desired_caps['headspin:capture.video'] = False desired_caps['no-reset'] = True appium_input = sys.argv[2] if appium_input.isdigit(): self.url = ('http://127.0.0.1:' + appium_input + '/wd/hub') else: self.url = appium_input #launching app self.driver = webdriver.Remote(self.url, desired_caps) self.start_app = int(round(time.time() * 1000)) #initialising variables self.status = "Fail_launch" self.app_launch_time = 0 self.status_dic = {} self.kpi_dic = {} self.app_launch_time = 0 self.home_pg_load_time = 0 self.cinema_load_time = 0 self.video_load_time = 0 self.alerts_during_video_play = False self.buffer_count = 0 self.alert_count = 0 self.test_name = "Globo_1hour_video" self.kpi_count = 5 self.pass_count = 0 self.fail_count = 0 def tearDown(self): #incrementing kpi count print "Pass count is %s" % self.pass_count if self.pass_count != self.kpi_count: self.fail_count = self.kpi_count - self.pass_count else: self.fail_count = 0 print "Fail count is %s " % self.fail_count #After function self.adb_activities.after_test(self.udid, self.reference, self.driver, self.status) if self.capture_cap == "1": self.session_id = self.driver.session_id print self.session_id else: self.session_id = None #Insert to app table insert = MysqlDataInsert() insert.globo_1hour_video_metrics( self.driver, self.app_launch_time, self.home_pg_load_time, self.cinema_load_time, self.video_load_time, self.alerts_during_video_play, self.buffer_count, self.alert_count, self.pass_count, self.fail_count, self.status, self.reference, self.session_id, self.test_name) path = os.getcwd() + "/logs/" if self.status == "Pass": screenshot_name = str(self.reference) + '_' + self.udid + ".png" log_file_name = str(self.reference) + '_' + self.udid + ".log" else: log_file_name = str( self.reference) + '_' + self.udid + "_error.log" screenshot_name = str( self.reference) + '_' + self.udid + "_error.png" screenshot_path = path + "/" + screenshot_name log_path = path + "/" + log_file_name log_url = "https://s3-us-west-2.amazonaws.com/grafana-images.headspin.io/globo/" + log_file_name png_url = "https://s3-us-west-2.amazonaws.com/grafana-images.headspin.io/globo/" + screenshot_name self.threshold = 5000 if not all( i < self.threshold for i in list(self.kpi_dic.values())) or self.status != "Pass": slack_messge = [] message_to_be_send = "" if not all(i < self.threshold for i in list(self.kpi_dic.values())): for key, value in self.kpi_dic.items(): if value > self.threshold: slack_messge.append('{} : {}'.format(key, value)) for text in slack_messge: message_to_be_send = message_to_be_send + text + "\n" print message_to_be_send message_to_be_send = self.os + "\n" + self.udid + "\n" + message_to_be_send + "\n" + "Device_log url:" + log_url + "\n" + "Device screenshot url:" + png_url #slack alert self.alerts.slack_alert(message_to_be_send) #Mail Alert self.alerts.email_alert(message_to_be_send) self.driver.quit() def test_login(self): self.driver.implicitly_wait(60) #Launching app agora_tab = self.driver.find_element_by_android_uiautomator( 'new UiSelector().description("Agora")') launched_app = int(round(time.time() * 1000)) #calcualting launch time self.app_launch_time = launched_app - self.start_app print("App Launch Time is %s ms" % self.app_launch_time) d = {'globo_launch_time': self.app_launch_time} self.kpi_dic.update(d) #incrementing pass count self.pass_count += 1 sleep(5) #library tab view time self.status = "Fail_login" user_icon = self.driver.find_element_by_id( "com.globo.globotv:id/menu_profile_custom_view_profile") user_icon.click() sleep(5) #Log out try: self.driver.implicitly_wait(5) logout = self.driver.find_element_by_android_uiautomator( 'new UiSelector().text("Sair")') logout.click() sleep(2) #Confirm log out yes_btn = self.driver.find_element_by_id('android:id/button1') yes_btn.click() sleep(5) #Click on te account button self.driver.implicitly_wait(10) user_icon = self.driver.find_element_by_id( "com.globo.globotv:id/menu_profile_custom_view_profile") user_icon.click() sleep(5) except: pass self.driver.implicitly_wait(60) entrar = self.driver.find_element_by_id( 'com.globo.globotv:id/activity_profile_text_view_get_int') entrar.click() self.driver.implicitly_wait(10) try: none_of_the_above = self.driver.find_element_by_id( "com.google.android.gms:id/cancel") none_of_the_above.click() except: pass sleep(5) self.driver.implicitly_wait(60) email_id_tf = self.driver.find_element_by_class_name( 'android.widget.EditText') email_id_tf.set_value('laurent_headspin') #password password_tf = self.driver.find_elements_by_class_name( 'android.widget.EditText')[1] password_tf.set_value('Globo@321') sleep(5) button = self.driver.find_element_by_android_uiautomator( 'new UiSelector().text("ENTRAR")') location = button.location size = button.size self.x_tap = location['x'] + int(size['width'] / 2) self.y_tap = location['y'] + int(size['height'] / 2) sleep(2) self.driver.tap([(self.x_tap, self.y_tap)]) self.status = "Fail_page_load_post_login" back_btn = self.driver.find_element_by_android_uiautomator( 'new UiSelector().description("Navigate up")') back_btn.click() home_page_load_start = int(round(time.time() * 1000)) self.driver.implicitly_wait(0.5) t_end = time.time() + 60 while time.time() < t_end: try: self.driver.find_element_by_class_name( 'android.widget.ProgressBar') except: break home_page = self.driver.find_element_by_id( "com.globo.globotv:id/custom_view_premium_highlights_image_view_background" ) home_page_load_end = int(round(time.time() * 1000)) self.home_pg_load_time = home_page_load_end - home_page_load_start d = {'globo_post_login_home_load_time': self.home_pg_load_time} self.kpi_dic.update(d) self.pass_count += 1 print "Home page loading time ", self.home_pg_load_time sleep(5) self.driver.implicitly_wait(60) categories_tab = self.driver.find_element_by_android_uiautomator( 'new UiSelector().description("Categorias")') categories_tab.click() sleep(5) cinema = self.driver.find_elements_by_id( 'com.globo.globotv:id/view_holder_categories_image_view_cover')[2] cinema.click() sleep(5) first_poster = self.driver.find_elements_by_id( 'com.globo.globotv:id/custom_view_title_image_view_poster')[0] first_poster.click() cinema_load_start = int(round(time.time() * 1000)) title = self.driver.find_element_by_id( 'com.globo.globotv:id/activity_title_text_view_title') cinema_load_end = int(round(time.time() * 1000)) self.cinema_load_time = cinema_load_end - cinema_load_start self.pass_count += 1 d = {'globo_cinema_page_load_time': self.cinema_load_time} self.kpi_dic.update(d) print "Cinema load time", self.cinema_load_time self.status = "Fail_video_play_start" continue_btn = self.driver.find_element_by_id( 'com.globo.globotv:id/activity_title_button_one') continue_btn.click() video_start = int(round(time.time() * 1000)) self.driver.implicitly_wait(1) try: self.driver.find_element_by_id("android:id/button1").click() sleep(2) play_button = self.driver.find_element_by_id( "com.globo.globotv:id/activity_title_button_one") play_button.click() video_second = int(round(time.time() * 1000)) self.driver.implicitly_wait(1) t_end = time.time() + 10 while time.time() < t_end: try: spinner = self.driver.find_element_by_id( 'com.globo.globotv:id/progress_bar') print "Spinner!!" except: video_play = int(round(time.time() * 1000)) print "Not displayed" break self.video_load_time = video_play - video_second except: t_end = time.time() + 10 while time.time() < t_end: try: spinner = self.driver.find_element_by_id( 'com.globo.globotv:id/progress_bar') print "Spinner!!" except: video_end = int(round(time.time() * 1000)) print "Not displayed" break self.video_load_time = video_end - video_start self.driver.implicitly_wait(5) print("Video load time ", self.video_load_time) self.pass_count += 1 d = {'globo_video_load_time': self.video_load_time} self.kpi_dic.update(d) buffer_flag = False sleep(5) t_end = time.time() + 3600 while time.time() < t_end: self.driver.implicitly_wait(1) try: spinner = self.driver.find_element_by_id( 'com.globo.globotv:id/progress_bar') if buffer_flag == False: buffer_flag = True self.buffer_count += 1 except: buffer_flag = False pass self.driver.implicitly_wait(0.5) try: flag = 0 try: alert = self.driver.find_element_by_android_uiautomator( 'new UiSelector().textContains("OK")') flag = 1 except: pass if flag == 0: try: alert = self.driver.find_element_by_android_uiautomator( 'new UiSelector().textContains("Ok")') flag = 2 except expression as identifier: pass if flag == 0: try: alert = self.driver.find_element_by_android_uiautomator( 'new UiSelector().textContains("ATUALIZAR")') flag = 3 except: pass alert.click() self.alerts_during_video_play = True self.alert_count += 1 try: self.driver.find_element_by_id( "android:id/button1").click() except: pass try: continue_btn = self.driver.find_element_by_id( 'com.globo.globotv:id/activity_title_button_one') continue_btn.click() sleep(3) except: pass except: pass if self.alerts_during_video_play: self.status = "Fail_video_interrupted_by_alerts" else: self.status = "Pass" self.pass_count += 1
class Globo_Download_Content_Test(unittest.TestCase): def setUp(self): self.reference= str(int(round(time.time() * 1000))) self.package = "com.globo.globotv" #device id as 1st argument self.udid = sys.argv[1] self.os = 'Android' self.adb_activities= AdbDdata() self.alerts = SendAlert() #Befre test function self.adb_activities.before_test(self.udid) self.capture_cap = sys.argv[3] #desired caps for the app desired_caps = {} desired_caps['platformName'] = self.os desired_caps['udid'] = self.udid desired_caps['deviceName'] = self.udid desired_caps['appPackage'] = self.package desired_caps['appActivity'] = "com.globo.globotv.splash.SplashActivity" desired_caps['noReset'] = True desired_caps['automationName'] = "uiautomator2" desired_caps['newCommandTimeout'] =600 desired_caps['no-reset'] = True if self.capture_cap == "1": desired_caps['headspin:capture'] = True else: desired_caps['headspin:capture'] = False appium_input= sys.argv[2] if appium_input.isdigit(): self.url= ('http://127.0.0.1:' + appium_input + '/wd/hub') else: self.url= appium_input #launching app self.driver = webdriver.Remote(self.url, desired_caps) self.start_app = int(round(time.time() * 1000)) #initialising variables self.status = "Fail_launch" self.app_launch_time= 0 self.status_dic = {} self.kpi_dic= {} self.app_launch_time= 0 self.home_pg_load_time = 0 self.video_load_time = 0 self.download_time = 0 self.title_check = False self.test_name = "Globo_Download_Content" self.kpi_count = 5 self.pass_count = 0 self.fail_count = 0 self.title_name = "" def tearDown(self): #incrementing kpi count print "Pass count is %s" %self.pass_count if self.pass_count!=self.kpi_count: self.fail_count = self.kpi_count - self.pass_count else: self.fail_count = 0 print "Fail count is %s " %self.fail_count if self.capture_cap =="1": self.session_id = self.driver.session_id print self.session_id else: self.session_id = None self.adb_activities.after_test(self.udid, self.reference, self.driver, self.status) insert = MysqlDataInsert() insert.globo_download_content(self.driver, self.app_launch_time,self.home_pg_load_time, self.video_load_time, self.title_check,self.download_time, self.pass_count,self.fail_count,self.status,self.reference,self.session_id,self.test_name) path=os.getcwd()+ "/logs/" if self.status=="Pass": screenshot_name = str(self.reference)+'_'+ self.udid +".png" log_file_name = str(self.reference)+'_'+self.udid + ".log" else: log_file_name = str(self.reference)+'_'+self.udid + "_error.log" screenshot_name = str(self.reference)+'_'+ self.udid +"_error.png" screenshot_path = path+"/"+screenshot_name log_path = path+"/"+ log_file_name log_url = "https://s3-us-west-2.amazonaws.com/grafana-images.headspin.io/globo/"+log_file_name png_url = "https://s3-us-west-2.amazonaws.com/grafana-images.headspin.io/globo/"+screenshot_name self.threshold= 5000 if not all( i< self.threshold for i in list(self.kpi_dic.values())) or self.status!= "Pass" : slack_messge= [] message_to_be_send="" if not all( i< self.threshold for i in list(self.kpi_dic.values()) ): for key,value in self.kpi_dic.items(): if value>self.threshold: slack_messge.append('{} : {}'.format(key,value)) for text in slack_messge: message_to_be_send = message_to_be_send+text+"\n" print message_to_be_send message_to_be_send = self.os+"\n"+self.udid+"\n"+message_to_be_send+"\n" +"Device_log url:"+log_url+"\n"+"Device screenshot url:"+png_url #slack alert self.alerts.slack_alert(message_to_be_send) #Mail ALert self.alerts.email_alert(message_to_be_send) self.driver.quit() def videoplay_check(self, sec): self.driver.implicitly_wait(5) t_end = time.time() + sec while time.time() < t_end: try: sleep(5) screen_size = self.driver.get_window_size() width = screen_size['width'] height = screen_size['height'] tap_x = width*0.4 tap_y=height*0.23 self.driver.tap([(tap_x,tap_y)]) player_control = self.driver.find_element_by_id("com.globo.globotv:id/media_control") except: spinner = self.driver.find_element_by_id('com.globo.globotv:id/progress_bar') print "Video Interrupted" self.video_play() def video_play(self): self.driver.implicitly_wait(1) t_end = time.time() + 10 while time.time() < t_end: try: spinner = self.driver.find_element_by_id('com.globo.globotv:id/progress_bar') except: break def delete_download(self): self.driver.implicitly_wait(6) try: downloads_tab = self.driver.find_element_by_android_uiautomator('new UiSelector().descriptionContains("Downloads")') downloads_tab.click() sleep(5) edit_button = self.driver.find_element_by_id("com.globo.globotv:id/menu_downloads_item_edit") edit_button.click() check_box = self.driver.find_elements_by_id("com.globo.globotv:id/view_holder_download_title_check_box_selected") for box in check_box: box.click() sleep(1) conf_del = self.driver.find_element_by_id("com.globo.globotv:id/snackbar_action") conf_del.click() except: pass #Select a random novela and check if it's downloadable. Else, searches and selects another random Novela def search_random_novela(self): screen_size = self.driver.get_window_size() width = screen_size['width'] height = screen_size['height'] swipe_start_x = width/2 swipe_start_y = height*0.6 swipe_end_x = width/2 swipe_end_y = height*0.2 while True: sleep(4) categories = self.driver.find_element_by_android_uiautomator('new UiSelector().description("Categorias")') categories.click() novelas = self.driver.find_element_by_android_uiautomator('new UiSelector().text("Novelas")') novelas.click() sleep(3) random.seed(time.time()) n=0 #Random number of swipes on novela screen while n<random.randint(0,6): self.driver.swipe(swipe_start_x,swipe_start_y,swipe_end_x,swipe_end_y,1000) n+=1 random.seed(time.time()) #Picks random novela from those currently on screen title_button = self.driver.find_elements_by_id("com.globo.globotv:id/view_holder_custom_view_grid_custom_view_title")[random.randint(0,5)] title_button.click() sleep(2) self.title_name = self.driver.find_element_by_id("com.globo.globotv:id/title").text self.title_name = self.title_name.lower() print self.title_name thumb_button = self.driver.find_element_by_id("com.globo.globotv:id/thumb") sleep(2) thumb_button.click() self.driver.implicitly_wait(2) try: self.driver.find_element_by_id("com.globo.globotv:id/activity_video_custom_view_download") break except: sleep(5) back_btn = self.driver.find_element_by_android_uiautomator('new UiSelector().description("Navigate up")') back_btn.click() sleep(3) back_btn = self.driver.find_element_by_android_uiautomator('new UiSelector().description("Navigate up")') back_btn.click() continue def video_metrics_control(self): #Starting video and monitoring it's metrics self.status="Fail_video_Play" video_start = int(round(time.time() * 1000)) self.driver.implicitly_wait(1) t_end = time.time() +60 while time.time() < t_end: try: spinner = self.driver.find_element_by_id('com.globo.globotv:id/progress_bar') except: print "Not displayed" break self.driver.implicitly_wait(1) t_end = time.time() +60 while time.time() < t_end: try: spinner = self.driver.find_element_by_id('com.globo.globotv:id/progress_bar') except: video_end = int(round(time.time() * 1000)) break self.video_load_time = video_end- video_start self.driver.implicitly_wait(5) try: self.driver.find_element_by_id("android:id/button1").click() sleep(2) play_button.click() video_second = int(round(time.time() * 1000)) self.driver.implicitly_wait(1) t_end = time.time() +60 while time.time() < t_end: try: spinner = self.driver.find_element_by_id('com.globo.globotv:id/progress_bar') except: break t_end= time.time() +60 while time.time() < t_end: try: spinner = self.driver.find_element_by_id('com.globo.globotv:id/progress_bar') except: video_play = int(round(time.time() * 1000)) break self.video_load_time = video_play - video_second except: pass print "Video load time ", self.video_load_time d = {'globo_video_load_time': self.video_load_time} self.kpi_dic.update(d) sleep(4) #Watch the Video for 1 minute self.videoplay_check(30) self.driver.implicitly_wait(50) def test_login(self): self.driver.implicitly_wait(60) #Launching app agora_tab = self.driver.find_element_by_android_uiautomator('new UiSelector().description("Agora")') launched_app = int(round(time.time() * 1000)) #calcualting launch time self.app_launch_time = launched_app - self.start_app print ("App Launch Time is %s ms" %self.app_launch_time) d = {'globo_launch_time': self.app_launch_time} self.kpi_dic.update(d) #incrementing pass count self.pass_count +=1 sleep(2) self.delete_download() self.driver.implicitly_wait(60) home_tab = self.driver.find_element_by_id("com.globo.globotv:id/menu_bottom_navigation_view_item_home") home_tab.click() self.status="Fail_login" user_icon = self.driver.find_element_by_id("com.globo.globotv:id/menu_profile_custom_view_profile") user_icon.click() #Log out try: self.driver.implicitly_wait(5) logout = self.driver.find_element_by_android_uiautomator('new UiSelector().text("Sair")') logout.click() #Confirm log out yes_btn = self.driver.find_element_by_id('android:id/button1') yes_btn.click() #Click on te account button self.driver.implicitly_wait(10) user_icon = self.driver.find_element_by_id("com.globo.globotv:id/menu_profile_custom_view_profile") user_icon.click() except: pass self.driver.implicitly_wait(60) entrar = self.driver.find_element_by_id('com.globo.globotv:id/activity_profile_text_view_get_int') entrar.click() self.driver.implicitly_wait(10) try: none_of_the_above = self.driver.find_element_by_id("com.google.android.gms:id/cancel") none_of_the_above.click() except: pass sleep(5) self.driver.implicitly_wait(60) email_id_tf = self.driver.find_element_by_class_name('android.widget.EditText') email_id_tf.set_value('laurent_headspin') #password password_tf = self.driver.find_elements_by_class_name('android.widget.EditText')[1] password_tf.set_value('Globo@321') sleep(5) buttons= self.driver.find_elements_by_class_name("android.widget.Button") for button in buttons: entrar = button.text if entrar =="ENTRAR": button.click() break self.status = "Fail_page_load_post_login" back_btn = self.driver.find_element_by_android_uiautomator('new UiSelector().description("Navigate up")') back_btn.click() home_page_load_start = int(round(time.time() * 1000)) self.driver.implicitly_wait(0.5) t_end = time.time()+60 while time.time() < t_end: try: self.driver.find_element_by_class_name('android.widget.ProgressBar') except: break self.driver.implicitly_wait(60) home_page = self.driver.find_element_by_id("com.globo.globotv:id/custom_view_premium_highlights_image_view_background") home_page_load_end = int(round(time.time() * 1000)) self.home_pg_load_time = home_page_load_end- home_page_load_start d = {'globo_post_login_home_load_time': self.home_pg_load_time} self.kpi_dic.update(d) sleep(2) self.pass_count +=1 print "Home page loading time ", self.home_pg_load_time while True: self.search_random_novela() self.video_metrics_control() #*********Download content**********# download_button = self.driver.find_element_by_id("com.globo.globotv:id/activity_video_custom_view_download") download_button.click() self.driver.implicitly_wait(15) try: start_download = int(round(time.time() * 1000)) download_progress = self.driver.find_element_by_id("com.globo.globotv:id/custom_view_download_status_status_progress_bar") break except: download_limit = self.driver.find_element_by_class_name("android.widget.Button") download_limit.click() navigate_up = self.driver.find_element_by_android_uiautomator('new UiSelector().descriptionContains("Navigate up")') navigate_up.click() navigate_up = self.driver.find_element_by_android_uiautomator('new UiSelector().descriptionContains("Navigate up")') navigate_up.click() continue sleep(2) #video play pass count increment self.pass_count= self.pass_count+1 self.driver.implicitly_wait(60) navigate_up = self.driver.find_element_by_android_uiautomator('new UiSelector().descriptionContains("Navigate up")') navigate_up.click() navigate_up = self.driver.find_element_by_android_uiautomator('new UiSelector().descriptionContains("Navigate up")') navigate_up.click() downloads_tab = self.driver.find_element_by_android_uiautomator('new UiSelector().descriptionContains("Downloads")') downloads_tab.click() sleep(2) download_title = self.driver.find_elements_by_id("com.globo.globotv:id/view_holder_download_text_view_title") screen_size = self.driver.get_window_size() width = screen_size['width'] height = screen_size['height'] swipe_start_x = width/2 swipe_start_y = height*0.7 swipe_end_x = width/2 swipe_end_y = height*0.3 self.driver.implicitly_wait(10) for i in range(0,5): try: options_menu = self.driver.find_element_by_id("com.globo.globotv:id/view_holder_download_title_text_view_downloading") break except: sleep(2) self.driver.swipe(swipe_start_x,swipe_start_y,swipe_end_x,swipe_end_y) download_title = self.driver.find_elements_by_id("com.globo.globotv:id/view_holder_download_text_view_title") for title in download_title: download_title_name = title.text.lower() print download_title_name if download_title_name ==self.title_name: print "Title Added to list" self.title_check = True self.pass_count = self.pass_count+1 break options_menu = self.driver.find_element_by_id("com.globo.globotv:id/view_holder_download_title_text_view_downloading") options_menu.click() sleep(4) self.driver.implicitly_wait(5) #Waits for download to finish self.status="Fail_Download" t_end = time.time() + 1200 while time.time() < t_end: try: self.driver.find_element_by_id("com.globo.globotv:id/custom_view_download_status_status_progress_bar") continue except: self.driver.implicitly_wait(5) try: ok_entendi = self.driver.find_element_by_id("android:id/button1") except: self.driver.find_element_by_id("com.globo.globotv:id/custom_view_download_status_image_view_icon") end_download = int(round(time.time() * 1000)) self.download_time = end_download - start_download - 10000 print "Download time: ",self.download_time self.pass_count = self.pass_count+1 d = {'globo_download_time': self.download_time} self.kpi_dic.update(d) break self.driver.implicitly_wait(50) self.delete_download() sleep(5) if self.title_check ==False: self.status="Fail_title_check" else: self.status = "Pass"