mirror of
https://github.com/Telecominfraproject/wlan-testing.git
synced 2025-11-02 11:57:49 +00:00
Added Android Test Cases
Signed-off-by: raj-TIP <rpasupathy@perfectomobile.com>
This commit is contained in:
@@ -1,20 +1,24 @@
|
|||||||
# !/usr/local/lib64/python3.8
|
|
||||||
"""
|
"""
|
||||||
Controller Library
|
Controller Library
|
||||||
1. controller_data/sdk_base_url
|
1. controller_data/sdk_base_url
|
||||||
2. login credentials
|
2. login credentials
|
||||||
"""
|
"""
|
||||||
from logging import exception
|
import datetime
|
||||||
import unittest
|
|
||||||
import warnings
|
|
||||||
from perfecto.test import TestResultFactory
|
|
||||||
import pytest
|
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
import time
|
import time
|
||||||
from selenium.common.exceptions import NoSuchElementException
|
import warnings
|
||||||
|
import urllib3
|
||||||
|
from perfecto.model.model import Job, Project
|
||||||
|
from perfecto import (PerfectoExecutionContext, PerfectoReportiumClient,TestContext, TestResultFactory)
|
||||||
|
import pytest
|
||||||
|
import logging
|
||||||
|
import re
|
||||||
|
from selenium.common.exceptions import NoSuchElementException, TimeoutException
|
||||||
from selenium.webdriver.common.by import By
|
from selenium.webdriver.common.by import By
|
||||||
from appium import webdriver
|
from selenium.webdriver.support.ui import WebDriverWait
|
||||||
from selenium.common.exceptions import NoSuchElementException
|
from appium.webdriver.common.mobileby import MobileBy
|
||||||
|
from selenium.webdriver.support import expected_conditions as EC
|
||||||
|
|
||||||
def openApp(appName, setup_perfectoMobile):
|
def openApp(appName, setup_perfectoMobile):
|
||||||
print("Refreshing App: " + appName)
|
print("Refreshing App: " + appName)
|
||||||
@@ -31,4 +35,613 @@ def closeApp(appName, setup_perfectoMobile):
|
|||||||
params = {'identifier': appName}
|
params = {'identifier': appName}
|
||||||
setup_perfectoMobile[0].execute_script('mobile:application:close', params)
|
setup_perfectoMobile[0].execute_script('mobile:application:close', params)
|
||||||
|
|
||||||
|
def getDeviceID(setup_perfectoMobile):
|
||||||
|
report = setup_perfectoMobile[1]
|
||||||
|
driver = setup_perfectoMobile[0]
|
||||||
|
|
||||||
|
report.step_start("Get DeviceID")
|
||||||
|
params = {'property': 'deviceId'}
|
||||||
|
deviceID = driver.execute_script('mobile:handset:info', params)
|
||||||
|
print("DeviceID: " + deviceID)
|
||||||
|
return deviceID
|
||||||
|
|
||||||
|
def getDeviceModelName(setup_perfectoMobile):
|
||||||
|
report = setup_perfectoMobile[1]
|
||||||
|
driver = setup_perfectoMobile[0]
|
||||||
|
|
||||||
|
report.step_start("Device Model Name")
|
||||||
|
params = {'property': 'model'}
|
||||||
|
deviceModel = driver.execute_script('mobile:handset:info', params)
|
||||||
|
print("ModelName: " + deviceModel)
|
||||||
|
return deviceModel
|
||||||
|
|
||||||
|
@pytest.fixture(scope="class")
|
||||||
|
def setup_perfectoMobile_android(request):
|
||||||
|
from appium import webdriver
|
||||||
|
driver = None
|
||||||
|
reporting_client = None
|
||||||
|
|
||||||
|
warnings.simplefilter("ignore", ResourceWarning)
|
||||||
|
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||||
|
|
||||||
|
capabilities = {
|
||||||
|
'platformName': request.config.getini("platformName-android"),
|
||||||
|
'model': request.config.getini("model-android"),
|
||||||
|
'browserName': 'mobileOS',
|
||||||
|
#'automationName' : 'Appium',
|
||||||
|
'securityToken' : request.config.getini("securityToken"),
|
||||||
|
'useAppiumForWeb' : 'false',
|
||||||
|
'useAppiumForHybrid' : 'false',
|
||||||
|
#'bundleId' : request.config.getini("appPackage-android"),
|
||||||
|
}
|
||||||
|
|
||||||
|
driver = webdriver.Remote('https://'+request.config.getini("perfectoURL")+'.perfectomobile.com/nexperience/perfectomobile/wd/hub', capabilities)
|
||||||
|
driver.implicitly_wait(35)
|
||||||
|
|
||||||
|
TestCaseFullName = os.environ.get('PYTEST_CURRENT_TEST').split(':')[-1].split(' ')[0]
|
||||||
|
nCurrentTestMethodNameSplit = re.sub(r'\[.*?\]\ *', "", TestCaseFullName)
|
||||||
|
TestCaseName = nCurrentTestMethodNameSplit.removeprefix('test_')
|
||||||
|
#print ("\nTestCaseName: " + TestCaseName)
|
||||||
|
|
||||||
|
projectname = request.config.getini("projectName")
|
||||||
|
projectversion = request.config.getini("projectVersion")
|
||||||
|
jobname = request.config.getini("jobName")
|
||||||
|
jobnumber = request.config.getini("jobNumber")
|
||||||
|
tags = request.config.getini("reportTags")
|
||||||
|
testCaseName = TestCaseName
|
||||||
|
|
||||||
|
print("\nSetting Perfecto ReportClient....")
|
||||||
|
perfecto_execution_context = PerfectoExecutionContext(driver, tags, Job(jobname, jobnumber),Project(projectname, projectversion))
|
||||||
|
reporting_client = PerfectoReportiumClient(perfecto_execution_context)
|
||||||
|
reporting_client.test_start(testCaseName, TestContext([], "Perforce"))
|
||||||
|
|
||||||
|
def teardown():
|
||||||
|
try:
|
||||||
|
print(" -- Tear Down --")
|
||||||
|
reporting_client.test_stop(TestResultFactory.create_success())
|
||||||
|
print('Report-Url: ' + reporting_client.report_url() + '\n')
|
||||||
|
driver.close()
|
||||||
|
except Exception as e:
|
||||||
|
print(" -- Exception Not Able To close --")
|
||||||
|
print (e.message)
|
||||||
|
finally:
|
||||||
|
try:
|
||||||
|
driver.quit()
|
||||||
|
except Exception as e:
|
||||||
|
print(" -- Exception Not Able To Quit --")
|
||||||
|
print (e.message)
|
||||||
|
|
||||||
|
request.addfinalizer(teardown)
|
||||||
|
|
||||||
|
if driver is None:
|
||||||
|
yield -1
|
||||||
|
else:
|
||||||
|
yield driver,reporting_client
|
||||||
|
|
||||||
|
def set_APconnMobileDevice_android(WifiName, WifiPass, setup_perfectoMobile, connData):
|
||||||
|
print("\n-------------------------------------")
|
||||||
|
print("Select Wifi/AccessPoint Connection")
|
||||||
|
print("-------------------------------------")
|
||||||
|
print("Verifying Wifi/AP Connection Details....")
|
||||||
|
report = setup_perfectoMobile[1]
|
||||||
|
driver = setup_perfectoMobile[0]
|
||||||
|
|
||||||
|
report.step_start("Switching Driver Context")
|
||||||
|
print("Switching Context to Native")
|
||||||
|
contexts = driver.contexts
|
||||||
|
driver.switch_to.context(contexts[0])
|
||||||
|
|
||||||
|
#Open Settings Application
|
||||||
|
openApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
|
||||||
|
deviceModelName = getDeviceModelName(setup_perfectoMobile)
|
||||||
|
print ("Selected Device Model: " + deviceModelName)
|
||||||
|
|
||||||
|
if deviceModelName!=("Pixel 4"):
|
||||||
|
|
||||||
|
report.step_start("Set Wifi Network to " + WifiName)
|
||||||
|
try:
|
||||||
|
print("Verifying Connected Wifi Connection")
|
||||||
|
report.step_start("Click Connections")
|
||||||
|
connElement = driver.find_element_by_xpath("//*[@text='Connections']")
|
||||||
|
connElement.click()
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Exception: Verify Xpath - Update/check Xpath for Click Connections")
|
||||||
|
|
||||||
|
try:
|
||||||
|
print("Get Connected Wifi Name if any")
|
||||||
|
report.step_start("Get Connected Wifi Name if any")
|
||||||
|
try:
|
||||||
|
driver.implicitly_wait(35)
|
||||||
|
WifiNameElement = driver.find_element_by_xpath("//*[@resource-id='android:id/summary']")
|
||||||
|
Wifi_AP_Name = WifiNameElement.text
|
||||||
|
print("Current Wifi Status Name: " + Wifi_AP_Name)
|
||||||
|
except NoSuchElementException:
|
||||||
|
report.step_start("Wifi Radio Button Enabled")
|
||||||
|
WifiRadioBtnConnections = driver.find_element_by_xpath("//*[@resource-id='android:id/switch_widget' and @content-desc='Wi-Fi']")
|
||||||
|
WifiRadioBtnConnections.click()
|
||||||
|
except NoSuchElementException:
|
||||||
|
Wifi_AP_Name="Null"
|
||||||
|
print("Device not connected to any Wifi")
|
||||||
|
|
||||||
|
report.step_start("Clicking Wi-Fi")
|
||||||
|
wifiElement = driver.find_element_by_xpath("//*[@text='Wi-Fi']")
|
||||||
|
wifiElement.click()
|
||||||
|
|
||||||
|
if Wifi_AP_Name.__eq__(WifiName):
|
||||||
|
print("Wifi Name Matches - Already Connected To: " + Wifi_AP_Name)
|
||||||
|
|
||||||
|
try:
|
||||||
|
report.step_start("Verify if Wifi is Connected")
|
||||||
|
WifiInternetErrMsg = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']")
|
||||||
|
print("Wifi Successfully Connected")
|
||||||
|
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Wifi Connection Error: " + WifiName)
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
|
#print("Set Wifi Radio Button to enabled")
|
||||||
|
#try:
|
||||||
|
# report.step_start("Set Wifi Radio Button to enabled")
|
||||||
|
# wifiRadioBtn = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_widget' and @text='Wi-Fi, Off']")
|
||||||
|
# wifiRadioBtn.click()
|
||||||
|
# except NoSuchElementException:
|
||||||
|
# report.step_start("Set Wifi Radio Button Already enabled")
|
||||||
|
# print("Radio button Already Enabled")
|
||||||
|
|
||||||
|
print("Selecting Wifi: " + WifiName)
|
||||||
|
try:
|
||||||
|
report.step_start("Selecting Wifi: " + WifiName)
|
||||||
|
wifiSelectionElement = WebDriverWait(driver, 35).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='"+ WifiName + "']")))
|
||||||
|
wifiSelectionElement.click()
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Exception on Selecting Wifi Network. Please check wifi Name or signal")
|
||||||
|
|
||||||
|
#Set password if Needed
|
||||||
|
try:
|
||||||
|
report.step_start("Set Wifi Password")
|
||||||
|
wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/edittext']")
|
||||||
|
wifiPasswordElement.send_keys(WifiPass)
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Password Page Not Loaded, password May be cached in the System")
|
||||||
|
|
||||||
|
try:
|
||||||
|
report.step_start("Click Connect Button")
|
||||||
|
joinBTNElement = driver.find_element_by_xpath("//*[@text='Connect']")
|
||||||
|
joinBTNElement.click()
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Connect Button Not Enabled...Verify if Password is set properly ")
|
||||||
|
|
||||||
|
try:
|
||||||
|
report.step_start("Verify if Wifi is Connected")
|
||||||
|
WifiInternetErrMsg = WebDriverWait(driver, 35).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']")))
|
||||||
|
print("Wifi Successfully Connected")
|
||||||
|
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Wifi Connection Error: " + WifiName)
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
|
report.step_start("Set Wifi Network to Pixel" + WifiName)
|
||||||
|
try:
|
||||||
|
print("Click Network & Internet")
|
||||||
|
report.step_start("Click Network & Internet")
|
||||||
|
connElement = driver.find_element_by_xpath("//*[@text='Network & internet']")
|
||||||
|
connElement.click()
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Exception: Verify Xpath - Update/check Xpath for Click Connections")
|
||||||
|
|
||||||
|
try:
|
||||||
|
print("Get Connected Wifi Name if any")
|
||||||
|
report.step_start("Get Connected Wifi Name if any")
|
||||||
|
WifiNameElement = WebDriverWait(driver, 35).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='android:id/title' and @text='Wi‑Fi']/parent::*/android.widget.TextView[@resource-id='android:id/summary']")))
|
||||||
|
Wifi_AP_Name = WifiNameElement.text
|
||||||
|
print("Current Wifi Status Name: " + Wifi_AP_Name)
|
||||||
|
WifiNameElement.click()
|
||||||
|
except NoSuchElementException:
|
||||||
|
Wifi_AP_Name="Null"
|
||||||
|
print("Device not connected to any Wifi")
|
||||||
|
|
||||||
|
if Wifi_AP_Name.__eq__(WifiName):
|
||||||
|
print("Wifi Name Matches - Already Connected To: " + Wifi_AP_Name)
|
||||||
|
|
||||||
|
try:
|
||||||
|
report.step_start("Verify if Wifi is Connected")
|
||||||
|
WifiInternetErrMsg = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']")
|
||||||
|
print("Wifi Successfully Connected")
|
||||||
|
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Wifi Connection Error: " + WifiName)
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
|
print("Set Wifi Radio Button to enabled")
|
||||||
|
try:
|
||||||
|
report.step_start("Set Wifi Radio Button to enabled")
|
||||||
|
wifiRadioBtn = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_widget' and @text='OFF']")
|
||||||
|
wifiRadioBtn.click()
|
||||||
|
except NoSuchElementException:
|
||||||
|
report.step_start("Set Wifi Radio Button Already enabled")
|
||||||
|
print("Radio button Already Enabled")
|
||||||
|
|
||||||
|
print("Selecting Wifi: " + WifiName)
|
||||||
|
try:
|
||||||
|
report.step_start("Selecting Wifi: " + WifiName)
|
||||||
|
wifiSelectionElement = WebDriverWait(driver, 35).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='"+ WifiName + "']")))
|
||||||
|
wifiSelectionElement.click()
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Exception on Selecting Wifi Network. Please check wifi Name or signal")
|
||||||
|
|
||||||
|
#Set password if Needed
|
||||||
|
try:
|
||||||
|
report.step_start("Set Wifi Password")
|
||||||
|
wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/password']")
|
||||||
|
wifiPasswordElement.send_keys(WifiPass)
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Password Page Not Loaded, password May be cached in the System")
|
||||||
|
|
||||||
|
try:
|
||||||
|
report.step_start("Click Connect Button")
|
||||||
|
joinBTNElement = driver.find_element_by_xpath("//*[@resource-id='android:id/button1' and @text='Connect']")
|
||||||
|
joinBTNElement.click()
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Connect Button Not Enabled...Verify if Password is set properly ")
|
||||||
|
|
||||||
|
try:
|
||||||
|
report.step_start("Verify if Wifi is Connected")
|
||||||
|
WifiInternetErrMsg = WebDriverWait(driver, 35).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']")))
|
||||||
|
print("Wifi Successfully Connected")
|
||||||
|
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Wifi Connection Error: " + WifiName)
|
||||||
|
|
||||||
|
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
|
||||||
|
def ForgetWifiConnection(setup_perfectoMobile, WifiName, connData):
|
||||||
|
print("\n-----------------------------")
|
||||||
|
print("Forget 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)
|
||||||
|
|
||||||
|
#Open Settings Application
|
||||||
|
openApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
|
||||||
|
deviceModelName = getDeviceModelName(setup_perfectoMobile)
|
||||||
|
print ("Selected Device Model: " + deviceModelName)
|
||||||
|
|
||||||
|
if deviceModelName!=("Pixel 4"):
|
||||||
|
|
||||||
|
report.step_start("Forget Existing Wifi" + WifiName)
|
||||||
|
try:
|
||||||
|
print("Verifying Connected Wifi Connection")
|
||||||
|
report.step_start("Click Connections")
|
||||||
|
connElement = driver.find_element_by_xpath("//*[@text='Connections']")
|
||||||
|
connElement.click()
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Exception: Verify Xpath - Update/check Xpath for Click Connections")
|
||||||
|
|
||||||
|
try:
|
||||||
|
print("Connected Wifi Name if any")
|
||||||
|
report.step_start("Get Connected Wifi Name if any")
|
||||||
|
WifiNameElement = driver.find_element_by_xpath("//*[@resource-id='android:id/summary']")
|
||||||
|
Wifi_AP_Name = WifiNameElement.text
|
||||||
|
print("Connected to Wifi: " + Wifi_AP_Name)
|
||||||
|
except NoSuchElementException:
|
||||||
|
Wifi_AP_Name="Null"
|
||||||
|
print("Device not connected to any Wifi")
|
||||||
|
|
||||||
|
report.step_start("Clicking Wi-Fi")
|
||||||
|
wifiElement = driver.find_element_by_xpath("//*[@text='Wi-Fi']")
|
||||||
|
wifiElement.click()
|
||||||
|
|
||||||
|
if Wifi_AP_Name.__eq__(WifiName):
|
||||||
|
print("Wifi Name Matches - Already Connected To: " + Wifi_AP_Name)
|
||||||
|
|
||||||
|
print("Load Wifi Details Page")
|
||||||
|
try:
|
||||||
|
report.step_start("Load Wifi Details Page")
|
||||||
|
WifiInternetDetails = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/wifi_details']")
|
||||||
|
WifiInternetDetails.click()
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Wifi Connection Error: " + WifiName)
|
||||||
|
|
||||||
|
print("Forget Wifi Network")
|
||||||
|
try:
|
||||||
|
report.step_start("Forget Wifi Network")
|
||||||
|
WifiForget= driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/smallLabel' and @text='Forget']")
|
||||||
|
WifiForget.click()
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Wifi Connection Error: " + WifiName)
|
||||||
|
|
||||||
|
print("Verify if wifi is disconnected from: " + WifiName)
|
||||||
|
try:
|
||||||
|
report.step_start("Verify if wifi is disconnected from: " + WifiName)
|
||||||
|
WifiForget= driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']")
|
||||||
|
print("Wifi Not disconnected, check xpath for: " + WifiName)
|
||||||
|
assert False
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Wifi Disconnected Successfully: " + WifiName)
|
||||||
|
|
||||||
|
else:
|
||||||
|
print("Wifi Does not Match with Wifi: " + WifiName)
|
||||||
|
|
||||||
|
try:
|
||||||
|
report.step_start("Wifi Details Page")
|
||||||
|
WifiInternetDetails = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/wifi_details']")
|
||||||
|
WifiInternetDetails.click()
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Wifi Connection Error: " + WifiName)
|
||||||
|
|
||||||
|
try:
|
||||||
|
report.step_start("Forget Wifi Network")
|
||||||
|
WifiForget= driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/smallLabel' and @text='Forget']")
|
||||||
|
WifiForget.click()
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Wifi Connection Error: " + WifiName)
|
||||||
|
|
||||||
|
|
||||||
|
print("Verify if wifi is disconnected from: " + WifiName)
|
||||||
|
try:
|
||||||
|
report.step_start("Verify if wifi is disconnected from: " + WifiName)
|
||||||
|
WifiForget= driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']")
|
||||||
|
print("Wifi Not disconnected, check xpath for: " + WifiName)
|
||||||
|
assert False
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Wifi Disconnected Successfully: " + WifiName)
|
||||||
|
|
||||||
|
|
||||||
|
else:
|
||||||
|
#print("Pixel Custom Code")
|
||||||
|
report.step_start("Forget Wifi Network on Pixel" + WifiName)
|
||||||
|
try:
|
||||||
|
print("Click Network & Internet")
|
||||||
|
report.step_start("Click Network & Internet")
|
||||||
|
connElement = driver.find_element_by_xpath("//*[@text='Network & internet']")
|
||||||
|
connElement.click()
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Exception: Verify Xpath - Update/check Xpath for Click Connections")
|
||||||
|
|
||||||
|
try:
|
||||||
|
print("Get Connected Wifi Name if any")
|
||||||
|
report.step_start("Get Connected Wifi Name if any")
|
||||||
|
WifiNameElement = WebDriverWait(driver, 35).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='android:id/title' and @text='Wi‑Fi']/parent::*/android.widget.TextView[@resource-id='android:id/summary']")))
|
||||||
|
Wifi_AP_Name = WifiNameElement.text
|
||||||
|
print("Current Wifi Status Name: " + Wifi_AP_Name)
|
||||||
|
WifiNameElement.click()
|
||||||
|
except NoSuchElementException:
|
||||||
|
Wifi_AP_Name="Null"
|
||||||
|
print("Device not connected to any Wifi")
|
||||||
|
|
||||||
|
|
||||||
|
#print("Wifi Name Matches - Already Connected To: " + Wifi_AP_Name)
|
||||||
|
try:
|
||||||
|
report.step_start("Wifi More information")
|
||||||
|
WifiInternetMoreSettings = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/settings_button_no_background']")
|
||||||
|
WifiInternetMoreSettings.click()
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Wifi Not Connected to any Wifi Error: " + WifiName)
|
||||||
|
|
||||||
|
try:
|
||||||
|
report.step_start("Forget Wifi Network")
|
||||||
|
WifiInternetMoreSettings = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/button1' and @text='Forget']")
|
||||||
|
WifiInternetMoreSettings.click()
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Wifi Connection Error: " + WifiName)
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
report.step_start("Verify if Wifi is Connected")
|
||||||
|
WifiInternetErrMsg = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']")
|
||||||
|
print("Forgot Wifi Error, check xpath")
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Wifi Disconnected Successfully: " + WifiName)
|
||||||
|
|
||||||
|
closeApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
|
||||||
|
def Toggle_AirplaneMode_android(setup_perfectoMobile, connData):
|
||||||
|
print("\n-----------------------")
|
||||||
|
print("Toggle Airplane Mode")
|
||||||
|
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)
|
||||||
|
|
||||||
|
#Open Settings Application
|
||||||
|
openApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
|
||||||
|
deviceModelName = getDeviceModelName(setup_perfectoMobile)
|
||||||
|
print ("Selected Device Model: " + deviceModelName)
|
||||||
|
|
||||||
|
airplaneFlag = False
|
||||||
|
|
||||||
|
report.step_start("Click Connections")
|
||||||
|
try:
|
||||||
|
print("Verifying Connected Wifi Connection")
|
||||||
|
report.step_start("Click Connections")
|
||||||
|
connElement = driver.find_element_by_xpath("//*[@text='Connections']")
|
||||||
|
connElement.click()
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Exception: Verify Xpath - Update/check Xpath for Click Connections")
|
||||||
|
|
||||||
|
try:
|
||||||
|
report.step_start("Toggle Airplane Mode to On")
|
||||||
|
print("Toggle Airplane Mode to On")
|
||||||
|
ToggleAirplanEle = driver.find_element_by_xpath("//*[@content-desc='Airplane mode' and @text='Off']")
|
||||||
|
ToggleAirplanEle.click()
|
||||||
|
airplaneFlag = True
|
||||||
|
|
||||||
|
print("Toggle Airplane Mode to Off")
|
||||||
|
ToggleAirplanEle2 = driver.find_element_by_xpath("//*[@content-desc='Airplane mode' and @text='On']")
|
||||||
|
ToggleAirplanEle2.click()
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Toggle Airplane Exception, Airplane mode may be on Already.")
|
||||||
|
|
||||||
|
try:
|
||||||
|
print("Checking to see if Airplane is already enabled")
|
||||||
|
report.step_start("Checking to see if Airplane is already enabled")
|
||||||
|
connElement = driver.find_element_by_xpath("//*[@content-desc='Airplane mode' and @text='On']")
|
||||||
|
airplaneFlag = True
|
||||||
|
report.step_start("Disable Airplane Mode")
|
||||||
|
connElement.click()
|
||||||
|
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Airplane Mode is On & Off status elements Error, please check xpath or if the Page Loaded")
|
||||||
|
|
||||||
|
return airplaneFlag
|
||||||
|
|
||||||
|
def Toggle_WifiMode_android(setup_perfectoMobile, WifiName, connData):
|
||||||
|
print("\n-----------------------")
|
||||||
|
print("Toggle Wifi Mode")
|
||||||
|
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)
|
||||||
|
|
||||||
|
#Open Settings Application
|
||||||
|
openApp(connData["appPackage-android"], setup_perfectoMobile)
|
||||||
|
|
||||||
|
deviceModelName = getDeviceModelName(setup_perfectoMobile)
|
||||||
|
print ("Selected Device Model: " + deviceModelName)
|
||||||
|
|
||||||
|
WifiFlag = False
|
||||||
|
|
||||||
|
try:
|
||||||
|
report.step_start("Click Connections")
|
||||||
|
print("Click Connections")
|
||||||
|
connElement = driver.find_element_by_xpath("//*[@text='Connections']")
|
||||||
|
connElement.click()
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Exception: Verify Xpath - Update/check Xpath for Click Connections")
|
||||||
|
|
||||||
|
try:
|
||||||
|
print("Get Connected Wifi Name if any")
|
||||||
|
report.step_start("Get Connected Wifi Name if any")
|
||||||
|
WifiNameElement = driver.find_element_by_xpath("//*[@resource-id='android:id/summary']")
|
||||||
|
Wifi_AP_Name = WifiNameElement.text
|
||||||
|
print("Current Wifi Status Name: " + Wifi_AP_Name)
|
||||||
|
except NoSuchElementException:
|
||||||
|
Wifi_AP_Name="Null"
|
||||||
|
print("Device not connected to any Wifi")
|
||||||
|
|
||||||
|
print("Current Selected Wifi: " + Wifi_AP_Name)
|
||||||
|
report.step_start("Current Selected Wifi: " + Wifi_AP_Name)
|
||||||
|
|
||||||
|
try:
|
||||||
|
report.step_start("Disable Wifi Radio Button")
|
||||||
|
print("Disable Wifi Radio Button")
|
||||||
|
connElement = driver.find_element_by_xpath("//*[@content-desc='Wi-Fi' and @text='On']")
|
||||||
|
connElement.click()
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Exception: Verify Xpath - Update/check Xpath for Wifi Radio Button")
|
||||||
|
|
||||||
|
try:
|
||||||
|
print("Get Connected Wifi Name if any after Wifi Radio is disabled")
|
||||||
|
report.step_start("Get Connected Wifi Name if any after Wifi Radio is disabled")
|
||||||
|
WifiNameElement = driver.find_element_by_xpath("//*[@resource-id='android:id/summary']")
|
||||||
|
Wifi_AP_Name2 = WifiNameElement.text
|
||||||
|
print("Device Connected to Wifi: " + Wifi_AP_Name2)
|
||||||
|
except NoSuchElementException:
|
||||||
|
Wifi_AP_Name2="Null"
|
||||||
|
print("Device connected to Wifi: " + Wifi_AP_Name2)
|
||||||
|
|
||||||
|
try:
|
||||||
|
report.step_start("Enable Wifi Radio Button")
|
||||||
|
print("Enable Wifi Radio Button")
|
||||||
|
wifiRadioBTN_Off = driver.find_element_by_xpath("//*[@content-desc='Wi-Fi' and @text='Off']")
|
||||||
|
wifiRadioBTN_Off.click()
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Exception: Verify Xpath - Update/check Xpath for Wifi Radio Button")
|
||||||
|
|
||||||
|
try:
|
||||||
|
print("Get Connected Wifi Name if any after Wifi Radio is Enabled")
|
||||||
|
report.step_start("Get Connected Wifi Name if any after Wifi Radio is disabled")
|
||||||
|
WifiNameElement3 = WebDriverWait(driver, 35).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='android:id/summary']")))
|
||||||
|
Wifi_AP_Name3 = WifiNameElement3.text
|
||||||
|
print("Current Wifi Status Name: " + Wifi_AP_Name3)
|
||||||
|
except NoSuchElementException:
|
||||||
|
Wifi_AP_Name3="Null"
|
||||||
|
print("Device did not connect back to Wifi: " + WifiName)
|
||||||
|
|
||||||
|
if Wifi_AP_Name3.__eq__(WifiName):
|
||||||
|
WifiFlag = True
|
||||||
|
else:
|
||||||
|
WifiFlag = False
|
||||||
|
|
||||||
|
return WifiFlag
|
||||||
|
|
||||||
|
|
||||||
|
def verifyUploadDownloadSpeed_android(setup_perfectoMobile, get_APToMobileDevice_data):
|
||||||
|
print("\n-------------------------------------")
|
||||||
|
print("Verify Upload & Download Speed")
|
||||||
|
print("-------------------------------------")
|
||||||
|
report = setup_perfectoMobile[1]
|
||||||
|
driver = setup_perfectoMobile[0]
|
||||||
|
connData = get_APToMobileDevice_data
|
||||||
|
|
||||||
|
currentResult=False
|
||||||
|
|
||||||
|
driver.switch_to.context('WEBVIEW_1')
|
||||||
|
|
||||||
|
try:
|
||||||
|
print("Launching Safari")
|
||||||
|
report.step_start("Google Home Page")
|
||||||
|
driver.get(connData["webURL"])
|
||||||
|
print("Enter Search Text")
|
||||||
|
elementFindTxt = driver.find_element_by_xpath(connData["lblSearch"])
|
||||||
|
elementFindTxt.send_keys("Internet Speed Test")
|
||||||
|
except Exception as e:
|
||||||
|
print("Launching Safari Failed")
|
||||||
|
print (e.message)
|
||||||
|
|
||||||
|
try:
|
||||||
|
print("Click Search Button")
|
||||||
|
report.step_start("Click Search Button")
|
||||||
|
elelSearch = driver.find_element_by_xpath("//*[@class='aajZCb']/li[1]/div[1]")
|
||||||
|
elelSearch.click()
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Search Drop Down not active...")
|
||||||
|
|
||||||
|
print("Click Run Speed Test Button...")
|
||||||
|
report.step_start("Click Run Speed Test Button")
|
||||||
|
driver.find_element_by_xpath(connData["BtnRunSpeedTest"]).click()
|
||||||
|
|
||||||
|
#Get upload/Download Speed
|
||||||
|
try:
|
||||||
|
print("Get Download Speed")
|
||||||
|
report.step_start("Get upload/Download Speed")
|
||||||
|
time.sleep(60)
|
||||||
|
downloadMbps = driver.find_element_by_xpath(connData["downloadMbps"])
|
||||||
|
downloadSpeed = downloadMbps.text
|
||||||
|
print("Download: " + downloadSpeed + " Mbps")
|
||||||
|
|
||||||
|
print("Get Upload Speed")
|
||||||
|
report.step_start("Get Upload Speed")
|
||||||
|
UploadMbps = driver.find_element_by_xpath(connData["UploadMbps"])
|
||||||
|
uploadSpeed = UploadMbps.text
|
||||||
|
print("Upload: " + uploadSpeed + " Mbps")
|
||||||
|
|
||||||
|
print("Access Point Verification Completed Successfully")
|
||||||
|
currentResult = True
|
||||||
|
except NoSuchElementException:
|
||||||
|
print("Access Point Verification NOT Completed, checking Connection....")
|
||||||
|
|
||||||
|
return currentResult
|
||||||
|
|
||||||
@@ -96,9 +96,6 @@ def pytest_addoption(parser):
|
|||||||
parser.addini("appPackage-android", "Android Devices")
|
parser.addini("appPackage-android", "Android Devices")
|
||||||
parser.addini("bundleId-iOS-Safari", "Safari BundleID")
|
parser.addini("bundleId-iOS-Safari", "Safari BundleID")
|
||||||
parser.addini("wifi-SSID-2g-Pwd", "Wifi 2g Password")
|
parser.addini("wifi-SSID-2g-Pwd", "Wifi 2g Password")
|
||||||
parser.addini("Default-SSID-5gl-perfecto-b", "Wifi 5g AP Name")
|
|
||||||
parser.addini("Default-SSID-2g-perfecto-b", "Wifi 2g AP Name")
|
|
||||||
parser.addini("Default-SSID-perfecto-b", "Wifi AP Name")
|
|
||||||
parser.addini("bundleId-iOS-Ping", "Ping Bundle ID")
|
parser.addini("bundleId-iOS-Ping", "Ping Bundle ID")
|
||||||
parser.addini("browserType-iOS", "Mobile Browser Name")
|
parser.addini("browserType-iOS", "Mobile Browser Name")
|
||||||
parser.addini("projectName", "Project Name")
|
parser.addini("projectName", "Project Name")
|
||||||
|
|||||||
@@ -3,13 +3,48 @@
|
|||||||
## pytest uses setup > test > tear_down
|
## pytest uses setup > test > tear_down
|
||||||
#### Fixtures : Code that needs to be part of more than 1 test cases, Setup and teardown is Implemented in Fixtures
|
#### Fixtures : Code that needs to be part of more than 1 test cases, Setup and teardown is Implemented in Fixtures
|
||||||
|
|
||||||
|
Requried Module Installation:
|
||||||
|
pip3 install selenium
|
||||||
|
pip3 install perfecto-py37
|
||||||
|
pip3 install Appium-Python-Client
|
||||||
|
|
||||||
#pip3 install selenium
|
Avaiable WPA2 & WPA Protocal for 5G or 2G Options
|
||||||
#pip3 install perfecto-py37
|
1) wpa2_personal :>
|
||||||
#pip3 install Appium-Python-Client
|
a) setup_profile_data["NAT"]["WPA2_P"]["5G"]
|
||||||
|
b) setup_profile_data["NAT"]["WPA2_P"]["2G"]
|
||||||
|
2) wpa :>
|
||||||
|
a) setup_profile_data["NAT"]["WPA"]["5G"]
|
||||||
|
b) setup_profile_data["NAT"]["WPA"]["2G"]
|
||||||
|
|
||||||
|
Sample Execution of Test Cases for a maximum of 4 devices in parallel only.
|
||||||
|
|
||||||
|
Required Parameters:
|
||||||
|
1) securityToken=<Please-Enter-your-securityToken>
|
||||||
|
2) jobName=<Your-CI-JOB-NAME>
|
||||||
|
3) jobNumber=<Your-CI-JOB-NUMBER>
|
||||||
|
4) model-iOS=iPhone.* < Picks any random iphone or use any device below.
|
||||||
|
a) iPhone-11.* (Picks any random iphone 11)
|
||||||
|
b) iPhone-12.* (Picks any random iphone 12)
|
||||||
|
c) iPhone-7.* (Picks any random iphone 7)
|
||||||
|
d) iPhone-XR.* (Picks any random iphone XR)
|
||||||
|
Note:Only 1 device of each are avaible on the cloud. You can only assign 1 test case to to a phone @ a time.
|
||||||
|
|
||||||
|
Sample Execution of Tests from CI:
|
||||||
|
|
||||||
|
Execute AccessPassPointConnectivety Test Case with wpa2_personal & fiveg
|
||||||
|
#pytest -m "AccessPassPointConnectivety and wpa2_personal and fiveg" -s -vvv --testbed=interop -o 'model-iOS=iPhone.*' -o 'jobName=TestRajMay' -o 'jobNumber=2' -o 'securityToken=<YOUR-SECURITY-TOKEN>'
|
||||||
|
|
||||||
|
pytest -m "ToggleAirplaneMode and wpa2_personal and fiveg" -s -vvv --testbed=interop -o 'model-iOS=iPhone.*' -o 'jobName=TestRajMay' -o 'jobNumber=2' -o 'securityToken=<YOUR-SECURITY-TOKEN>'
|
||||||
|
|
||||||
|
pytest -m "ClientConnectivity and wpa2_personal and fiveg" -s -vvv --testbed=interop -o 'model-iOS=iPhone.*' -o 'jobName=TestRajMay' -o 'jobNumber=2' -o 'securityToken=<YOUR-SECURITY-TOKEN>'
|
||||||
|
|
||||||
|
pytest -m "PassPointConnection and wpa2_personal and fiveg" -s -vvv --testbed=interop -o 'model-iOS=iPhone.*' -o 'jobName=TestRajMay' -o 'jobNumber=2' -o 'securityToken=<YOUR-SECURITY-TOKEN>'
|
||||||
|
|
||||||
|
pytest -m "ToggleWifiMode and wpa2_personal and fiveg" -s -vvv --testbed=interop -o 'model-iOS=iPhone.*' -o 'jobName=TestRajMay' -o 'jobNumber=2' -o 'securityToken=<YOUR-SECURITY-TOKEN>'
|
||||||
|
|
||||||
#### For any Clarifications, regarding Framework,
|
#### For any Clarifications, regarding Framework,
|
||||||
#### Email : shivam.thakur@candelatech.com
|
#### Email : shivam.thakur@candelatech.com <Shivam>
|
||||||
|
#### Email : rpasupathy@perforce.com <Raj>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,136 @@
|
|||||||
|
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
|
||||||
|
|
||||||
|
if 'perfecto_libs' not in sys.path:
|
||||||
|
sys.path.append(f'../libs/perfecto_libs')
|
||||||
|
|
||||||
|
from android_lib import closeApp, verifyUploadDownloadSpeed_android, set_APconnMobileDevice_android, Toggle_AirplaneMode_android, ForgetWifiConnection, openApp, setup_perfectoMobile_android
|
||||||
|
|
||||||
|
@pytest.mark.AccessPointConnectionAndroid
|
||||||
|
@pytest.mark.wifi5
|
||||||
|
@pytest.mark.wifi6
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
'setup_profiles, create_profiles',
|
||||||
|
[(["NAT"], ["NAT"])],
|
||||||
|
indirect=True,
|
||||||
|
scope="class"
|
||||||
|
)
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures("setup_profiles")
|
||||||
|
@pytest.mark.usefixtures("create_profiles")
|
||||||
|
class TestAcessPointConnection(object):
|
||||||
|
|
||||||
|
@pytest.mark.fiveg
|
||||||
|
@pytest.mark.wpa2_personal
|
||||||
|
def test_AccessPointConnection_5g_WPA2_Personal(self, setup_profile_data, get_APToMobileDevice_data, setup_perfectoMobile_android):
|
||||||
|
|
||||||
|
profile_data = setup_profile_data["NAT"]["WPA2_P"]["5G"]
|
||||||
|
ssidName = profile_data["ssid_name"]
|
||||||
|
ssidPassword = profile_data["security_key"]
|
||||||
|
print ("SSID_NAME: " + ssidName)
|
||||||
|
print ("SSID_PASS: " + ssidPassword)
|
||||||
|
|
||||||
|
report = setup_perfectoMobile_android[1]
|
||||||
|
driver = setup_perfectoMobile_android[0]
|
||||||
|
connData = get_APToMobileDevice_data
|
||||||
|
|
||||||
|
#Set Wifi/AP Mode
|
||||||
|
set_APconnMobileDevice_android(ssidName, ssidPassword, setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Toggle AirplaneMode
|
||||||
|
assert Toggle_AirplaneMode_android(setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Verify Upload download Speed from device Selection
|
||||||
|
assert verifyUploadDownloadSpeed_android(setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#ForgetWifi
|
||||||
|
ForgetWifiConnection(setup_perfectoMobile_android, ssidName, connData)
|
||||||
|
|
||||||
|
@pytest.mark.twog
|
||||||
|
@pytest.mark.wpa2_personal
|
||||||
|
def test_AccessPointConnection_2g_WPA2_Personal(self, setup_profile_data, get_ToggleAirplaneMode_data, setup_perfectoMobile_android):
|
||||||
|
|
||||||
|
profile_data = setup_profile_data["NAT"]["WPA2_P"]["2G"]
|
||||||
|
ssidName = profile_data["ssid_name"]
|
||||||
|
ssidPassword = profile_data["security_key"]
|
||||||
|
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
|
||||||
|
set_APconnMobileDevice_android(ssidName, ssidPassword, setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Toggle AirplaneMode
|
||||||
|
assert Toggle_AirplaneMode_android(setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Verify Upload download Speed from device Selection
|
||||||
|
assert verifyUploadDownloadSpeed_android(setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#ForgetWifi
|
||||||
|
ForgetWifiConnection(setup_perfectoMobile_android, ssidName, connData)
|
||||||
|
|
||||||
|
@pytest.mark.fiveg
|
||||||
|
@pytest.mark.wpa
|
||||||
|
def test_AccessPointConnection_5g_WPA(self, setup_profile_data, get_ToggleAirplaneMode_data, setup_perfectoMobile_android):
|
||||||
|
|
||||||
|
profile_data = setup_profile_data["NAT"]["WPA"]["5G"]
|
||||||
|
ssidName = profile_data["ssid_name"]
|
||||||
|
ssidPassword = profile_data["security_key"]
|
||||||
|
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
|
||||||
|
set_APconnMobileDevice_android(ssidName, ssidPassword, setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Toggle AirplaneMode
|
||||||
|
assert Toggle_AirplaneMode_android(setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Verify Upload download Speed from device Selection
|
||||||
|
assert verifyUploadDownloadSpeed_android(setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#ForgetWifi
|
||||||
|
ForgetWifiConnection(setup_perfectoMobile_android, ssidName, connData)
|
||||||
|
|
||||||
|
@pytest.mark.twog
|
||||||
|
@pytest.mark.wpa
|
||||||
|
def test_AccessPointConnection_2g_WPA(self, setup_profile_data, get_ToggleAirplaneMode_data, setup_perfectoMobile_android):
|
||||||
|
|
||||||
|
profile_data = setup_profile_data["NAT"]["WPA"]["2G"]
|
||||||
|
ssidName = profile_data["ssid_name"]
|
||||||
|
ssidPassword = profile_data["security_key"]
|
||||||
|
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
|
||||||
|
set_APconnMobileDevice_android(ssidName, ssidPassword, setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Toggle AirplaneMode
|
||||||
|
assert Toggle_AirplaneMode_android(setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Verify Upload download Speed from device Selection
|
||||||
|
assert verifyUploadDownloadSpeed_android(setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#ForgetWifi
|
||||||
|
ForgetWifiConnection(setup_perfectoMobile_android, ssidName, connData)
|
||||||
0
tests/e2e/interOp/android/AirplaneMode/__init__.py
Normal file
0
tests/e2e/interOp/android/AirplaneMode/__init__.py
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
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
|
||||||
|
|
||||||
|
if 'perfecto_libs' not in sys.path:
|
||||||
|
sys.path.append(f'../libs/perfecto_libs')
|
||||||
|
|
||||||
|
from android_lib import closeApp, set_APconnMobileDevice_android, Toggle_AirplaneMode_android, ForgetWifiConnection, openApp, setup_perfectoMobile_android
|
||||||
|
|
||||||
|
@pytest.mark.ToggleAirplaneModeAndroid
|
||||||
|
@pytest.mark.wifi5
|
||||||
|
@pytest.mark.wifi6
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
'setup_profiles, create_profiles',
|
||||||
|
[(["NAT"], ["NAT"])],
|
||||||
|
indirect=True,
|
||||||
|
scope="class"
|
||||||
|
)
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures("setup_profiles")
|
||||||
|
@pytest.mark.usefixtures("create_profiles")
|
||||||
|
class TestToggleAirplaneModeAndroid(object):
|
||||||
|
|
||||||
|
@pytest.mark.fiveg
|
||||||
|
@pytest.mark.wpa2_personal
|
||||||
|
def test_ToogleAirplaneMode_5g_WPA2_Personal(self, setup_profile_data, get_ToggleAirplaneMode_data, setup_perfectoMobile_android):
|
||||||
|
|
||||||
|
profile_data = setup_profile_data["NAT"]["WPA2_P"]["5G"]
|
||||||
|
ssidName = profile_data["ssid_name"]
|
||||||
|
ssidPassword = profile_data["security_key"]
|
||||||
|
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
|
||||||
|
set_APconnMobileDevice_android(ssidName, ssidPassword, setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Toggle AirplaneMode
|
||||||
|
assert Toggle_AirplaneMode_android(setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#ForgetWifi
|
||||||
|
ForgetWifiConnection(setup_perfectoMobile_android, ssidName, connData)
|
||||||
|
|
||||||
|
@pytest.mark.twog
|
||||||
|
@pytest.mark.wpa2_personal
|
||||||
|
def test_ToogleAirplaneMode_2g_WPA2_Personal(self, setup_profile_data, get_ToggleAirplaneMode_data, setup_perfectoMobile_android):
|
||||||
|
|
||||||
|
profile_data = setup_profile_data["NAT"]["WPA2_P"]["2G"]
|
||||||
|
ssidName = profile_data["ssid_name"]
|
||||||
|
ssidPassword = profile_data["security_key"]
|
||||||
|
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
|
||||||
|
set_APconnMobileDevice_android(ssidName, ssidPassword, setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Toggle AirplaneMode
|
||||||
|
assert Toggle_AirplaneMode_android(setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#ForgetWifi
|
||||||
|
ForgetWifiConnection(setup_perfectoMobile_android, ssidName, connData)
|
||||||
|
|
||||||
|
@pytest.mark.fiveg
|
||||||
|
@pytest.mark.wpa
|
||||||
|
def test_ToogleAirplaneMode_5g_WPA(self, setup_profile_data, get_ToggleAirplaneMode_data, setup_perfectoMobile_android):
|
||||||
|
|
||||||
|
profile_data = setup_profile_data["NAT"]["WPA"]["5G"]
|
||||||
|
ssidName = profile_data["ssid_name"]
|
||||||
|
ssidPassword = profile_data["security_key"]
|
||||||
|
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
|
||||||
|
set_APconnMobileDevice_android(ssidName, ssidPassword, setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Toggle AirplaneMode
|
||||||
|
assert Toggle_AirplaneMode_android(setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#ForgetWifi
|
||||||
|
ForgetWifiConnection(setup_perfectoMobile_android, ssidName, connData)
|
||||||
|
|
||||||
|
@pytest.mark.twog
|
||||||
|
@pytest.mark.wpa
|
||||||
|
def test_ToogleAirplaneMode_2g_WPA(self, setup_profile_data, get_ToggleAirplaneMode_data, setup_perfectoMobile_android):
|
||||||
|
|
||||||
|
profile_data = setup_profile_data["NAT"]["WPA"]["2G"]
|
||||||
|
ssidName = profile_data["ssid_name"]
|
||||||
|
ssidPassword = profile_data["security_key"]
|
||||||
|
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
|
||||||
|
set_APconnMobileDevice_android(ssidName, ssidPassword, setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Toggle AirplaneMode
|
||||||
|
assert Toggle_AirplaneMode_android(setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#ForgetWifi
|
||||||
|
ForgetWifiConnection(setup_perfectoMobile_android, ssidName, connData)
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
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
|
||||||
|
|
||||||
|
if 'perfecto_libs' not in sys.path:
|
||||||
|
sys.path.append(f'../libs/perfecto_libs')
|
||||||
|
|
||||||
|
from android_lib import closeApp, set_APconnMobileDevice_android, verifyUploadDownloadSpeed_android, Toggle_WifiMode_android, Toggle_AirplaneMode_android, ForgetWifiConnection, openApp, setup_perfectoMobile_android
|
||||||
|
|
||||||
|
@pytest.mark.PassPointConnectionAndroid
|
||||||
|
@pytest.mark.wifi5
|
||||||
|
@pytest.mark.wifi6
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
'setup_profiles, create_profiles',
|
||||||
|
[(["NAT"], ["NAT"])],
|
||||||
|
indirect=True,
|
||||||
|
scope="class"
|
||||||
|
)
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures("setup_profiles")
|
||||||
|
@pytest.mark.usefixtures("create_profiles")
|
||||||
|
class TestPassPointConnection(object):
|
||||||
|
|
||||||
|
@pytest.mark.fiveg
|
||||||
|
@pytest.mark.wpa2_personal
|
||||||
|
def test_PassPointConnection_5g_WPA2_Personal(self, setup_profile_data, get_APToMobileDevice_data, setup_perfectoMobile_android):
|
||||||
|
|
||||||
|
profile_data = setup_profile_data["NAT"]["WPA2_P"]["5G"]
|
||||||
|
ssidName = profile_data["ssid_name"]
|
||||||
|
ssidPassword = profile_data["security_key"]
|
||||||
|
print ("SSID_NAME: " + ssidName)
|
||||||
|
print ("SSID_PASS: " + ssidPassword)
|
||||||
|
|
||||||
|
report = setup_perfectoMobile_android[1]
|
||||||
|
driver = setup_perfectoMobile_android[0]
|
||||||
|
connData = get_APToMobileDevice_data
|
||||||
|
|
||||||
|
#Set Wifi/AP Mode
|
||||||
|
set_APconnMobileDevice_android(ssidName, ssidPassword, setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Verify Upload download Speed from device Selection
|
||||||
|
assert verifyUploadDownloadSpeed_android(setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Toggle Wifi Mode
|
||||||
|
assert Toggle_WifiMode_android(setup_perfectoMobile_android, ssidName, connData)
|
||||||
|
|
||||||
|
#ForgetWifi
|
||||||
|
ForgetWifiConnection(setup_perfectoMobile_android, ssidName, connData)
|
||||||
|
|
||||||
|
@pytest.mark.twog
|
||||||
|
@pytest.mark.wpa2_personal
|
||||||
|
def test_PassPointConnection_2g_WPA2_Personal(self, setup_profile_data, get_ToggleAirplaneMode_data, setup_perfectoMobile_android):
|
||||||
|
|
||||||
|
profile_data = setup_profile_data["NAT"]["WPA2_P"]["2G"]
|
||||||
|
ssidName = profile_data["ssid_name"]
|
||||||
|
ssidPassword = profile_data["security_key"]
|
||||||
|
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
|
||||||
|
set_APconnMobileDevice_android(ssidName, ssidPassword, setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Verify Upload download Speed from device Selection
|
||||||
|
assert verifyUploadDownloadSpeed_android(setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Toggle Wifi Mode
|
||||||
|
assert Toggle_WifiMode_android(setup_perfectoMobile_android, ssidName, connData)
|
||||||
|
|
||||||
|
#ForgetWifi
|
||||||
|
ForgetWifiConnection(setup_perfectoMobile_android, ssidName, connData)
|
||||||
|
|
||||||
|
@pytest.mark.fiveg
|
||||||
|
@pytest.mark.wpa
|
||||||
|
def test_PassPointConnection_5g_WPA(self, setup_profile_data, get_ToggleAirplaneMode_data, setup_perfectoMobile_android):
|
||||||
|
|
||||||
|
profile_data = setup_profile_data["NAT"]["WPA"]["5G"]
|
||||||
|
ssidName = profile_data["ssid_name"]
|
||||||
|
ssidPassword = profile_data["security_key"]
|
||||||
|
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
|
||||||
|
set_APconnMobileDevice_android(ssidName, ssidPassword, setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Verify Upload download Speed from device Selection
|
||||||
|
assert verifyUploadDownloadSpeed_android(setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Toggle Wifi Mode
|
||||||
|
assert Toggle_WifiMode_android(setup_perfectoMobile_android, ssidName, connData)
|
||||||
|
|
||||||
|
#ForgetWifi
|
||||||
|
ForgetWifiConnection(setup_perfectoMobile_android, ssidName, connData)
|
||||||
|
|
||||||
|
@pytest.mark.twog
|
||||||
|
@pytest.mark.wpa
|
||||||
|
def test_PassPointConnection_2g_WPA(self, setup_profile_data, get_ToggleAirplaneMode_data, setup_perfectoMobile_android):
|
||||||
|
|
||||||
|
profile_data = setup_profile_data["NAT"]["WPA"]["2G"]
|
||||||
|
ssidName = profile_data["ssid_name"]
|
||||||
|
ssidPassword = profile_data["security_key"]
|
||||||
|
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
|
||||||
|
set_APconnMobileDevice_android(ssidName, ssidPassword, setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Verify Upload download Speed from device Selection
|
||||||
|
assert verifyUploadDownloadSpeed_android(setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Toggle Wifi Mode
|
||||||
|
assert Toggle_WifiMode_android(setup_perfectoMobile_android, ssidName, connData)
|
||||||
|
|
||||||
|
#ForgetWifi
|
||||||
|
ForgetWifiConnection(setup_perfectoMobile_android, ssidName, connData)
|
||||||
0
tests/e2e/interOp/android/WifiMode/__init__.py
Normal file
0
tests/e2e/interOp/android/WifiMode/__init__.py
Normal file
124
tests/e2e/interOp/android/WifiMode/test_ToggleWifiMode.py
Normal file
124
tests/e2e/interOp/android/WifiMode/test_ToggleWifiMode.py
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
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
|
||||||
|
|
||||||
|
if 'perfecto_libs' not in sys.path:
|
||||||
|
sys.path.append(f'../libs/perfecto_libs')
|
||||||
|
|
||||||
|
from android_lib import closeApp, set_APconnMobileDevice_android, Toggle_WifiMode_android, Toggle_AirplaneMode_android, ForgetWifiConnection, openApp, setup_perfectoMobile_android
|
||||||
|
|
||||||
|
@pytest.mark.ToggleWifiModeAndroid
|
||||||
|
@pytest.mark.wifi5
|
||||||
|
@pytest.mark.wifi6
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
'setup_profiles, create_profiles',
|
||||||
|
[(["NAT"], ["NAT"])],
|
||||||
|
indirect=True,
|
||||||
|
scope="class"
|
||||||
|
)
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures("setup_profiles")
|
||||||
|
@pytest.mark.usefixtures("create_profiles")
|
||||||
|
class TestToggleWifiMode(object):
|
||||||
|
|
||||||
|
@pytest.mark.fiveg
|
||||||
|
@pytest.mark.wpa2_personal
|
||||||
|
def test_ToogleWifiMode_5g_WPA2_Personal(self, setup_profile_data, get_ToggleWifiMode_data, setup_perfectoMobile_android):
|
||||||
|
|
||||||
|
profile_data = setup_profile_data["NAT"]["WPA2_P"]["5G"]
|
||||||
|
ssidName = profile_data["ssid_name"]
|
||||||
|
ssidPassword = profile_data["security_key"]
|
||||||
|
print ("SSID_NAME: " + ssidName)
|
||||||
|
print ("SSID_PASS: " + ssidPassword)
|
||||||
|
|
||||||
|
report = setup_perfectoMobile_android[1]
|
||||||
|
driver = setup_perfectoMobile_android[0]
|
||||||
|
connData = get_ToggleWifiMode_data
|
||||||
|
|
||||||
|
#Set Wifi/AP Mode
|
||||||
|
set_APconnMobileDevice_android(ssidName, ssidPassword, setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Toggle Wifi Mode
|
||||||
|
assert Toggle_WifiMode_android(setup_perfectoMobile_android, ssidName, connData)
|
||||||
|
|
||||||
|
#ForgetWifi
|
||||||
|
ForgetWifiConnection(setup_perfectoMobile_android, ssidName, connData)
|
||||||
|
|
||||||
|
@pytest.mark.twog
|
||||||
|
@pytest.mark.wpa2_personal
|
||||||
|
def test_ToogleWifiMode_2g_WPA2_Personal(self, setup_profile_data, get_ToggleWifiMode_data, setup_perfectoMobile_android):
|
||||||
|
|
||||||
|
profile_data = setup_profile_data["NAT"]["WPA2_P"]["2G"]
|
||||||
|
ssidName = profile_data["ssid_name"]
|
||||||
|
ssidPassword = profile_data["security_key"]
|
||||||
|
print ("SSID_NAME: " + ssidName)
|
||||||
|
print ("SSID_PASS: " + ssidPassword)
|
||||||
|
|
||||||
|
report = setup_perfectoMobile_android[1]
|
||||||
|
driver = setup_perfectoMobile_android[0]
|
||||||
|
connData = get_ToggleWifiMode_data
|
||||||
|
|
||||||
|
#Set Wifi/AP Mode
|
||||||
|
set_APconnMobileDevice_android(ssidName, ssidPassword, setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Toggle Wifi Mode
|
||||||
|
assert Toggle_WifiMode_android(setup_perfectoMobile_android, ssidName, connData)
|
||||||
|
|
||||||
|
#ForgetWifi
|
||||||
|
ForgetWifiConnection(setup_perfectoMobile_android, ssidName, connData)
|
||||||
|
|
||||||
|
@pytest.mark.fiveg
|
||||||
|
@pytest.mark.wpa
|
||||||
|
def test_ToogleWifiMode_5g_WPA(self, setup_profile_data, get_ToggleWifiMode_data, setup_perfectoMobile_android):
|
||||||
|
|
||||||
|
profile_data = setup_profile_data["NAT"]["WPA"]["5G"]
|
||||||
|
ssidName = profile_data["ssid_name"]
|
||||||
|
ssidPassword = profile_data["security_key"]
|
||||||
|
print ("SSID_NAME: " + ssidName)
|
||||||
|
print ("SSID_PASS: " + ssidPassword)
|
||||||
|
|
||||||
|
report = setup_perfectoMobile_android[1]
|
||||||
|
driver = setup_perfectoMobile_android[0]
|
||||||
|
connData = get_ToggleWifiMode_data
|
||||||
|
|
||||||
|
#Set Wifi/AP Mode
|
||||||
|
set_APconnMobileDevice_android(ssidName, ssidPassword, setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Toggle Wifi Mode
|
||||||
|
assert Toggle_WifiMode_android(setup_perfectoMobile_android, ssidName, connData)
|
||||||
|
|
||||||
|
#ForgetWifi
|
||||||
|
ForgetWifiConnection(setup_perfectoMobile_android, ssidName, connData)
|
||||||
|
|
||||||
|
@pytest.mark.twog
|
||||||
|
@pytest.mark.wpa
|
||||||
|
def test_ToogleWifiMode_2g_WPA(self, setup_profile_data, get_ToggleWifiMode_data, setup_perfectoMobile_android):
|
||||||
|
|
||||||
|
profile_data = setup_profile_data["NAT"]["WPA"]["2G"]
|
||||||
|
ssidName = profile_data["ssid_name"]
|
||||||
|
ssidPassword = profile_data["security_key"]
|
||||||
|
print ("SSID_NAME: " + ssidName)
|
||||||
|
print ("SSID_PASS: " + ssidPassword)
|
||||||
|
|
||||||
|
report = setup_perfectoMobile_android[1]
|
||||||
|
driver = setup_perfectoMobile_android[0]
|
||||||
|
connData = get_ToggleWifiMode_data
|
||||||
|
|
||||||
|
#Set Wifi/AP Mode
|
||||||
|
set_APconnMobileDevice_android(ssidName, ssidPassword, setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Toggle Wifi Mode
|
||||||
|
assert Toggle_WifiMode_android(setup_perfectoMobile_android, ssidName, connData)
|
||||||
|
|
||||||
|
#ForgetWifi
|
||||||
|
ForgetWifiConnection(setup_perfectoMobile_android, ssidName, connData)
|
||||||
0
tests/e2e/interOp/android/__init__.py
Normal file
0
tests/e2e/interOp/android/__init__.py
Normal file
125
tests/e2e/interOp/android/client_connectivity/test_NatMode.py
Normal file
125
tests/e2e/interOp/android/client_connectivity/test_NatMode.py
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
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
|
||||||
|
#pytestmark = [pytest.mark.ClientConnectivity, pytest.mark.nat, pytest.mark.interop]
|
||||||
|
|
||||||
|
if 'perfecto_libs' not in sys.path:
|
||||||
|
sys.path.append(f'../libs/perfecto_libs')
|
||||||
|
|
||||||
|
from android_lib import closeApp, set_APconnMobileDevice_android, verifyUploadDownloadSpeed_android, Toggle_AirplaneMode_android, ForgetWifiConnection, openApp, setup_perfectoMobile_android
|
||||||
|
|
||||||
|
@pytest.mark.ClientConnectivityAndroid
|
||||||
|
@pytest.mark.wifi5
|
||||||
|
@pytest.mark.wifi6
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
'setup_profiles, create_profiles',
|
||||||
|
[(["NAT"], ["NAT"])],
|
||||||
|
indirect=True,
|
||||||
|
scope="class"
|
||||||
|
)
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures("setup_profiles")
|
||||||
|
@pytest.mark.usefixtures("create_profiles")
|
||||||
|
class TestNatMode(object):
|
||||||
|
|
||||||
|
@pytest.mark.fiveg
|
||||||
|
@pytest.mark.wpa2_personal
|
||||||
|
def test_ClientConnectivity_5g_WPA2_Personal(self, setup_profile_data, get_APToMobileDevice_data, setup_perfectoMobile_android):
|
||||||
|
|
||||||
|
profile_data = setup_profile_data["NAT"]["WPA2_P"]["5G"]
|
||||||
|
ssidName = profile_data["ssid_name"]
|
||||||
|
ssidPassword = profile_data["security_key"]
|
||||||
|
print ("SSID_NAME: " + ssidName)
|
||||||
|
print ("SSID_PASS: " + ssidPassword)
|
||||||
|
|
||||||
|
report = setup_perfectoMobile_android[1]
|
||||||
|
driver = setup_perfectoMobile_android[0]
|
||||||
|
connData = get_APToMobileDevice_data
|
||||||
|
|
||||||
|
#Set Wifi/AP Mode
|
||||||
|
set_APconnMobileDevice_android(ssidName, ssidPassword, setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Verify Upload download Speed from device Selection
|
||||||
|
assert verifyUploadDownloadSpeed_android(setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#ForgetWifi
|
||||||
|
ForgetWifiConnection(setup_perfectoMobile_android, ssidName, connData)
|
||||||
|
|
||||||
|
@pytest.mark.twog
|
||||||
|
@pytest.mark.wpa2_personal
|
||||||
|
def test_ClientConnectivity_2g_WPA2_Personal(self, setup_profile_data, get_APToMobileDevice_data, setup_perfectoMobile_android):
|
||||||
|
|
||||||
|
profile_data = setup_profile_data["NAT"]["WPA2_P"]["2G"]
|
||||||
|
ssidName = profile_data["ssid_name"]
|
||||||
|
ssidPassword = profile_data["security_key"]
|
||||||
|
print ("SSID_NAME: " + ssidName)
|
||||||
|
print ("SSID_PASS: " + ssidPassword)
|
||||||
|
|
||||||
|
report = setup_perfectoMobile_android[1]
|
||||||
|
driver = setup_perfectoMobile_android[0]
|
||||||
|
connData = get_APToMobileDevice_data
|
||||||
|
|
||||||
|
#Set Wifi/AP Mode
|
||||||
|
set_APconnMobileDevice_android(ssidName, ssidPassword, setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Toggle AirplaneMode
|
||||||
|
assert Toggle_AirplaneMode_android(setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#ForgetWifi
|
||||||
|
ForgetWifiConnection(setup_perfectoMobile_android, ssidName, connData)
|
||||||
|
|
||||||
|
@pytest.mark.twog
|
||||||
|
@pytest.mark.wpa
|
||||||
|
def test_ClientConnectivity_2g_WPA(self, setup_profile_data, get_APToMobileDevice_data, setup_perfectoMobile_android):
|
||||||
|
|
||||||
|
profile_data = setup_profile_data["NAT"]["WPA"]["2G"]
|
||||||
|
ssidName = profile_data["ssid_name"]
|
||||||
|
ssidPassword = profile_data["security_key"]
|
||||||
|
print ("SSID_NAME: " + ssidName)
|
||||||
|
print ("SSID_PASS: " + ssidPassword)
|
||||||
|
|
||||||
|
report = setup_perfectoMobile_android[1]
|
||||||
|
driver = setup_perfectoMobile_android[0]
|
||||||
|
connData = get_APToMobileDevice_data
|
||||||
|
|
||||||
|
#Set Wifi/AP Mode
|
||||||
|
set_APconnMobileDevice_android(ssidName, ssidPassword, setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Toggle AirplaneMode
|
||||||
|
assert Toggle_AirplaneMode_android(setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#ForgetWifi
|
||||||
|
ForgetWifiConnection(setup_perfectoMobile_android, ssidName, connData)
|
||||||
|
|
||||||
|
@pytest.mark.fiveg
|
||||||
|
@pytest.mark.wpa
|
||||||
|
def test_ClientConnectivity_5g_WPA(self, setup_profile_data, get_APToMobileDevice_data, setup_perfectoMobile_android):
|
||||||
|
|
||||||
|
profile_data = setup_profile_data["NAT"]["WPA"]["5G"]
|
||||||
|
ssidName = profile_data["ssid_name"]
|
||||||
|
ssidPassword = profile_data["security_key"]
|
||||||
|
print ("SSID_NAME: " + ssidName)
|
||||||
|
print ("SSID_PASS: " + ssidPassword)
|
||||||
|
|
||||||
|
report = setup_perfectoMobile_android[1]
|
||||||
|
driver = setup_perfectoMobile_android[0]
|
||||||
|
connData = get_APToMobileDevice_data
|
||||||
|
|
||||||
|
#Set Wifi/AP Mode
|
||||||
|
set_APconnMobileDevice_android(ssidName, ssidPassword, setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#Toggle AirplaneMode
|
||||||
|
assert Toggle_AirplaneMode_android(setup_perfectoMobile_android, connData)
|
||||||
|
|
||||||
|
#ForgetWifi
|
||||||
|
ForgetWifiConnection(setup_perfectoMobile_android, ssidName, connData)
|
||||||
@@ -187,7 +187,9 @@ def get_APToMobileDevice_data(request):
|
|||||||
"bundleId-iOS-Safari": request.config.getini("bundleId-iOS-Safari"),
|
"bundleId-iOS-Safari": request.config.getini("bundleId-iOS-Safari"),
|
||||||
"downloadMbps": "//*[@id='knowledge-verticals-internetspeedtest__download']/P[@class='spiqle']",
|
"downloadMbps": "//*[@id='knowledge-verticals-internetspeedtest__download']/P[@class='spiqle']",
|
||||||
"UploadMbps": "//*[@id='knowledge-verticals-internetspeedtest__upload']/P[@class='spiqle']",
|
"UploadMbps": "//*[@id='knowledge-verticals-internetspeedtest__upload']/P[@class='spiqle']",
|
||||||
"lblSearch2": "test "
|
#Android
|
||||||
|
"platformName-android": request.config.getini("platformName-android"),
|
||||||
|
"appPackage-android": request.config.getini("appPackage-android")
|
||||||
}
|
}
|
||||||
yield passPoint_data
|
yield passPoint_data
|
||||||
|
|
||||||
@@ -202,20 +204,28 @@ def get_AccessPointConn_data(request):
|
|||||||
@pytest.fixture(scope="function")
|
@pytest.fixture(scope="function")
|
||||||
def get_ToggleAirplaneMode_data(request):
|
def get_ToggleAirplaneMode_data(request):
|
||||||
passPoint_data = {
|
passPoint_data = {
|
||||||
"bundleId-iOS-Settings": request.config.getini("bundleId-iOS-Settings"),
|
"webURL": "https://www.google.com",
|
||||||
"lblSearch": "//*[@class='gLFyf']",
|
"lblSearch": "//*[@class='gLFyf']",
|
||||||
"elelSearch": "(//*[@class='fSXkBc'])[1]",
|
"elelSearch": "(//*[@class='sbic sb43'])[1]",
|
||||||
"BtnRunSpeedTest": "//*[text()='RUN SPEED TEST']",
|
"BtnRunSpeedTest": "//*[text()='RUN SPEED TEST']",
|
||||||
|
"bundleId-iOS-Settings": request.config.getini("bundleId-iOS-Settings"),
|
||||||
|
"bundleId-iOS-Safari": request.config.getini("bundleId-iOS-Safari"),
|
||||||
"downloadMbps": "//*[@id='knowledge-verticals-internetspeedtest__download']/P[@class='spiqle']",
|
"downloadMbps": "//*[@id='knowledge-verticals-internetspeedtest__download']/P[@class='spiqle']",
|
||||||
"UploadMbps": "//*[@id='knowledge-verticals-internetspeedtest__upload']/P[@class='spiqle']",
|
"UploadMbps": "//*[@id='knowledge-verticals-internetspeedtest__upload']/P[@class='spiqle']",
|
||||||
|
#Android
|
||||||
|
"platformName-android": request.config.getini("platformName-android"),
|
||||||
|
"appPackage-android": request.config.getini("appPackage-android")
|
||||||
}
|
}
|
||||||
yield passPoint_data
|
yield passPoint_data
|
||||||
|
|
||||||
@pytest.fixture(scope="function")
|
@pytest.fixture(scope="function")
|
||||||
def get_ToggleWifiMode_data(request):
|
def get_ToggleWifiMode_data(request):
|
||||||
passPoint_data = {
|
passPoint_data = {
|
||||||
"bundleId-iOS-Settings": request.config.getini("bundleId-iOS-Settings")
|
#iOS
|
||||||
|
"bundleId-iOS-Settings": request.config.getini("bundleId-iOS-Settings"),
|
||||||
|
#Android
|
||||||
|
"platformName-android": request.config.getini("platformName-android"),
|
||||||
|
"appPackage-android": request.config.getini("appPackage-android")
|
||||||
}
|
}
|
||||||
yield passPoint_data
|
yield passPoint_data
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class TestToggleAirplaneMode(object):
|
|||||||
set_APconnMobileDevice_iOS(ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
|
set_APconnMobileDevice_iOS(ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
|
||||||
|
|
||||||
#Toggle AirplaneMode
|
#Toggle AirplaneMode
|
||||||
assert Toggle_AirplaneMode_iOS(setup_perfectoMobile_iOS, connData)
|
Toggle_AirplaneMode_iOS(setup_perfectoMobile_iOS, connData)
|
||||||
|
|
||||||
#Verify AP After AirplaneMode
|
#Verify AP After AirplaneMode
|
||||||
assert verify_APconnMobileDevice_iOS(ssidName, setup_perfectoMobile_iOS, connData)
|
assert verify_APconnMobileDevice_iOS(ssidName, setup_perfectoMobile_iOS, connData)
|
||||||
|
|||||||
@@ -44,14 +44,14 @@ securityToken=eyJhbGciOiJIUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICI3NzkzZGM0Ni1jZm
|
|||||||
# Perfecto CI Report
|
# Perfecto CI Report
|
||||||
projectName = TIP-PyTest-Execution
|
projectName = TIP-PyTest-Execution
|
||||||
projectVersion = 1.0
|
projectVersion = 1.0
|
||||||
jobName = Tip-PyTest-Execution
|
jobName = Default_JobName
|
||||||
jobNumber = 1
|
jobNumber = 1
|
||||||
reportTags = TestTag
|
reportTags = TestTag
|
||||||
|
|
||||||
# iOS Device Capabilities
|
# iOS Device Capabilities
|
||||||
platformName-iOS=iOS
|
platformName-iOS=iOS
|
||||||
#manufacturer-iOS=Apple
|
#manufacturer-iOS=Apple
|
||||||
model-iOS=iPhone-11.*
|
model-iOS=iPhone.*
|
||||||
bundleId-iOS=com.apple.Preferences
|
bundleId-iOS=com.apple.Preferences
|
||||||
#default iOS settings app
|
#default iOS settings app
|
||||||
bundleId-iOS-Settings=com.apple.Preferences
|
bundleId-iOS-Settings=com.apple.Preferences
|
||||||
@@ -62,5 +62,5 @@ bundleId-iOS-Safari=com.apple.mobilesafari
|
|||||||
|
|
||||||
# Android Device Capabilities
|
# Android Device Capabilities
|
||||||
platformName-android=Android
|
platformName-android=Android
|
||||||
model-android=Android.*
|
model-android=.*
|
||||||
appPackage-android=com.android.settings
|
appPackage-android=com.android.settings
|
||||||
|
|||||||
Reference in New Issue
Block a user