示例#1
0
 def BeingMeasured_system_screenshot(self):
     """
     被测系统截图
     :return:
     """
     from src.utils.otherMethods.initialize import pywin_openAProgram
     aero_window = pywin_openAProgram().entrance_subroutine_title()
     location = r"F:\Aerobook\src\testCase\a_useCaseSet\Aerockeck\img\test_1.png"  # 截图的保存位置
     aero_window.capture_as_image().save(location)  # 获取警告弹窗的文本截图
     print("")
示例#2
0
 def examine_LocatedModule(self):
     """
     检查被系统是否在被模块(Aerocherk、frmbook等)
     :return:
     """
     from src.utils.otherMethods.initialize import UIA_link
     from src.utils.otherMethods.initialize import pywin_openAProgram
     if self.title == "Aerobook-Aerocheck":
         titleName = ProfileDataProcessing(
             "commonality",
             "AerocheckEdition").config_File()  # 从配置文件获取Aerocheck窗口标题
         moduleName = "Aerocheck"
     elif self.title == "Aerobook-Fiberbook":
         titleName = ProfileDataProcessing(
             "commonality",
             "FiberbookEdition").config_File()  # 从配置文件获取Aerocheck窗口标题
         moduleName = "Fiberbook"
     else:
         raise MyException("没有找到需要检查的模块:%r" % self.title)
     # 通过Aerobook标题链接Aerobook进程,并切换到Aerobook窗口
     aero_window = pywin_openAProgram().entrance_subroutine_title()
     try:  # 是否能找到被测模块
         aero_window.child_window(title=titleName,
                                  class_name="wxWindowNR").verify_visible()
     except Exception:  # 如果没有找到抛出异常
         # 如果没有找到被测模块
         UIA_link().EntrySubapplication(moduleName)  # 然后点击进入被测模块的按钮
         try:
             aero_window.child_window(title=titleName,
                                      class_name="wxWindowNR").wait(
                                          "exists",
                                          timeout=60,
                                          retry_interval=0.2)  # 等待被测模块出现
         except Exception:  # 如果抛出异常说明没有找到被测模块
             raise MyException("没有找到被测试模块:%r" % titleName)
         else:
             pass
 def start_Aerobook_Aercheck(self):
     """
     启动Aerobook_Aercheck
     :param self:
     :return:
     """
     relativeAddress = path.location()  # 获取项目相对位置
     # 初始化项目的存放位置
     sourceDir = relativeAddress + r"src\testCase\projectFile\自动化测试相关文件"  # 项目有关的模板文件
     source = relativeAddress + r"src\testCase\projectFile\automateFile"  # 新建项目的保存地址
     folderFile_dispose(source).delfolder()  # 删除已有的项目文件夹
     folderFile_dispose(sourceDir).copyFile(source)  # 生成新的项目文件夹,并返回文件夹路径
     # 读取配置文档信息里的Aerobook和Aerocheck窗口的标题
     aero_title = ProfileDataProcessing("commonality", "AerobookEdition").config_File()  # 从配置文件获取Aerobook窗口标题
     aerocheck_title = ProfileDataProcessing("commonality", "AerocheckEdition").config_File()  # 从配置文件获取Aerocheck窗口标题
     # 通过AerobookEXE文件启动Aerobook,并进入进入Aerocheck页面
     py_app = pywin_openAProgram().open_accredit()  # 启动Aerobook应用程序
     uia_app = UIA_link().EntrySubapplication("Aerocheck")  # 点击Aerocheck进入Aerocheck页面
     # 新建项目
     ControlOperationSuite_Aercheck(aerocheck_title).childApp_newProject(py_app, "文件->项目->新建", source)
     # 独立显示底部蒙皮
     ControlOperationSuite_Aercheck(py_app).uia_ShowSkinSeparately(aero_title)
     #  修改配置文件内容用于执行用例的时候获取项目所在地址
     ProfileDataProcessing("commonality-Aerobook-Aerocheck", "ProjectSave_path").config_File_amend(source)
示例#4
0
# 刚到比设计响应

from src.utils.otherMethods.initialize import pywin_openAProgram
import time

from OperatingControls.enterModule import ctrW_AeroFiberbook

time.sleep(2)

testdicts = {"所在模块": "优化->优化设置->刚度约束设计响应->刚度比设计响应"}
module = "Aerobook-Fiberbook"

aero_window, son_window = pywin_openAProgram(module).menuOpen(testdicts)

win_one = ctrW_AeroFiberbook(son_window).workField_general()

win_one.print_ctrl_ids()
示例#5
0
from src.utils.otherMethods.initialize import pywin_openAProgram
from pywinauto.application import Application
from config.configurationFile import ProfileDataProcessing
from win32gui import *
from win32api import *
from win32process import *
import win32con

