Added attach_report_kpi, attach_report_graphs methods

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>
This commit is contained in:
jitendracandela
2022-08-24 14:00:33 +05:30
parent 39349eaaa1
commit a66336f5e4

View File

@@ -1209,6 +1209,39 @@ class lf_libs:
else: else:
logging.error("Radio name is wrong") logging.error("Radio name is wrong")
def attach_report_graphs(self, report_name=None, pdf_name="WIFI Capacity Test PDF Report"):
relevant_path = "../reports/" + report_name + "/"
entries = os.listdir("../reports/" + report_name + '/')
pdf = False
for i in entries:
if ".pdf" in i:
pdf = i
if pdf:
allure.attach.file(source=relevant_path + pdf,
name=pdf_name)
included_extensions = ['png']
file_names = [fn for fn in os.listdir(relevant_path)
if any(fn.endswith(ext) for ext in included_extensions)]
a = [item for item in file_names if 'print' not in item]
a = [item for item in a if 'logo' not in item]
a = [item for item in a if 'Logo' not in item]
a = [item for item in a if 'candela' not in item]
a.sort()
for i in a:
allure.attach.file(source=relevant_path + i,
name=i,
attachment_type="image/png", extension=None)
def attach_report_kpi(self, report_name=None, file_name="kpi_file"):
path = "../reports/" + str(report_name) + "/kpi.csv"
if os.path.exists(path):
allure.attach.file(source=path,
name=file_name, attachment_type="CSV")
return os.path.exists(path)
class Report: class Report:
def __init__(self, key1=None, def __init__(self, key1=None,
@@ -1231,6 +1264,8 @@ class Report:
return x return x
class SCP_File: class SCP_File:
def __init__(self, ip="localhost", port=22, username="lanforge", password="lanforge", remote_path="/home/lanforge/", def __init__(self, ip="localhost", port=22, username="lanforge", password="lanforge", remote_path="/home/lanforge/",
local_path="."): local_path="."):