Merge branch 'WIFI-1321-create-a-lan-forge-pip-module' of https://github.com/Telecominfraproject/wlan-testing into WIFI-11101

This commit is contained in:
tarun-candela
2022-10-19 19:28:43 +05:30
4 changed files with 30 additions and 10 deletions

View File

@@ -113,12 +113,13 @@ class android_libs:
"jobNumber": 38
}
}
def __init__(self, perfecto_data=None, dut_data=None):
def __init__(self, perfecto_data=None, dut_data=None, testcase=None):
logging_level = logging.INFO
logging.basicConfig(format='%(asctime)s - %(message)s', level=logging_level)
# super().__init__(perfecto_data=perfecto_data, dut_data=dut_data)
self.perfecto_data = perfecto_data
self.dut_data = dut_data
self.testcase_name = testcase
self.connData = self.get_ToggleAirplaneMode_data()
print("connData------", self.connData)
pass
@@ -402,15 +403,17 @@ class android_libs:
'https://' + perfecto_data["perfectoURL"] + '.perfectomobile.com/nexperience/perfectomobile/wd/hub',
capabilities)
driver.implicitly_wait(2)
TestCaseFullName = os.environ.get('PYTEST_CURRENT_TEST').split(':')[-1].split(' ')[0]
nCurrentTestMethodNameSplit = re.sub(r'\[.*?\]\ *', "", TestCaseFullName)
if os.environ.get('PYTEST_CURRENT_TEST') is not None:
TestCaseFullName = os.environ.get('PYTEST_CURRENT_TEST').split(':')[-1].split(' ')[0]
nCurrentTestMethodNameSplit = re.sub(r'\[.*?\]\ *', "", TestCaseFullName)
else:
nCurrentTestMethodNameSplit = self.testcase_name
try:
# TestCaseName = nCurrentTestMethodNameSplit.removeprefix('test_')
testcase = nCurrentTestMethodNameSplit.replace('test_', '')
print("\n\nExecuting TestCase: " + testcase)
except Exception as e:
TestCaseName = nCurrentTestMethodNameSplit
testcase = nCurrentTestMethodNameSplit
print("\nUpgrade Python to 3.9 to avoid test_ string in your test case name, see below URL")
# print("https://www.andreagrandi.it/2020/10/11/python39-introduces-removeprefix-removesuffix/")

View File

@@ -42,6 +42,7 @@ class AndroidTests(android_libs):
try:
ssid_with_internet, setup, ssid_found = self.wifi_connect(ssid=ssid, passkey=passkey, setup_perfectoMobile=
setup_perfecto_mobile, connData=self.connData)
print(ssid_with_internet, ssid_found, "++++++++++")
if ssid_with_internet is True and ssid_found is True:
ip_address = self.get_ip_address(ssid, setup, self.connData)
self.closeApp(self.connData["appPackage-android"], setup)

View File

@@ -21,11 +21,12 @@ from xml.etree import ElementTree as ET
class ios_libs:
global driver, perfecto_execution_context, deviceModel
def __init__(self, perfecto_data=None, dut_data=None):
def __init__(self, perfecto_data=None, dut_data=None, testcase=None):
logging_level = logging.INFO
logging.basicConfig(format='%(asctime)s - %(message)s', level=logging_level)
self.perfecto_data = perfecto_data
self.dut_data = dut_data
self.testcase_name = testcase
pass
def openApp(self, appName, setup_perfectoMobile):
@@ -183,9 +184,11 @@ class ios_libs:
'https://' + perfecto_data["perfectoURL"] + '.perfectomobile.com/nexperience/perfectomobile/wd/hub',
capabilities)
driver.implicitly_wait(2)
TestCaseFullName = os.environ.get('PYTEST_CURRENT_TEST').split(':')[-1].split(' ')[0]
nCurrentTestMethodNameSplit = re.sub(r'\[.*?\]\ *', "", TestCaseFullName)
if os.environ.get('PYTEST_CURRENT_TEST') is not None:
TestCaseFullName = os.environ.get('PYTEST_CURRENT_TEST').split(':')[-1].split(' ')[0]
nCurrentTestMethodNameSplit = re.sub(r'\[.*?\]\ *', "", TestCaseFullName)
else:
nCurrentTestMethodNameSplit = self.testcase_name
try:
# TestCaseName = nCurrentTestMethodNameSplit.removeprefix('test_')
testcase = nCurrentTestMethodNameSplit.replace('test_', '')

View File

@@ -221,6 +221,19 @@ if __name__ == '__main__':
"appPackage-android": "com.android.settings",
"jobName": "Interop-iphone-11",
"jobNumber": 38
},
"iPhone-7": {
"model-iOS": "iPhone-7",
"bundleId-iOS": "com.apple.Preferences",
"platformName-iOS": "iOS",
"bundleId-iOS-Settings": "com.apple.Preferences",
"bundleId-iOS-Ping": "com.deftapps.ping",
"browserType-iOS": "Safari",
"bundleId-iOS-Safari": "com.apple.mobilesafari",
"platformName-android": "Android",
"appPackage-android": "com.android.settings",
"jobName": "Interop-iphone-7",
"jobNumber": 38
}
}
access_point = [{
@@ -252,7 +265,7 @@ if __name__ == '__main__':
"serial_tty": "/dev/ttyAP5",
"firmware_version": "next-latest"
}]
obj = ios_tests(perfecto_data=perfecto_data, dut_data=access_point,device="iPhone-11",
obj = ios_tests(perfecto_data=perfecto_data, dut_data=access_point,device="iPhone-7",
testcase="Test_perfecto_check")
# print(obj.client_connectivity_test(ssid="ssid_wpa2_2g_RL_E3V2240", passkey="something"))
# print(obj.rate_limiting_test(ssid="ssid_wpa2_2g_RL_1VE7537",passkey="something",up_rate="60",down_rate="10"))