aero_title = ProfileDataProcessing(
    "commonality", "AerobookEdition").config_File()  # 从配置文件获取Aerobook窗口标题
aerocheck_title = ProfileDataProcessing(
    "commonality", "AerocheckEdition").config_File()  # 从配置文件获取Aerocheck窗口标题

# # 通过Aerobook标题链接Aerobook进行,并切换到Aerobook窗口
aero_window = pywin_openAProgram().entrance_subroutine_title()

dlg_spec = aero_window.child_window(auto_id="panel_Graph",
                                    control_type="System.Windows.Forms.Panel")

dlg_spec1 = dlg_spec.child_window(title="Aerocheck 1.0.4",
                                  class_name="wxWindowNR")

dlg_spec2 = dlg_spec1.panelwxWindowNR0

dlg_spec3 = dlg_spec2.child_window(title="multiSplitter",
                                   class_name="wxWindowNR")

dlg_spec4 = dlg_spec3.child_window(title="splitter", class_name="wxWindowNR")

dlg_spec5 = dlg_spec4.controlwxWindowNR
示例#6
0
from src.utils.otherMethods.initialize import pywin_openAProgram

testdicts = {"所在模块": "金属结构强度校核->金属曲板后驱曲强度校核"}

aero_window, module_window = pywin_openAProgram().menuOpen(testdicts)

workField1 = module_window.scrolledpanelwxWindowNR2  # 切换到被测工作

workField1.print_control_identifiers()

#安全系数文本框
workField1.Edit1.set_text("222")

#曲板剪切勾选框
workField1.CheckBox1.click_input()

#2系勾选框
workField1.RadioButton1.click_input()

#7系勾选框
workField1.RadioButton2.click_input()

#其他勾选框
workField1.RadioButton3.click_input()

#τ*文本框
workField1.Edit2.set_text("222")

#折减宽度文本框
workField1.Edit3.set_text("222")
from OperatingControls.enterModule import ctrW_AeroAerochcek



WindowTop("Aerobook v1.0.4").EnumWindows()
time.sleep(1)
# 连接到被测程序,并且通过菜单栏打开被测模块

testCase_dict={"所在模块":"复材结构强度校核->复合材料强度校核"}

operationWindow="二维单元"

# operationWindow="杆柱单元"
module="Aerobook-Aerocheck"

aero_window, son_window = pywin_openAProgram(module).menuOpen_switchingWin_UIA(testCase_dict,operationWindow)



aero_window, son_window=ctrW_AeroAerochcek(son_window).workField_intensityCheck()


aero_window.print_control_identifiers()




"""二维单元"""


# 点击复合强度校核工作栏的二维单元按钮
示例#8
0
# 铺层数据库制作工具弹窗

from OperatingControls.enterModule import BeingMeasured_popupWin

from src.utils.otherMethods.initialize import pywin_openAProgram

testCase_attribute = {"所在模块": "载荷信息->载荷数据库制作工具"}

module = "Aerobook-Aerocheck"
aero_window, son_window = pywin_openAProgram(module).menuOpen(
    testCase_attribute)
# 切入载荷数据库工具弹窗中
module_window = BeingMeasured_popupWin("载荷数据库制作工具").menu_LetsGoTopopover()

module_window.print_control_identifiers()

# # 选择载荷文件文件文本框
#
# module_window.filepicker0.Edit.set_text("ss")
#
# # 载荷数据库保存路径文本框
#
# module_window.filepicker2.Edit2.set_text("ss")

# 选择载荷文件文件浏览按钮

# module_window.filepicker0.Button1.click()

# 载荷数据库保存路径浏览按钮

