- commented wifi-switch logic

- wifi will not be turned off at end of testcases now

Signed-off-by: Sushant Bawiskar <sushant.bawiskar@candelatech.com>
This commit is contained in:
sushant
2021-12-13 22:34:30 +05:30
committed by Sushant Bawiskar
parent 18e91a4fe7
commit 226461ace9
2 changed files with 90 additions and 90 deletions

View File

@@ -1358,15 +1358,15 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa
print("Forgetting ssid") print("Forgetting ssid")
#------------------------------- Wifi Switch ---------------- #------------------------------- Wifi Switch ----------------
try: # try:
print("clicking on wifi switch") # print("clicking on wifi switch")
get_switch_element = driver.find_element_by_xpath( # get_switch_element = driver.find_element_by_xpath(
"//*[@resource-id='com.android.settings:id/switch_widget']") # "//*[@resource-id='com.android.settings:id/switch_widget']")
driver.implicitly_wait(2) # driver.implicitly_wait(2)
get_switch_element.click() # get_switch_element.click()
except: # except:
print("couldn't click on wifi switch") # print("couldn't click on wifi switch")
#allure.attach(name= body=str("couldn't click on wifi switch")) # #allure.attach(name= body=str("couldn't click on wifi switch"))
except: except:
print("Couldn't forget ssid") print("Couldn't forget ssid")
# closeApp(connData["appPackage-android"], setup_perfectoMobile) # closeApp(connData["appPackage-android"], setup_perfectoMobile)
@@ -2381,15 +2381,15 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM
print("Forgetting ssid") print("Forgetting ssid")
#------------------------------- Wifi Switch ---------------- #------------------------------- Wifi Switch ----------------
try: # try:
print("clicking on wifi switch") # print("clicking on wifi switch")
get_switch_element = driver.find_element_by_xpath( # get_switch_element = driver.find_element_by_xpath(
"//*[@resource-id='com.android.settings:id/switch_widget']") # "//*[@resource-id='com.android.settings:id/switch_widget']")
driver.implicitly_wait(2) # driver.implicitly_wait(2)
get_switch_element.click() # get_switch_element.click()
except: # except:
print("couldn't click on wifi switch") # print("couldn't click on wifi switch")
#allure.attach(name= body=str("couldn't click on wifi switch")) # #allure.attach(name= body=str("couldn't click on wifi switch"))
except: except:
print("Couldn't forget ssid") print("Couldn't forget ssid")
# closeApp(connData["appPackage-android"], setup_perfectoMobile) # closeApp(connData["appPackage-android"], setup_perfectoMobile)

View File

