def test_local_pgan_auto(self): driver1 = self.driver1 myurl = Myurl(self.driver1) myurl.access_url() driver1.implicitly_wait(10) print("This is Title name :", driver1.title) # ScreenShot Relative Path ss_path = '/Rvirtus/' # Creating object of screenshot utility ss = SS(driver1) # ------- Login Details ------------ user = LoginUsers() Admin = user.user1_name Pwd = user.user1_password expadmin = user.user1_expadmin exppass = user.user1_exppass # ------ local path ------------ paths = Paths() locpath = paths.Local_path #-------Pgan path ----------- pgan_path = paths.Pgan_path admin_login = AdminLogin(driver1) admin_login.set_login_uname(Admin) admin_login.set_login_upass(Pwd) sleep(3) admin_login.submit_login(Admin, Pwd) sleep(5) if Admin == expadmin and Pwd == exppass: print("Login successful") else: assert print("Invalid credentials") print("************ Pgan Auto *****************") # --------Frame work-------------- f = self.driver1.find_element_by_xpath("//img[@src='/images/tenserflow.png']") f.click() print("Selected Tensorflow") sleep(2) inception = self.driver1.find_element_by_xpath("//*[@class='card-body text-center font-weight-normal btnNext']") inception.click() sleep(1) #assert isinstance(inception.text, object) #print("Your Selected ", str(inception.text)) print("Selected Inception") # -----------local folder--------------- local = self.driver1.find_element(By.ID, 'r100') local.click() sleep(1) localpath = self.driver1.find_element(By.ID, 'local_dir_path') localpath.send_keys(locpath) # ----------GPU Auto -------- gpu = self.driver1.find_element(By.ID, 'r4') gpu.click() sleep(2) auto = self.driver1.find_element_by_id("r101") auto.click() sleep(2) print("Your selected Auto") # ------Screenshot-1----------- ss.ScreenShot(ss_path + "test_03_local_pagn_auto_setupscreen.png") #-----Setup screen ------------ setupbtn = self.driver1.find_element(By.ID, 'setupbtn') setupbtn.click() sleep(25) # -------Datsets & Training ---------------- traindir = self.driver1.find_element(By.ID, 'traindirectory') trdirectory = Select(traindir) trdirectory.select_by_visible_text("pgan") sleep(2) trinfile = self.driver1.find_element(By.ID, 'file_name') trfile = Select(trinfile) trfile.select_by_visible_text("train.py") sleep(2) # --------- Train -------------------- train = self.driver1.find_element_by_xpath("//a[@href='#train']") train.click() sleep(2) textpath = self.driver1.find_element_by_id("textVal") textpath.clear() textpath.send_keys(pgan_path) sleep(2) Train = self.driver1.find_element(By.ID, 'train_id') Train.click() sleep(620) # ------- Gpu Usage -------------------- gpuTime = driver1.find_elements_by_id("gputime") for GpuUsage in gpuTime: assert isinstance(GpuUsage.text, object) print("Gpu Usage : ", str(GpuUsage.text)) sleep(1000) # --------Elapsed Time ------------------- myElem = self.driver1.find_element_by_id("elapsedTime") myElem.click() sleep(1) # --------Screen shot-2 ----------- ss.ScreenShot(ss_path + "test_03_local_pagn_auto_elapsedtime.png") sleep(3) assert isinstance(myElem.text, object) print("Pgan Auto -", str(myElem.text)) for logs in driver1.get_log('browser'): print(logs) try: '''for elapsedTime in gettime: assert isinstance(elapsedTime.text, object) print("Pggan Auto -", str(elapsedTime.text))''' except Exception as e: print("Exception Occurred :" + str(e)) # ---------Logout ---------------- self.driver1.find_element_by_id("navbarDropdownMenuLink").click() logout = self.driver1.find_element_by_class_name("dropdown-item") logout.click() sleep(5) for Logedout in self.driver1.find_elements_by_xpath("//*[@class='alert alert-success']"): assert isinstance(Logedout.text, object) print(str(Logedout.text))
def test_local_pgan_manual(self): #gpuper = "50" #coreper = "90" driver1 = self.driver1 myurl = Myurl(self.driver1) myurl.access_url() driver1.implicitly_wait(10) print("This is Title name :", driver1.title) # ScreenShot Relative Path ss_path = '/K8s_UI/' # Creating object of screenshot utility ss = SS(driver1) # ------Memory and core Percentages ---------- percentages = Memory_and_Core_Percentages() gpuper = percentages.memory_10 coreper = percentages.core_10 # ------- Login Details ------------ user = LoginUsers() Admin = user.user1_name Pwd = user.user1_password expadmin = user.user1_expadmin exppass = user.user1_exppass # ------ local path ------------ paths = Paths() locpath = paths.Local_path # -------Pgan path ----------- pgan_path = paths.Pgan_path admin_login = AdminLogin(driver1) admin_login.set_login_uname(Admin) admin_login.set_login_upass(Pwd) sleep(3) admin_login.submit_login(Admin, Pwd) sleep(5) admin_login = AdminLogin(driver1) admin_login.set_login_uname(Admin) admin_login.set_login_upass(Pwd) sleep(3) # sub = self.driver1.find_element_by_tag_name("button") # sub.click() # setcookie = pickle.dump(self.driver1.get_cookies(), open("cookies.pkl", "wb")) # print("setcookievalue :", setcookie) admin_login.submit_login(Admin, Pwd) sleep(5) if Admin == expadmin and Pwd == exppass: print("Login successful") else: assert print("Invalid credentials") print("************ Pgan Manual *****************") # --------Frame work-------------- # f = self.driver1.find_element_by_class_name("f-image mxnet text-center") f = self.driver1.find_element_by_xpath( "//img[@src='/images/tenserflow.png']") f.click() print("Selected Tensorflow") sleep(2) inception = self.driver1.find_element_by_xpath( "//*[@class='card-body text-center font-weight-normal btnNext']") inception.click() sleep(1) print("Selected Inception") # -----------local folder--------------- local = self.driver1.find_element(By.ID, 'r100') local.click() sleep(1) localpath = self.driver1.find_element(By.ID, 'local_dir_path') localpath.send_keys(locpath) # ----------GPU Manual -------- gpu = self.driver1.find_element(By.ID, 'r4') gpu.click() sleep(2) print("Your selected Manual") manual = self.driver1.find_element_by_id("r102") manual.click() sleep(1) # ------ gpu percentage ----------- memory0 = self.driver1.find_element(By.ID, 'gpupercent0') memory0.send_keys(gpuper) print("gpu percentage : ", gpuper, '%') # --------core percentage ----------- sleep(1) gpuvalue = self.driver1.find_element(By.ID, 'gpuvalue0') gpuvalue.send_keys(coreper) print("core percentage : ", coreper, '%') sleep(2) # ------Screenshot-1----------- ss.ScreenShot(ss_path + "test_04_pgan_manual_setupscreen.png") setupbtn = self.driver1.find_element(By.ID, 'setupbtn') setupbtn.click() sleep(25) # -------Datsets & Training ---------------- traindir = self.driver1.find_element(By.ID, 'traindirectory') trdirectory = Select(traindir) trdirectory.select_by_visible_text("pgan") sleep(2) trinfile = self.driver1.find_element(By.ID, 'file_name') trfile = Select(trinfile) trfile.select_by_visible_text("train.py") sleep(2) # --------- Train -------------------- train = self.driver1.find_element_by_xpath("//a[@href='#train']") train.click() sleep(2) textpath = self.driver1.find_element_by_id("textVal") textpath.clear() textpath.send_keys(pgan_path) sleep(2) Train = self.driver1.find_element(By.ID, 'train_id') Train.click() sleep(200) # ------- Gpu Usage -------------------- gpuTime = driver1.find_elements_by_id("gputime") for GpuUsage in gpuTime: assert isinstance(GpuUsage.text, object) print("Gpu Usage : ", str(GpuUsage.text)) sleep(350) # --------Elapsed Time ------------------- myElem = self.driver1.find_element_by_id("elapsedTime") myElem.click() sleep(1) # ------Screenshot-2----------- ss.ScreenShot(ss_path + "test_04_pgan_manual_elapsedtime.png") sleep(2) assert isinstance(myElem.text, object) print("Pgan Manual -", str(myElem.text)) #gettime = self.driver1.find_elements_by_id("elapsedTime") for logs in driver1.get_log('browser'): print(logs) try: ''' # enable browser logging d = DesiredCapabilities.CHROME d['loggingPrefs'] = {'browser': 'ALL'} driver1 = webdriver1.Chrome(desired_capabilities=d) ''' # print messages for entry in driver1.get_log('browser'): assert print(entry) '''for elapsedTime in gettime: assert isinstance(elapsedTime.text, object) print("Pggan Manual -", str(elapsedTime.text))''' except Exception as e: print("Exception Occurred :" + str(e)) # ---------Logout ---------------- self.driver1.find_element_by_id("navbarDropdownMenuLink").click() logout = self.driver1.find_element_by_class_name("dropdown-item") logout.click() sleep(5) for Logedout in self.driver1.find_elements_by_xpath( "//*[@class='alert alert-success']"): assert isinstance(Logedout.text, object) print(str(Logedout.text))
def test_local_image_manual(self): #gpuper = "90" #coreper = "90" # Second browser driver driver1 = self.driver1 myurl = Myurl(self.driver1) myurl.access_url() driver1.implicitly_wait(10) print("This is Title name :", driver1.title) # ScreenShot Relative Path ss_path = '/Rvirtus/' # Creating object of screenshot utility ss = SS(driver1) # ------Memory and core Percentages ---------- percentages = Memory_and_Core_Percentages() gpuper = percentages.memory_12 coreper = percentages.core_12 # ------- Login Details ------------ user = LoginUsers() Admin = user.user1_name Pwd = user.user1_password expadmin = user.user1_expadmin exppass = user.user1_exppass # ------ local path ------------ paths = Paths() locpath = paths.Local_path # -------Image classification path ----------- flower_path = paths.Local_Image_clf_path admin_login = AdminLogin(driver1) admin_login.set_login_uname(Admin) admin_login.set_login_upass(Pwd) sleep(3) admin_login.submit_login(Admin, Pwd) sleep(5) if Admin == expadmin and Pwd == exppass: print("Login successful") else: assert print("Invalid credentials") print("************ Image classification Manual *****************") # --------Frame work-------------- # f = self.driver1.find_element_by_class_name("f-image mxnet text-center") f = self.driver1.find_element_by_xpath( "//img[@src='/images/tenserflow.png']") f.click() print("Selected Tensorflow") sleep(2) # --------if you have compound class name you should write like this----------- inception = self.driver1.find_element_by_xpath( "//*[@class='card-body text-center font-weight-normal btnNext']") inception.click() sleep(1) print("Selected Inception") # -----------local folder--------------- local = self.driver1.find_element(By.ID, 'r100') local.click() sleep(1) localpath = self.driver1.find_element(By.ID, 'local_dir_path') localpath.send_keys(locpath) sleep(2) # ----------GPU Manual -------- gpu = self.driver1.find_element(By.ID, 'r4') gpu.click() sleep(2) print("Your selected Manual") manual = self.driver1.find_element_by_id("r102") manual.click() sleep(1) # ------ gpu percentage ----------- memory0 = self.driver1.find_element(By.ID, 'gpupercent0') memory0.send_keys(gpuper) print("gpu percentage : ", gpuper, '%') # --------core percentage ----------- sleep(1) gpuvalue = self.driver1.find_element(By.ID, 'gpuvalue0') gpuvalue.send_keys(coreper) print("core percentage : ", coreper, '%') sleep(2) # ------Screenshot-1----------- ss.ScreenShot(ss_path + "test_06_local_image_clf_manual-setupscreen.png") # -------------------- setup btn ----------------- setupbtn = self.driver1.find_element(By.ID, 'setupbtn') setupbtn.click() sleep(25) traindir = self.driver1.find_element(By.ID, 'traindirectory') trdirectory = Select(traindir) trdirectory.select_by_visible_text("flower_classification") sleep(2) trinfile = self.driver1.find_element(By.ID, 'file_name') trfile = Select(trinfile) trfile.select_by_visible_text("retrain-new.py") sleep(2) # --------- Train -------------------- train = self.driver1.find_element_by_xpath("//a[@href='#train']") train.click() textpath = self.driver1.find_element_by_id("textVal") textpath.clear() textpath.send_keys(flower_path) sleep(2) Train = self.driver1.find_element(By.ID, 'train_id') Train.click() sleep(80) gpuTime = driver1.find_elements_by_id("gputime") for GpuUsage in gpuTime: assert isinstance(GpuUsage.text, object) print("Gpu Usage : ", str(GpuUsage.text)) sleep(100) # --------Elapsed Time ------------------- myElem = self.driver1.find_element_by_id("elapsedTime") myElem.click() sleep(1) # ------Screenshot-2----------- ss.ScreenShot(ss_path + "test_local_image_clf_manual-elapsedtime.png") sleep(2) assert isinstance(myElem.text, object) print("Image classification Manual -", str(myElem.text)) for logs in driver1.get_log('browser'): print(logs) try: pass except Exception as e: print("Exception Occurred :" + str(e)) # ---------Logout ---------------- self.driver1.find_element_by_id("navbarDropdownMenuLink").click() logout = self.driver1.find_element_by_class_name("dropdown-item") logout.click() sleep(5) for Logedout in self.driver1.find_elements_by_xpath( "//*[@class='alert alert-success']"): assert isinstance(Logedout.text, object) print(str(Logedout.text))
def test_nfs_pgan_auto(self): # Second browser driver driver1 = self.driver1 myurl = Myurl(self.driver1) myurl.access_url() driver1.implicitly_wait(10) print("This is Title name :", driver1.title) # ScreenShot Relative Path ss_path = '/K8s_UI/' # Creating object of screenshot utility ss = SS(driver1) # ------- Login Details ------------ user = LoginUsers() Admin = user.user1_name Pwd = user.user1_password expadmin = user.user1_expadmin exppass = user.user1_exppass # ------ NFS path ------------ paths = Paths() nfs_ip = paths.NFS_ip nfs_path = paths.NFS_path #-------Pgan path ----------- pgan_path = paths.Pgan_path admin_login = AdminLogin(driver1) admin_login.set_login_uname(Admin) admin_login.set_login_upass(Pwd) sleep(3) admin_login.submit_login(Admin, Pwd) sleep(5) if Admin == expadmin and Pwd == exppass: print("Login successful") else: assert print("Invalid credentials") print("************ Pgan Auto *****************") # --------Frame work-------------- # f = self.driver1.find_element_by_class_name("f-image mxnet text-center") f = self.driver1.find_element_by_xpath( "//img[@src='/images/tenserflow.png']") f.click() print("Selected Tensorflow") sleep(2) # --------if you have compound class name you should write like this----------- inception = self.driver1.find_element_by_xpath( "//*[@class='card-body text-center font-weight-normal btnNext']") inception.click() sleep(1) print("Selected Inception") # -----------NFS --------------- nfs = self.driver1.find_element(By.ID, 'r2') nfs.click() sleep(1) ipadd = self.driver1.find_element(By.ID, 'ds_ip') ipadd.send_keys(nfs_ip) print("Your given ip :", nfs_ip) sleep(2) dirpath = self.driver1.find_element(By.ID, 'ds_dirpath') dirpath.send_keys(nfs_path) sleep(2) # ----------GPU Auto -------- gpu = self.driver1.find_element(By.ID, 'r4') gpu.click() sleep(2) auto = self.driver1.find_element_by_id("r101") auto.click() sleep(2) # ------Screenshot-1----------- ss.ScreenShot(ss_path + "test_09_nfs_pgan_auto_setupscreen.png") # -------------------- setup btn ----------------- setupbtn = self.driver1.find_element(By.ID, 'setupbtn') setupbtn.click() sleep(24) # -------Datsets & Training ---------------- traindir = self.driver1.find_element(By.ID, 'traindirectory') trdirectory = Select(traindir) trdirectory.select_by_visible_text("pgan") sleep(2) trinfile = self.driver1.find_element(By.ID, 'file_name') trfile = Select(trinfile) trfile.select_by_visible_text("train.py") sleep(2) # --------- Train -------------------- train = self.driver1.find_element_by_xpath("//a[@href='#train']") train.click() sleep(2) textpath = self.driver1.find_element_by_id("textVal") textpath.clear() textpath.send_keys(pgan_path) sleep(2) Train = self.driver1.find_element(By.ID, 'train_id') Train.click() sleep(200) gpuTime = driver1.find_elements_by_id("gputime") for GpuUsage in gpuTime: assert isinstance(GpuUsage.text, object) print("Gpu Usage : ", str(GpuUsage.text)) sleep(340) # --------Elapsed Time ------------------- myElem = self.driver1.find_element_by_id("elapsedTime") myElem.click() sleep(1) # --------Screen shot-2 ----------- ss.ScreenShot(ss_path + "test_09_nfs_pgan_auto_elapsedtime.png") sleep(2) assert isinstance(myElem.text, object) print("Pgan Auto -", str(myElem.text)) for logs in driver1.get_log('browser'): print(logs) # ---------Logout ---------------- self.driver1.find_element_by_id("navbarDropdownMenuLink").click() logout = self.driver1.find_element_by_class_name("dropdown-item") logout.click() sleep(5) for Logedout in self.driver1.find_elements_by_xpath( "//*[@class='alert alert-success']"): assert isinstance(Logedout.text, object) print(str(Logedout.text))
def test_s3_image_auto(self): # Second browser driver driver1 = self.driver1 myurl = Myurl(self.driver1) myurl.access_url() driver1.implicitly_wait(10) print("This is Title name :", driver1.title) # ScreenShot Relative Path ss_path = '/K8s_UI/' # Creating object of screenshot utility ss = SS(driver1) # ------- Login Details ------------ user = LoginUsers() Admin = user.user1_name Pwd = user.user1_password expadmin = user.user1_expadmin exppass = user.user1_exppass # ------ S3 bucket ------------ paths = Paths() bkt_name = paths.Bucket_name bkt_keys = paths.Bucket_keys # -------flower path ----------- flower_path = paths.S3_Image_clf_path admin_login = AdminLogin(driver1) admin_login.set_login_uname(Admin) admin_login.set_login_upass(Pwd) sleep(3) # sub = self.driver1.find_element_by_tag_name("button") # sub.click() # setcookie = pickle.dump(self.driver1.get_cookies(), open("cookies.pkl", "wb")) # print("setcookievalue :", setcookie) admin_login.submit_login(Admin, Pwd) sleep(5) if Admin == expadmin and Pwd == exppass: print("Login successful") else: assert print("Invalid credentials") print("************ Image Auto *****************") # --------Frame work-------------- # f = self.driver1.find_element_by_class_name("f-image mxnet text-center") f = self.driver1.find_element_by_xpath( "//img[@src='/images/tenserflow.png']") f.click() print("Selected Tensorflow") sleep(2) # --------if you have compound class name you should write like this----------- inception = self.driver1.find_element_by_xpath( "//*[@class='card-body text-center font-weight-normal btnNext']") inception.click() sleep(1) print("Selected Inception") # -----------S3 bucket --------------- s3 = self.driver1.find_element(By.ID, 'r1') s3.click() sleep(1) bucketname = self.driver1.find_element(By.ID, 'bkt_name') bucketname.send_keys(bkt_name) sleep(2) bucketkeys = self.driver1.find_element(By.ID, 'bkt_keys') bucketkeys.send_keys(bkt_keys) sleep(2) # ----------GPU Auto -------- gpu = self.driver1.find_element(By.ID, 'r4') gpu.click() sleep(2) auto = self.driver1.find_element_by_id("r101") auto.click() sleep(2) # ------Screenshot-1----------- ss.ScreenShot(ss_path + "test_17_s3_image_auto_setupscreen.png") # -------------------- setup btn ----------------- setupbtn = self.driver1.find_element(By.ID, 'setupbtn') setupbtn.click() sleep(24) # -------Datsets & Training ---------------- traindir = self.driver1.find_element(By.ID, 'traindirectory') trdirectory = Select(traindir) trdirectory.select_by_visible_text("flower_classification") sleep(2) trinfile = self.driver1.find_element(By.ID, 'file_name') trfile = Select(trinfile) trfile.select_by_visible_text("retrain-new.py") sleep(2) # --------- Train -------------------- train = self.driver1.find_element_by_xpath("//a[@href='#train']") train.click() textpath = self.driver1.find_element_by_id("textVal") textpath.clear() textpath.send_keys(flower_path) sleep(2) Train = self.driver1.find_element(By.ID, 'train_id') Train.click() sleep(100) gpuTime = driver1.find_elements_by_id("gputime") for GpuUsage in gpuTime: assert isinstance(GpuUsage.text, object) print("Gpu Usage : ", str(GpuUsage.text)) sleep(240) # --------Elapsed Time ------------------- myElem = self.driver1.find_element_by_id("elapsedTime") myElem.click() sleep(1) # --------Screen shot-2 ----------- ss.ScreenShot(ss_path + "test_17_s3_image_auto_auto_elapsedtime.png") sleep(2) assert isinstance(myElem.text, object) print("Image classi fication Auto -", str(myElem.text)) for logs in driver1.get_log('browser'): print(logs) # ---------Logout ---------------- self.driver1.find_element_by_id("navbarDropdownMenuLink").click() logout = self.driver1.find_element_by_class_name("dropdown-item") logout.click() sleep(5) for Logedout in self.driver1.find_elements_by_xpath( "//*[@class='alert alert-success']"): assert isinstance(Logedout.text, object) print(str(Logedout.text))
def mnist_manual1(self): gpuper = "50" coreper = "90" driver1 = self.driver1 myurl = Myurl(self.driver1) myurl.access_url() driver1.implicitly_wait(10) print("User-2 This is Title name :", driver1.title) # ScreenShot Relative Path ss_path = '/K8s_UI/Parallel_MultiUser/' # Creating object of screenshot utility ss = SS(driver1) # ------- Login Details ------------ user = LoginUsers() Admin = user.user2_name Pwd = user.user2_password expected_username = user.user2_expadmin expected_password = user.user2_exppass # ------ local path ------------ paths = Paths() locpath = paths.Local_path sleep(5) user = self.driver1.find_element_by_name("username") user.send_keys(Admin) sleep(2) pwd = self.driver1.find_element_by_name("password") pwd.send_keys(Pwd) sleep(2) # self.driver1.find_element_by_class_name("btn btn-primary").click() ----this getting error # self.driver1.find_element_by_partial_link_text("Submit").click() ----this getting error-- sub = self.driver1.find_element_by_tag_name("button") sub.click() for Logedout in self.driver1.find_elements_by_xpath( "//*[@class='alert alert-success']"): assert isinstance(Logedout.text, object) assert (print(str(Logedout.text))) if (Admin == expected_username and Pwd == expected_password): print("Login successful") else: assert (print("failed to login")) # print("Login Successfull") sleep(3) print("************ Mnist Manual *****************") # --------Frame work-------------- # f = self.driver1.find_element_by_class_name("f-image mxnet text-center") f = self.driver1.find_element_by_xpath( "//img[@src='/images/tenserflow.png']") f.click() print("Selected Tensorflow") sleep(2) # --------if you have compound class name you should write like this----------- inception = self.driver1.find_element_by_xpath( "//*[@class='card-body text-center font-weight-normal btnNext']") inception.click() sleep(1) print("Selected Inception") # -----------local folder--------------- local = self.driver1.find_element(By.ID, 'r100') local.click() sleep(1) localpath = self.driver1.find_element(By.ID, 'local_dir_path') localpath.send_keys(locpath) sleep(2) # ----------GPU Manual -------- gpu = self.driver1.find_element(By.ID, 'r4') gpu.click() sleep(2) print("Your selected Manual") manual = self.driver1.find_element_by_id("r102") manual.click() sleep(1) # ------ gpu percentage ----------- memory0 = self.driver1.find_element(By.ID, 'gpupercent0') memory0.send_keys(gpuper) print("gpu percentage-2 : ", gpuper, '%') # --------core percentage ----------- sleep(1) gpuvalue = self.driver1.find_element(By.ID, 'gpuvalue0') gpuvalue.send_keys(coreper) print("core percentage-2 : ", coreper, '%') sleep(2) # ------Screenshot-1----------- ss.ScreenShot(ss_path + "test_05_singleGpu_mnist_manual_setupscreen1.png") # -------------------- setup btn ----------------- setupbtn = self.driver1.find_element(By.ID, 'setupbtn') setupbtn.click() sleep(35) # it is pending waiting for user logout #sleep(70) # -------Datsets & Training ---------------- traindir = self.driver1.find_element(By.ID, 'traindirectory') trdirectory = Select(traindir) trdirectory.select_by_visible_text("Mnist_classification") sleep(2) trinfile = self.driver1.find_element(By.ID, 'file_name') trfile = Select(trinfile) trfile.select_by_visible_text("mnist_gpu.py") sleep(2) #sleep(40) # --------- Train -------------------- train = self.driver1.find_element_by_xpath("//a[@href='#train']") train.click() sleep(2) Train = self.driver1.find_element(By.ID, 'train_id') Train.click() sleep(20) gpuTime = driver1.find_elements_by_id("gputime") for GpuUsage in gpuTime: assert isinstance(GpuUsage.text, object) print("Gpu Usage-2 : ", str(GpuUsage.text)) sleep(50) # --------Elapsed Time ------------------- myElem = self.driver1.find_element_by_id("elapsedTime") myElem.click() sleep(1) # ------Screenshot-2----------- ss.ScreenShot(ss_path + "test_05_singleGpu_mnist_manual_elapsedtime1.png") sleep(2) assert isinstance(myElem.text, object) print("Mnist Manual-2 -", str(myElem.text)) try: pass except Exception as e: print("Exception Occurred :" + str(e)) # ---------Logout ---------------- self.driver1.find_element_by_id("navbarDropdownMenuLink").click() logout = self.driver1.find_element_by_class_name("dropdown-item") logout.click() # print("Logout Successfull") sleep(5) for Logedout in self.driver1.find_elements_by_xpath( "//*[@class='alert alert-success']"): assert isinstance(Logedout.text, object) print(str(Logedout.text))
def test_local_image_auto(self): driver1 = self.driver1 myurl = Myurl(self.driver1) myurl.access_url() driver1.implicitly_wait(10) print("User-1 This is Title name :", driver1.title) # ------- Login Details ------------ user = LoginUsers() Admin = user.user1_name Pwd = user.user1_password expected_username = user.user1_expadmin expected_password = user.user1_exppass # ------ local path ------------ paths = Paths() locpath = paths.Local_path # -------Image classification path ----------- flower_path = paths.Local_Image_clf_path # ScreenShot Relative Path ss_path = '/K8s_UI/' # Creating object of screenshot utility ss = SS(driver1) admin_login = AdminLogin(driver1) admin_login.set_login_uname(Admin) admin_login.set_login_upass(Pwd) sleep(3) admin_login.submit_login(Admin, Pwd) sleep(5) if Admin == expected_username and Pwd == expected_password: print("Login successful") else: assert print("Invalid credentials") print("************ Image classification Auto *****************") # --------Frame work-------------- # f = self.driver1.find_element_by_class_name("f-image mxnet text-center") f = self.driver1.find_element_by_xpath( "//img[@src='/images/tenserflow.png']") f.click() print("Selected Tensorflow") sleep(2) # --------if you have compound class name you should write like this----------- inception = self.driver1.find_element_by_xpath( "//*[@class='card-body text-center font-weight-normal btnNext']") inception.click() sleep(1) print("Selected Inception") # -----------local folder--------------- local = self.driver1.find_element(By.ID, 'r100') local.click() sleep(1) localpath = self.driver1.find_element(By.ID, 'local_dir_path') localpath.send_keys(locpath) sleep(2) # ----------GPU Auto -------- gpu = self.driver1.find_element(By.ID, 'r4') gpu.click() sleep(2) auto = self.driver1.find_element_by_id("r101") auto.click() sleep(2) print("Your selected Auto") # ------Screenshot-1----------- ss.ScreenShot(ss_path + "test_03_multigpus_8_image_auto_setupscreen.png") # -------------------- setup btn ----------------- setupbtn = self.driver1.find_element(By.ID, 'setupbtn') setupbtn.click() sleep(18) traindir = self.driver1.find_element(By.ID, 'traindirectory') trdirectory = Select(traindir) trdirectory.select_by_visible_text("flower_classification") sleep(2) trinfile = self.driver1.find_element(By.ID, 'file_name') trfile = Select(trinfile) trfile.select_by_visible_text("retrain-new.py") sleep(2) # --------- Train -------------------- train = self.driver1.find_element_by_xpath("//a[@href='#train']") train.click() textpath = self.driver1.find_element_by_id("textVal") textpath.clear() textpath.send_keys(flower_path) sleep(2) Train = self.driver1.find_element(By.ID, 'train_id') Train.click() sleep(70) gpuTime = driver1.find_elements_by_id("gputime") for GpuUsage in gpuTime: assert isinstance(GpuUsage.text, object) print("Gpu Usage : ", str(GpuUsage.text)) sleep(70) # --------Elapsed Time ------------------- myElem = self.driver1.find_element_by_id("elapsedTime") myElem.click() sleep(1) # --------Screen shot-2 ----------- ss.ScreenShot(ss_path + "test_03_multigpus_8_image_auto_elapsedtime.png") sleep(2) assert isinstance(myElem.text, object) print("Image classification Auto -", str(myElem.text)) try: pass except Exception as e: print("Exception Occurred :" + str(e)) # ---------Logout ---------------- self.driver1.find_element_by_id("navbarDropdownMenuLink").click() logout = self.driver1.find_element_by_class_name("dropdown-item") logout.click() sleep(5) for Logedout in self.driver1.find_elements_by_xpath( "//*[@class='alert alert-success']"): assert isinstance(Logedout.text, object) print(str(Logedout.text))
def test_local_mnist_manual(self): driver1 = self.driver1 myurl = Myurl(self.driver1) myurl.access_url() driver1.implicitly_wait(10) print("This is Title name :", driver1.title) # ScreenShot Relative Path ss_path = '/Rvirtus/' # Creating object of screenshot utility ss = SS(driver1) # ------Memory and core Percentages ---------- percentages = Memory_and_Core_Percentages() gpuper0 = percentages.gpuper0 gpuper1 = percentages.gpuper1 gpuper2 = percentages.gpuper2 gpuper3 = percentages.gpuper3 gpuper4 = percentages.gpuper4 gpuper5 = percentages.gpuper5 gpuper6 = percentages.gpuper6 gpuper7 = percentages.gpuper7 coreper0 = percentages.coreper0 coreper1 = percentages.coreper1 coreper2 = percentages.coreper2 coreper3 = percentages.coreper3 coreper4 = percentages.coreper4 coreper5 = percentages.coreper5 coreper6 = percentages.coreper6 coreper7 = percentages.coreper7 # ------- Login Details ------------ user = LoginUsers() Admin = user.user1_name Pwd = user.user1_password expadmin = user.user1_expadmin exppass = user.user1_exppass # ------ local path ------------ paths = Paths() locGVpath = paths.Local_GVirtus_path Backendip = paths.Backend_ip admin_login = AdminLogin(driver1) admin_login.set_login_uname(Admin) admin_login.set_login_upass(Pwd) sleep(3) admin_login.submit_login(Admin, Pwd) sleep(5) if Admin == expadmin and Pwd == exppass: print("Login successful") else: assert print("Invalid credentials") print("************ Mnist Manual *****************") # --------Frame work-------------- f = self.driver1.find_element_by_xpath( "//img[@src='/images/tenserflow.png']") f.click() print("Selected Tensorflow") sleep(2) # --------if you have compound class name you should write like this----------- inception = self.driver1.find_element_by_xpath( "//*[@class='card-body text-center font-weight-normal btnNext']") inception.click() sleep(1) assert isinstance(inception.text, object) print("Your Selected ", str(inception.text)) #print("Selected Inception") # -----------local folder--------------- local = self.driver1.find_element(By.ID, 'r100') local.click() sleep(1) localpath = self.driver1.find_element(By.ID, 'local_dir_path') localpath.send_keys(locGVpath) sleep(2) # ----------GPU Manual -------- gpu = self.driver1.find_element(By.ID, 'r4') gpu.click() sleep(2) print("Your selected Manual") manual = self.driver1.find_element_by_id("r102") manual.click() sleep(1) # ------ gpu percentage ----------- memory0 = self.driver1.find_element(By.ID, 'gpupercent0') memory0.send_keys(gpuper0) sleep(1) memory1 = self.driver1.find_element(By.ID, 'gpupercent1') memory1.send_keys(gpuper1) sleep(1) memory2 = self.driver1.find_element(By.ID, 'gpupercent2') memory2.send_keys(gpuper2) sleep(1) memory3 = self.driver1.find_element(By.ID, 'gpupercent3') memory3.send_keys(gpuper3) sleep(1) memory4 = self.driver1.find_element(By.ID, 'gpupercent4') memory4.send_keys(gpuper4) sleep(1) memory5 = self.driver1.find_element(By.ID, 'gpupercent5') memory5.send_keys(gpuper5) sleep(1) memory6 = self.driver1.find_element(By.ID, 'gpupercent6') memory6.send_keys(gpuper6) sleep(1) memory7 = self.driver1.find_element(By.ID, 'gpupercent7') memory7.send_keys(gpuper7) print("gpu percentages : ", gpuper0, gpuper1, gpuper2, gpuper3, gpuper4, gpuper5, gpuper6, gpuper7) # --------core percentage ----------- sleep(1) gpuvalue0 = self.driver1.find_element(By.ID, 'gpuvalue0') gpuvalue0.send_keys(coreper0) sleep(1) gpuvalue1 = self.driver1.find_element(By.ID, 'gpuvalue1') gpuvalue1.send_keys(coreper1) sleep(1) gpuvalue2 = self.driver1.find_element(By.ID, 'gpuvalue2') gpuvalue2.send_keys(coreper2) sleep(1) gpuvalue3 = self.driver1.find_element(By.ID, 'gpuvalue3') gpuvalue3.send_keys(coreper3) sleep(1) gpuvalue4 = self.driver1.find_element(By.ID, 'gpuvalue4') gpuvalue4.send_keys(coreper4) sleep(1) gpuvalue5 = self.driver1.find_element(By.ID, 'gpuvalue5') gpuvalue5.send_keys(coreper5) sleep(1) gpuvalue6 = self.driver1.find_element(By.ID, 'gpuvalue6') gpuvalue6.send_keys(coreper6) sleep(1) gpuvalue7 = self.driver1.find_element(By.ID, 'gpuvalue7') gpuvalue7.send_keys(coreper7) print("core percentages : ", coreper0, coreper1, coreper2, coreper3, coreper4, coreper5, coreper6, coreper7) sleep(2) # ------Screenshot-1----------- ss.ScreenShot(ss_path + "test_02_local_mnist_manual-SetupsScreen.png") # -------------------- setup btn ----------------- setupbtn = self.driver1.find_element(By.ID, 'setupbtn') setupbtn.click() sleep(25) # -------Datsets & Training ---------------- traindir = self.driver1.find_element(By.ID, 'traindirectory') trdirectory = Select(traindir) trdirectory.select_by_visible_text("Mnist_classification") sleep(2) trinfile = self.driver1.find_element(By.ID, 'file_name') trfile = Select(trinfile) trfile.select_by_visible_text("mnist_gpu.py") sleep(2) # --------- Train -------------------- train = self.driver1.find_element_by_xpath("//a[@href='#train']") train.click() sleep(2) Train = self.driver1.find_element(By.ID, 'train_id') Train.click() sleep(30) gpuTime = driver1.find_elements_by_id("gputime") for GpuUsage in gpuTime: assert isinstance(GpuUsage.text, object) print("Gpu Usage : ", str(GpuUsage.text)) sleep(60) # --------Elapsed Time ------------------- myElem = self.driver1.find_element_by_id("elapsedTime") myElem.click() sleep(1) # ------Screenshot-2----------- ss.ScreenShot(ss_path + "test_02_local_mnist_manual-ElapsedTime.png") sleep(2) assert isinstance(myElem.text, object) print("Mnist Manual -", str(myElem.text)) for logs in driver1.get_log('browser'): print(logs) try: pass #log = self.get_browser_console_log() #log = self.driver1.get_log(browser) #print("Console Log: ",log) except Exception as e: print("Exception Occurred :" + str(e)) # ---------Logout ---------------- self.driver1.find_element_by_id("navbarDropdownMenuLink").click() logout = self.driver1.find_element_by_class_name("dropdown-item") logout.click() sleep(5) for Logedout in self.driver1.find_elements_by_xpath( "//*[@class='alert alert-success']"): assert isinstance(Logedout.text, object) print(str(Logedout.text))
def pgan_manual3(self): gpuper = "80" coreper = "90" driver1 = self.driver1 myurl = Myurl(self.driver1) myurl.access_url() driver1.implicitly_wait(10) print("User-3 This is Title name :", driver1.title) # ------- Login Details ------------ user = LoginUsers() Admin = user.user3_name Pwd = user.user3_password expected_username = user.user3_expadmin expected_password = user.user3_exppass # ------ local path ------------ paths = Paths() locpath = paths.Local_path # -------Pgan path ----------- pgan_path = paths.Pgan_path # ScreenShot Relative Path ss_path = '/K8s_UI/Parallel_VoltaGpu/' # Creating object of screenshot utility ss = SS(driver1) user = self.driver1.find_element_by_name("username") user.send_keys(Admin) sleep(2) pwd = self.driver1.find_element_by_name("password") pwd.send_keys(Pwd) sleep(2) # self.driver1.find_element_by_class_name("btn btn-primary").click() ----this getting error # self.driver1.find_element_by_partial_link_text("Submit").click() ----this getting error-- sub = self.driver1.find_element_by_tag_name("button") sub.click() for Logedout in self.driver1.find_elements_by_xpath( "//*[@class='alert alert-success']"): assert isinstance(Logedout.text, object) assert (print(str(Logedout.text))) if (Admin == expected_username and Pwd == expected_password): print("User-3 Login successful") else: assert (print("failed to login")) print("************ Pgan Manual *****************") # --------Frame work-------------- # f = self.driver1.find_element_by_class_name("f-image mxnet text-center") f = self.driver1.find_element_by_xpath( "//img[@src='/images/tenserflow.png']") f.click() print("Selected Tensorflow") sleep(2) inception = self.driver1.find_element_by_xpath( "//*[@class='card-body text-center font-weight-normal btnNext']") inception.click() sleep(1) print("Selected Inception") # -----------local folder--------------- local = self.driver1.find_element(By.ID, 'r100') local.click() sleep(1) localpath = self.driver1.find_element(By.ID, 'local_dir_path') localpath.send_keys(locpath) # ----------GPU Manual -------- gpu = self.driver1.find_element(By.ID, 'r4') gpu.click() sleep(2) print("Your selected Manual") manual = self.driver1.find_element_by_id("r102") manual.click() sleep(1) # ------ gpu percentage ----------- memory0 = self.driver1.find_element(By.ID, 'gpupercent0') memory0.send_keys(gpuper) print("gpu percentage : ", gpuper, '%') # --------core percentage ----------- sleep(1) gpuvalue = self.driver1.find_element(By.ID, 'gpuvalue0') gpuvalue.send_keys(coreper) print("core percentage : ", coreper, '%') sleep(2) # ------Screenshot-1----------- ss.ScreenShot(ss_path + "test_07_voltaGpu_pgan_manual3_setupscreen3.png") setupbtn = self.driver1.find_element(By.ID, 'setupbtn') setupbtn.click() sleep(28) # -------Datsets & Training ---------------- traindir = self.driver1.find_element(By.ID, 'traindirectory') trdirectory = Select(traindir) trdirectory.select_by_visible_text("pgan") sleep(2) trinfile = self.driver1.find_element(By.ID, 'file_name') trfile = Select(trinfile) trfile.select_by_visible_text("train.py") sleep(2) # --------- Train -------------------- train = self.driver1.find_element_by_xpath("//a[@href='#train']") train.click() sleep(2) textpath = self.driver1.find_element_by_id("textVal") textpath.clear() textpath.send_keys(pgan_path) sleep(2) Train = self.driver1.find_element(By.ID, 'train_id') Train.click() # This is wating for not having space sleep(570) sleep(200) # ------- Gpu Usage -------------------- gpuTime = driver1.find_elements_by_id("gputime") for GpuUsage in gpuTime: assert isinstance(GpuUsage.text, object) print("Gpu Usage : ", str(GpuUsage.text)) sleep(350) # --------Elapsed Time ------------------- myElem = self.driver1.find_element_by_id("elapsedTime") myElem.click() sleep(1) # ------Screenshot-2----------- ss.ScreenShot(ss_path + "test_07_voltaGpu_pgan_manual3_elapsedtime3.png") sleep(2) assert isinstance(myElem.text, object) print("Pgan Manual -", str(myElem.text)) try: for logs in driver1.get_log('browser'): print(logs) pass except Exception as e: print("Exception Occurred :" + str(e)) # ---------Logout ---------------- self.driver1.find_element_by_id("navbarDropdownMenuLink").click() logout = self.driver1.find_element_by_class_name("dropdown-item") logout.click() sleep(5) for Logedout in self.driver1.find_elements_by_xpath( "//*[@class='alert alert-success']"): assert isinstance(Logedout.text, object) print(str(Logedout.text))
def test_local_mnist_auto(self): #gpuper = "80" #coreper = "90" driver1 = self.driver1 myurl = Myurl(self.driver1) myurl.access_url() #driver1.implicitly_wait(10) sleep(10) print("This is Title name :", driver1.title) # ScreenShot Relative Path ss_path = '/Rvirtus/' # Creating object of screenshot utility ss = SS(driver1) # ------Memory and core Percentages ---------- percentages = Memory_and_Core_Percentages() gpuper = percentages.memory_08 coreper = percentages.core_08 # ------- Login Details ------------ user = LoginUsers() Admin = user.user1_name Pwd = user.user1_password expadmin = user.user1_expadmin exppass = user.user1_exppass # ------ local path ------------ paths = Paths() locGVpath = paths.Local_GVirtus_path Backendip = paths.Backend_ip admin_login = AdminLogin(driver1) admin_login.set_login_uname(Admin) admin_login.set_login_upass(Pwd) sleep(3) admin_login.submit_login(Admin, Pwd) sleep(5) if Admin == expadmin and Pwd == exppass: print("Login successful") else: assert print("Invalid credentials") print("************ Mnist Manual *****************") # --------Frame work-------------- f = self.driver1.find_element_by_xpath("//img[@src='/images/tenserflow.png']") f.click() print("Selected Tensorflow") sleep(2) # --------if you have compound class name you should write like this----------- inception = self.driver1.find_element_by_xpath("//*[@class='card-body text-center font-weight-normal btnNext']") inception.click() sleep(1) assert isinstance(inception.text, object) print("Your Selected ", str(inception.text)) #print("Selected Inception") # -----------local folder--------------- local = self.driver1.find_element(By.ID, 'r100') local.click() sleep(1) localpath = self.driver1.find_element(By.ID, 'local_dir_path') localpath.send_keys(locGVpath) sleep(2) # ----------GPU Auto -------- gpu = self.driver1.find_element(By.ID, 'r4') gpu.click() sleep(2) auto = self.driver1.find_element_by_id("r101") auto.click() sleep(4) print("Your selected Auto") #---------Backend IP -------------- ''' backendip = self.driver1.find_element(By.ID, 'gpuip0') backendip.clear() sleep(1) backendip.send_keys(Backendip) # ------ gpu percentage ----------- memory0 = self.driver1.find_element(By.ID, 'gpupercent0') memory0.send_keys(gpuper) print("gpu percentage : ", gpuper, '%') # --------core percentage ----------- sleep(1) gpuvalue = self.driver1.find_element(By.ID, 'gpuvalue0') gpuvalue.send_keys(coreper) print("core percentage : ", coreper, '%') sleep(2) ''' # ------Screenshot-1----------- ss.ScreenShot(ss_path + "test_local_mnist_auto-SetupsScreen.png") # -------------------- setup btn ----------------- setupbtn = self.driver1.find_element(By.ID, 'setupbtn') setupbtn.click() sleep(25) # -------Datsets & Training ---------------- traindir = self.driver1.find_element(By.ID, 'traindirectory') trdirectory = Select(traindir) trdirectory.select_by_visible_text("Mnist_classification") sleep(2) trinfile = self.driver1.find_element(By.ID, 'file_name') trfile = Select(trinfile) trfile.select_by_visible_text("mnist_deep.py") sleep(2) # --------- Train -------------------- train = self.driver1.find_element_by_xpath("//a[@href='#train']") train.click() sleep(2) Train = self.driver1.find_element(By.ID, 'train_id') Train.click() sleep(30) gpuTime = driver1.find_elements_by_id("gputime") for GpuUsage in gpuTime: assert isinstance(GpuUsage.text, object) print("Gpu Usage : ", str(GpuUsage.text)) sleep(60) # --------Elapsed Time ------------------- myElem = self.driver1.find_element_by_id("elapsedTime") myElem.click() sleep(1) # ------Screenshot-2----------- ss.ScreenShot(ss_path + "test_local_mnist_auto-ElapsedTime.png") sleep(2) assert isinstance(myElem.text, object) print("Mnist Manual -", str(myElem.text)) for logs in driver1.get_log('browser'): print(logs) try: pass #log = self.get_browser_console_log() #log = self.driver1.get_log(browser) #print("Console Log: ",log) except Exception as e: print("Exception Occurred :" + str(e)) # ---------Logout ---------------- self.driver1.find_element_by_id("navbarDropdownMenuLink").click() logout = self.driver1.find_element_by_class_name("dropdown-item") logout.click() sleep(5) for Logedout in self.driver1.find_elements_by_xpath("//*[@class='alert alert-success']"): assert isinstance(Logedout.text, object) print(str(Logedout.text))
def test_local_mnist_manual(self): count = 0 logedout_txt = None #gpuper = "80" #coreper = "90" driver1 = self.driver1 myurl = Myurl(self.driver1) myurl.access_url() #driver1.implicitly_wait(10) sleep(8) print("This is Title name :", driver1.title) # ScreenShot Relative Path ss_path = '/K8s_UI/' # Creating object of screenshot utility ss = SS(driver1) # ------Memory and core Percentages ---------- percentages = Memory_and_Core_Percentages() gpuper = percentages.memory_08 coreper = percentages.core_08 # ------- Login Details ------------ user = LoginUsers() Admin = user.user1_name Pwd = user.user1_password expadmin = user.user1_expadmin exppass = user.user1_exppass # ------ local path ------------ paths = Paths() locpath = paths.Local_path admin_login = AdminLogin(driver1) admin_login.set_login_uname(Admin) admin_login.set_login_upass(Pwd) sleep(3) admin_login.submit_login(Admin, Pwd) sleep(5) logout_exp = "You are logged out .. please login.!" re_login = self.driver1.find_elements_by_xpath( "//*[@class='alert alert-success']") print("re login : "******"please logedout text :", str(logedout_txt)) if logout_exp == logedout_txt: print("logged out matched here ^^^^^^^^^^^^^^^^^^^^^^^^^^") driver1 = self.driver1 myurl = Myurl(self.driver1) myurl.access_url() #driver1.implicitly_wait(10) sleep(10) print("This is Title name inside if 2:", driver1.title) #self.assertEqual("Rapt.AI", driver1.title) sleep(5) # ------- Login Details ------------ user = LoginUsers() Admin = user.user2_name Pwd = user.user2_password expadmin = user.user2_expadmin exppass = user.user2_exppass admin_login = AdminLogin(driver1) admin_login.set_login_uname(Admin) sleep(2) admin_login.set_login_upass(Pwd) sleep(3) admin_login.submit_login(Admin, Pwd) sleep(5) elif Admin == expadmin and Pwd == exppass: print("Login successful") else: assert print("Invalid credentials") print("************ Mnist Manual *****************") # --------Frame work-------------- f = self.driver1.find_element_by_xpath( "//img[@src='/images/tenserflow.png']") f.click() print("Selected Tensorflow") sleep(2) # --------if you have compound class name you should write like this----------- inception = self.driver1.find_element_by_xpath( "//*[@class='card-body text-center font-weight-normal btnNext']") inception.click() sleep(1) print("Selected Inception") # -----------local folder--------------- local = self.driver1.find_element(By.ID, 'r100') local.click() sleep(1) localpath = self.driver1.find_element(By.ID, 'local_dir_path') localpath.send_keys(locpath) sleep(2) # ----------GPU Manual -------- gpu = self.driver1.find_element(By.ID, 'r4') gpu.click() sleep(2) print("Your selected Manual") manual = self.driver1.find_element_by_id("r102") manual.click() sleep(1) # ------ gpu percentage ----------- memory0 = self.driver1.find_element(By.ID, 'gpupercent0') memory0.send_keys(gpuper) print("gpu percentage : ", gpuper, '%') # --------core percentage ----------- sleep(1) gpuvalue = self.driver1.find_element(By.ID, 'gpuvalue0') gpuvalue.send_keys(coreper) print("core percentage : ", coreper, '%') sleep(2) # ------Screenshot-1----------- ss.ScreenShot(ss_path + "test_02_manual_setupscreen.png") # -------------------- setup btn ----------------- setupbtn = self.driver1.find_element(By.ID, 'setupbtn') setupbtn.click() sleep(30) # -------Datsets & Training ---------------- traindir = self.driver1.find_element(By.ID, 'traindirectory') trdirectory = Select(traindir) trdirectory.select_by_visible_text("Mnist_classification") sleep(2) trinfile = self.driver1.find_element(By.ID, 'file_name') trfile = Select(trinfile) trfile.select_by_visible_text("mnist_gpu.py") sleep(2) # --------- Train -------------------- train = self.driver1.find_element_by_xpath("//a[@href='#train']") train.click() sleep(2) Train = self.driver1.find_element(By.ID, 'train_id') Train.click() sleep(20) #****************** getting logs error *************** ''' logs_file_path = "/home/ubuntu/raptLogs/"+Admin+"/retrain.log" regex = "(.*?)InvalidArgument(E/e)rror(.*?)" match_list = [] with open(logs_file_path, "r") as file: for line in file: for match in re.finditer(regex, line, re.S): match_text = match.group() match_list.append(match_text) print("********** Match text *********** :\n" + match_text) ''' #m1 = multiprocessing.Process(target=self.get_logs) #m1.start() #time.sleep(10) #m1.join() #**************************************************** gpuTime = driver1.find_elements_by_id("gputime") for GpuUsage in gpuTime: assert isinstance(GpuUsage.text, object) print("Gpu Usage : ", str(GpuUsage.text)) sleep(30) # --------Elapsed Time ------------------- myElem = self.driver1.find_element_by_id("elapsedTime") myElem.click() sleep(1) # ------Screenshot-2----------- ss.ScreenShot(ss_path + "test_02_manual_elapsedtime.png") sleep(3) assert isinstance(myElem.text, object) print("Mnist Manual -", str(myElem.text)) # ----------- logs ------------ #console_msg = self.driver1.find_elements_by_xpath("//*[@title='/home/ubuntu/retrain.log']") #console_msg.click() #sleep(2) #for consolelog in console_msg : #assert isinstance(consolelog.text, object) #print("*********** console logs **************:\n") #print(str(consolelog.text)) #for logs in driver1.get_log('browser'): #print(logs) frame1 = driver1.find_element_by_id("logioReload") driver1.switch_to.frame(frame1) sleep(4) page_source = driver1.page_source print("************************************************************") #print("console logs :\n", page_source) dir_path = "/home/cit/PycharmProjects/RaptAutomation/Test_UI/K8s_SingleUser_SingleGpu" #logs_file_path = "console_logs.txt" logs_file_path = Admin + ".txt" with open(logs_file_path, 'w') as consolelogs: print("page creating and writing ..............") consolelogs.write("Console Logs :\n" + page_source) consolelogs.close() print( "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" ) driver1.switch_to.default_content() sleep(3) regex = "InvalidArgumentError(.*?)" match_list = [] with open(logs_file_path, "r") as file: sleep(2) print("reading file ..............:\n" + file.readline()) for lines in file: #print("getting file ********** ") #print(lines) #sleep(1) for match in re.finditer(regex, lines, re.S): #print("error match lines :") #sleep(1) match_text = match.group() match_list.append(match_text) assert print("********** Match text *********** :\n" + match_text) #if re.match("(.*?)InvalidArgumentError(.*?)", lines): #print("warnings ................ ") #print("^^^^^^^^^^^^^^^^^^^ match ERROR : \n", lines) #if re.match("InvalidArgumentError", lines): #print("warnings 222222................ ") #print("$$$$$$$$$$$$$$$$$ match ERROR 2222222222 : \n", lines) #sleep(1) ''' file_read = file.read() for line in file_read: print("lines : \n" + line + "\n") for match in re.finditer(regex, line, re.S): match_text = match.group() match_list.append(match_text) print("********** Match text *********** :\n" + match_text) if re.match("(.*?)WARNING(.*?)", line): print("warnings ................ ") print("$$$$$$$$$$$$$$$$$ match ERROR : \n", line ) ''' print( "************************************************************************" ) #src2 = driver1.get_p #text_found = re.search('No such file or directory', src) #print("default contents :\n", driver1.switch_to.default_content()) #driver1.switch_to.default_content() #sleep(5) #--------------------------------- logs end ---------------- try: pass #log = self.get_browser_console_log() #log = self.driver1.get_log(browser) #print("Console Log: ",log) except Exception as e: print("Exception Occurred :" + str(e)) # ---------Logout ---------------- self.driver1.find_element_by_id("navbarDropdownMenuLink").click() print("trying to logout") logout = self.driver1.find_element_by_class_name("dropdown-item") logout.click() sleep(2) for Logedout in self.driver1.find_elements_by_xpath( "//*[@class='alert alert-success']"): assert isinstance(Logedout.text, object) print("rapt logout msg ", str(Logedout.text))
def test_s3_mnist_auto(self): # Second browser driver driver1 = self.driver1 # self.driver1.get("http://52.34.222.154:3050/users/login") myurl = Myurl(self.driver1) myurl.access_url() driver1.implicitly_wait(10) print("This is Title name :", driver1.title) # ScreenShot Relative Path ss_path = '/Rvirtus/' # Creating object of screenshot utility ss = SS(driver1) # ------- Login Details ------------ user = LoginUsers() Admin = user.user1_name Pwd = user.user1_password expadmin = user.user1_expadmin exppass = user.user1_exppass # ------ S3 bucket ------------ paths = Paths() bkt_name = paths.Bucket_name bkt_keys = paths.Bucket_keys admin_login = AdminLogin(driver1) admin_login.set_login_uname(Admin) admin_login.set_login_upass(Pwd) sleep(3) admin_login.submit_login(Admin, Pwd) sleep(5) if Admin == expadmin and Pwd == exppass: print("Login successful") else: assert print("Invalid credentials") print("************ Mnist Auto *****************") # --------Frame work-------------- # f = self.driver1.find_element_by_class_name("f-image mxnet text-center") f = self.driver1.find_element_by_xpath( "//img[@src='/images/tenserflow.png']") f.click() print("Selected Tensorflow") sleep(2) # --------if you have compound class name you should write like this----------- inception = self.driver1.find_element_by_xpath( "//*[@class='card-body text-center font-weight-normal btnNext']") inception.click() sleep(1) print("Selected Inception") # -----------S3 bucket --------------- s3 = self.driver1.find_element(By.ID, 'r1') s3.click() sleep(1) bucketname = self.driver1.find_element(By.ID, 'bkt_name') bucketname.send_keys(bkt_name) sleep(2) bucketkeys = self.driver1.find_element(By.ID, 'bkt_keys') bucketkeys.send_keys(bkt_keys) sleep(2) # ----------GPU Auto -------- gpu = self.driver1.find_element(By.ID, 'r4') gpu.click() sleep(2) auto = self.driver1.find_element_by_id("r101") auto.click() sleep(4) print("Your selected Auto") # ------Screenshot-1----------- ss.ScreenShot(ss_path + "test_13_s3_mnist_auto_setupscreen.png") # -------------------- setup btn ----------------- setupbtn = self.driver1.find_element(By.ID, 'setupbtn') setupbtn.click() sleep(25) # -------Datsets & Training ---------------- traindir = self.driver1.find_element(By.ID, 'traindirectory') trdirectory = Select(traindir) trdirectory.select_by_visible_text("Mnist_classification") sleep(2) trinfile = self.driver1.find_element(By.ID, 'file_name') trfile = Select(trinfile) trfile.select_by_visible_text("mnist_deep.py") sleep(2) # --------- Train -------------------- train = self.driver1.find_element_by_xpath("//a[@href='#train']") train.click() sleep(2) Train = self.driver1.find_element(By.ID, 'train_id') Train.click() sleep(30) gpuTime = driver1.find_elements_by_id("gputime") for GpuUsage in gpuTime: assert isinstance(GpuUsage.text, object) print("Gpu Usage : ", str(GpuUsage.text)) sleep(60) #--------Elapsed Time ------------------- myElem = self.driver1.find_element_by_id("elapsedTime") myElem.click() sleep(1) # --------Screen shot-2 ----------- ss.ScreenShot(ss_path + "test_13_s3_mnist_auto_elapsedtime.png") sleep(5) assert isinstance(myElem.text, object) print("Mnist Auto -", str(myElem.text)) for logs in driver1.get_log('browser'): print(logs) try: pass except Exception as e: print("Exception Occurred :" + str(e)) # ---------Logout ---------------- self.driver1.find_element_by_id("navbarDropdownMenuLink").click() logout = self.driver1.find_element_by_class_name("dropdown-item") logout.click() sleep(5) for Logedout in self.driver1.find_elements_by_xpath( "//*[@class='alert alert-success']"): assert isinstance(Logedout.text, object) print(str(Logedout.text))
def test_local_mnist_auto(self): logedout_txt = None driver1 = self.driver1 myurl = Myurl(self.driver1) myurl.access_url() print("myurl ", myurl.acces_user()) #driver1.implicitly_wait(10) sleep(5) #-----------Rapt Title ---------------------- rapt_title = "Rapt.AI" if rapt_title == driver1.title: print("This is Title name :", driver1.title) else: assert print("Rapt title didn't match....!") print("This is Title name :", driver1.title) #ScreenShot Relative Path #ss_path = '/K8s_UI/' ss_path = '/Rhel_UI/' #Creating object of screenshot utility ss = SS(driver1) #------- Login Details ------------ user = LoginUsers() Admin = user.user1_name Pwd = user.user1_password expadmin = user.user1_expadmin exppass = user.user1_exppass # ------ local path ------------ paths = Paths() locpath = paths.Local_path admin_login = AdminLogin(driver1) admin_login.set_login_uname(Admin) admin_login.set_login_upass(Pwd) sleep(3) admin_login.submit_login(Admin, Pwd) sleep(5) #----------- Re login user ------------------ logout_exp = "You are logged out .. please login.!" re_login = self.driver1.find_elements_by_xpath( "//*[@class='alert alert-success']") for Logedout in re_login: assert isinstance(Logedout.text, object) logedout_txt = Logedout.text print("please logedout text :", str(logedout_txt)) if logout_exp == logedout_txt: print("logged out matched here ^^^^^^^^^^^^^^^^^^^^^^^^^^") driver1 = self.driver1 myurl = Myurl(self.driver1) myurl.access_url() # driver1.implicitly_wait(10) sleep(5) print("This is Title name inside if 2:", driver1.title) # self.assertEqual("Rapt.AI", driver1.title) sleep(5) # ------- Login Details ------------ user = LoginUsers() Admin = user.user1_name Pwd = user.user1_password #expadmin = user.user1_expadmin #exppass = user.user1_exppass admin_login = AdminLogin(driver1) admin_login.set_login_uname(Admin) sleep(2) admin_login.set_login_upass(Pwd) sleep(3) admin_login.submit_login(Admin, Pwd) sleep(5) if Admin == expadmin and Pwd == exppass: print("Login successful") else: assert print("Invalid credentials") print("************ Mnist Auto *****************") # --------Frame work-------------- f = self.driver1.find_element_by_xpath( "//img[@src='/images/tenserflow.png']") f.click() print("Selected Tensorflow") sleep(2) # --------if you have compound class name you should write like this----------- inception = self.driver1.find_element_by_xpath( "//*[@class='card-body text-center font-weight-normal btnNext']") inception.click() sleep(1) print("Selected Inception") # -----------local folder--------------- local = self.driver1.find_element(By.ID, 'r100') local.click() sleep(1) localpath = self.driver1.find_element(By.ID, 'local_dir_path') localpath.send_keys(locpath) sleep(2) # ----------GPU Auto -------- gpu = self.driver1.find_element(By.ID, 'r4') gpu.click() sleep(2) auto = self.driver1.find_element_by_id("r101") auto.click() sleep(2) print("Your selected Auto") #------Screenshot-1----------- ss.ScreenShot(ss_path + "test_01_mnist_auto_setupscreen.png") # -------------------- setup btn ----------------- setupbtn = self.driver1.find_element(By.ID, 'setupbtn') setupbtn.click() sleep(25) #sleep(60) SHORT_TIMEOUT = 10 # give enough time for the loading element to appear LONG_TIMEOUT = 20 # give enough time for loading to finish #LOADING_ELEMENT_XPATH = self.driver1.find_element(By.ID, 'loader') LOADING_ELEMENT_XPATH = "//*[@id='loader']" '''try: wait = Webdriver1Wait(driver1, 10) wait.until(EC.presence_of_element_located((By.XPATH, '//*[@id="loader"]'))) #element = Webdriver1Wait(driver1, 10).until( #EC.presence_of_element_located((By.ID, "loader"))) myElem = Webdriver1Wait(driver1, LONG_TIMEOUT).until(EC.presence_of_element_located((By.ID, 'loader'))) print("Page is ready!",myElem) except TimeoutException: print("Loading took too much time!")''' #Webdriver1Wait(self.driver1, SHORT_TIMEOUT #).until(EC.presence_of_element_located((By.XPATH, LOADING_ELEMENT_XPATH))) #Webdriver1Wait(driver1,SHORT_TIMEOUT).until(EC.visibility_of_element_located((By.XPATH, LOADING_ELEMENT_XPATH))) #Webdriver1Wait(driver1,LONG_TIMEOUT).until(EC.visibility_of_element_located((By.XPATH, LOADING_ELEMENT_XPATH))) # then wait for the element to disappear #Webdriver1Wait(self.driver1, LONG_TIMEOUT #).until_not(EC.presence_of_element_located((By.XPATH, LOADING_ELEMENT_XPATH))) # -------Datsets & Training ---------------- traindir = self.driver1.find_element(By.ID, 'traindirectory') trdirectory = Select(traindir) trdirectory.select_by_visible_text("Mnist_classification") sleep(2) trinfile = self.driver1.find_element(By.ID, 'file_name') trfile = Select(trinfile) trfile.select_by_visible_text("mnist_gpu.py") sleep(2) # --------- Train -------------------- train = self.driver1.find_element_by_xpath("//a[@href='#train']") train.click() sleep(2) Train = self.driver1.find_element(By.ID, 'train_id') Train.click() #-------- Tensor console -------------- tensor_console = self.driver1.find_element_by_xpath( "//*[@class='text-center mb-3']") tensor_console.click() sleep(20) gpuTime = driver1.find_elements_by_id("gputime") for GpuUsage in gpuTime: assert isinstance(GpuUsage.text, object) print("Gpu Usage : ", str(GpuUsage.text)) sleep(60) #--------Elapsed Time ------------------- myElem = self.driver1.find_element_by_id("elapsedTime") myElem.click() sleep(1) # --------Screen shot-2 ----------- ss.ScreenShot(ss_path + "test_01_mnist_auto_elapsedtime.png") sleep(10) assert isinstance(myElem.text, object) print("Mnist Auto -", str(myElem.text)) #------------- logs ---------------- frame1 = driver1.find_element_by_id("logioReload") driver1.switch_to.frame(frame1) sleep(4) page_source = driver1.page_source #print("************************************************************") # print("console logs :\n", page_source) dir_path = "/home/cit/PycharmProjects/RaptAutomation/Test_UI/K8s_SingleUser_SingleGpu" # logs_file_path = "console_logs.txt" logs_file_path = Admin + ".txt" with open(logs_file_path, 'w') as consolelogs: print("file creating and writing .............." + logs_file_path) consolelogs.write("Console Logs :\n" + page_source) consolelogs.close() #print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@") driver1.switch_to.default_content() sleep(3) regex = "Error(.*?)" match_list = [] with open(logs_file_path, "r") as file: sleep(2) #print("reading file ..............:\n" + file.readline()) for lines in file: # print("getting file ********** ") # print(lines) #sleep(1) for match in re.finditer(regex, lines, re.S): # print("error match lines :") sleep(1) match_text = match.group() match_list.append(match_text) assert print("********** Match text *********** :\n" + match_text) # --------------------------------- logs end ---------------- try: for logs in driver1.get_log('browser'): print(logs) pass except Exception as e: print("Exception Occurred :" + str(e)) # ---------Logout ---------------- self.driver1.find_element_by_id("navbarDropdownMenuLink").click() logout = self.driver1.find_element_by_class_name("dropdown-item") logout.click() sleep(5) for Logedout in self.driver1.find_elements_by_xpath( "//*[@class='alert alert-success']"): assert isinstance(Logedout.text, object) print(str(Logedout.text))
def test_local_pgan_manual(self): #gpuper0,gpuper1,gpuper2,gpuper3,gpuper4,gpuper5,gpuper6,gpuper7 = '40','50','60','70','80','90','50','60' #coreper0,coreper1,coreper2,coreper3,coreper4,coreper5,coreper6,coreper7 = '90','90','90','90','90','90','90','90' driver1 = self.driver1 myurl = Myurl(self.driver1) myurl.access_url() driver1.implicitly_wait(10) print("User-1 This is Title name :", driver1.title) # ------- Multi gpus memory % and core % ------------- percentages = Memory_and_Core_Percentages() gpuper0 = percentages.gpuper0 gpuper1 = percentages.gpuper1 gpuper2 = percentages.gpuper2 gpuper3 = percentages.gpuper3 gpuper4 = percentages.gpuper4 gpuper5 = percentages.gpuper5 gpuper6 = percentages.gpuper6 gpuper7 = percentages.gpuper7 coreper0 = percentages.coreper0 coreper1 = percentages.coreper1 coreper2 = percentages.coreper2 coreper3 = percentages.coreper3 coreper4 = percentages.coreper4 coreper5 = percentages.coreper5 coreper6 = percentages.coreper6 coreper7 = percentages.coreper7 # ------- Login Details ------------ user = LoginUsers() Admin = user.user1_name Pwd = user.user1_password expected_username = user.user1_expadmin expected_password = user.user1_exppass # ------ local path ------------ paths = Paths() locpath = paths.Local_path # -------Pgan path ----------- pgan_path = paths.Pgan_path # ScreenShot Relative Path ss_path = '/K8s_UI/' # Creating object of screenshot utility ss = SS(driver1) admin_login = AdminLogin(driver1) admin_login.set_login_uname(Admin) admin_login.set_login_upass(Pwd) sleep(3) admin_login.submit_login(Admin, Pwd) sleep(5) if Admin == expected_username and Pwd == expected_password: print("Login successful") else: assert print("Invalid credentials") print("************ Pgan Manual *****************") # --------Frame work-------------- # f = self.driver1.find_element_by_class_name("f-image mxnet text-center") f = self.driver1.find_element_by_xpath( "//img[@src='/images/tenserflow.png']") f.click() print("Selected Tensorflow") sleep(2) inception = self.driver1.find_element_by_xpath( "//*[@class='card-body text-center font-weight-normal btnNext']") inception.click() sleep(1) print("Selected Inception") # -----------local folder--------------- local = self.driver1.find_element(By.ID, 'r100') local.click() sleep(1) localpath = self.driver1.find_element(By.ID, 'local_dir_path') localpath.send_keys(locpath) # ----------GPU Manual -------- gpu = self.driver1.find_element(By.ID, 'r4') gpu.click() sleep(2) print("Your selected Manual") manual = self.driver1.find_element_by_id("r102") manual.click() sleep(1) # ------ gpu percentage ----------- memory0 = self.driver1.find_element(By.ID, 'gpupercent0') memory0.send_keys(gpuper0) sleep(1) memory1 = self.driver1.find_element(By.ID, 'gpupercent1') memory1.send_keys(gpuper1) sleep(1) memory2 = self.driver1.find_element(By.ID, 'gpupercent2') memory2.send_keys(gpuper2) sleep(1) memory3 = self.driver1.find_element(By.ID, 'gpupercent3') memory3.send_keys(gpuper3) sleep(1) memory4 = self.driver1.find_element(By.ID, 'gpupercent4') memory4.send_keys(gpuper4) sleep(1) memory5 = self.driver1.find_element(By.ID, 'gpupercent5') memory5.send_keys(gpuper5) sleep(1) memory6 = self.driver1.find_element(By.ID, 'gpupercent6') memory6.send_keys(gpuper6) sleep(1) memory7 = self.driver1.find_element(By.ID, 'gpupercent7') memory7.send_keys(gpuper7) print("gpu percentages : ", gpuper0, gpuper1, gpuper2, gpuper3, gpuper4, gpuper5, gpuper6, gpuper7) # --------core percentage ----------- sleep(1) gpuvalue0 = self.driver1.find_element(By.ID, 'gpuvalue0') gpuvalue0.send_keys(coreper0) sleep(1) gpuvalue1 = self.driver1.find_element(By.ID, 'gpuvalue1') gpuvalue1.send_keys(coreper1) sleep(1) gpuvalue2 = self.driver1.find_element(By.ID, 'gpuvalue2') gpuvalue2.send_keys(coreper2) sleep(1) gpuvalue3 = self.driver1.find_element(By.ID, 'gpuvalue3') gpuvalue3.send_keys(coreper3) sleep(1) gpuvalue4 = self.driver1.find_element(By.ID, 'gpuvalue4') gpuvalue4.send_keys(coreper4) sleep(1) gpuvalue5 = self.driver1.find_element(By.ID, 'gpuvalue5') gpuvalue5.send_keys(coreper5) sleep(1) gpuvalue6 = self.driver1.find_element(By.ID, 'gpuvalue6') gpuvalue6.send_keys(coreper6) sleep(1) gpuvalue7 = self.driver1.find_element(By.ID, 'gpuvalue7') gpuvalue7.send_keys(coreper7) print("core percentages : ", coreper0, coreper1, coreper2, coreper3, coreper4, coreper5, coreper6, coreper7) sleep(2) # ------Screenshot-1----------- ss.ScreenShot(ss_path + "test_01_multigpus_8_pgan_manual_setupscreen.png") setupbtn = self.driver1.find_element(By.ID, 'setupbtn') setupbtn.click() sleep(16) # -------Datsets & Training ---------------- traindir = self.driver1.find_element(By.ID, 'traindirectory') trdirectory = Select(traindir) trdirectory.select_by_visible_text("pgan") sleep(2) trinfile = self.driver1.find_element(By.ID, 'file_name') trfile = Select(trinfile) trfile.select_by_visible_text("train.py") sleep(2) # --------- Train -------------------- train = self.driver1.find_element_by_xpath("//a[@href='#train']") train.click() sleep(2) textpath = self.driver1.find_element_by_id("textVal") textpath.clear() textpath.send_keys(pgan_path) sleep(2) Train = self.driver1.find_element(By.ID, 'train_id') Train.click() sleep(200) # ------- Gpu Usage -------------------- gpuTime = driver1.find_elements_by_id("gputime") for GpuUsage in gpuTime: assert isinstance(GpuUsage.text, object) print("Gpu Usage : ", str(GpuUsage.text)) sleep(340) # --------Elapsed Time ------------------- myElem = self.driver1.find_element_by_id("elapsedTime") myElem.click() sleep(1) # ------Screenshot-2----------- ss.ScreenShot(ss_path + "test_01_multigpus_8_pgan_manual_elapsedtime.png") sleep(2) assert isinstance(myElem.text, object) print("Pgan Manual -", str(myElem.text)) #gettime = self.driver1.find_elements_by_id("elapsedTime") try: pass except Exception as e: print("Exception Occurred :" + str(e)) # ---------Logout ---------------- self.driver1.find_element_by_id("navbarDropdownMenuLink").click() logout = self.driver1.find_element_by_class_name("dropdown-item") logout.click() sleep(5) for Logedout in self.driver1.find_elements_by_xpath( "//*[@class='alert alert-success']"): assert isinstance(Logedout.text, object) print(str(Logedout.text))
def test_local_image_manual(self): #gpuper = "90" #coreper = "90" logedout_txt = None # Second browser driver driver1 = self.driver1 myurl = Myurl(self.driver1) myurl.access_url() #driver1.implicitly_wait(10) sleep(5) #-----------Rapt Title ---------------------- rapt_title = "Rapt.AI" if rapt_title == driver1.title: print("This is Title name :", driver1.title) else: assert print("Rapt title didn't match....!") # ScreenShot Relative Path ss_path = '/K8s_UI/' # Creating object of screenshot utility ss = SS(driver1) # ------Memory and core Percentages ---------- percentages = Memory_and_Core_Percentages() gpuper = percentages.memory_12 coreper = percentages.core_12 # ------- Login Details ------------ user = LoginUsers() Admin = user.user1_name Pwd = user.user1_password expadmin = user.user1_expadmin exppass = user.user1_exppass # ------ local path ------------ paths = Paths() locpath = paths.Local_path # -------Image classification path ----------- flower_path = paths.Local_Image_clf_path admin_login = AdminLogin(driver1) admin_login.set_login_uname(Admin) admin_login.set_login_upass(Pwd) sleep(3) admin_login.submit_login(Admin, Pwd) sleep(5) # ----------- Re login user ------------------ logout_exp = "You are logged out .. please login.!" re_login = self.driver1.find_elements_by_xpath( "//*[@class='alert alert-success']") for Logedout in re_login: assert isinstance(Logedout.text, object) logedout_txt = Logedout.text print("please logedout text :", str(logedout_txt)) if logout_exp == logedout_txt: print("logged out matched here ^^^^^^^^^^^^^^^^^^^^^^^^^^") driver1 = self.driver1 myurl = Myurl(self.driver1) myurl.access_url() # driver1.implicitly_wait(10) sleep(5) print("This is Title name inside if 2:", driver1.title) #self.assertEqual("Rapt.AI", driver1.title) sleep(5) # ------- Login Details ------------ user = LoginUsers() Admin = user.user2_name Pwd = user.user2_password expadmin = user.user2_expadmin exppass = user.user2_exppass admin_login = AdminLogin(driver1) admin_login.set_login_uname(Admin) sleep(2) admin_login.set_login_upass(Pwd) sleep(3) admin_login.submit_login(Admin, Pwd) sleep(5) if Admin == expadmin and Pwd == exppass: print("Login successful") else: assert print("Invalid credentials") print("************ Image classification Manual *****************") # --------Frame work-------------- # f = self.driver1.find_element_by_class_name("f-image mxnet text-center") f = self.driver1.find_element_by_xpath( "//img[@src='/images/tenserflow.png']") f.click() print("Selected Tensorflow") sleep(2) # --------if you have compound class name you should write like this----------- inception = self.driver1.find_element_by_xpath( "//*[@class='card-body text-center font-weight-normal btnNext']") inception.click() sleep(1) print("Selected Inception") # -----------local folder--------------- local = self.driver1.find_element(By.ID, 'r100') local.click() sleep(1) localpath = self.driver1.find_element(By.ID, 'local_dir_path') localpath.send_keys(locpath) sleep(2) # ----------GPU Manual -------- gpu = self.driver1.find_element(By.ID, 'r4') gpu.click() sleep(2) print("Your selected Manual") manual = self.driver1.find_element_by_id("r102") manual.click() sleep(1) # ------ gpu percentage ----------- memory0 = self.driver1.find_element(By.ID, 'gpupercent0') memory0.send_keys(gpuper) print("gpu percentage : ", gpuper, '%') # --------core percentage ----------- sleep(1) gpuvalue = self.driver1.find_element(By.ID, 'gpuvalue0') gpuvalue.send_keys(coreper) print("core percentage : ", coreper, '%') sleep(2) # ------Screenshot-1----------- ss.ScreenShot(ss_path + "test_06_image_manual_setupscreen.png") # -------------------- setup btn ----------------- setupbtn = self.driver1.find_element(By.ID, 'setupbtn') setupbtn.click() sleep(30) traindir = self.driver1.find_element(By.ID, 'traindirectory') trdirectory = Select(traindir) trdirectory.select_by_visible_text("flower_classification") sleep(2) trinfile = self.driver1.find_element(By.ID, 'file_name') trfile = Select(trinfile) trfile.select_by_visible_text("retrain-new.py") sleep(2) # --------- Train -------------------- train = self.driver1.find_element_by_xpath("//a[@href='#train']") train.click() sleep(2) textpath = self.driver1.find_element_by_id("textVal") textpath.clear() sleep(2) textpath.send_keys(flower_path) sleep(2) Train = self.driver1.find_element(By.ID, 'train_id') Train.click() #-------- Tensor console -------------- tensor_console = self.driver1.find_element_by_xpath( "//*[@class='text-center mb-3']") tensor_console.click() sleep(80) gpuTime = driver1.find_elements_by_id("gputime") for GpuUsage in gpuTime: assert isinstance(GpuUsage.text, object) print("Gpu Usage : ", str(GpuUsage.text)) sleep(100) # --------Elapsed Time ------------------- myElem = self.driver1.find_element_by_id("elapsedTime") myElem.click() sleep(1) # ------Screenshot-2----------- ss.ScreenShot(ss_path + "manual-elapsedtime.png") sleep(2) assert isinstance(myElem.text, object) print("Image classification Manual -", str(myElem.text)) # ------------- logs ---------------- frame1 = driver1.find_element_by_id("logioReload") driver1.switch_to.frame(frame1) sleep(4) page_source = driver1.page_source # print("************************************************************") # print("console logs :\n", page_source) dir_path = "/home/cit/PycharmProjects/RaptAutomation/Test_UI/K8s_SingleUser_SingleGpu" # logs_file_path = "console_logs.txt" logs_file_path = Admin + ".txt" with open(logs_file_path, 'w') as consolelogs: print("file creating and writing .............." + logs_file_path) consolelogs.write("Console Logs :\n" + page_source) consolelogs.close() # print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@") driver1.switch_to.default_content() sleep(3) regex = "Error(.*?)" match_list = [] with open(logs_file_path, "r") as file: sleep(2) #print("reading file ..............:\n" + file.readline()) for lines in file: # print("getting file ********** ") # print(lines) #sleep(1) for match in re.finditer(regex, lines, re.S): # print("error match lines :") sleep(1) match_text = match.group() match_list.append(match_text) assert print("********** Match text *********** :\n" + match_text) for logs in driver1.get_log('browser'): print(logs) # --------------------------------- logs end ---------------- try: pass except Exception as e: print("Exception Occurred :" + str(e)) # ---------Logout ---------------- self.driver1.find_element_by_id("navbarDropdownMenuLink").click() sleep(2) logout = self.driver1.find_element_by_class_name("dropdown-item") logout.click() sleep(5) for Logedout in self.driver1.find_elements_by_xpath( "//*[@class='alert alert-success']"): assert isinstance(Logedout.text, object) print(str(Logedout.text))
def test_nfs_mnist_manual(self): #memory = "80" #core = "90" # Second browser driver driver1 = self.driver1 # self.driver1.get("http://52.34.222.154:3050/users/login") myurl = Myurl(self.driver1) myurl.access_url() driver1.implicitly_wait(10) print("This is Title name :", driver1.title) # ScreenShot Relative Path ss_path = '/Rvirtus/' # Creating object of screenshot utility ss = SS(driver1) #------Memory and core Percentages ---------- percentages = Memory_and_Core_Percentages() memory = percentages.memory_02 core = percentages.core_02 # ------- Login Details ------------ user = LoginUsers() Admin = user.user1_name Pwd = user.user1_password expadmin = user.user1_expadmin exppass = user.user1_exppass # ------ NFS path ------------ paths = Paths() nfs_path = paths.NFS_path nfs_ip = paths.NFS_ip admin_login = AdminLogin(driver1) admin_login.set_login_uname(Admin) admin_login.set_login_upass(Pwd) sleep(3) # sub = self.driver1.find_element_by_tag_name("button") # sub.click() # setcookie = pickle.dump(self.driver1.get_cookies(), open("cookies.pkl", "wb")) # print("setcookievalue :", setcookie) admin_login.submit_login(Admin, Pwd) sleep(5) if Admin == expadmin and Pwd == exppass: print("Login successful") else: assert print("Invalid credentials") print("************ Mnist Manual *****************") # --------Frame work-------------- # f = self.driver1.find_element_by_class_name("f-image mxnet text-center") f = self.driver1.find_element_by_xpath( "//img[@src='/images/tenserflow.png']") f.click() print("Selected Tensorflow") sleep(2) # --------if you have compound class name you should write like this----------- inception = self.driver1.find_element_by_xpath( "//*[@class='card-body text-center font-weight-normal btnNext']") inception.click() sleep(1) print("Selected Inception") # -----------NFS --------------- nfs = self.driver1.find_element(By.ID, 'r2') nfs.click() sleep(1) ipadd = self.driver1.find_element(By.ID, 'ds_ip') ipadd.send_keys(nfs_ip) sleep(2) dirpath = self.driver1.find_element(By.ID, 'ds_dirpath') dirpath.send_keys(nfs_path) sleep(2) # ----------GPU Manual -------- gpu = self.driver1.find_element(By.ID, 'r4') gpu.click() sleep(2) manual = self.driver1.find_element_by_id("r102") manual.click() sleep(2) memoryper = self.driver1.find_element(By.ID, 'gpupercent0') memoryper.send_keys(memory) sleep(1) print("Memory percentage :", memory) coreper = self.driver1.find_element(By.ID, 'gpuvalue0') coreper.send_keys(core) sleep(2) print("Core percentage :", core) # ------Screenshot-1----------- ss.ScreenShot(ss_path + "test_08_nfs_mnist_manual_setupscreen.png") # -------------------- setup btn ----------------- setupbtn = self.driver1.find_element(By.ID, 'setupbtn') setupbtn.click() sleep(25) # -------Datsets & Training ---------------- traindir = self.driver1.find_element(By.ID, 'traindirectory') trdirectory = Select(traindir) trdirectory.select_by_visible_text("Mnist_classification") sleep(2) trinfile = self.driver1.find_element(By.ID, 'file_name') trfile = Select(trinfile) trfile.select_by_visible_text("mnist_deep.py") sleep(2) # --------- Train -------------------- train = self.driver1.find_element_by_xpath("//a[@href='#train']") train.click() sleep(2) Train = self.driver1.find_element(By.ID, 'train_id') Train.click() sleep(30) gpuTime = driver1.find_elements_by_id("gputime") for GpuUsage in gpuTime: assert isinstance(GpuUsage.text, object) print("Gpu Usage : ", str(GpuUsage.text)) sleep(60) #--------Elapsed Time ------------------- myElem = self.driver1.find_element_by_id("elapsedTime") myElem.click() sleep(1) # ------Screenshot-2----------- ss.ScreenShot(ss_path + "test_08_nfs_mnist_manual_elapsedtime.png") sleep(2) assert isinstance(myElem.text, object) print("Mnist Manual -", str(myElem.text)) for logs in driver1.get_log('browser'): print(logs) try: pass except Exception as e: print("Exception Occurred :" + str(e)) # ---------Logout ---------------- self.driver1.find_element_by_id("navbarDropdownMenuLink").click() logout = self.driver1.find_element_by_class_name("dropdown-item") logout.click() sleep(5) for Logedout in self.driver1.find_elements_by_xpath( "//*[@class='alert alert-success']"): assert isinstance(Logedout.text, object) print(str(Logedout.text))
def test_inferencing_dog_classification_auto(self): # Second browser driver1 driver1 = self.driver1 # self.driver1.get("http://52.34.222.154:3050/users/login") myurl = Myurl(self.driver1) myurl.access_url() driver1.implicitly_wait(10) print("This is Title name :", driver1.title) #ScreenShot Relative Path ss_path = '/K8s_UI/' #Creating object of screenshot utility ss = SS(driver1) # ------- Login Details ------------ user = LoginUsers() Admin = user.user1_name Pwd = user.user1_password expadmin = user.user1_expadmin exppass = user.user1_exppass # ------ local path ------------ paths = Paths() inf_path = paths.Inference_path admin_login = AdminLogin(driver1) admin_login.set_login_uname(Admin) admin_login.set_login_upass(Pwd) sleep(3) # sub = self.driver1.find_element_by_tag_name("button") # sub.click() # setcookie = pickle.dump(self.driver1.get_cookies(), open("cookies.pkl", "wb")) # print("setcookievalue :", setcookie) admin_login.submit_login(Admin, Pwd) sleep(5) if Admin == expadmin and Pwd == exppass: print("Login successful") else: assert print("Invalid credentials") # ---------Inferencing ----------------- sleep(2) inferencing = self.driver1.find_element(By.ID, 'INFERENCING') inferencing.click() sleep(1) # --------Frame work-------------- # f = self.driver1.find_element_by_class_name("f-image mxnet text-center") f = self.driver1.find_element_by_xpath( "//img[@src='/images/tenserflow.png']") f.click() print("Selected Tensorflow") sleep(2) # --------if you have compound class name you should write like this----------- inception = self.driver1.find_element_by_xpath( "//*[@class='card-body text-center font-weight-normal btnNext']") inception.click() sleep(1) print("Selected Inception") # -----------local folder--------------- local = self.driver1.find_element(By.ID, 'r100') local.click() sleep(1) localpath = self.driver1.find_element(By.ID, 'local_dir_path') localpath.send_keys(inf_path) sleep(2) # ----------GPU Auto -------- gpu = self.driver1.find_element(By.ID, 'r4') gpu.click() sleep(2) auto = self.driver1.find_element_by_id("r101") auto.click() sleep(2) # ------Screenshot-1----------- ss.ScreenShot(ss_path + "test_19_inferencing_dog_images_auto_setupscreen.png") # -------------------- setup btn ----------------- setupbtn = self.driver1.find_element(By.ID, 'setupbtn') setupbtn.click() sleep(24) # -------Datsets & Training ---------------- traindir = self.driver1.find_element(By.ID, 'inferencedirectory') trdirectory = Select(traindir) trdirectory.select_by_visible_text("dogs_breed_classification") sleep(2) trinfile = self.driver1.find_element(By.ID, 'infer_file_name') trfile = Select(trinfile) trfile.select_by_visible_text("classify.py") sleep(2) # --------- Train -------------------- train = self.driver1.find_element_by_xpath("//a[@href='#train']") train.click() sleep(2) Train = self.driver1.find_element(By.ID, 'train_id') Train.click() sleep(400) gpuTime = driver1.find_elements_by_id("gputime") for GpuUsage in gpuTime: assert isinstance(GpuUsage.text, object) print("Gpu Usage : ", str(GpuUsage.text)) sleep(440) # --------Elapsed Time ------------------- myElem = self.driver1.find_element_by_id("elapsedTime") myElem.click() sleep(1) # ------Screenshot-2----------- ss.ScreenShot(ss_path + "test_19_inferencing_dog_images_auto_elapsedtime.png") sleep(2) assert isinstance(myElem.text, object) print("dog_classification Auto -", str(myElem.text)) for logs in driver1.get_log('browser'): print(logs) try: pass except Exception as e: print("Exception Occurred :" + str(e)) # ---------Logout ---------------- self.driver1.find_element_by_id("navbarDropdownMenuLink").click() logout = self.driver1.find_element_by_class_name("dropdown-item") logout.click() sleep(5) for Logedout in self.driver1.find_elements_by_xpath( "//*[@class='alert alert-success']"): assert isinstance(Logedout.text, object) print(str(Logedout.text))