# module_window.filepicker2.Button2.click()
示例#9
0
 def get_window_instance(self):
     """
     获取操作控件的各个窗口
     :return:
     """
     print("\033[0;32;33m《开始获取“%r”模块窗口标识》\033[0m" % self.ModuMarking,
           __file__,
           sys._getframe().f_lineno)
     print("")
     from src.utils.otherMethods.initialize import pywin_openAProgram
     # 连接到被测程序,并且通过菜单栏打开被测模块
     aero_window, son_window = pywin_openAProgram(self.module).menuOpen(
         self.property)
     if self.module == "Aerobook-Aerocheck":
         # 切换到被测模块窗口
         if self.ModuMarking == "铺层信息--铺层库优化" or \
                 self.ModuMarking == "求解计算--求解计算" or \
                 self.ModuMarking == "紧固件强度校核--紧固件参数设置" or \
                 self.ModuMarking == "材料信息--定义金属材料参数" or \
                 self.ModuMarking == "金属结构强度校核--金属一维单元强度校核" or \
                 self.ModuMarking == "金属结构强度校核--金属二维单元强度校核" or \
                 self.ModuMarking == "金属结构强度校核--金属加筋板强度校核" or \
                 self.ModuMarking == "金属结构强度校核--金属曲板后驱曲强度校核":
             self.win_one = ctrW_AeroAerochcek(
                 son_window).workField_general()
         elif self.ModuMarking == "尺寸信息--一维单元尺寸定义(模板)" or self.ModuMarking == "尺寸信息--二维单元尺寸定义(模板)":
             self.win_one = ctrW_AeroAerochcek(
                 son_window).workField_sizeInfo()
         elif self.ModuMarking == "铺层信息--铺层数据库制作工具":
             # 切入铺层数据库工具弹窗中
             self.win_three = BeingMeasured_popupWin(
                 "铺层数据库制作工具").menu_LetsGoTopopover()
             # 切入铺层数据库工具弹窗中控件中
             self.win_one, self.win_two = BeingMeasured_popupWin(
                 None).Laminatedata_popUp(self.win_three)
         elif self.ModuMarking == "载荷信息--载荷数据库制作工具":
             # 切入铺层数据库工具弹窗中
             self.win_three = BeingMeasured_popupWin(
                 "载荷数据库制作工具").menu_LetsGoTopopover()
             # 切入铺层数据库工具弹窗中控件中
             self.win_one, self.win_two = BeingMeasured_popupWin(
                 None).Laminatedata_popUp(self.win_three)
         elif self.ModuMarking == "载荷信息--编辑工况":
             self.win_one = BeingMeasured_popupWin(
                 "编辑工况").menu_LetsGoTopopover()
         elif self.ModuMarking == "复材结构强度校核--复合材料强度校核1D" or \
                 self.ModuMarking == "复材结构强度校核--复合材料强度校核2D":
             specialWay_OperatingControls(
                 self.testWinTitle_son).uia_OperatingControls(
                 )  # 使用uiautomation框架点击切换模块
             self.win_one, self.win_two = ctrW_AeroAerochcek(
                 son_window).workField_intensityCheck()
         elif self.ModuMarking == "尺寸信息--一维单元尺寸定义":
             self.win_one, self.win_two, self.win_three, self.win_four = ctrW_AeroAerochcek(
                 son_window).workField_SizeDefinition_1D()
         elif self.ModuMarking == "尺寸信息--二维单元尺寸定义":
             self.win_one, self.win_two = ctrW_AeroAerochcek(
                 son_window).workField_SizeDefinition_2D()
         elif self.ModuMarking == "紧固件强度校核--紧固件信息输入":
             if self.testWinTitle_son == "紧固件参数输入":
                 self.win_one = ctrW_AeroAerochcek(
                     son_window).workField_general()
             elif self.testWinTitle_son == "编辑参数弹框":
                 self.win_one = ctrW_AeroAerochcek(
                     son_window).workField_Open_EditArgument()
         elif self.ModuMarking == "紧固件强度校核--紧固件强度校核":
             self.win_one = ctrW_AeroAerochcek(
                 son_window).workField_general()
         elif self.ModuMarking == "紧固件优化--紧固件参数优化":
             self.win_one = ctrW_AeroAerochcek(
                 son_window).workField_fastener_parOptimization()
         elif self.ModuMarking == "材料信息--定义复合材料参数":
             specialWay_OperatingControls(
                 self.testWinTitle).uia_OperatingControls(
                 )  # 使用uiautomation框架点击切换模块
             self.win_one, self.win_two = ctrW_AeroAerochcek(
                 son_window).workField_fastenerSEO(self.testWinTitle_son)
         else:
             raise MyException("没有找到需要切换的窗口:%r" % self.ModuMarking)
     elif self.module == "Aerobook-Fiberbook":
         if self.ModuMarking == "优化设置--全局设置":
             self.win_one = ctrW_AeroFiberbook(
                 son_window).workField_general()
         elif self.ModuMarking == "设计变量--一维单元设计变量(截面尺寸)":
             if self.testWinTitle_son == "一维单元设计参数(截面尺寸)":
                 self.win_one, self.win_two, self.win_three, self.win_four = ctrW_AeroFiberbook(
                     son_window).workField_1DDESVAR_sectionSize()
             elif self.testWinTitle_son == "1D截面参数定义":
                 self.win_one, self.win_two, self.win_three, self.win_four = ctrW_AeroFiberbook(
                     son_window).workField_1DSection_popUps()
             elif self.testWinTitle_son == "铺层比定义":
                 self.win_one, self.win_two, self.win_three, self.win_four = ctrW_AeroFiberbook(
                     son_window).workField_LayerThan_popUps()
             else:
                 raise MyException("没有找到需要切换的子窗口:%r" %
                                   self.testWinTitle_son)
         elif self.ModuMarking == "设计变量--一维单元设计变量(截面积)":
             self.win_one = ctrW_AeroFiberbook(
                 son_window).workField_general()
         elif self.ModuMarking == "设计变量--二维单元设计参数":
             if self.testWinTitle_son == "二维单元设计参数":
                 self.win_one, self.win_two, self.win_three, self.win_four = ctrW_AeroFiberbook(
                     son_window).workField_2DDESVAR()
             elif self.testWinTitle_son == "铺层厚度/铺层比定义":
                 self.win_one, self.win_two, self.win_three, self.win_four = ctrW_AeroFiberbook(
                     son_window).workField_2DDESVAR_popUps()
         elif self.ModuMarking == "应变设计响应--一维单元应变设计响应":
             self.win_one = ctrW_AeroFiberbook(
                 son_window).workField_general()
         elif self.ModuMarking == "应变设计响应--二维单元应变设计响应":
             self.win_one = ctrW_AeroFiberbook(
                 son_window).workField_general()
         elif self.ModuMarking == "应变设计响应--二维单元应变耦合DRESP3":
             self.win_one = ctrW_AeroFiberbook(
                 son_window).workField_general()
         elif self.ModuMarking == "应力设计响应->一维单元应力设计响应":
             self.win_one = ctrW_AeroFiberbook(
                 son_window).workField_general()
         elif self.ModuMarking == "应力设计响应->二维单元应力设计响应":
             self.win_one = ctrW_AeroFiberbook(
                 son_window).workField_general()
         elif self.ModuMarking == "丢成/厚度比设计响应--一维单元丢成/厚度比设计响应":
             self.win_one = ctrW_AeroFiberbook(
                 son_window).workField_general()
         elif self.ModuMarking == "丢成/厚度比设计响应--二维单元丢成/厚度比设计响应":
             self.win_one = ctrW_AeroFiberbook(
                 son_window).workField_general()
         elif self.ModuMarking == "优化设置--泊松比匹配响应":
             self.win_one = ctrW_AeroFiberbook(
                 son_window).workField_general()
         elif self.ModuMarking == "刚度约束设计响应--位移设计响应":
             self.win_one = ctrW_AeroFiberbook(
                 son_window).workField_general()
         elif self.ModuMarking == "刚度约束设计响应--扭转角约束设计响应":
             self.win_one = ctrW_AeroFiberbook(
                 son_window).workField_general()
         elif self.ModuMarking == "刚度约束设计响应--刚度比设计响应":
             self.win_one = ctrW_AeroFiberbook(
                 son_window).workField_general()
         elif self.ModuMarking == "机翼优化响应--梁腹板缘条厚度比设计响应":
             self.win_one = ctrW_AeroFiberbook(
                 son_window).workField_general()
         elif self.ModuMarking == "机翼优化响应--梁腹板缘条铺层比之差设计响应":
             self.win_one = ctrW_AeroFiberbook(
                 son_window).workField_general()
         elif self.ModuMarking == "机翼优化响应--肋站位EI GJ设计响应":
             self.win_one = ctrW_AeroFiberbook(
                 son_window).workField_general()
         elif self.ModuMarking == "稳定性设计响应--杆柱稳定性响应和约束":
             self.win_one, self.win_two, self.win_three, self.win_four = ctrW_AeroFiberbook(
                 son_window).workField_Pole_stability()
         elif self.ModuMarking == "稳定性设计响应--平板稳定性响应约束":
             self.win_one = ctrW_AeroFiberbook(
                 son_window).workField_general()
         elif self.ModuMarking == "稳定性设计响应--曲板稳定性响应约束":
             self.win_one = ctrW_AeroFiberbook(
                 son_window).workField_general()
         elif self.ModuMarking == "稳定性设计响应--加筋板稳定性响应约束":
             self.win_one, self.win_two, self.win_three, self.win_four = ctrW_AeroFiberbook(
                 son_window).workField_Pole_stability()
         else:
             raise MyException("没有找到需要切换的窗口:%r" % self.ModuMarking)
     else:
         raise MyException("没有找到主模块名称:%r" % self.module)
     print(
         "\033[0;34m窗口标识一:%r,窗口标识二:%r,窗口标识三:%r,窗口标识四:%r" %
         (self.win_one, self.win_two, self.win_three, self.win_four),
         __file__,
         sys._getframe().f_lineno)
     print("")
     print("\033[0;32;35m{{窗口标识获取完毕}}\033[0m", __file__,
           sys._getframe().f_lineno)
     print("")
     print(" ")
     return self.win_one, self.win_two, self.win_three, self.win_four