@@ -1121,42 +1121,42 @@ def get_ip_address_ios(request, WifiName, WifiPass, setup_perfectoMobile, connDa
print("error on ssid element") print("error on ssid element")
# --------------------To Turn on WIFi Switch if already OFF-------------------------------- # --------------------To Turn on WIFi Switch if already OFF--------------------------------
try: # try:
get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='1']") # get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='1']")
get_wifi_switch_element_text = get_wifi_switch_element.text # get_wifi_switch_element_text = get_wifi_switch_element.text
print("switch state is : ", get_wifi_switch_element_text) # print("switch state is : ", get_wifi_switch_element_text)
try: # try:
if get_wifi_switch_element_text == "1" or get_wifi_switch_element_text == 1: # if get_wifi_switch_element_text == "1" or get_wifi_switch_element_text == 1:
get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='1']") # get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='1']")
driver.implicitly_wait(1) # driver.implicitly_wait(1)
get_wifi_switch_element.click() # get_wifi_switch_element.click()
driver.implicitly_wait(1) # driver.implicitly_wait(1)
i = 0 # i = 0
for i in range(5): # for i in range(5):
try: # try:
get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='0']") # get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='0']")
get_wifi_switch_element_text = get_wifi_switch_element.text # get_wifi_switch_element_text = get_wifi_switch_element.text
except: # except:
print("switch is ON") # print("switch is ON")
#
if get_wifi_switch_element_text == "0" or get_wifi_switch_element_text == 0: # if get_wifi_switch_element_text == "0" or get_wifi_switch_element_text == 0:
print("WIFI Switch is OFF") # print("WIFI Switch is OFF")
break # break
else: # else:
try: # try:
get_wifi_switch_element = driver.find_element_by_xpath( # get_wifi_switch_element = driver.find_element_by_xpath(
"//*[@label='Wi-Fi' and @value='1']") # "//*[@label='Wi-Fi' and @value='1']")
get_wifi_switch_element.click() # get_wifi_switch_element.click()
get_wifi_switch_element_text = get_wifi_switch_element.text # get_wifi_switch_element_text = get_wifi_switch_element.text
except: # except:
print("WIFi switch is OFF") # print("WIFi switch is OFF")
#
else: # else:
print("Switch is Still OFF") # print("Switch is Still OFF")
except: # except:
pass # pass
except: # except:
print("get_wifi_switch_element is ON") # print("get_wifi_switch_element is ON")
# --------------------To Turn on WIFi Switch if already OFF-------------------------------- # --------------------To Turn on WIFi Switch if already OFF--------------------------------
except Exception as e: except Exception as e:
@@ -1866,42 +1866,42 @@ def get_ip_address_eap_ios(request, WifiName, User, ttls_passwd, setup_perfectoM
print("error on ssid element") print("error on ssid element")
# --------------------To Turn on WIFi Switch if already OFF-------------------------------- # --------------------To Turn on WIFi Switch if already OFF--------------------------------
try: # try:
get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='1']") # get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='1']")
get_wifi_switch_element_text = get_wifi_switch_element.text # get_wifi_switch_element_text = get_wifi_switch_element.text
print("switch state is : ", get_wifi_switch_element_text) # print("switch state is : ", get_wifi_switch_element_text)
try: # try:
if get_wifi_switch_element_text == "1" or get_wifi_switch_element_text == 1: # if get_wifi_switch_element_text == "1" or get_wifi_switch_element_text == 1:
get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='1']") # get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='1']")
driver.implicitly_wait(1) # driver.implicitly_wait(1)
get_wifi_switch_element.click() # get_wifi_switch_element.click()
driver.implicitly_wait(1) # driver.implicitly_wait(1)
i = 0 # i = 0
for i in range(5): # for i in range(5):
try: # try:
get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='0']") # get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='0']")
get_wifi_switch_element_text = get_wifi_switch_element.text # get_wifi_switch_element_text = get_wifi_switch_element.text
except: # except:
print("switch is ON") # print("switch is ON")
#
if get_wifi_switch_element_text == "0" or get_wifi_switch_element_text == 0: # if get_wifi_switch_element_text == "0" or get_wifi_switch_element_text == 0:
print("WIFI Switch is OFF") # print("WIFI Switch is OFF")
break # break
else: # else:
try: # try:
get_wifi_switch_element = driver.find_element_by_xpath( # get_wifi_switch_element = driver.find_element_by_xpath(
"//*[@label='Wi-Fi' and @value='1']") # "//*[@label='Wi-Fi' and @value='1']")
get_wifi_switch_element.click() # get_wifi_switch_element.click()
get_wifi_switch_element_text = get_wifi_switch_element.text # get_wifi_switch_element_text = get_wifi_switch_element.text
except: # except:
print("WIFi switch is OFF") # print("WIFi switch is OFF")
#
else: # else:
print("Switch is Still OFF") # print("Switch is Still OFF")
except: # except:
pass # pass
except: # except:
print("get_wifi_switch_element is ON") # print("get_wifi_switch_element is ON")
# --------------------To Turn on WIFi Switch if already OFF-------------------------------- # --------------------To Turn on WIFi Switch if already OFF--------------------------------
except Exception as e: except Exception as e: