Merge pull request #358 from Telecominfraproject/WIFI-6790

Added time in ios lib
This commit is contained in:
Shivam Thakur
2022-01-25 22:15:53 +05:30
committed by GitHub

View File

@@ -931,7 +931,7 @@ def get_ip_address_ios(request, WifiName, WifiPass, setup_perfectoMobile, connDa
print("Exception: Verify Xpath - unable to click on Wifi")
time.sleep(2)
driver.implicitly_wait(2)
driver.implicitly_wait(4)
# --------------------To Turn on WIFi Switch if already OFF--------------------------------
try:
get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='0']")
@@ -988,11 +988,13 @@ def get_ip_address_ios(request, WifiName, WifiPass, setup_perfectoMobile, connDa
additional_details_element = driver.find_element_by_xpath("//*[@label='selected']/parent::*/parent::*/XCUIElementTypeButton[@label='More Info']")
additional_details_element.click()
try:
time.sleep(2)
print("Forget Connected Network")
forget_ssid = WebDriverWait(driver, 30).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='Forget This Network']")))
forget_ssid.click()
print("Forget old ssid")
try:
time.sleep(2)
report.step_start("Forget SSID popup1")
forget_ssid_popup = WebDriverWait(driver, 30).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='Forget']")))
forget_ssid_popup.click()
@@ -1054,7 +1056,7 @@ def get_ip_address_ios(request, WifiName, WifiPass, setup_perfectoMobile, connDa
# ---------------------This is to Select SSID-------------------------------
# ---------------------Set Password-------------------------------
try:
time.sleep(3)
driver.implicitly_wait(2)
print("Entering Password")
report.step_start("Entering Password")
wifiPassword = driver.find_element_by_xpath("//*[@label='Password']")
@@ -1065,7 +1067,7 @@ def get_ip_address_ios(request, WifiName, WifiPass, setup_perfectoMobile, connDa
# ---------------------Click on join-------------------------------
try:
time.sleep(2)
driver.implicitly_wait(3)
print("Selecting join")
report.step_start("Clicking JOIN")
joinBTN = driver.find_element_by_xpath("//*[@label='Join']")
@@ -1090,13 +1092,14 @@ def get_ip_address_ios(request, WifiName, WifiPass, setup_perfectoMobile, connDa
try:
print("Selecting SSID: ", WifiName)
report.step_start("Additional details of SSID")
additional_details_element = WebDriverWait(driver, 30).until(
additional_details_element = WebDriverWait(driver, 35).until(
EC.presence_of_element_located((MobileBy.XPATH,
"//*[@label='" + WifiName + "']")))
# //*[@label='selected']/parent::*/parent::*/XCUIElementTypeButton[@label='More Info']
additional_details_element.click()
try:
driver.implicitly_wait(2)
report.step_start("Checking SSID Name as Expected")
print("Checking SSID Name")
ssidname_text = driver.find_element_by_xpath("//*[@label='" + WifiName + "']").text
@@ -1684,7 +1687,7 @@ def get_ip_address_eap_ios(request, WifiName, User, ttls_passwd, setup_perfectoM
print("Exception: Verify Xpath - unable to click on Wifi")
time.sleep(2)
driver.implicitly_wait(2)
driver.implicitly_wait(4)
# --------------------To Turn on WIFi Switch if already OFF--------------------------------
try:
get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='0']")
@@ -1735,19 +1738,21 @@ def get_ip_address_eap_ios(request, WifiName, User, ttls_passwd, setup_perfectoM
# ---------------------This is to Forget current connected SSID-------------------------------
try:
time.sleep(2)
time.sleep(3)
report.step_start("Selecting Connected SSID Info")
print("getting in to Additional details")
additional_details_element = driver.find_element_by_xpath(
"//*[@label='selected']/parent::*/parent::*/XCUIElementTypeButton[@label='More Info']")
additional_details_element.click()
try:
time.sleep(2)
print("Forget Connected Network")
report.step_start("Forget Connected SSID")
forget_ssid = driver.find_element_by_xpath("//*[@label='Forget This Network']")
forget_ssid.click()
print("Forget old ssid")
try:
time.sleep(2)
report.step_start("Forget SSID popup1")
forget_ssid_popup = driver.find_element_by_xpath("//*[@label='Forget']")
forget_ssid_popup.click()
@@ -1765,7 +1770,7 @@ def get_ip_address_eap_ios(request, WifiName, User, ttls_passwd, setup_perfectoM
# ---------------------To get all available SSID-------------------------------
print("Searching for Wifi: " + WifiName)
# allure.attach(name= body=str("Searching for Wifi: " + WifiName))
time.sleep(2)
time.sleep(5)
print("Selecting Wifi: " + WifiName)
ssid_found = False
available_ssids = False
@@ -1807,7 +1812,7 @@ def get_ip_address_eap_ios(request, WifiName, User, ttls_passwd, setup_perfectoM
# Set username
# -------------------------------------------------------
try:
driver.implicitly_wait(5)
driver.implicitly_wait(2)
report.step_start("Entering User")
print("Entering User name")
wifiUserElement = driver.find_element_by_xpath("//*[@label='Username']")
@@ -1818,7 +1823,7 @@ def get_ip_address_eap_ios(request, WifiName, User, ttls_passwd, setup_perfectoM
# ---------------------Set Password-------------------------------
try:
driver.implicitly_wait(5)
driver.implicitly_wait(2)
report.step_start("Entering Password")
print("Entering password")
wifiPassword = driver.find_element_by_xpath("//*[@label='Password']")
@@ -1830,6 +1835,7 @@ def get_ip_address_eap_ios(request, WifiName, User, ttls_passwd, setup_perfectoM
# ---------------------Click on join-------------------------------
try:
driver.implicitly_wait(2)
report.step_start("Clicking Join")
print("Clicking Join")
joinBTN = WebDriverWait(driver, 30).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='Join']")))
@@ -1840,6 +1846,7 @@ def get_ip_address_eap_ios(request, WifiName, User, ttls_passwd, setup_perfectoM
# Selecting certificate
# -------------------------------------------------------
try:
driver.implicitly_wait(3)
report.step_start("Clicking Trust CA Cert")
print("Clicking Trust CA Cert")
certElement = WebDriverWait(driver, 30).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='Trust']")))
@@ -1861,7 +1868,7 @@ def get_ip_address_eap_ios(request, WifiName, User, ttls_passwd, setup_perfectoM
# ---------------------Additional INFO-------------------------------
try:
driver.implicitly_wait(2)
driver.implicitly_wait(4)
print("Selecting SSID: ", WifiName)
report.step_start("Selecting More Info")
additional_details_element = WebDriverWait(driver, 35).until(
@@ -1871,6 +1878,7 @@ def get_ip_address_eap_ios(request, WifiName, User, ttls_passwd, setup_perfectoM
additional_details_element.click()
try:
driver.implicitly_wait(2)
report.step_start("Checking SSID Name as Expected")
print("Checking SSID Name")
ssidname_text = driver.find_element_by_xpath("//*[@label='" + WifiName + "']").text
@@ -1898,7 +1906,6 @@ def get_ip_address_eap_ios(request, WifiName, User, ttls_passwd, setup_perfectoM
print("WiFi-Address not Found")
allure.attach(name="No Connected SSID WiFi-Address Found")
try:
driver.implicitly_wait(5)
print("Checking IP address")
report.step_start("Checking IP address")
time.sleep(4)