mirror of
https://github.com/Telecominfraproject/wlan-testing.git
synced 2025-11-03 20:38:05 +00:00
- e2e for expresswifi
- library code changes for android in android_lib.py - Testcases to turn on and off wifi, forget wifi at end of testcases Signed-off-by: Sushant Bawiskar <sushant.bawiskar@candelatech.com>
This commit is contained in:
committed by
Sushant Bawiskar
parent
b4910948ac
commit
8f17612b2c
@@ -1575,7 +1575,7 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData):
|
||||
print("Connect Button Not Enabled...Verify if Password is set properly ")
|
||||
check_if_no_internet_popup(driver)
|
||||
# -------------------------------------------------------
|
||||
|
||||
# //*[@resource-id='com.android.settings:id/summary' and @text="Sign in to the network."]/parent::*/android.widget.TextView[@text='XWF-OWF_DSx']
|
||||
#Verify if WiFi is connected
|
||||
# -------------------------------------------------------
|
||||
try:
|
||||
@@ -1607,11 +1607,16 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData):
|
||||
ssid_with_internet = True
|
||||
print("Wifi Successfully Connected")
|
||||
#allure.attach(name=body=str("Wifi Successfully Connected"))
|
||||
except NoSuchElementException:
|
||||
print("Wifi Connection Error: " + WifiName)
|
||||
#allure.attach(name=body=str("Wifi Connection Error: " + WifiName))
|
||||
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||
return ssid_with_internet
|
||||
except:
|
||||
try:
|
||||
report.step_start("Unknown WIFI status found")
|
||||
ssid_with_internet = False
|
||||
print("Unknown WIFI status found")
|
||||
except NoSuchElementException:
|
||||
print("Wifi Connection Error: " + WifiName)
|
||||
#allure.attach(name=body=str("Wifi Connection Error: " + WifiName))
|
||||
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||
return ssid_with_internet
|
||||
|
||||
|
||||
except NoSuchElementException:
|
||||
@@ -2659,7 +2664,7 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile,
|
||||
#allure.attach(name=body=str("Wifi Successfully Connected"))
|
||||
except NoSuchElementException:
|
||||
print("Wifi Connection Error: " + WifiName)
|
||||
#allure.attach(name=body=str("Wifi Connection Error: " + WifiName))
|
||||
#allure.attach(name=body=str("Wifi Connection Error: " + WifiName))
|
||||
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||
return ssid_with_internet
|
||||
|
||||
@@ -2687,13 +2692,22 @@ def close_driver(driver):
|
||||
driver.quit()
|
||||
|
||||
|
||||
def expressWifi(request,setup_perfectoMobile, connData):
|
||||
def expressWifi(request, WifiName, setup_perfectoMobile, connData):
|
||||
print("\n-------------------------------------")
|
||||
print("Express Wifi Verification")
|
||||
print("-------------------------------------")
|
||||
report = setup_perfectoMobile[1]
|
||||
driver = setup_perfectoMobile[0]
|
||||
|
||||
try:
|
||||
click_on_ssid = WebDriverWait(driver, 60).until(EC.presence_of_element_located((
|
||||
MobileBy.XPATH,
|
||||
"//*[@resource-id='com.android.settings:id/summary' and @text='Sign in to the network.']/parent::*/android.widget.TextView[@text='" + WifiName + "']")))
|
||||
click_on_ssid.click()
|
||||
print("click on expresswifi SSID to open login page")
|
||||
except:
|
||||
print("Could not found expresswifi SSID")
|
||||
|
||||
try:
|
||||
print("Express Wifi Home Page Verification")
|
||||
report.step_start("Express Wifi Home Page Verification")
|
||||
@@ -2707,7 +2721,7 @@ def expressWifi(request,setup_perfectoMobile, connData):
|
||||
try:
|
||||
print("ExpressWifi Click on Menu Circle")
|
||||
report.step_start("ExpressWifi Click on Menu Circle")
|
||||
ExpressWifiMenu = driver.find_element_by_xpath("//*[@label='⚙️']")
|
||||
ExpressWifiMenu = driver.find_element_by_xpath("//*[@resource-id='dogfood-menu']")
|
||||
ExpressWifiMenu.click()
|
||||
except NoSuchElementException:
|
||||
print("---- Exception ExpressWifi Click on Menu Circle")
|
||||
@@ -2724,24 +2738,15 @@ def expressWifi(request,setup_perfectoMobile, connData):
|
||||
try:
|
||||
print("Verify Results: ")
|
||||
report.step_start("Verify Results")
|
||||
# ExpressWifiLogMsgCount = driver.find_element_by_xpath("//*[@label='running test ...']/parent::*/XCUIElementTypeStaticText")
|
||||
# ExpressWifiLogMsg = []
|
||||
|
||||
# for i in range(1,12):
|
||||
expressWifiOutputMsg = "//*[@resource-id='test_result']"
|
||||
LogOut = driver.find_element_by_xpath(expressWifiOutputMsg)
|
||||
# ExpressWifiLogMsg.append(LogOut.text)
|
||||
print("----" + LogOut.text + "\n")
|
||||
# print("ExpressWifiLog: ", ExpressWifiLogMsg)
|
||||
|
||||
if 'test completed successfully' in LogOut.text:
|
||||
assert True
|
||||
else:
|
||||
assert False
|
||||
except NoSuchElementException:
|
||||
print("Exception Verify Results")
|
||||
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||
|
||||
try:
|
||||
print("ExpressWifi Verify Test Complete Msg")
|
||||
report.step_start("ExpressWifi Verify Test Complete Msg")
|
||||
ExpressWifiRunTests = driver.find_element_by_xpath("//*[contains (@label,'test completed successfully')]")
|
||||
|
||||
except Exception as e:
|
||||
assert False
|
||||
print(" !! ExpressWifi Failure Test Complete Msg")
|
||||
|
||||
0
tests/e2e/interOp/Express_WiFi/__init__.py
Normal file
0
tests/e2e/interOp/Express_WiFi/__init__.py
Normal file
0
tests/e2e/interOp/Express_WiFi/android/__init__.py
Normal file
0
tests/e2e/interOp/Express_WiFi/android/__init__.py
Normal file
@@ -0,0 +1,66 @@
|
||||
from logging import exception
|
||||
import unittest
|
||||
import warnings
|
||||
from perfecto.test import TestResultFactory
|
||||
import pytest
|
||||
import sys
|
||||
import time
|
||||
from selenium.common.exceptions import NoSuchElementException
|
||||
from selenium.webdriver.common.by import By
|
||||
from appium import webdriver
|
||||
from selenium.common.exceptions import NoSuchElementException
|
||||
|
||||
import sys
|
||||
import allure
|
||||
|
||||
if 'perfecto_libs' not in sys.path:
|
||||
sys.path.append(f'../libs/perfecto_libs')
|
||||
|
||||
pytestmark = [pytest.mark.sanity, pytest.mark.interop, pytest.mark.android, pytest.mark.interop_android, pytest.mark.expressWifiConnection]
|
||||
|
||||
from android_lib import set_APconnMobileDevice_android, ForgetWifiConnection, expressWifi, wifi_connect, wifi_disconnect_and_forget
|
||||
|
||||
setup_params_general = {
|
||||
"mode": "NAT",
|
||||
"ssid_modes": {
|
||||
"open": [{"ssid_name": "XWF-OWF_DSx", "appliedRadios": ["2G"]}]
|
||||
},
|
||||
"rf": {},
|
||||
"radius": False,
|
||||
"express-wifi": True
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'setup_profiles',
|
||||
[setup_params_general],
|
||||
indirect=True,
|
||||
scope="class"
|
||||
)
|
||||
@pytest.mark.usefixtures("setup_profiles")
|
||||
class TestExpressWifiAndroid(object):
|
||||
|
||||
@pytest.mark.twog
|
||||
@pytest.mark.open
|
||||
def test_ExpressWifi_Android(self, request, get_ToggleAirplaneMode_data, setup_perfectoMobile_android):
|
||||
profile_data = setup_params_general["ssid_modes"]["open"][0]
|
||||
ssidName = profile_data["ssid_name"]
|
||||
ssidPassword = ""
|
||||
print ("SSID_NAME: " + ssidName)
|
||||
print ("SSID_PASS: " + ssidPassword)
|
||||
|
||||
report = setup_perfectoMobile_android[1]
|
||||
driver = setup_perfectoMobile_android[0]
|
||||
connData = get_ToggleAirplaneMode_data
|
||||
|
||||
#Set Wifi/AP Mode
|
||||
wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
|
||||
|
||||
#Express Wifi
|
||||
expressWifi(request, ssidName, setup_perfectoMobile_android, connData)
|
||||
|
||||
#ForgetWifi
|
||||
wifi_disconnect_and_forget(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
|
||||
|
||||
|
||||
|
||||
0
tests/e2e/interOp/Express_WiFi/iOS/__init__.py
Normal file
0
tests/e2e/interOp/Express_WiFi/iOS/__init__.py
Normal file
66
tests/e2e/interOp/Express_WiFi/iOS/test_ExpressWifi_ios.py
Normal file
66
tests/e2e/interOp/Express_WiFi/iOS/test_ExpressWifi_ios.py
Normal file
@@ -0,0 +1,66 @@
|
||||
from logging import exception
|
||||
import unittest
|
||||
import warnings
|
||||
from perfecto.test import TestResultFactory
|
||||
import pytest
|
||||
import sys
|
||||
import time
|
||||
from selenium.common.exceptions import NoSuchElementException
|
||||
from selenium.webdriver.common.by import By
|
||||
from appium import webdriver
|
||||
from selenium.common.exceptions import NoSuchElementException
|
||||
|
||||
import sys
|
||||
import allure
|
||||
|
||||
if 'perfecto_libs' not in sys.path:
|
||||
sys.path.append(f'../libs/perfecto_libs')
|
||||
|
||||
pytestmark = [pytest.mark.sanity, pytest.mark.interop, pytest.mark.ios, pytest.mark.interop_ios,
|
||||
pytest.mark.expressWifiConnection]
|
||||
|
||||
from iOS_lib import closeApp, ForgetWifiConnection, set_APconnMobileDevice_iOS, Toggle_WifiMode_iOS, \
|
||||
verifyUploadDownloadSpeediOS, expressWifi, wifi_connect, wifi_disconnect_and_forget
|
||||
|
||||
setup_params_general = {
|
||||
"mode": "NAT",
|
||||
"ssid_modes": {
|
||||
"open": [{"ssid_name": "XWF-OWF_DSx", "appliedRadios": ["2G"]}]
|
||||
},
|
||||
"rf": {},
|
||||
"radius": False,
|
||||
"express-wifi": True
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'setup_profiles',
|
||||
[setup_params_general],
|
||||
indirect=True,
|
||||
scope="class"
|
||||
)
|
||||
@pytest.mark.usefixtures("setup_profiles")
|
||||
class TestExpressWifi(object):
|
||||
|
||||
@pytest.mark.twog
|
||||
@pytest.mark.open
|
||||
def test_ExpressWifi(self, request, get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS):
|
||||
profile_data = setup_params_general["ssid_modes"]["open"][0]
|
||||
ssidName = profile_data["ssid_name"]
|
||||
ssidPassword = ""
|
||||
print("SSID_NAME: " + ssidName)
|
||||
print("SSID_PASS: " + ssidPassword)
|
||||
|
||||
report = setup_perfectoMobile_iOS[1]
|
||||
driver = setup_perfectoMobile_iOS[0]
|
||||
connData = get_ToggleAirplaneMode_data
|
||||
|
||||
# Set Wifi/AP Mode
|
||||
wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
|
||||
|
||||
# Express Wifi
|
||||
expressWifi(request, setup_perfectoMobile_iOS, connData)
|
||||
|
||||
# ForgetWifi
|
||||
wifi_disconnect_and_forget(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
|
||||
|
||||
Reference in New Issue
Block a user