mirror of
https://github.com/Telecominfraproject/wlan-testing.git
synced 2025-11-03 12:27:53 +00:00
Fixed/Update OpenRoaming iOS
Signed-off-by: raj-TIP <rpasupathy@perfectomobile.com>
This commit is contained in:
@@ -232,10 +232,10 @@ def set_APconnMobileDevice_android(request, WifiName, WifiPass, setup_perfectoMo
|
||||
report.step_start("Selecting Wifi: " + WifiName)
|
||||
wifiSelectionElement = WebDriverWait(driver, 35).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='"+ WifiName + "']")))
|
||||
wifiSelectionElement.click()
|
||||
except NoSuchElementException or TimeoutException as e:
|
||||
except Exception as e:
|
||||
print("Exception on Selecting Wifi Network. Please check wifi Name or signal")
|
||||
request.config.cache.set(key="SelectingWifiFailed", value=str(e))
|
||||
pytest.xfail("Selecting Wifi Failed: " + e)
|
||||
assert False
|
||||
|
||||
#Set password if Needed
|
||||
try:
|
||||
|
||||
@@ -8,6 +8,7 @@ from ast import Str
|
||||
from logging import exception
|
||||
import unittest
|
||||
import warnings
|
||||
from _pytest.outcomes import fail
|
||||
from perfecto.test import TestResultFactory
|
||||
import pytest
|
||||
import sys
|
||||
@@ -29,6 +30,16 @@ def openApp(appName, setup_perfectoMobile):
|
||||
setup_perfectoMobile[0].execute_script('mobile:application:close', params)
|
||||
setup_perfectoMobile[0].execute_script('mobile:application:open', params)
|
||||
|
||||
def scrollDown(setup_perfectoMobile):
|
||||
#print("Refreshing App: " + appName)
|
||||
setup_perfectoMobile[1].step_start("Scroll Down")
|
||||
params = {'start': "40%,90%"}
|
||||
params = {'end': "40%,20%"}
|
||||
params = {'duration': "2"}
|
||||
#Open/Close/Open Action is performed to ensure the app is back to its Original Settings
|
||||
setup_perfectoMobile[0].execute_script('mobile:application:swipe', params)
|
||||
|
||||
|
||||
def closeApp(appName, setup_perfectoMobile):
|
||||
#print("Closing App.." + appName)
|
||||
setup_perfectoMobile[1].step_start("Closing App: " + appName)
|
||||
@@ -42,6 +53,8 @@ def rebootPhone(setup_perfectoMobile):
|
||||
setup_perfectoMobile[0].execute_script('mobile:handset:reboot', params)
|
||||
|
||||
def set_APconnMobileDevice_iOS(request, WifiName, WifiPass, setup_perfectoMobile, connData):
|
||||
consoleOutput = ""
|
||||
|
||||
print("\n-------------------------------------")
|
||||
print("Select Wifi/AccessPoint Connection")
|
||||
print("-------------------------------------")
|
||||
@@ -103,6 +116,7 @@ def set_APconnMobileDevice_iOS(request, WifiName, WifiPass, setup_perfectoMobile
|
||||
|
||||
else:
|
||||
print("Selecting Wifi: " + WifiName)
|
||||
#consoleOutput+=str(WifiName)+ "\n"
|
||||
report.step_start("Selecting Wifi...: " + WifiName)
|
||||
element = driver.find_element_by_xpath("//XCUIElementTypeCell[@name='Wi-Fi']/XCUIElementTypeStaticText[2]")
|
||||
element.click()
|
||||
@@ -112,9 +126,8 @@ def set_APconnMobileDevice_iOS(request, WifiName, WifiPass, setup_perfectoMobile
|
||||
except Exception as e:
|
||||
print("Exception on Selecting Wifi Network. Please check wifi Name or signal")
|
||||
request.config.cache.set(key="SelectingWifiFailed", value=str(e))
|
||||
pytest.xfail("Selecting Wifi Failed: " + e)
|
||||
#allure.attach(name="Raj", body="hello world")
|
||||
|
||||
assert False
|
||||
#Set password if Needed
|
||||
try:
|
||||
wifiPassword = driver.find_element_by_xpath("//*[@label='Password']")
|
||||
@@ -193,6 +206,10 @@ def Toggle_AirplaneMode_iOS(request, setup_perfectoMobile, connData):
|
||||
return currentResult
|
||||
|
||||
def verify_APconnMobileDevice_iOS(request, WifiName, setup_perfectoMobile, connData):
|
||||
print("\n-----------------------")
|
||||
print("Verify Connected Wifi Mode")
|
||||
print("-----------------------")
|
||||
|
||||
report = setup_perfectoMobile[1]
|
||||
driver = setup_perfectoMobile[0]
|
||||
|
||||
@@ -204,12 +221,18 @@ def verify_APconnMobileDevice_iOS(request, WifiName, setup_perfectoMobile, connD
|
||||
#Verifies if AP is connected to Wifi status
|
||||
try:
|
||||
# print("Verifying Connected Wifi Connection")
|
||||
wifiXpath2 = WebDriverWait(driver, 30).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='"+ WifiName + "']")))
|
||||
wifiXpath2.click()
|
||||
|
||||
report.step_start("Verifying Connected Wifi Connection")
|
||||
element = driver.find_element_by_xpath("//XCUIElementTypeCell[@name='Wi-Fi']/XCUIElementTypeStaticText[2]")
|
||||
Wifi_AP_Name = element.text
|
||||
|
||||
except NoSuchElementException:
|
||||
print("Exception: Verify Xpath - UpdateXpath")
|
||||
except Exception as e:
|
||||
print("Exception on Selecting Wifi Network. Please check wifi Name or signal")
|
||||
request.config.cache.set(key="SelectingWifiFailed", value=str(e))
|
||||
#allure.attach(name="Raj", body="hello world")
|
||||
assert False
|
||||
|
||||
try:
|
||||
if Wifi_AP_Name.__eq__(WifiName):
|
||||
@@ -509,11 +532,13 @@ def verifyUploadDownloadSpeediOS(request, setup_perfectoMobile, get_APToMobileDe
|
||||
|
||||
return currentResult
|
||||
|
||||
def downloadInstallOpenRoamingProfile(setup_perfectoMobile, get_APToMobileDevice_data):
|
||||
def downloadInstallOpenRoamingProfile(request, setup_perfectoMobile, get_APToMobileDevice_data):
|
||||
print("\n-------------------------------------")
|
||||
print("Download Open Roaming Profile")
|
||||
print("-------------------------------------")
|
||||
|
||||
OpenRoamingWifiName = ""
|
||||
|
||||
report = setup_perfectoMobile[1]
|
||||
driver = setup_perfectoMobile[0]
|
||||
connData = get_APToMobileDevice_data
|
||||
@@ -575,12 +600,173 @@ def downloadInstallOpenRoamingProfile(setup_perfectoMobile, get_APToMobileDevice
|
||||
except NoSuchElementException:
|
||||
print("Exception: Install 3rd Confirmation")
|
||||
|
||||
try:
|
||||
print("Verify Profile Installed")
|
||||
report.step_start("Verify Profile Installed")
|
||||
elelSearch2 = WebDriverWait(driver, 30).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='Profile Installed']")))
|
||||
elelSearch2.click()
|
||||
except Exception as e:
|
||||
print("Profile Installed Message Error")
|
||||
request.config.cache.set(key="SelectingWifiFailed", value=str(e))
|
||||
assert False
|
||||
|
||||
try:
|
||||
print("Click Done Button")
|
||||
report.step_start("Click Done Button")
|
||||
elelSearch = driver.find_element_by_xpath("//XCUIElementTypeButton[@label='Done']")
|
||||
elelSearch.click()
|
||||
except NoSuchElementException:
|
||||
"Exception: Done Button"
|
||||
print("Exception: Clicking on Done Button")
|
||||
|
||||
closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile)
|
||||
|
||||
#Open Settings Application
|
||||
openApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile)
|
||||
|
||||
try:
|
||||
print("Verifying OpenRoaming Connected Wifi")
|
||||
time.sleep(20)
|
||||
report.step_start("Verifying Connected Wifi Name")
|
||||
element = driver.find_element_by_xpath("//XCUIElementTypeCell[@name='Wi-Fi']/XCUIElementTypeStaticText[2]")
|
||||
OpenRoamingWifiName = element.text
|
||||
element.click()
|
||||
|
||||
except Exception as e:
|
||||
OpenRoamingWifiName = "None"
|
||||
print("Wifi Not Connected to OpenRoaming Profile: ")
|
||||
request.config.cache.set(key="SelectingWifiFailed", value=str(e))
|
||||
assert False
|
||||
|
||||
#try:
|
||||
# report.step_start("Verify Wifi Connected Status")
|
||||
# WifiXpath = "//*[@label='selected']/parent::*/parent::*/XCUIElementTypeStaticText[@label='"+ OpenRoamingWifiName + "']"
|
||||
# elementWifName = driver.find_element_by_xpath(WifiXpath)
|
||||
# OpenRoamingWifiName = elementWifName.text
|
||||
# print ("Connected to: " + OpenRoamingWifiName)
|
||||
#except NoSuchElementException:
|
||||
# OpenRoamingWifiName = "None"
|
||||
# reportFlag = False
|
||||
# assert reportFlag
|
||||
|
||||
|
||||
return OpenRoamingWifiName
|
||||
|
||||
def ForgetAllWifiConnection(request, setup_perfectoMobile, connData):
|
||||
print("\n-----------------------------")
|
||||
print("Forget All Wifi/AP Connection")
|
||||
print("-----------------------------")
|
||||
|
||||
report = setup_perfectoMobile[1]
|
||||
driver = setup_perfectoMobile[0]
|
||||
|
||||
report.step_start("Switching Driver Context")
|
||||
print("Switching Context to Native")
|
||||
driver.switch_to.context('NATIVE_APP')
|
||||
contexts = driver.contexts
|
||||
#print(contexts)
|
||||
|
||||
report.step_start("Forget Existing Wifi")
|
||||
openApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile)
|
||||
|
||||
try:
|
||||
print("Verifying Connected Wifi Connection")
|
||||
report.step_start("Verifying Existing Connected Wifi Connection")
|
||||
element = driver.find_element_by_xpath("//XCUIElementTypeCell[@name='Wi-Fi']/XCUIElementTypeStaticText[2]")
|
||||
Wifi_AP_Name = element.text
|
||||
element.click()
|
||||
print ("Connected to: " + Wifi_AP_Name)
|
||||
except NoSuchElementException:
|
||||
Wifi_AP_Name = "None"
|
||||
print("Wifi Not Connected to anything")
|
||||
|
||||
if Wifi_AP_Name.__eq__("Not Connected"):
|
||||
print("Not Connected to any wifi")
|
||||
|
||||
else:
|
||||
report.step_start("Click on More Info on Wifi")
|
||||
WifiXpathMoreInfo = "//*[@label='selected']/parent::*/parent::*/XCUIElementTypeStaticText[@label='"+ Wifi_AP_Name + "']/parent::*/XCUIElementTypeButton[@label='More Info']"
|
||||
elementMoreInfo = driver.find_element_by_xpath(WifiXpathMoreInfo)
|
||||
elementMoreInfo.click()
|
||||
|
||||
print("Forget Wifi Network " + Wifi_AP_Name)
|
||||
report.step_start("Forget Wifi Network")
|
||||
WifiXpathForgetWifi = "//*[@label='Forget This Network']"
|
||||
elementforgetWifi = driver.find_element_by_xpath(WifiXpathForgetWifi)
|
||||
elementforgetWifi.click()
|
||||
|
||||
report.step_start("Confirm Forget Wifi Network")
|
||||
WifiXpathForgetWifi = "//*[@label='Forget']"
|
||||
elementforgetWifi = driver.find_element_by_xpath(WifiXpathForgetWifi)
|
||||
elementforgetWifi.click()
|
||||
|
||||
def deleteOpenRoamingInstalledProfile(request, setup_perfectoMobile, connData):
|
||||
print("\n-----------------------------")
|
||||
print("Delete Open Roaming Profile")
|
||||
print("-----------------------------")
|
||||
|
||||
report = setup_perfectoMobile[1]
|
||||
driver = setup_perfectoMobile[0]
|
||||
|
||||
report.step_start("Switching Driver Context")
|
||||
print("Switching Context to Native")
|
||||
driver.switch_to.context('NATIVE_APP')
|
||||
contexts = driver.contexts
|
||||
#print(contexts)
|
||||
|
||||
report.step_start("Forget Existing Wifi")
|
||||
openApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile)
|
||||
|
||||
try:
|
||||
print("Click General")
|
||||
report.step_start("Click General")
|
||||
element = driver.find_element_by_xpath("//*[@value='General']")
|
||||
element.click()
|
||||
except NoSuchElementException:
|
||||
print("Exception General Menu Not found")
|
||||
assert False
|
||||
|
||||
scrollDown(setup_perfectoMobile)
|
||||
|
||||
try:
|
||||
print("Select Profile ")
|
||||
report.step_start("Select Profile")
|
||||
element = driver.find_element_by_xpath("//*[@name='ManagedConfigurationList' and @label='Profile']")
|
||||
element.click()
|
||||
except NoSuchElementException:
|
||||
print("Exception Select Profile Button")
|
||||
assert False
|
||||
|
||||
try:
|
||||
print("Click Configuration Profile ")
|
||||
report.step_start("Click Configuration Profile ")
|
||||
element = driver.find_element_by_xpath("//XCUIElementTypeStaticText[@label='AmeriBand']")
|
||||
element.click()
|
||||
except NoSuchElementException:
|
||||
print("Exception Click Configuration Button")
|
||||
assert False
|
||||
|
||||
try:
|
||||
print("Remove Profile")
|
||||
report.step_start("Remove Profile ")
|
||||
element = driver.find_element_by_xpath("//*[@label='Remove Profile']")
|
||||
element.click()
|
||||
except NoSuchElementException:
|
||||
print("Exception Remove")
|
||||
assert False
|
||||
|
||||
try:
|
||||
print("Click Remove Button")
|
||||
report.step_start("Click Remove Button")
|
||||
element = driver.find_element_by_xpath("//*[@label='Remove']")
|
||||
element.click()
|
||||
except NoSuchElementException:
|
||||
print("Exception Remove Button")
|
||||
assert False
|
||||
|
||||
try:
|
||||
print("Verify No Profile Installed Msg")
|
||||
report.step_start("Verify No Profile Installed Msg")
|
||||
element = driver.find_element_by_xpath("//*[@label='No profiles are currently installed.']")
|
||||
except NoSuchElementException:
|
||||
print("Exception Verify No Profile Installed Msg")
|
||||
assert False
|
||||
@@ -1,4 +1,5 @@
|
||||
from logging import exception
|
||||
import io
|
||||
import unittest
|
||||
import warnings
|
||||
from perfecto.test import TestResultFactory
|
||||
@@ -47,12 +48,9 @@ class TestAccessPointConnectivety(object):
|
||||
@pytest.mark.wpa2_personal
|
||||
def test_AccessPointConnection_5g_WPA2_Personal(self, request, get_AccessPointConn_data, setup_perfectoMobile_iOS):
|
||||
|
||||
#profile_data = setup_params_general["ssid_modes"]["wpa2_personal"][1]
|
||||
#ssidName = profile_data["ssid_name"]
|
||||
# ssidPassword = profile_data["security_key"]
|
||||
|
||||
ssidName = "Hello"
|
||||
ssidPassword = "Password"
|
||||
profile_data = setup_params_general["ssid_modes"]["wpa2_personal"][1]
|
||||
ssidName = profile_data["ssid_name"]
|
||||
ssidPassword = profile_data["security_key"]
|
||||
|
||||
print ("SSID_NAME: " + ssidName)
|
||||
print ("SSID_PASS: " + ssidPassword)
|
||||
|
||||
@@ -16,7 +16,7 @@ import allure
|
||||
if 'perfecto_libs' not in sys.path:
|
||||
sys.path.append(f'../libs/perfecto_libs')
|
||||
|
||||
from iOS_lib import closeApp, openApp, verifyUploadDownloadSpeediOS, downloadInstallOpenRoamingProfile, ForgetWifiConnection, Toggle_AirplaneMode_iOS, set_APconnMobileDevice_iOS, verify_APconnMobileDevice_iOS, Toggle_WifiMode_iOS, tearDown
|
||||
from iOS_lib import closeApp, openApp, ForgetAllWifiConnection, deleteOpenRoamingInstalledProfile, verifyUploadDownloadSpeediOS, downloadInstallOpenRoamingProfile, ForgetWifiConnection, Toggle_AirplaneMode_iOS, set_APconnMobileDevice_iOS, verify_APconnMobileDevice_iOS, Toggle_WifiMode_iOS, tearDown
|
||||
|
||||
setup_params_general = {
|
||||
"mode": "NAT",
|
||||
@@ -40,16 +40,19 @@ setup_params_general = {
|
||||
# indirect=True,
|
||||
# scope="class"
|
||||
#)
|
||||
@pytest.mark.usefixtures("setup_profiles")
|
||||
#@pytest.mark.usefixtures("setup_profiles")
|
||||
class TestOpenRoaming(object):
|
||||
|
||||
@pytest.mark.fiveg
|
||||
@pytest.mark.wpa2_personal
|
||||
def test_OpenRoaming_5g_WPA2_Personal(self, request, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
|
||||
|
||||
profile_data = setup_params_general["ssid_modes"]["wpa2_personal"][1]
|
||||
ssidName = profile_data["ssid_name"]
|
||||
ssidPassword = profile_data["security_key"]
|
||||
#profile_data = setup_params_general["ssid_modes"]["wpa2_personal"][1]
|
||||
#ssidName = profile_data["ssid_name"]
|
||||
#ssidPassword = profile_data["security_key"]
|
||||
|
||||
ssidName = "ssid-passpoint-osu"
|
||||
ssidPassword = "something"
|
||||
print ("SSID_NAME: " + ssidName)
|
||||
print ("SSID_PASS: " + ssidPassword)
|
||||
|
||||
@@ -57,17 +60,35 @@ class TestOpenRoaming(object):
|
||||
driver = setup_perfectoMobile_iOS[0]
|
||||
connData = get_APToMobileDevice_data
|
||||
|
||||
ssidName = "ssid-passpoint-osu"
|
||||
ssidPassword = "something"
|
||||
|
||||
ForgetAllWifiConnection(request, setup_perfectoMobile_iOS, connData)
|
||||
|
||||
#Delete Profile Under Settings
|
||||
#deleteOpenRoamingInstalledProfile(request, setup_perfectoMobile_iOS, connData)
|
||||
|
||||
|
||||
#Set Wifi/AP Mode
|
||||
set_APconnMobileDevice_iOS(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
|
||||
|
||||
#Install Profile
|
||||
downloadInstallOpenRoamingProfile(request, setup_perfectoMobile_iOS, connData)
|
||||
OpenRoamingWifiName = downloadInstallOpenRoamingProfile(request, setup_perfectoMobile_iOS, connData)
|
||||
print ("OpenRoaming Profile Connected WifiName: " + OpenRoamingWifiName)
|
||||
|
||||
#ForgetWifi Original
|
||||
ForgetWifiConnection(request, setup_perfectoMobile_iOS, ssidName, connData)
|
||||
|
||||
assert verify_APconnMobileDevice_iOS(request, OpenRoamingWifiName, setup_perfectoMobile_iOS, connData)
|
||||
|
||||
#Verify Upload download Speed from device Selection
|
||||
verifyUploadDownloadSpeediOS(request, setup_perfectoMobile_iOS, connData)
|
||||
|
||||
#ForgetWifi
|
||||
ForgetWifiConnection(request, setup_perfectoMobile_iOS, ssidName, connData)
|
||||
#Delete Profile Under Settings
|
||||
#deleteOpenRoamingInstalledProfile(request, setup_perfectoMobile_iOS, connData)
|
||||
|
||||
|
||||
|
||||
|
||||
@pytest.mark.twog
|
||||
@pytest.mark.wpa2_personal
|
||||
|
||||
Reference in New Issue
Block a user