mirror of
https://github.com/Telecominfraproject/wlan-testing.git
synced 2025-11-02 11:57:49 +00:00
Wifi 7848 (#513)
* Updated the Client_reconnect library for Android Signed-off-by: haricharan-jaka <haricharan.jaka@candelatech.com> * Updated the Client_reconnect library for iOS Signed-off-by: haricharan-jaka <haricharan.jaka@candelatech.com> * Rectified the function name in testcase Signed-off-by: haricharan-jaka <haricharan.jaka@candelatech.com>
This commit is contained in:
@@ -5506,6 +5506,8 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf
|
|||||||
|
|
||||||
# Verify if WiFi is connected
|
# Verify if WiFi is connected
|
||||||
# -------------------------------------------------------
|
# -------------------------------------------------------
|
||||||
|
if get_phone_information(setup_perfectoMobile=setup_perfectoMobile,
|
||||||
|
search_this="osVersion") != "12":
|
||||||
try:
|
try:
|
||||||
report.step_start("Verify if Wifi is Connected")
|
report.step_start("Verify if Wifi is Connected")
|
||||||
WifiInternetErrMsg = WebDriverWait(driver, 35).until(
|
WifiInternetErrMsg = WebDriverWait(driver, 35).until(
|
||||||
@@ -5526,8 +5528,9 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf
|
|||||||
check_if_no_internet_popup(driver)
|
check_if_no_internet_popup(driver)
|
||||||
except:
|
except:
|
||||||
try:
|
try:
|
||||||
report.step_start("Verify if Wifi is Connected")
|
report.step_start("Verify if Wifi is Connected - 2")
|
||||||
WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located((
|
WifiInternetErrMsg = WebDriverWait(driver, 60).until(
|
||||||
|
EC.presence_of_element_located((
|
||||||
MobileBy.XPATH,
|
MobileBy.XPATH,
|
||||||
"//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']")))
|
"//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']")))
|
||||||
ssid_with_internet = True
|
ssid_with_internet = True
|
||||||
@@ -5536,6 +5539,37 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf
|
|||||||
print("Wifi Connection Error: " + WifiName)
|
print("Wifi Connection Error: " + WifiName)
|
||||||
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
return ip_address_element_text, ssid_with_internet
|
return ip_address_element_text, ssid_with_internet
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
report.step_start("Verifying wifi connection status connected/connected without internet")
|
||||||
|
check_if_no_internet_popup(driver)
|
||||||
|
check_if_no_internet_popup(driver)
|
||||||
|
|
||||||
|
wifi_connection_name = WebDriverWait(driver, 50).until(
|
||||||
|
EC.presence_of_element_located((MobileBy.XPATH,
|
||||||
|
"//*[@resource-id='com.android.settings:id/connected_list']/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.TextView[1]"
|
||||||
|
)))
|
||||||
|
if wifi_connection_name.text == WifiName:
|
||||||
|
wifi_connection_status = WebDriverWait(driver, 50).until(
|
||||||
|
EC.presence_of_element_located((MobileBy.XPATH,
|
||||||
|
"//*[@resource-id='com.android.settings:id/summary']"
|
||||||
|
)))
|
||||||
|
if wifi_connection_status.text == "Connected":
|
||||||
|
ssid_with_internet = True
|
||||||
|
print("Connected with internet")
|
||||||
|
|
||||||
|
else:
|
||||||
|
ssid_with_internet = False
|
||||||
|
print("Wifi Successfully Connected without internet")
|
||||||
|
check_if_no_internet_popup(driver)
|
||||||
|
# Go into additional details here
|
||||||
|
else:
|
||||||
|
# Connected to some other wifi, makes sense to close app and fail this testcase
|
||||||
|
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
return ip_address_element_text, ssid_with_internet
|
||||||
|
except:
|
||||||
|
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
return ip_address_element_text, ssid_with_internet
|
||||||
# -------------------------------------------------------
|
# -------------------------------------------------------
|
||||||
|
|
||||||
# Get into Additional Details
|
# Get into Additional Details
|
||||||
@@ -5543,6 +5577,8 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf
|
|||||||
# To Forget connection
|
# To Forget connection
|
||||||
# To turn off auto. connect
|
# To turn off auto. connect
|
||||||
# -------------------------------------------------------
|
# -------------------------------------------------------
|
||||||
|
if get_phone_information(setup_perfectoMobile=setup_perfectoMobile,
|
||||||
|
search_this="osVersion") != "12":
|
||||||
try:
|
try:
|
||||||
print("Into additional details")
|
print("Into additional details")
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
@@ -5564,27 +5600,171 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf
|
|||||||
print("Device IP address is :", ip_address_element_text)
|
print("Device IP address is :", ip_address_element_text)
|
||||||
except:
|
except:
|
||||||
print("IP address element not found")
|
print("IP address element not found")
|
||||||
|
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
assert False
|
||||||
# allure.attach(name= body=str("IP address element not found"))
|
# allure.attach(name= body=str("IP address element not found"))
|
||||||
|
# --------------------Added for ssid security check--------------------------
|
||||||
# closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
try:
|
||||||
# return ip_address_element_text, ssid_with_internet
|
time.sleep(2)
|
||||||
|
security_name_element = driver.find_element_by_xpath(
|
||||||
|
"//*[@text='Security']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']")
|
||||||
|
security_name_element_text = security_name_element.text
|
||||||
|
print("Ssid security is :", security_name_element_text)
|
||||||
|
allure.attach(name="Ssid Security:", body=str(security_name_element_text))
|
||||||
|
except:
|
||||||
|
print("Security is not available")
|
||||||
|
# --------------------Added for ssid Name check--------------------------
|
||||||
|
try:
|
||||||
|
time.sleep(2)
|
||||||
|
ssid_name_element = driver.find_element_by_xpath(
|
||||||
|
"//*[@resource-id='com.android.settings:id/entity_header_title']")
|
||||||
|
ssid_name_element_text = ssid_name_element.text
|
||||||
|
print("Ssid Name is :", ssid_name_element_text)
|
||||||
|
allure.attach(name="Ssid connected:", body=str(ssid_name_element_text))
|
||||||
|
except:
|
||||||
|
print("Ssid name not available")
|
||||||
|
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
assert False
|
||||||
|
if (ssid_name_element_text == WifiName):
|
||||||
|
print("Wifi is connected to the expected ssid")
|
||||||
|
else:
|
||||||
|
print("Wifi is not connected to the expected ssid")
|
||||||
|
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
assert False
|
||||||
try:
|
try:
|
||||||
check_if_no_internet_popup(driver)
|
check_if_no_internet_popup(driver)
|
||||||
driver.implicitly_wait(3)
|
driver.implicitly_wait(3)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
auto_reconnect_off = driver.find("//*[@resource-id='android:id/switch_widget']")
|
auto_reconnect_off = driver.find("//*[@resource-id='android:id/switch_widget']")
|
||||||
auto_reconnect_off_text = auto_reconnect_off.text
|
auto_reconnect_off_text = auto_reconnect_off.text
|
||||||
if auto_reconnect_off_text != "On":
|
if auto_reconnect_off_text != "Off":
|
||||||
auto_reconnect_off.click()
|
auto_reconnect_off.click()
|
||||||
print("Auto reconnect turning on")
|
print("Auto reconnect turning off")
|
||||||
else:
|
else:
|
||||||
print("Auto reconnect is already on")
|
print("Auto reconnect is already off")
|
||||||
except:
|
except:
|
||||||
print("Couldn't find auto reconnect element")
|
print("Couldn't find auto reconnect element")
|
||||||
|
|
||||||
|
# ------------------------------- Forget SSID ----------------
|
||||||
|
try:
|
||||||
|
check_if_no_internet_popup(driver)
|
||||||
|
forget_ssid = driver.find_element_by_xpath(
|
||||||
|
"//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']")
|
||||||
|
forget_ssid.click()
|
||||||
|
print("Forgetting ssid")
|
||||||
|
|
||||||
|
# ------------------------------- Wifi Switch ----------------
|
||||||
|
# try:
|
||||||
|
# print("clicking on wifi switch")
|
||||||
|
# get_switch_element = driver.find_element_by_xpath(
|
||||||
|
# "//*[@resource-id='com.android.settings:id/switch_widget']")
|
||||||
|
# driver.implicitly_wait(2)
|
||||||
|
# get_switch_element.click()
|
||||||
|
# except:
|
||||||
|
# print("couldn't click on wifi switch")
|
||||||
|
# #allure.attach(name= body=str("couldn't click on wifi switch"))
|
||||||
|
except:
|
||||||
|
print("Couldn't forget ssid")
|
||||||
|
# closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
# return ip_address_element_text, ssid_with_internet
|
||||||
except:
|
except:
|
||||||
print("Couldn't get into Additional settings")
|
print("Couldn't get into Additional settings")
|
||||||
# -------------------------------------------------------
|
# -------------------------------------------------------
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
print("Into additional details")
|
||||||
|
time.sleep(2)
|
||||||
|
additional_details_element = driver.find_element_by_xpath(
|
||||||
|
"//*[@resource-id='com.android.settings:id/wifi_details']")
|
||||||
|
additional_details_element.click()
|
||||||
|
|
||||||
|
try:
|
||||||
|
print("click on view more")
|
||||||
|
additional_details_element = WebDriverWait(driver, 50).until(
|
||||||
|
EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='View more']")))
|
||||||
|
additional_details_element.click()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
time.sleep(2)
|
||||||
|
ssid_name_element = driver.find_element_by_xpath(
|
||||||
|
"//*[@resource-id='com.android.settings:id/entity_header_title']")
|
||||||
|
ssid_name_element_text = ssid_name_element.text
|
||||||
|
print("Ssid Name is :", ssid_name_element_text)
|
||||||
|
allure.attach(name="Ssid connected:", body=str(ssid_name_element_text))
|
||||||
|
except:
|
||||||
|
print("Ssid name not available")
|
||||||
|
pass
|
||||||
|
|
||||||
|
if (ssid_name_element_text == WifiName):
|
||||||
|
print("Wifi is connected to the expected ssid")
|
||||||
|
ip_address_element_text = "SSID Match, S20 Does Not support scrolling"
|
||||||
|
ssid_with_internet = "SSID Match, S20 Does Not support scrolling"
|
||||||
|
# return ip_address_element_text, ssid_with_internet
|
||||||
|
else:
|
||||||
|
print("Wifi is not connected to the expected ssid")
|
||||||
|
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
|
||||||
|
report.step_start("Scrolling for ip address - 1")
|
||||||
|
# if deviceModelName == "Galaxy S20":
|
||||||
|
# print("Scrolling for S20")
|
||||||
|
driver.swipe(470, 1400, 470, 1000, 400)
|
||||||
|
# else:
|
||||||
|
# scrollDown(setup_perfectoMobile)
|
||||||
|
|
||||||
|
report.step_start("Scrolling for ip address - 2")
|
||||||
|
# if deviceModelName == "Galaxy S20":
|
||||||
|
# print("Scrolling for S20")
|
||||||
|
driver.swipe(470, 1400, 470, 1000, 400)
|
||||||
|
# else:
|
||||||
|
# scrollDown(setup_perfectoMobile)
|
||||||
|
|
||||||
|
report.step_start("Scrolling for ip address - 3")
|
||||||
|
# if deviceModelName == "Galaxy S20":
|
||||||
|
# print("Scrolling for S20")
|
||||||
|
driver.swipe(470, 1400, 470, 1000, 400)
|
||||||
|
# else:
|
||||||
|
# scrollDown(setup_perfectoMobile)
|
||||||
|
report.step_start("looking for ip address")
|
||||||
|
|
||||||
|
try:
|
||||||
|
ip_address_element_text = driver.find_element_by_xpath(
|
||||||
|
"//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[4]/android.widget.RelativeLayout[1]/android.widget.TextView[2]")
|
||||||
|
ip_address_element_text = ip_address_element_text.text
|
||||||
|
ssid_with_internet = True
|
||||||
|
except:
|
||||||
|
print("Unable to get IP address")
|
||||||
|
pass
|
||||||
|
|
||||||
|
# report.step_start("Forget SSID")
|
||||||
|
#
|
||||||
|
# try:
|
||||||
|
# check_if_no_internet_popup(driver)
|
||||||
|
# forget_ssid = driver.find_element_by_xpath(
|
||||||
|
# "//*[@text='Forget']")
|
||||||
|
# forget_ssid.click()
|
||||||
|
# print("Forgetting ssid")
|
||||||
|
#
|
||||||
|
# # ------------------------------- Wifi Switch ----------------
|
||||||
|
# # try:
|
||||||
|
# # print("clicking on wifi switch")
|
||||||
|
# # get_switch_element = driver.find_element_by_xpath(
|
||||||
|
# # "//*[@resource-id='com.android.settings:id/switch_widget']")
|
||||||
|
# # driver.implicitly_wait(2)
|
||||||
|
# # get_switch_element.click()
|
||||||
|
# # except:
|
||||||
|
# # print("couldn't click on wifi switch")
|
||||||
|
# # #allure.attach(name= body=str("couldn't click on wifi switch"))
|
||||||
|
# except:
|
||||||
|
# print("Couldn't forget ssid")
|
||||||
|
# closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
# return ip_address_element_text, ssid_with_internet
|
||||||
|
except:
|
||||||
|
print("Couldn't get into Additional settings")
|
||||||
|
# -------------------------------------------------------
|
||||||
|
|
||||||
|
# -------------------------------------------------------
|
||||||
except:
|
except:
|
||||||
print("No Switch element found")
|
print("No Switch element found")
|
||||||
# ---------------------To Turn on WIFi Switch if already OFF-------------------------------
|
# ---------------------To Turn on WIFi Switch if already OFF-------------------------------
|
||||||
@@ -5595,7 +5775,6 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf
|
|||||||
|
|
||||||
except:
|
except:
|
||||||
print("Exception: Verify Xpath - Update/check Xpath for Click Connections")
|
print("Exception: Verify Xpath - Update/check Xpath for Click Connections")
|
||||||
# -----------------To Open Connections page---------------------------
|
|
||||||
#--------------------Pixel 4 code---------------------------
|
#--------------------Pixel 4 code---------------------------
|
||||||
else:
|
else:
|
||||||
report.step_start("Set Wifi Network to " + WifiName)
|
report.step_start("Set Wifi Network to " + WifiName)
|
||||||
@@ -6124,6 +6303,8 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw
|
|||||||
|
|
||||||
# Verify if WiFi is connected
|
# Verify if WiFi is connected
|
||||||
# -------------------------------------------------------
|
# -------------------------------------------------------
|
||||||
|
if get_phone_information(setup_perfectoMobile=setup_perfectoMobile,
|
||||||
|
search_this="osVersion") != "12":
|
||||||
try:
|
try:
|
||||||
report.step_start("Verify if Wifi is Connected")
|
report.step_start("Verify if Wifi is Connected")
|
||||||
WifiInternetErrMsg = WebDriverWait(driver, 35).until(
|
WifiInternetErrMsg = WebDriverWait(driver, 35).until(
|
||||||
@@ -6144,8 +6325,9 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw
|
|||||||
check_if_no_internet_popup(driver)
|
check_if_no_internet_popup(driver)
|
||||||
except:
|
except:
|
||||||
try:
|
try:
|
||||||
report.step_start("Verify if Wifi is Connected")
|
report.step_start("Verify if Wifi is Connected - 2")
|
||||||
WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located((
|
WifiInternetErrMsg = WebDriverWait(driver, 60).until(
|
||||||
|
EC.presence_of_element_located((
|
||||||
MobileBy.XPATH,
|
MobileBy.XPATH,
|
||||||
"//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']")))
|
"//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']")))
|
||||||
ssid_with_internet = True
|
ssid_with_internet = True
|
||||||
@@ -6154,6 +6336,37 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw
|
|||||||
print("Wifi Connection Error: " + WifiName)
|
print("Wifi Connection Error: " + WifiName)
|
||||||
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
return ip_address_element_text, ssid_with_internet
|
return ip_address_element_text, ssid_with_internet
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
report.step_start("Verifying wifi connection status connected/connected without internet")
|
||||||
|
check_if_no_internet_popup(driver)
|
||||||
|
check_if_no_internet_popup(driver)
|
||||||
|
|
||||||
|
wifi_connection_name = WebDriverWait(driver, 50).until(
|
||||||
|
EC.presence_of_element_located((MobileBy.XPATH,
|
||||||
|
"//*[@resource-id='com.android.settings:id/connected_list']/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.TextView[1]"
|
||||||
|
)))
|
||||||
|
if wifi_connection_name.text == WifiName:
|
||||||
|
wifi_connection_status = WebDriverWait(driver, 50).until(
|
||||||
|
EC.presence_of_element_located((MobileBy.XPATH,
|
||||||
|
"//*[@resource-id='com.android.settings:id/summary']"
|
||||||
|
)))
|
||||||
|
if wifi_connection_status.text == "Connected":
|
||||||
|
ssid_with_internet = True
|
||||||
|
print("Connected with internet")
|
||||||
|
|
||||||
|
else:
|
||||||
|
ssid_with_internet = False
|
||||||
|
print("Wifi Successfully Connected without internet")
|
||||||
|
check_if_no_internet_popup(driver)
|
||||||
|
# Go into additional details here
|
||||||
|
else:
|
||||||
|
# Connected to some other wifi, makes sense to close app and fail this testcase
|
||||||
|
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
return ip_address_element_text, ssid_with_internet
|
||||||
|
except:
|
||||||
|
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
return ip_address_element_text, ssid_with_internet
|
||||||
# -------------------------------------------------------
|
# -------------------------------------------------------
|
||||||
|
|
||||||
# Get into Additional Details
|
# Get into Additional Details
|
||||||
@@ -6161,6 +6374,8 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw
|
|||||||
# To Forget connection
|
# To Forget connection
|
||||||
# To turn off auto. connect
|
# To turn off auto. connect
|
||||||
# -------------------------------------------------------
|
# -------------------------------------------------------
|
||||||
|
if get_phone_information(setup_perfectoMobile=setup_perfectoMobile,
|
||||||
|
search_this="osVersion") != "12":
|
||||||
try:
|
try:
|
||||||
print("Into additional details")
|
print("Into additional details")
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
@@ -6182,27 +6397,171 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw
|
|||||||
print("Device IP address is :", ip_address_element_text)
|
print("Device IP address is :", ip_address_element_text)
|
||||||
except:
|
except:
|
||||||
print("IP address element not found")
|
print("IP address element not found")
|
||||||
|
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
assert False
|
||||||
# allure.attach(name= body=str("IP address element not found"))
|
# allure.attach(name= body=str("IP address element not found"))
|
||||||
|
# --------------------Added for ssid security check--------------------------
|
||||||
# closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
try:
|
||||||
# return ip_address_element_text, ssid_with_internet
|
time.sleep(2)
|
||||||
|
security_name_element = driver.find_element_by_xpath(
|
||||||
|
"//*[@text='Security']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']")
|
||||||
|
security_name_element_text = security_name_element.text
|
||||||
|
print("Ssid security is :", security_name_element_text)
|
||||||
|
allure.attach(name="Ssid Security:", body=str(security_name_element_text))
|
||||||
|
except:
|
||||||
|
print("Security is not available")
|
||||||
|
# --------------------Added for ssid Name check--------------------------
|
||||||
|
try:
|
||||||
|
time.sleep(2)
|
||||||
|
ssid_name_element = driver.find_element_by_xpath(
|
||||||
|
"//*[@resource-id='com.android.settings:id/entity_header_title']")
|
||||||
|
ssid_name_element_text = ssid_name_element.text
|
||||||
|
print("Ssid Name is :", ssid_name_element_text)
|
||||||
|
allure.attach(name="Ssid connected:", body=str(ssid_name_element_text))
|
||||||
|
except:
|
||||||
|
print("Ssid name not available")
|
||||||
|
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
assert False
|
||||||
|
if (ssid_name_element_text == WifiName):
|
||||||
|
print("Wifi is connected to the expected ssid")
|
||||||
|
else:
|
||||||
|
print("Wifi is not connected to the expected ssid")
|
||||||
|
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
assert False
|
||||||
try:
|
try:
|
||||||
check_if_no_internet_popup(driver)
|
check_if_no_internet_popup(driver)
|
||||||
driver.implicitly_wait(3)
|
driver.implicitly_wait(3)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
auto_reconnect_off = driver.find("//*[@resource-id='android:id/switch_widget']")
|
auto_reconnect_off = driver.find("//*[@resource-id='android:id/switch_widget']")
|
||||||
auto_reconnect_off_text = auto_reconnect_off.text
|
auto_reconnect_off_text = auto_reconnect_off.text
|
||||||
if auto_reconnect_off_text != "On":
|
if auto_reconnect_off_text != "Off":
|
||||||
auto_reconnect_off.click()
|
auto_reconnect_off.click()
|
||||||
print("Auto reconnect turning on")
|
print("Auto reconnect turning off")
|
||||||
else:
|
else:
|
||||||
print("Auto reconnect is already on")
|
print("Auto reconnect is already off")
|
||||||
except:
|
except:
|
||||||
print("Couldn't find auto reconnect element")
|
print("Couldn't find auto reconnect element")
|
||||||
|
|
||||||
|
# ------------------------------- Forget SSID ----------------
|
||||||
|
try:
|
||||||
|
check_if_no_internet_popup(driver)
|
||||||
|
forget_ssid = driver.find_element_by_xpath(
|
||||||
|
"//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']")
|
||||||
|
forget_ssid.click()
|
||||||
|
print("Forgetting ssid")
|
||||||
|
|
||||||
|
# ------------------------------- Wifi Switch ----------------
|
||||||
|
# try:
|
||||||
|
# print("clicking on wifi switch")
|
||||||
|
# get_switch_element = driver.find_element_by_xpath(
|
||||||
|
# "//*[@resource-id='com.android.settings:id/switch_widget']")
|
||||||
|
# driver.implicitly_wait(2)
|
||||||
|
# get_switch_element.click()
|
||||||
|
# except:
|
||||||
|
# print("couldn't click on wifi switch")
|
||||||
|
# #allure.attach(name= body=str("couldn't click on wifi switch"))
|
||||||
|
except:
|
||||||
|
print("Couldn't forget ssid")
|
||||||
|
# closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
# return ip_address_element_text, ssid_with_internet
|
||||||
except:
|
except:
|
||||||
print("Couldn't get into Additional settings")
|
print("Couldn't get into Additional settings")
|
||||||
# -------------------------------------------------------
|
# -------------------------------------------------------
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
print("Into additional details")
|
||||||
|
time.sleep(2)
|
||||||
|
additional_details_element = driver.find_element_by_xpath(
|
||||||
|
"//*[@resource-id='com.android.settings:id/wifi_details']")
|
||||||
|
additional_details_element.click()
|
||||||
|
|
||||||
|
try:
|
||||||
|
print("click on view more")
|
||||||
|
additional_details_element = WebDriverWait(driver, 50).until(
|
||||||
|
EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='View more']")))
|
||||||
|
additional_details_element.click()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
time.sleep(2)
|
||||||
|
ssid_name_element = driver.find_element_by_xpath(
|
||||||
|
"//*[@resource-id='com.android.settings:id/entity_header_title']")
|
||||||
|
ssid_name_element_text = ssid_name_element.text
|
||||||
|
print("Ssid Name is :", ssid_name_element_text)
|
||||||
|
allure.attach(name="Ssid connected:", body=str(ssid_name_element_text))
|
||||||
|
except:
|
||||||
|
print("Ssid name not available")
|
||||||
|
pass
|
||||||
|
|
||||||
|
if (ssid_name_element_text == WifiName):
|
||||||
|
print("Wifi is connected to the expected ssid")
|
||||||
|
ip_address_element_text = "SSID Match, S20 Does Not support scrolling"
|
||||||
|
ssid_with_internet = "SSID Match, S20 Does Not support scrolling"
|
||||||
|
# return ip_address_element_text, ssid_with_internet
|
||||||
|
else:
|
||||||
|
print("Wifi is not connected to the expected ssid")
|
||||||
|
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
|
||||||
|
report.step_start("Scrolling for ip address - 1")
|
||||||
|
# if deviceModelName == "Galaxy S20":
|
||||||
|
# print("Scrolling for S20")
|
||||||
|
driver.swipe(470, 1400, 470, 1000, 400)
|
||||||
|
# else:
|
||||||
|
# scrollDown(setup_perfectoMobile)
|
||||||
|
|
||||||
|
report.step_start("Scrolling for ip address - 2")
|
||||||
|
# if deviceModelName == "Galaxy S20":
|
||||||
|
# print("Scrolling for S20")
|
||||||
|
driver.swipe(470, 1400, 470, 1000, 400)
|
||||||
|
# else:
|
||||||
|
# scrollDown(setup_perfectoMobile)
|
||||||
|
|
||||||
|
report.step_start("Scrolling for ip address - 3")
|
||||||
|
# if deviceModelName == "Galaxy S20":
|
||||||
|
# print("Scrolling for S20")
|
||||||
|
driver.swipe(470, 1400, 470, 1000, 400)
|
||||||
|
# else:
|
||||||
|
# scrollDown(setup_perfectoMobile)
|
||||||
|
report.step_start("looking for ip address")
|
||||||
|
|
||||||
|
try:
|
||||||
|
ip_address_element_text = driver.find_element_by_xpath(
|
||||||
|
"//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[4]/android.widget.RelativeLayout[1]/android.widget.TextView[2]")
|
||||||
|
ip_address_element_text = ip_address_element_text.text
|
||||||
|
ssid_with_internet = True
|
||||||
|
except:
|
||||||
|
print("Unable to get IP address")
|
||||||
|
pass
|
||||||
|
|
||||||
|
# report.step_start("Forget SSID")
|
||||||
|
#
|
||||||
|
# try:
|
||||||
|
# check_if_no_internet_popup(driver)
|
||||||
|
# forget_ssid = driver.find_element_by_xpath(
|
||||||
|
# "//*[@text='Forget']")
|
||||||
|
# forget_ssid.click()
|
||||||
|
# print("Forgetting ssid")
|
||||||
|
#
|
||||||
|
# # ------------------------------- Wifi Switch ----------------
|
||||||
|
# # try:
|
||||||
|
# # print("clicking on wifi switch")
|
||||||
|
# # get_switch_element = driver.find_element_by_xpath(
|
||||||
|
# # "//*[@resource-id='com.android.settings:id/switch_widget']")
|
||||||
|
# # driver.implicitly_wait(2)
|
||||||
|
# # get_switch_element.click()
|
||||||
|
# # except:
|
||||||
|
# # print("couldn't click on wifi switch")
|
||||||
|
# # #allure.attach(name= body=str("couldn't click on wifi switch"))
|
||||||
|
# except:
|
||||||
|
# print("Couldn't forget ssid")
|
||||||
|
# closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
# return ip_address_element_text, ssid_with_internet
|
||||||
|
except:
|
||||||
|
print("Couldn't get into Additional settings")
|
||||||
|
# -------------------------------------------------------
|
||||||
|
|
||||||
|
# -------------------------------------------------------
|
||||||
except:
|
except:
|
||||||
print("No Switch element found")
|
print("No Switch element found")
|
||||||
# ---------------------To Turn on WIFi Switch if already OFF-------------------------------
|
# ---------------------To Turn on WIFi Switch if already OFF-------------------------------
|
||||||
@@ -6213,7 +6572,6 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw
|
|||||||
|
|
||||||
except:
|
except:
|
||||||
print("Exception: Verify Xpath - Update/check Xpath for Click Connections")
|
print("Exception: Verify Xpath - Update/check Xpath for Click Connections")
|
||||||
# -----------------To Open Connections page---------------------------
|
|
||||||
else: #--------------------Pixel code-----------------------------------
|
else: #--------------------Pixel code-----------------------------------
|
||||||
report.step_start("Set Wifi Network to " + WifiName)
|
report.step_start("Set Wifi Network to " + WifiName)
|
||||||
|
|
||||||
@@ -6637,6 +6995,10 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup
|
|||||||
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
return ip_address_element_text, ssid_with_internet
|
return ip_address_element_text, ssid_with_internet
|
||||||
# -------------------------------------------------------
|
# -------------------------------------------------------
|
||||||
|
# Verify if WiFi is connected
|
||||||
|
# -------------------------------------------------------
|
||||||
|
if get_phone_information(setup_perfectoMobile=setup_perfectoMobile,
|
||||||
|
search_this="osVersion") != "12":
|
||||||
try:
|
try:
|
||||||
report.step_start("Verify if Wifi is Connected")
|
report.step_start("Verify if Wifi is Connected")
|
||||||
WifiInternetErrMsg = WebDriverWait(driver, 35).until(
|
WifiInternetErrMsg = WebDriverWait(driver, 35).until(
|
||||||
@@ -6657,8 +7019,9 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup
|
|||||||
check_if_no_internet_popup(driver)
|
check_if_no_internet_popup(driver)
|
||||||
except:
|
except:
|
||||||
try:
|
try:
|
||||||
report.step_start("Verify if Wifi is Connected")
|
report.step_start("Verify if Wifi is Connected - 2")
|
||||||
WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located((
|
WifiInternetErrMsg = WebDriverWait(driver, 60).until(
|
||||||
|
EC.presence_of_element_located((
|
||||||
MobileBy.XPATH,
|
MobileBy.XPATH,
|
||||||
"//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']")))
|
"//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']")))
|
||||||
ssid_with_internet = True
|
ssid_with_internet = True
|
||||||
@@ -6667,6 +7030,38 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup
|
|||||||
print("Wifi Connection Error: " + WifiName)
|
print("Wifi Connection Error: " + WifiName)
|
||||||
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
return ip_address_element_text, ssid_with_internet
|
return ip_address_element_text, ssid_with_internet
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
report.step_start(
|
||||||
|
"Verifying wifi connection status connected/connected without internet")
|
||||||
|
check_if_no_internet_popup(driver)
|
||||||
|
check_if_no_internet_popup(driver)
|
||||||
|
|
||||||
|
wifi_connection_name = WebDriverWait(driver, 50).until(
|
||||||
|
EC.presence_of_element_located((MobileBy.XPATH,
|
||||||
|
"//*[@resource-id='com.android.settings:id/connected_list']/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.TextView[1]"
|
||||||
|
)))
|
||||||
|
if wifi_connection_name.text == WifiName:
|
||||||
|
wifi_connection_status = WebDriverWait(driver, 50).until(
|
||||||
|
EC.presence_of_element_located((MobileBy.XPATH,
|
||||||
|
"//*[@resource-id='com.android.settings:id/summary']"
|
||||||
|
)))
|
||||||
|
if wifi_connection_status.text == "Connected":
|
||||||
|
ssid_with_internet = True
|
||||||
|
print("Connected with internet")
|
||||||
|
|
||||||
|
else:
|
||||||
|
ssid_with_internet = False
|
||||||
|
print("Wifi Successfully Connected without internet")
|
||||||
|
check_if_no_internet_popup(driver)
|
||||||
|
# Go into additional details here
|
||||||
|
else:
|
||||||
|
# Connected to some other wifi, makes sense to close app and fail this testcase
|
||||||
|
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
return ip_address_element_text, ssid_with_internet
|
||||||
|
except:
|
||||||
|
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
return ip_address_element_text, ssid_with_internet
|
||||||
# -------------------------------------------------------
|
# -------------------------------------------------------
|
||||||
|
|
||||||
# Get into Additional Details
|
# Get into Additional Details
|
||||||
@@ -6674,6 +7069,8 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup
|
|||||||
# To Forget connection
|
# To Forget connection
|
||||||
# To turn off auto. connect
|
# To turn off auto. connect
|
||||||
# -------------------------------------------------------
|
# -------------------------------------------------------
|
||||||
|
if get_phone_information(setup_perfectoMobile=setup_perfectoMobile,
|
||||||
|
search_this="osVersion") != "12":
|
||||||
try:
|
try:
|
||||||
print("Into additional details")
|
print("Into additional details")
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
@@ -6695,11 +7092,37 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup
|
|||||||
print("Device IP address is :", ip_address_element_text)
|
print("Device IP address is :", ip_address_element_text)
|
||||||
except:
|
except:
|
||||||
print("IP address element not found")
|
print("IP address element not found")
|
||||||
|
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
assert False
|
||||||
# allure.attach(name= body=str("IP address element not found"))
|
# allure.attach(name= body=str("IP address element not found"))
|
||||||
|
# --------------------Added for ssid security check--------------------------
|
||||||
# closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
try:
|
||||||
# return ip_address_element_text, ssid_with_internet
|
time.sleep(2)
|
||||||
|
security_name_element = driver.find_element_by_xpath(
|
||||||
|
"//*[@text='Security']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']")
|
||||||
|
security_name_element_text = security_name_element.text
|
||||||
|
print("Ssid security is :", security_name_element_text)
|
||||||
|
allure.attach(name="Ssid Security:", body=str(security_name_element_text))
|
||||||
|
except:
|
||||||
|
print("Security is not available")
|
||||||
|
# --------------------Added for ssid Name check--------------------------
|
||||||
|
try:
|
||||||
|
time.sleep(2)
|
||||||
|
ssid_name_element = driver.find_element_by_xpath(
|
||||||
|
"//*[@resource-id='com.android.settings:id/entity_header_title']")
|
||||||
|
ssid_name_element_text = ssid_name_element.text
|
||||||
|
print("Ssid Name is :", ssid_name_element_text)
|
||||||
|
allure.attach(name="Ssid connected:", body=str(ssid_name_element_text))
|
||||||
|
except:
|
||||||
|
print("Ssid name not available")
|
||||||
|
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
assert False
|
||||||
|
if (ssid_name_element_text == WifiName):
|
||||||
|
print("Wifi is connected to the expected ssid")
|
||||||
|
else:
|
||||||
|
print("Wifi is not connected to the expected ssid")
|
||||||
|
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
assert False
|
||||||
try:
|
try:
|
||||||
check_if_no_internet_popup(driver)
|
check_if_no_internet_popup(driver)
|
||||||
driver.implicitly_wait(3)
|
driver.implicitly_wait(3)
|
||||||
@@ -6739,17 +7162,108 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup
|
|||||||
except:
|
except:
|
||||||
print("Couldn't get into Additional settings")
|
print("Couldn't get into Additional settings")
|
||||||
# -------------------------------------------------------
|
# -------------------------------------------------------
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
print("Into additional details")
|
||||||
|
time.sleep(2)
|
||||||
|
additional_details_element = driver.find_element_by_xpath(
|
||||||
|
"//*[@resource-id='com.android.settings:id/wifi_details']")
|
||||||
|
additional_details_element.click()
|
||||||
|
|
||||||
|
try:
|
||||||
|
print("click on view more")
|
||||||
|
additional_details_element = WebDriverWait(driver, 50).until(
|
||||||
|
EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='View more']")))
|
||||||
|
additional_details_element.click()
|
||||||
except:
|
except:
|
||||||
print("No Switch element found")
|
pass
|
||||||
# ---------------------To Turn on WIFi Switch if already OFF-------------------------------
|
|
||||||
|
try:
|
||||||
|
time.sleep(2)
|
||||||
|
ssid_name_element = driver.find_element_by_xpath(
|
||||||
|
"//*[@resource-id='com.android.settings:id/entity_header_title']")
|
||||||
|
ssid_name_element_text = ssid_name_element.text
|
||||||
|
print("Ssid Name is :", ssid_name_element_text)
|
||||||
|
allure.attach(name="Ssid connected:", body=str(ssid_name_element_text))
|
||||||
|
except:
|
||||||
|
print("Ssid name not available")
|
||||||
|
pass
|
||||||
|
|
||||||
|
if (ssid_name_element_text == WifiName):
|
||||||
|
print("Wifi is connected to the expected ssid")
|
||||||
|
ip_address_element_text = "SSID Match, S20 Does Not support scrolling"
|
||||||
|
ssid_with_internet = "SSID Match, S20 Does Not support scrolling"
|
||||||
|
# return ip_address_element_text, ssid_with_internet
|
||||||
|
else:
|
||||||
|
print("Wifi is not connected to the expected ssid")
|
||||||
|
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
|
||||||
|
report.step_start("Scrolling for ip address - 1")
|
||||||
|
# if deviceModelName == "Galaxy S20":
|
||||||
|
# print("Scrolling for S20")
|
||||||
|
driver.swipe(470, 1400, 470, 1000, 400)
|
||||||
|
# else:
|
||||||
|
# scrollDown(setup_perfectoMobile)
|
||||||
|
|
||||||
|
report.step_start("Scrolling for ip address - 2")
|
||||||
|
# if deviceModelName == "Galaxy S20":
|
||||||
|
# print("Scrolling for S20")
|
||||||
|
driver.swipe(470, 1400, 470, 1000, 400)
|
||||||
|
# else:
|
||||||
|
# scrollDown(setup_perfectoMobile)
|
||||||
|
|
||||||
|
report.step_start("Scrolling for ip address - 3")
|
||||||
|
# if deviceModelName == "Galaxy S20":
|
||||||
|
# print("Scrolling for S20")
|
||||||
|
driver.swipe(470, 1400, 470, 1000, 400)
|
||||||
|
# else:
|
||||||
|
# scrollDown(setup_perfectoMobile)
|
||||||
|
report.step_start("looking for ip address")
|
||||||
|
|
||||||
|
try:
|
||||||
|
ip_address_element_text = driver.find_element_by_xpath(
|
||||||
|
"//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[4]/android.widget.RelativeLayout[1]/android.widget.TextView[2]")
|
||||||
|
ip_address_element_text = ip_address_element_text.text
|
||||||
|
ssid_with_internet = True
|
||||||
|
except:
|
||||||
|
print("Unable to get IP address")
|
||||||
|
pass
|
||||||
|
|
||||||
|
report.step_start("Forget SSID")
|
||||||
|
|
||||||
|
try:
|
||||||
|
check_if_no_internet_popup(driver)
|
||||||
|
forget_ssid = driver.find_element_by_xpath(
|
||||||
|
"//*[@text='Forget']")
|
||||||
|
forget_ssid.click()
|
||||||
|
print("Forgetting ssid")
|
||||||
|
|
||||||
|
# ------------------------------- Wifi Switch ----------------
|
||||||
|
# try:
|
||||||
|
# print("clicking on wifi switch")
|
||||||
|
# get_switch_element = driver.find_element_by_xpath(
|
||||||
|
# "//*[@resource-id='com.android.settings:id/switch_widget']")
|
||||||
|
# driver.implicitly_wait(2)
|
||||||
|
# get_switch_element.click()
|
||||||
|
# except:
|
||||||
|
# print("couldn't click on wifi switch")
|
||||||
|
# #allure.attach(name= body=str("couldn't click on wifi switch"))
|
||||||
|
except:
|
||||||
|
print("Couldn't forget ssid")
|
||||||
|
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
return ip_address_element_text, ssid_with_internet
|
||||||
|
except:
|
||||||
|
print("Couldn't get into Additional settings")
|
||||||
|
# -------------------------------------------------------
|
||||||
|
|
||||||
except:
|
except:
|
||||||
print("Couldn't find wifi Button")
|
print("Couldn't find wifi Button")
|
||||||
# ------------------Open WIFI page----------------------------------
|
# ------------------Open WIFI page----------------------------------
|
||||||
|
except:
|
||||||
|
print("No Switch element found")
|
||||||
|
# ---------------------To Turn on WIFi Switch if already OFF-------------------------------
|
||||||
except:
|
except:
|
||||||
print("Exception: Verify Xpath - Update/check Xpath for Click Connections")
|
print("Exception: Verify Xpath - Update/check Xpath for Click Connections")
|
||||||
# -----------------To Open Connections page---------------------------
|
|
||||||
#--------------------Pixel 4 code---------------------------
|
#--------------------Pixel 4 code---------------------------
|
||||||
else:
|
else:
|
||||||
report.step_start("Set Wifi Network to " + WifiName)
|
report.step_start("Set Wifi Network to " + WifiName)
|
||||||
|
|||||||
@@ -2690,19 +2690,27 @@ def gets_ip_add_and_does_not_forget_ssid_ios(request, WifiName, WifiPass, setup_
|
|||||||
available_ssids = get_all_available_ssids(driver)
|
available_ssids = get_all_available_ssids(driver)
|
||||||
allure.attach(name="Available SSIDs in device: ", body=str(available_ssids))
|
allure.attach(name="Available SSIDs in device: ", body=str(available_ssids))
|
||||||
try:
|
try:
|
||||||
if WifiName not in available_ssids:
|
if (not ssid_Visible(driver, WifiName)) or (WifiName not in available_ssids):
|
||||||
scrollDown(setup_perfectoMobile)
|
scrollDown(setup_perfectoMobile)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
|
driver.implicitly_wait(8)
|
||||||
report.step_start("Selecting SSID To Connect")
|
report.step_start("Selecting SSID To Connect")
|
||||||
ssid_found = True
|
ssid_found = True
|
||||||
print(WifiName + " : Found in Device")
|
print(WifiName + " : Found in Device")
|
||||||
wifiSelElement = WebDriverWait(driver, 30).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='" + WifiName + "']")))
|
wifiSelElement = WebDriverWait(driver, 35).until(
|
||||||
|
EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='" + WifiName + "']")))
|
||||||
print(wifiSelElement)
|
print(wifiSelElement)
|
||||||
wifiSelElement.click()
|
wifiSelElement.click()
|
||||||
print("Selecting SSID")
|
print("Selecting SSID")
|
||||||
# allure.attach(name= body=str(WifiName + " : Found in Device"))
|
|
||||||
break
|
break
|
||||||
|
except:
|
||||||
|
print("SSID unable to select")
|
||||||
|
report.step_start("Selecting Unable SSID To Connect")
|
||||||
|
closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile)
|
||||||
|
return ip_address_element_text, is_internet
|
||||||
|
|
||||||
except:
|
except:
|
||||||
print("couldn't connect to " + WifiName)
|
print("couldn't connect to " + WifiName)
|
||||||
# request.config.cache.set(key="SelectingWifiFailed", value=str(e))
|
# request.config.cache.set(key="SelectingWifiFailed", value=str(e))
|
||||||
@@ -2792,6 +2800,7 @@ def gets_ip_add_and_does_not_forget_ssid_ios(request, WifiName, WifiPass, setup_
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("WiFi-Address not Found")
|
print("WiFi-Address not Found")
|
||||||
try:
|
try:
|
||||||
|
time.sleep(4)
|
||||||
report.step_start("Checking IP Address")
|
report.step_start("Checking IP Address")
|
||||||
print("Checking IP address")
|
print("Checking IP address")
|
||||||
# (//*[@label="IP Address"]/parent::*/XCUIElementTypeStaticText)[2]
|
# (//*[@label="IP Address"]/parent::*/XCUIElementTypeStaticText)[2]
|
||||||
@@ -2799,6 +2808,14 @@ def gets_ip_add_and_does_not_forget_ssid_ios(request, WifiName, WifiPass, setup_
|
|||||||
"(//*[@label='IP Address']/parent::*/XCUIElementTypeStaticText)[2]").text
|
"(//*[@label='IP Address']/parent::*/XCUIElementTypeStaticText)[2]").text
|
||||||
print("ip_address_element_text: ", ip_address_element_text)
|
print("ip_address_element_text: ", ip_address_element_text)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
try:
|
||||||
|
time.sleep(4)
|
||||||
|
print("Scrolling for checking ip address")
|
||||||
|
scrollDown(setup_perfectoMobile)
|
||||||
|
ip_address_element_text = driver.find_element_by_xpath(
|
||||||
|
"(//*[@label='IP Address']/parent::*/XCUIElementTypeStaticText)[2]").text
|
||||||
|
print("ip_address_element_text: ", ip_address_element_text)
|
||||||
|
except:
|
||||||
print("IP Address not Found")
|
print("IP Address not Found")
|
||||||
request.config.cache.set(key="select IP failed", value=str(e))
|
request.config.cache.set(key="select IP failed", value=str(e))
|
||||||
|
|
||||||
@@ -2935,20 +2952,26 @@ def gets_ip_add_eap_and_does_not_forget_ssid_ios(request, WifiName, User, ttls_p
|
|||||||
available_ssids = get_all_available_ssids(driver)
|
available_ssids = get_all_available_ssids(driver)
|
||||||
allure.attach(name="Available SSIDs in device: ", body=str(available_ssids))
|
allure.attach(name="Available SSIDs in device: ", body=str(available_ssids))
|
||||||
try:
|
try:
|
||||||
if WifiName not in available_ssids:
|
if (not ssid_Visible(driver, WifiName)) or (WifiName not in available_ssids):
|
||||||
scrollDown(setup_perfectoMobile)
|
scrollDown(setup_perfectoMobile)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
|
driver.implicitly_wait(8)
|
||||||
report.step_start("Selecting SSID To Connect")
|
report.step_start("Selecting SSID To Connect")
|
||||||
ssid_found = True
|
ssid_found = True
|
||||||
print(WifiName + " : Found in Device")
|
print(WifiName + " : Found in Device")
|
||||||
wifiSelElement = WebDriverWait(driver, 30).until(
|
wifiSelElement = WebDriverWait(driver, 35).until(
|
||||||
EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='" + WifiName + "']")))
|
EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='" + WifiName + "']")))
|
||||||
print(wifiSelElement)
|
print(wifiSelElement)
|
||||||
wifiSelElement.click()
|
wifiSelElement.click()
|
||||||
print("Selecting SSID")
|
print("Selecting SSID")
|
||||||
# allure.attach(name= body=str(WifiName + " : Found in Device"))
|
|
||||||
break
|
break
|
||||||
|
except:
|
||||||
|
print("SSID unable to select")
|
||||||
|
report.step_start("Selecting Unable SSID To Connect")
|
||||||
|
closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile)
|
||||||
|
return ip_address_element_text, is_internet
|
||||||
except:
|
except:
|
||||||
print("couldn't connect to " + WifiName)
|
print("couldn't connect to " + WifiName)
|
||||||
# request.config.cache.set(key="SelectingWifiFailed", value=str(e))
|
# request.config.cache.set(key="SelectingWifiFailed", value=str(e))
|
||||||
@@ -3058,15 +3081,22 @@ def gets_ip_add_eap_and_does_not_forget_ssid_ios(request, WifiName, User, ttls_p
|
|||||||
print("WiFi-Address not Found")
|
print("WiFi-Address not Found")
|
||||||
allure.attach(name="No Connected SSID WiFi-Address Found")
|
allure.attach(name="No Connected SSID WiFi-Address Found")
|
||||||
try:
|
try:
|
||||||
driver.implicitly_wait(5)
|
|
||||||
print("Checking IP address")
|
|
||||||
report.step_start("Checking IP address")
|
|
||||||
time.sleep(4)
|
time.sleep(4)
|
||||||
|
report.step_start("Checking IP Address")
|
||||||
|
print("Checking IP address")
|
||||||
# (//*[@label="IP Address"]/parent::*/XCUIElementTypeStaticText)[2]
|
# (//*[@label="IP Address"]/parent::*/XCUIElementTypeStaticText)[2]
|
||||||
ip_address_element_text = driver.find_element_by_xpath(
|
ip_address_element_text = driver.find_element_by_xpath(
|
||||||
"(//*[@label='IP Address']/parent::*/XCUIElementTypeStaticText)[2]").text
|
"(//*[@label='IP Address']/parent::*/XCUIElementTypeStaticText)[2]").text
|
||||||
print("ip_address_element_text: ", ip_address_element_text)
|
print("ip_address_element_text: ", ip_address_element_text)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
try:
|
||||||
|
time.sleep(4)
|
||||||
|
print("Scrolling for checking ip address")
|
||||||
|
scrollDown(setup_perfectoMobile)
|
||||||
|
ip_address_element_text = driver.find_element_by_xpath(
|
||||||
|
"(//*[@label='IP Address']/parent::*/XCUIElementTypeStaticText)[2]").text
|
||||||
|
print("ip_address_element_text: ", ip_address_element_text)
|
||||||
|
except:
|
||||||
print("IP Address not Found")
|
print("IP Address not Found")
|
||||||
request.config.cache.set(key="select IP failed", value=str(e))
|
request.config.cache.set(key="select IP failed", value=str(e))
|
||||||
|
|
||||||
@@ -3201,6 +3231,7 @@ def gets_ip_add_for_checking_and_forgets_ssid_ios(request, WifiName, WifiPass, s
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("WiFi-Address not Found")
|
print("WiFi-Address not Found")
|
||||||
try:
|
try:
|
||||||
|
time.sleep(4)
|
||||||
report.step_start("Checking IP Address")
|
report.step_start("Checking IP Address")
|
||||||
print("Checking IP address")
|
print("Checking IP address")
|
||||||
# (//*[@label="IP Address"]/parent::*/XCUIElementTypeStaticText)[2]
|
# (//*[@label="IP Address"]/parent::*/XCUIElementTypeStaticText)[2]
|
||||||
@@ -3208,9 +3239,16 @@ def gets_ip_add_for_checking_and_forgets_ssid_ios(request, WifiName, WifiPass, s
|
|||||||
"(//*[@label='IP Address']/parent::*/XCUIElementTypeStaticText)[2]").text
|
"(//*[@label='IP Address']/parent::*/XCUIElementTypeStaticText)[2]").text
|
||||||
print("ip_address_element_text: ", ip_address_element_text)
|
print("ip_address_element_text: ", ip_address_element_text)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
try:
|
||||||
|
time.sleep(4)
|
||||||
|
print("Scrolling for checking ip address")
|
||||||
|
scrollDown(setup_perfectoMobile)
|
||||||
|
ip_address_element_text = driver.find_element_by_xpath(
|
||||||
|
"(//*[@label='IP Address']/parent::*/XCUIElementTypeStaticText)[2]").text
|
||||||
|
print("ip_address_element_text: ", ip_address_element_text)
|
||||||
|
except:
|
||||||
print("IP Address not Found")
|
print("IP Address not Found")
|
||||||
request.config.cache.set(key="select IP failed", value=str(e))
|
request.config.cache.set(key="select IP failed", value=str(e))
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
request.config.cache.set(key="select additional info failed", value=str(e))
|
request.config.cache.set(key="select additional info failed", value=str(e))
|
||||||
# ---------------------Additional INFO-------------------------------
|
# ---------------------Additional INFO-------------------------------
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class TestToggleAirplaneModeBridgeModeEnterpriseTTLSSuiteA(object):
|
|||||||
connData = get_ToggleAirplaneMode_data
|
connData = get_ToggleAirplaneMode_data
|
||||||
|
|
||||||
# Set Wifi/AP Mode
|
# Set Wifi/AP Mode
|
||||||
ip, is_internet = gets_ip_add_for_checking_and_forgets_ssid_ios(request, ssidName, identity, ttls_passwd, setup_perfectoMobile_iOS, connData)
|
ip, is_internet = gets_ip_add_eap_and_does_not_forget_ssid_ios(request, ssidName, identity, ttls_passwd, setup_perfectoMobile_iOS, connData)
|
||||||
|
|
||||||
if is_internet:
|
if is_internet:
|
||||||
if ip:
|
if ip:
|
||||||
|
|||||||
Reference in New Issue
Block a user