From 1786faa9fb38b094771b0bb49c7b1546ef9c1c2b Mon Sep 17 00:00:00 2001 From: Ajaydeep Grewal Date: Fri, 28 Jan 2022 17:02:20 -0500 Subject: [PATCH 1/4] WIFI-6758: Make sure that the ssid is visible on the page before clicking it. --- libs/perfecto_libs/iOS_lib.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/libs/perfecto_libs/iOS_lib.py b/libs/perfecto_libs/iOS_lib.py index 8696309f9..f3f2a1065 100644 --- a/libs/perfecto_libs/iOS_lib.py +++ b/libs/perfecto_libs/iOS_lib.py @@ -1363,6 +1363,14 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): # ---------------------This is to Select SSID------------------------------- try: + counter_time = 0 + while ((not ssid_Visible(driver, WifiName)) and counter_time < 5): + scrollDown(setup_perfectoMobile) + counter_time = counter_time + 1 + + if counter_time == 5: + print(f"Not able to get the {WifiName} to be visible") + wifiSelectionElement = WebDriverWait(driver, 30).until( EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='" + WifiName + "']"))) wifiSelectionElement.click() @@ -2432,3 +2440,14 @@ def captive_portal_ios(request, WifiName, WifiPass, setup_perfectoMobile, connDa # --------------------- close app------------------------------- #closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile) return ip_address_element_text, is_internet + +# Returns whether the ssid is currently visible +def ssid_Visible(driver,WifiName): + wifiSelectionElement = WebDriverWait(driver, 30).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='" + WifiName + "']"))) + isVisible = wifiSelectionElement.get_attribute("visible") + print(f"Is ssid visible: {isVisible}") + if(isVisible == 'false'): + return False + else: + return True \ No newline at end of file From 02e3145cd852c28c7787469f09eb52a5dc0ba2da Mon Sep 17 00:00:00 2001 From: sushant Date: Mon, 31 Jan 2022 13:13:20 +0530 Subject: [PATCH 2/4] - added patch to check if ssid is visible in sanity Signed-off-by: Sushant Bawiskar --- libs/perfecto_libs/iOS_lib.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/libs/perfecto_libs/iOS_lib.py b/libs/perfecto_libs/iOS_lib.py index 3d8eaf5ad..f101e236f 100644 --- a/libs/perfecto_libs/iOS_lib.py +++ b/libs/perfecto_libs/iOS_lib.py @@ -1023,7 +1023,7 @@ def get_ip_address_ios(request, WifiName, WifiPass, setup_perfectoMobile, connDa available_ssids = get_all_available_ssids(driver) allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) try: - if WifiName not in available_ssids: + if (WifiName not in available_ssids ) and (not ssid_Visible(driver, WifiName)): scrollDown(setup_perfectoMobile) time.sleep(2) else: @@ -1383,14 +1383,6 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): # ---------------------This is to Select SSID------------------------------- try: - counter_time = 0 - while ((not ssid_Visible(driver, WifiName)) and counter_time < 5): - scrollDown(setup_perfectoMobile) - counter_time = counter_time + 1 - - if counter_time == 5: - print(f"Not able to get the {WifiName} to be visible") - wifiSelectionElement = WebDriverWait(driver, 30).until( EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='" + WifiName + "']"))) wifiSelectionElement.click() @@ -1798,7 +1790,7 @@ def get_ip_address_eap_ios(request, WifiName, User, ttls_passwd, setup_perfectoM available_ssids = get_all_available_ssids(driver) allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) try: - if WifiName not in available_ssids: + if (WifiName not in available_ssids ) and (not ssid_Visible(driver, WifiName)): scrollDown(setup_perfectoMobile) time.sleep(2) else: From fd89fe313daa9080d293f090131eadd0b07428f7 Mon Sep 17 00:00:00 2001 From: sushant Date: Wed, 2 Feb 2022 12:57:40 +0530 Subject: [PATCH 3/4] - added patch to check if ssid is visible in sanity Signed-off-by: Sushant Bawiskar --- libs/perfecto_libs/iOS_lib.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/perfecto_libs/iOS_lib.py b/libs/perfecto_libs/iOS_lib.py index f101e236f..ca21eb7bb 100644 --- a/libs/perfecto_libs/iOS_lib.py +++ b/libs/perfecto_libs/iOS_lib.py @@ -1023,7 +1023,7 @@ def get_ip_address_ios(request, WifiName, WifiPass, setup_perfectoMobile, connDa available_ssids = get_all_available_ssids(driver) allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) try: - if (WifiName not in available_ssids ) and (not ssid_Visible(driver, WifiName)): + if (not ssid_Visible(driver, WifiName)) and (WifiName not in available_ssids): scrollDown(setup_perfectoMobile) time.sleep(2) else: @@ -1790,7 +1790,7 @@ def get_ip_address_eap_ios(request, WifiName, User, ttls_passwd, setup_perfectoM available_ssids = get_all_available_ssids(driver) allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) try: - if (WifiName not in available_ssids ) and (not ssid_Visible(driver, WifiName)): + if (not ssid_Visible(driver, WifiName)) and (WifiName not in available_ssids): scrollDown(setup_perfectoMobile) time.sleep(2) else: From 6e71759931dec072fd9598562aac70859f36edd1 Mon Sep 17 00:00:00 2001 From: haricharan-jaka Date: Thu, 3 Feb 2022 11:59:39 +0530 Subject: [PATCH 4/4] Changed scrolling condition while looking for ssids in ios --- libs/perfecto_libs/iOS_lib.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/perfecto_libs/iOS_lib.py b/libs/perfecto_libs/iOS_lib.py index ca21eb7bb..bb7946cdf 100644 --- a/libs/perfecto_libs/iOS_lib.py +++ b/libs/perfecto_libs/iOS_lib.py @@ -1023,7 +1023,7 @@ def get_ip_address_ios(request, WifiName, WifiPass, setup_perfectoMobile, connDa available_ssids = get_all_available_ssids(driver) allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) try: - if (not ssid_Visible(driver, WifiName)) and (WifiName not in available_ssids): + if (not ssid_Visible(driver, WifiName)) or (WifiName not in available_ssids): scrollDown(setup_perfectoMobile) time.sleep(2) else: @@ -1790,7 +1790,7 @@ def get_ip_address_eap_ios(request, WifiName, User, ttls_passwd, setup_perfectoM available_ssids = get_all_available_ssids(driver) allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) try: - if (not ssid_Visible(driver, WifiName)) and (WifiName not in available_ssids): + if (not ssid_Visible(driver, WifiName)) or (WifiName not in available_ssids): scrollDown(setup_perfectoMobile) time.sleep(2) else: