diff options
| author | youzhijiang <[email protected]> | 2024-10-25 18:35:12 +0800 |
|---|---|---|
| committer | youzhijiang <[email protected]> | 2024-10-25 18:35:12 +0800 |
| commit | df76f7de5655d6198cb9dbcf191fcaa88084f7aa (patch) | |
| tree | b57bbacb43572dcdd1d2975d9ba68b59cbdce1ac | |
| parent | 3087ab555ddcecc9b70f6d386c86f394976593d5 (diff) | |
元素定位调整
| -rw-r--r-- | cases/object/test_accounts.py | 6 | ||||
| -rw-r--r-- | cases/object/test_moible_identities.py | 56 | ||||
| -rw-r--r-- | cases/object/test_subscriber_ids.py | 42 | ||||
| -rw-r--r-- | common/ui_common/objects/accounts.py | 65 | ||||
| -rw-r--r-- | common/ui_common/objects/fqdns.py | 17 | ||||
| -rw-r--r-- | common/ui_common/objects/ip_address.py | 51 | ||||
| -rw-r--r-- | common/ui_common/objects/keywords.py | 14 | ||||
| -rw-r--r-- | common/ui_common/objects/moible_identities.py | 6 | ||||
| -rw-r--r-- | common/ui_common/objects/objects_public_operations.py | 99 | ||||
| -rw-r--r-- | common/ui_common/objects/subscriber_ids.py | 4 | ||||
| -rw-r--r-- | page_element/objects_element_position.py | 36 | ||||
| -rw-r--r-- | testdata/ui_file/objects/import_file/accounts_single_item导入文件.txt | 2 |
12 files changed, 179 insertions, 219 deletions
diff --git a/cases/object/test_accounts.py b/cases/object/test_accounts.py index 570924dd..6a87d5a0 100644 --- a/cases/object/test_accounts.py +++ b/cases/object/test_accounts.py @@ -98,6 +98,7 @@ class TestAccounts: finally: acc.delete(data) + #未修改 @pytest.mark.parametrize("data", [ { "ids": "test_reference_by_object", @@ -139,6 +140,7 @@ class TestAccounts: # acc._export_objects_and_verify(data) # # driver.quit() + @pytest.mark.parametrize("data", data.read_data_object(r"URLs\\pages_turning.json"), ids=data.generate_id) def test_pages_turning(self, demo_fixture, data): acc = Accounts(demo_fixture) @@ -152,6 +154,7 @@ class TestAccounts: acc._goto_accountsPage() acc._add_to_watchList() + #未修改 @pytest.mark.parametrize("data", [ { "ids": "创建urlObject并查看验证审计日志-T016/创建并修改urlObject查看验证审计日志-T041/23.09版本新功能:右侧页面增加Audit Logs功能-T073", @@ -556,6 +559,7 @@ class TestAccounts: acc = Accounts(demo_fixture) acc._different_vsys_check(data) + #未修改 @pytest.mark.parametrize("data", [ { "ids": "test_audit_log_all_operation", @@ -580,7 +584,7 @@ class TestAccounts: "Model": "create", "Type": 0, "Name": "", - "Search type": "Name&ID&Description&Details", + "Search type": "Name&Description&Details", "Items": [ "[random]->" ], diff --git a/cases/object/test_moible_identities.py b/cases/object/test_moible_identities.py index ae600e4a..e93dade2 100644 --- a/cases/object/test_moible_identities.py +++ b/cases/object/test_moible_identities.py @@ -36,7 +36,7 @@ class TestMoible_identities: }, "Createtype": "Phone_Number", "Subtype": "", - "Search_type": "ID" + "Search_type": "Name" } ]) def test_shakedown(self,demo_fixture,data): @@ -194,7 +194,7 @@ class TestMoible_identities: "Createtype": "IMSI", "Subtype": "export_files", - "Search_type": "ID" + "Search_type": "Name" } ]) def test_mobile_identiities_download_case(self,data): @@ -238,7 +238,7 @@ class TestMoible_identities: "Createtype": "IMSI", "Subtype": "", - "Search_type": "ID" + "Search_type": "Name" } ]) def test_mobile_identiities_audit_case(self,demo_fixture,data): @@ -277,7 +277,7 @@ class TestMoible_identities: "Createtype": "IMSI", "Subtype": "", - "Search_type": "ID" + "Search_type": "Name" }, { "ids": "30、moible_identities_错误类型文件error_type", @@ -291,7 +291,7 @@ class TestMoible_identities: "Createtype": "IMSI", "Subtype": "", - "Search_type": "ID" + "Search_type": "Name" }, { "ids": "30、moible_identities_错误item文件error_item", @@ -305,7 +305,7 @@ class TestMoible_identities: "Createtype": "IMSI", "Subtype": "", - "Search_type": "ID" + "Search_type": "Name" }, { "ids": "31、不输入必要数据校验", @@ -318,7 +318,7 @@ class TestMoible_identities: 'Createtype': "IMSI", "Subtype": "", - "Search_type": "ID" + "Search_type": "Name" } ]) def test_import_files(self,demo_fixture,data): @@ -336,7 +336,7 @@ class TestMoible_identities: "Createtype":"Phone_Number", "Subtype": "", - "Search_type": "ID", + "Search_type": "Name", "vsys_opearte": {"step1": "Tvsys2->create", "step2": "Tvsys3->search"} }, { @@ -350,7 +350,7 @@ class TestMoible_identities: "Createtype": "Phone_Number", "Subtype": "", - "Search_type": "ID", + "Search_type": "Name", "vsys_opearte": {"step1": "Tvsys3->create", "step2": "Tvsys2->quote"}, "subName": "" @@ -365,7 +365,7 @@ class TestMoible_identities: # }, # "Createtype": "Phone_Number", # "Subtype": "", - # "Search_type": "ID", + # "Search_type": "Name", # "vsys_opearte": {"step1": "Tvsys3->create", "step2": "Tvsys4->quote"}, # "subName": "" # @@ -380,7 +380,7 @@ class TestMoible_identities: # }, # "Createtype":"IMSI", # "Subtype": "", - # "Search_type": "ID", + # "Search_type": "Name", # "vsys_opearte": {"step1": "super_Tvsys3->create", "step2": "super_Mvsys10->search"}, # "subName": "" # }, @@ -394,7 +394,7 @@ class TestMoible_identities: # }, # "Createtype":"Phone_Number", # "Subtype": "", - # "Search_type": "ID", + # "Search_type": "Name", # "vsys_opearte": {"step1": "super_Tvsys3->create", "step2": "super_Mvsys3->search"}, # "subName": "" # }, @@ -408,7 +408,7 @@ class TestMoible_identities: # }, # "Createtype":"IMEI", # "Subtype": "", - # "Search_type": "ID", + # "Search_type": "Name", # "vsys_opearte": {"step1": "super_Tvsys3->create", "step2": "super_Mvsys3->search"}, # "subName": "" # }, @@ -423,7 +423,7 @@ class TestMoible_identities: # }, # "Createtype":"IMEI", # "Subtype": "", - # "Search_type": "ID", + # "Search_type": "Name", # "vsys_opearte": {"step1": "super_Tvsys3->create", "step2": "super_Tvsys10->security_quote"}, # "delete_mode" : "", # "subName": "" @@ -439,7 +439,7 @@ class TestMoible_identities: # }, # "Createtype":"IMEI", # "Subtype": "", - # "Search_type": "ID", + # "Search_type": "Name", # "vsys_opearte": {"step1": "super_Tvsys3->create", "step2": "super_Tvsys10->intercept_quote"}, # "delete_mode" : "", # "subName": "" @@ -454,7 +454,7 @@ class TestMoible_identities: # }, # "Createtype":"IMEI", # "Subtype": "", - # "Search_type": "ID", + # "Search_type": "Name", # "vsys_opearte": {"step1": "super_Tvsys3->create", "step2": "super_Tvsys10->intercept_quote"}, # "delete_mode" : "", # "subName": "" @@ -469,7 +469,7 @@ class TestMoible_identities: # }, # "Createtype":"IMEI", # "Subtype": "", - # "Search_type": "ID", + # "Search_type": "Name", # "vsys_opearte": {"step1": "super_Tvsys3->create", "step2": "super_Mvsys10->intercept_quote"}, # "delete_mode" : "", # "subName": "" @@ -491,7 +491,7 @@ class TestMoible_identities: }, "Createtype":"Phone_Number", "Subtype":"", - "Search_type": "ID" + "Search_type": "Name" }, ]) @@ -565,7 +565,7 @@ class TestMoible_identities: }, "Subtype": "0", "Createtype":"IMSI", - "Search_type": "ID" + "Search_type": "Name" },{ "ids": "用例33、exclude添加,include未添加校验", @@ -577,7 +577,7 @@ class TestMoible_identities: }, "Subtype": "1", "Createtype":"Phone_Number", - "Search_type": "ID" + "Search_type": "Name" },{ "ids": "用例33、exclude,include均未添加校验", "Name": "test-1", @@ -593,7 +593,7 @@ class TestMoible_identities: }, "Subtype": "3", "Createtype": "IMEI", - "Search_type": "ID" + "Search_type": "Name" } ]) def test_group_include(self,demo_fixture,data): @@ -611,7 +611,7 @@ class TestMoible_identities: }, "Createtype": "IMSI", "Subtype":"", - "Search_type": "ID" + "Search_type": "Name" }, { "ids": "Phone_Number列表页item搜索", "Name": "test-1", @@ -622,7 +622,7 @@ class TestMoible_identities: }, "Createtype": "Phone_Number", "Subtype":"", - "Search_type": "ID" + "Search_type": "Name" },{ "ids": "IMEI列表页item搜索", "Name": "test-1", @@ -633,7 +633,7 @@ class TestMoible_identities: }, "Createtype": "IMEI", "Subtype": "", - "Search_type": "ID" + "Search_type": "Name" },{ "ids": "Mobile Identity Group(Type:IMSI)子对象搜索", "Name": "test-mobile-identity group", @@ -703,7 +703,7 @@ class TestMoible_identities: }, "Createtype": "IMSI", "Subtype":"", - "Search_type": "ID" + "Search_type": "Name" } ]) def test_audit_log_all_operation(self,data): @@ -722,7 +722,7 @@ class TestMoible_identities: }, "Createtype": "IMSI", "Subtype":"", - "Search_type": "ID" + "Search_type": "Name" },{ "ids": "Phone_Number列表页item搜索", "Name": "test_policy_quote", @@ -733,7 +733,7 @@ class TestMoible_identities: }, "Createtype": "Phone_Number", "Subtype": "", - "Search_type": "ID" + "Search_type": "Name" },{ "ids": "IMEI列表页item搜索", "Name": "test-1", @@ -744,7 +744,7 @@ class TestMoible_identities: }, "Createtype": "IMEI", "Subtype": "", - "Search_type": "ID" + "Search_type": "Name" } ]) def test_policy_quote_role(self,demo_fixture, data): diff --git a/cases/object/test_subscriber_ids.py b/cases/object/test_subscriber_ids.py index 12169e78..aa7b6caa 100644 --- a/cases/object/test_subscriber_ids.py +++ b/cases/object/test_subscriber_ids.py @@ -65,7 +65,7 @@ class Test_Subscriber_IDs: }, "Createtype": "Subscriber_IDs", "Subtype": "not_delete", - "Search_type": "ID" + "Search_type": "Name" },{ "ids": "用例6:五层嵌套对象", "Name": "test--2", @@ -76,7 +76,7 @@ class Test_Subscriber_IDs: }, "Createtype": "Subscriber_IDs", "Subtype": "not_delete", - "Search_type": "ID" + "Search_type": "Name" },{ "ids": "用例6:五层嵌套对象", "Name": "test--3", @@ -87,7 +87,7 @@ class Test_Subscriber_IDs: }, "Createtype": "Subscriber_IDs", "Subtype": "not_delete", - "Search_type": "ID" + "Search_type": "Name" },{ "ids": "用例6:五层嵌套对象", "Name": "test--", @@ -116,7 +116,7 @@ class Test_Subscriber_IDs: }, "Createtype": "Subscriber_IDs", "Subtype":"", - "Search_type": "ID" + "Search_type": "Name" },{ "ids": "Subscriber_IDs_Group的统计页面查看", "Name":"test-subscriberid group", @@ -127,7 +127,7 @@ class Test_Subscriber_IDs: }, "Createtype": "Subscriber_IDs", "Subtype":"", - "Search_type": "ID" + "Search_type": "Name" } ]) def test_View_statistics_case(self,demo_fixture,data): @@ -207,7 +207,7 @@ class Test_Subscriber_IDs: }, "Createtype": "Subscriber_IDs", "Subtype": "", - "Search_type": "ID" + "Search_type": "Name" }]) def test_audit_log_case(self,demo_fixture,data): subscriber_ids = Subscriber_IDs(demo_fixture) @@ -225,7 +225,7 @@ class Test_Subscriber_IDs: }, "Createtype": "Subscriber_IDs", "Subtype": "", - "Search_type": "ID" + "Search_type": "Name" } ]) def test_subscriber_export_case(self,data): @@ -236,19 +236,7 @@ class Test_Subscriber_IDs: @pytest.mark.parametrize("data", [ - { - "ids": "用例1:Subscriber_IDs的增删改查", - "Name": "test-1", - "Create":{ - "model": "0", - "type": "new_object", - "item": ["^username$"] - }, - "Createtype": "Subscriber_IDs", - - "Subtype":"", - "Search_type": "ID&Details" - }, { + { "ids": "用例1:Subscriber_IDs的增删改查", "Name": "test-1", "Create":{ @@ -300,7 +288,7 @@ class Test_Subscriber_IDs: "item": ["^test1$"] }, "Subtype": "0", - "Search_type": "ID" + "Search_type": "Name" }, { "ids": "用例33、exclude添加,include未添加校验", "Name": "test-1", @@ -310,7 +298,7 @@ class Test_Subscriber_IDs: "item": ["^test1$"] }, "Subtype": "1", - "Search_type": "ID" + "Search_type": "Name" }, { "ids": "用例33、exclude,include均未添加校验", "Name": "test-1", @@ -324,7 +312,7 @@ class Test_Subscriber_IDs: }, "Name": "test-1", "Subtype": "3", - "Search_type": "ID" + "Search_type": "Name" } ]) def test_group_include(self, demo_fixture, data): @@ -342,7 +330,7 @@ class Test_Subscriber_IDs: }, "Createtype": "Subscriber_IDs", "Subtype": "", - "Search_type": "ID" + "Search_type": "Name" },{ "ids": "用例2:Subscriber_IDs_Group的增删改查", "Name": "test-subscriberid group", @@ -353,7 +341,7 @@ class Test_Subscriber_IDs: }, "Createtype": "Subscriber_IDs", "Subtype": "", - "Search_type": "ID" + "Search_type": "Name" } ]) def test_item_search(self, demo_fixture, data): @@ -392,7 +380,7 @@ class Test_Subscriber_IDs: }, "Createtype": "Subscriber_IDs", "Subtype": "", - "Search_type": "ID" + "Search_type": "Name" } ]) def test_sub_objects_drawer_search(self, demo_fixture, data): @@ -413,7 +401,7 @@ class Test_Subscriber_IDs: }, "Createtype": "Subscriber_IDs", "Subtype":"", - "Search_type": "ID" + "Search_type": "Name" } ]) def test_audit_log_all_operation(self,data): diff --git a/common/ui_common/objects/accounts.py b/common/ui_common/objects/accounts.py index afc6b7a2..e290d258 100644 --- a/common/ui_common/objects/accounts.py +++ b/common/ui_common/objects/accounts.py @@ -1628,24 +1628,21 @@ class Accounts: # 进入编辑页面 items_total = self.driver.find_element(By.XPATH, acc_ObjectDetailPage_itemsTotal_posXpath).text # Total 值 - print("items_total0:{}".format(items_total)) - items_total = items_total.split(":")[1].strip() + # print("items_total0:{}".format(items_total)) + # items_total = items_total.split(":")[1].strip() print("items_total:{}".format(items_total)) try: if int(items_total) == 0: self.driver.implicitly_wait(5) time.sleep(2) - items_total = self.driver.find_element(By.XPATH, - acc_ObjectDetailPage_itemsTotal_posXpath).text # Total 值 - items_total = items_total.split(":")[1].strip() - print("items_total1:{}".format(items_total)) + items_total = self.driver.find_element(By.XPATH,acc_ObjectDetailPage_itemsTotal_posXpath).text # Total 值 + # items_total = items_total.split(":")[1].strip() + # print("items_total1:{}".format(items_total)) except: pass finally: - assert len(data["Items"]) == int( - items_total), "校验失败,Total数值不正确,页面Total={},数据源Total={}".format( - int(items_total), len(data["Items"])) - self.driver.find_element(By.XPATH, mainPage_secondLevelMenu_Account_posXpath).click() # 返回acc列表页 + assert len(data["Items"]) == int(items_total), "校验失败,Total数值不正确,页面Total={},数据源Total={}".format(int(items_total), len(data["Items"])) + self.driver.find_element(By.XPATH, "//div[@class='MuiListItem-root MuiListItem-gutters Mui-selected menu-account-object css-1l56wwh']").click() # 返回acc列表页 # self._query(data) # 查询 self._del(data) @@ -1657,7 +1654,7 @@ class Accounts: # 点击create self.driver.find_element(By.XPATH, acc_listPage_createButton_posXpath).click() # 选择Category - self.driver.find_element(By.ID, acc_listPage_createButton_account_posId).click() + self.driver.find_element(By.XPATH, acc_listPage_createButton_account_posId).click() # 页面选项操作 self._operate_name(data, no_modify=None) # 添加acc item from file @@ -1666,10 +1663,9 @@ class Accounts: # 点击Import From File self.driver.find_element(By.XPATH, acc_ObjectDetailPage_importFromFile_posXpath).click() # 于Please Upload input 上传文件 - self.driver.find_element(By.XPATH, acc_ObjectDetailPage_pleaseUpload_posXpath).send_keys( - self.my_files._obj_files_path(file_name=data_file_name)) + self.driver.find_element(By.XPATH, acc_ObjectDetailPage_pleaseUpload_posXpath).send_keys(self.my_files._obj_files_path(file_name=data_file_name)) try: - error_message = self.driver.find_element(By.XPATH, '//div[@class="valid-column import-line"]/span').text + error_message = self.driver.find_element(By.XPATH, "(//div[@data-field='status'])[2]").text print(error_message) assert (error_message == "Incorrect match format" or error_message == "Require at least 3 bytes for any single substring , the total length of string can not exceed 1024 bytes." @@ -1686,19 +1682,17 @@ class Accounts: # 点击create self.driver.find_element(By.XPATH, acc_listPage_createButton_posXpath).click() # 选择Account - self.driver.find_element(By.ID, acc_listPage_createButton_account_posId).click() + self.driver.find_element(By.XPATH, acc_listPage_createButton_account_posId).click() # 页面选项操作 - self.driver.find_element(By.XPATH, acc_ObjectDetailPage_nameInput_posXpath).send_keys( - data["Name"]) # 于Name输入框Name + self.driver.find_element(By.XPATH, acc_ObjectDetailPage_nameInput_posXpath).send_keys(data["Name"]) # 于Name输入框Name self.driver.find_element(By.XPATH,acc_ObjectDetailPage_mainOkButton_posXpath).click() # 点击“OK”按钮 if len(data["Name"]) < 4: - error_message = self.driver.find_element(By.XPATH, '//div[@class="el-form-item__error"]').text + error_message = self.driver.find_element(By.XPATH, "//div[@class='account-object-name']/div[2]").text print(error_message) assert error_message == "The length of the name is at most 128 characters and cannot be less than 4 characters" else: # 长度大于128 # actually_name = self.driver.find_element(By.XPATH,acc_ObjectDetailPage_nameInput_posXpath) - actually_name_lenth_number = self.driver.find_element(By.XPATH, - acc_ObjectDetailPage_nameLenthNumber_posXpath).text + actually_name_lenth_number = self.driver.find_element(By.XPATH,acc_ObjectDetailPage_nameLenthNumber_posXpath).text # print(actually_name_lenth_number) assert actually_name_lenth_number == '128/128', "校验失败!actually_name_lenth_number ={}".format( actually_name_lenth_number) @@ -1718,14 +1712,14 @@ class Accounts: self.driver.find_element(By.XPATH,acc_ObjectDetailPage_mainOkButton_posXpath).click() # 点击“OK”按钮 try: - error_message_elem = '//div[@role="alert"][1]' + error_message_elem = "//div[@class='items']/div[2]" error_message = self.driver.find_element(By.XPATH, error_message_elem).text - assert error_message == "Form validation failed", "当前error_message={}!!".format(error_message) - print("校验通过,页面提示且{}=Form validation failed".format(error_message)) + assert error_message == "Please add at least one item", "当前error_message={}!!".format(error_message) + print("校验通过,页面提示且{}=Please add at least one item".format(error_message)) if not self.driver.element_isExist(By.XPATH, error_message_elem): self.driver.find_element(By.XPATH,acc_ObjectDetailPage_mainOkButton_posXpath).click() # 点击“OK”按钮 - assert error_message == "Form validation failed", "当前error_message={}!!".format(error_message) - print("校验通过,页面提示且{}=Form validation failed".format(error_message)) + assert error_message == "Please add at least one item", "当前error_message={}!!".format(error_message) + print("校验通过,页面提示且{}=Please add at least one item".format(error_message)) except Exception as e: print(e) @@ -1796,8 +1790,7 @@ class Accounts: # 选择模式 if selected_object_type == 0: # data中选择类型:0-对象,1-对象组,2-对象与对象组 self.no_need_to_get_data_from_list_page = 0 # 需要在列表页获取对象details value - object_checkbox_elems = self.driver.find_elements(By.XPATH, - acc_listPage_object_tableCheckbox_singleObject_posXpaths) # 定位所有single object对应的CheckBox + object_checkbox_elems = self.driver.find_elements(By.XPATH,acc_listPage_object_tableCheckbox_singleObject_posXpaths) # 定位所有single object对应的CheckBox print("object_checkbox_elems{}".format(object_checkbox_elems)) if selected_objects_number == 0: # 不选中对象 @@ -1894,11 +1887,9 @@ class Accounts: calcu_selected_data_number = selected_data_number if selected_object_type == 0: # 导出单独的对象 - self.driver.find_element(By.XPATH, - acc_listPage_object_exportPopSelectAll_posXpath).click() # 点击全选按钮,取消默认全选 + self.driver.find_element(By.XPATH,acc_listPage_object_exportPopSelectAll_posXpath).click() # 点击全选按钮,取消默认全选 if selected_data_number > 0: - data_checkbox_elems = self.driver.find_elements(By.XPATH, - acc_listPage_object_exportPopCheckbox_posXpaths) # 导出弹窗数据CheckBox + data_checkbox_elems = self.driver.find_elements(By.XPATH,acc_listPage_object_exportPopCheckbox_posXpaths) # 导出弹窗数据CheckBox # 选择头selected_data_number个数据 for i in data_checkbox_elems: @@ -2045,22 +2036,18 @@ class Accounts: self._create(data) # 编辑对象,并编辑item self._query(data, need_verify_details=0) # 搜索 - self.first_row_checkBox_element = self.driver.find_element(By.XPATH, - acc_listPage_first_row_checkBox_posXpath).click() # 勾选第一行元素 + self.first_row_checkBox_element = self.driver.find_element(By.XPATH,acc_listPage_first_row_checkBox_posXpath).click() # 勾选第一行元素 self.driver.find_element(By.XPATH, acc_listPage_editButton_posXpath).click() # 点击edit按钮 item_data = data["Items"][0] if item_data == "[random]": item_data = self.random_account - acc_item_edit_btn_xpath = "//span[normalize-space(text())='{acc}']/ancestor::*[@class='view-row']//i[contains(@class, 'iconfont icon-Edit')]".format( - acc=item_data) + acc_item_edit_btn_xpath = "(//*[normalize-space(text())='{acc}']/ancestor::*[@class='view-row']//i[contains(@class, 'iconfont icon-Edit')])[1]".format(acc=item_data) self.driver.find_element(By.XPATH, acc_item_edit_btn_xpath).click() # 点击要修改数据的编辑按钮操作 # 校验此时ImportFromFile按钮不可点击 try: try: - is_disabled = self.driver.find_element(By.XPATH, - acc_ObjectDetailPage_importFromFile_button_posXpath).get_attribute( - "disabled") + is_disabled = self.driver.find_element(By.XPATH,acc_ObjectDetailPage_importFromFile_button_posXpath).get_attribute("disabled") print("is_disabled:{}".format(is_disabled)) assert is_disabled == 'true', "校验失败!此时按钮可点击" print("校验成功,按钮不可点击") @@ -3308,7 +3295,7 @@ class Accounts: self.wait.until(EC.visibility_of_element_located((By.XPATH, item_result_pos))) total_text = self.driver.find_element(By.XPATH,groupObjectDetailPage_addSubObjecDrawer_totalText_posXpath).get_attribute("innerHTML") assert total_text == "Total:1", "搜索结果错误,此时获取到的文本为{}".format(total_text) - # self.driver.find_element(By.XPATH,"//div[@class='IpItems list-box']//span[normalize-space(text())='Close']").click() + self.driver.find_element(By.XPATH,acc_ObjectDetailPage_cancel_posXpath).click() except Exception as e: raise e finally: diff --git a/common/ui_common/objects/fqdns.py b/common/ui_common/objects/fqdns.py index 33416127..6dbb6b07 100644 --- a/common/ui_common/objects/fqdns.py +++ b/common/ui_common/objects/fqdns.py @@ -327,8 +327,8 @@ class FQDNs: # self.driver.find_element(By.XPATH, FQDNsObjectPage_button_warningSaveYes_posXpath).click() # except: # pass - # time.sleep(3) - # self.objects_po.extract_ele() + time.sleep(3) + self.objects_po.extract_ele() elif data['Create']['files_type'] == "error_format": data['Create']['model'] = "2" assert self.driver.find_element(By.XPATH,main_ObjectPage_import_files_error_format_posXpath).text == "Require at least 3 bytes for any single substring , the total length of string can not exceed 1024 bytes.","错误格式校验" @@ -432,7 +432,7 @@ class FQDNs: if search_type == "ID": search_value = self.objects_po.table_dict['ID'] elif search_type == "Name": - search_value = data["Name"] + search_value = self.objects_po.table_dict['Name'] elif search_type == "Description": search_value = self.objects_po.table_dict['Description'] elif search_type == "Details": @@ -1607,7 +1607,7 @@ if __name__ == '__main__': command_executor="http://192.168.39.77:4444", options=chrome_option ) - a.get("http://192.168.45.158/policies/security-rules?vsys=1&t=1729131281875") + a.get("http://192.168.45.158/") a.maximize_window() a.find_element(By.XPATH, '//*[@id="root"]/div/div[2]/div/div[1]/input').send_keys("admin") a.find_element(By.XPATH, '//*[@id="root"]/div/div[2]/div/div[2]/input').send_keys("admin") @@ -1619,12 +1619,13 @@ if __name__ == '__main__': # model=0/1 ====0:单个 1group # type =IMSI/Phone_Number/IMEI data= { - "ids": "用例24:FQDN的item为空校验", - "Name": "test", + "ids": "用例12-2:FQDNs中导入文件", + "Name": "test-1", "Create": { "model": "0", - "type": "new_object", - "item": "null" + "type": "import_files", + "files_type": "error_item", + "files_name": "FQDNs_error_item.txt" }, "Createtype": "FQDN", "Subtype": "", diff --git a/common/ui_common/objects/ip_address.py b/common/ui_common/objects/ip_address.py index fc3eb48a..a302303d 100644 --- a/common/ui_common/objects/ip_address.py +++ b/common/ui_common/objects/ip_address.py @@ -265,12 +265,12 @@ class IPAddress: # self.driver.find_element(By.XPATH, ip_addressObjectPage_button_warningSaveYes_posXpath).click() elif data['Create']['files_type'] == "error_format": data['Create']['model'] = "2" - assert self.driver.find_element(By.XPATH, - main_ObjectPage_import_files_error_format_posXpath).text == "IP addresses format error", "错误格式校验" + assert self.driver.find_element(By.XPATH,main_ObjectPage_import_files_error_format_posXpath).text == "IP addresses format error", "错误格式校验" + return elif data['Create']['files_type'] == "error_item": data['Create']['model'] = "2" - assert self.driver.find_element(By.XPATH, - main_ObjectPage_import_files_error_format_posXpath).text == "IP addresses format error", "错误item校验" + assert self.driver.find_element(By.XPATH,main_ObjectPage_import_files_error_format_posXpath).text == "IP addresses format error", "错误item校验" + return elif data['Create']['files_type'] == "error_type": data['Create']['model'] = "2" try: @@ -281,6 +281,7 @@ class IPAddress: pass time.sleep(1) assert self.error_tip == "Items cannot be empty", "断言错误提示" + return time.sleep(2) if self.modify_status == "0": @@ -607,7 +608,8 @@ class IPAddress: self.driver.find_element(By.XPATH, listPage_objectSearch_ip_address_select_IP_posXpath).click() elif "global" in search_type: self.driver.find_element(By.XPATH, listPage_objectSearch_ip_address_selectLabel_posXpath).send_keys(search_value + Keys.ENTER) - self.driver.find_element(By.XPATH, listpage_search_button_posXpath).click() + self.driver.find_element(By.XPATH, listPage_objectSearch_ip_address_select_Search_posXpath).click() + # self.driver.find_element(By.XPATH, listpage_search_button_posXpath).click() self.driver.find_element(By.XPATH, listpage_search_button_posXpath).click() @@ -1547,13 +1549,13 @@ class IPAddress: assert self.create_name == self.driver.find_element(By.XPATH, listPage_First_object_Name_posXpath).text assert self.random_name == self.driver.find_element(By.XPATH, listPage_First_object_Description_posXpath).text time.sleep(2) - if data["Createtype"] == "IP": - self.driver.find_element(By.XPATH,'(//div[@id="multilineItemDetails-_MultilineTableCell_ElTableBody_ElTable_Objects_ip_Home_App_anonymousComponent"])[1]').click() - self.driver.find_element(By.XPATH, listPage_item_search_text_posXpath).click() - self.driver.find_element(By.XPATH,"//div[@class='select_info_list']/ul/li[normalize-space(text())='IP']").click() - # 正确校验 - self.driver.find_element(By.XPATH, listPage_item_search_text_posXpath).send_keys('.'.join(data["Create"]["item"][0].split('.')[-2:]) + Keys.ENTER) - assert int((self.driver.find_element(By.XPATH, listPage_item_search_total_text_posXpath).text).split("Total:")[1]) >= 1, "搜索结果错误" + # if data["Createtype"] == "IP": + # self.driver.find_element(By.XPATH,'(//div[@id="multilineItemDetails-_MultilineTableCell_ElTableBody_ElTable_Objects_ip_Home_App_anonymousComponent"])[1]').click() + # self.driver.find_element(By.XPATH, listPage_item_search_text_posXpath).click() + # self.driver.find_element(By.XPATH,"//div[@class='select_info_list']/ul/li[normalize-space(text())='IP']").click() + # # 正确校验 + # self.driver.find_element(By.XPATH, listPage_item_search_text_posXpath).send_keys('.'.join(data["Create"]["item"][0].split('.')[-2:]) + Keys.ENTER) + # assert int((self.driver.find_element(By.XPATH, listPage_item_search_total_text_posXpath).text).split("Total:")[1]) >= 1, "搜索结果错误" self._delete(data) def group_object_include(self,data): @@ -1807,20 +1809,17 @@ if __name__ == '__main__': # model=0/1 ====0:单个 1group # type =IMSI/Phone_Number/IMEI data={ - "ids": "用例6、IP_Group的增删改查", - "Name": "test-1", - "Create": { - "model": "1", - "type": "new_object", - "item": [ - "1.1.1.1", - "1.1.1.1-1.1.1.1", - "1:1:1::1" - ] - }, - "Createtype": "IP", - "Subtype": "Five_layer", - "Search_type": "Name" + "ids": "用例22-3、IP的增量导入", + "Name": "test-1", + "Create": { + "model": "0", + "type": "import_files", + "files_type": "error_type", + "files_name": "FQDNs_error_type.png" + }, + "Createtype": "IP", + "Subtype": "", + "Search_type": "Name" } # r._clear_counter(data) r.ip_address_case(data) diff --git a/common/ui_common/objects/keywords.py b/common/ui_common/objects/keywords.py index 24e86e69..32bddc82 100644 --- a/common/ui_common/objects/keywords.py +++ b/common/ui_common/objects/keywords.py @@ -331,7 +331,7 @@ class Keywords: if search_type == "ID": search_value = self.objects_po.table_dict['ID'] elif search_type == "Name": - search_value = data["Name"] + search_value = self.objects_po.table_dict['Name'] elif search_type == "Description": search_value = self.objects_po.table_dict['Description'] elif search_type == "Details": @@ -525,8 +525,8 @@ class Keywords: # self.driver.find_element(By.XPATH, KeywordsObjectPage_button_warningSaveYes_posXpath).click() # except: # pass - # time.sleep(2) - # self.objects_po.extract_ele() + time.sleep(2) + self.objects_po.extract_ele() elif data["Create"]["model"] == "1": if "sub_name" not in data['Create'].keys(): # 确认创建sub_new_fqdns @@ -540,8 +540,8 @@ class Keywords: # self.driver.find_element(By.XPATH, KeywordsObjectPage_button_warningSaveYes_posXpath).click() # except: # pass - # time.sleep(2) - # self.objects_po.extract_ele() + time.sleep(2) + self.objects_po.extract_ele() elif "sub_name" in data['Create'].keys(): # 确认创建 self.driver.find_element(By.XPATH, KeywordsObjectPage_button_SaveYes_posXpath).click() @@ -551,8 +551,8 @@ class Keywords: # self.driver.find_element(By.XPATH, KeywordsObjectPage_button_warningSaveYes_posXpath).click() # except: # pass - # time.sleep(2) - # self.objects_po.extract_ele() + time.sleep(2) + self.objects_po.extract_ele() elif data['Create']['model'] == "2": if len(data['Name'])<4: self.driver.find_element(By.XPATH, KeywordsObjectPage_button_SaveYes_posXpath).click() diff --git a/common/ui_common/objects/moible_identities.py b/common/ui_common/objects/moible_identities.py index 8891d403..39f3d80b 100644 --- a/common/ui_common/objects/moible_identities.py +++ b/common/ui_common/objects/moible_identities.py @@ -484,7 +484,7 @@ class mobile_identiities: if search_type == "ID": search_value = self.objects_po.table_dict['ID'] elif search_type == "Name": - search_value = self.create_name + search_value = self.objects_po.table_dict['Name'] elif search_type == "Description": search_value = self.objects_po.table_dict['Description'] elif search_type == "Details": @@ -963,8 +963,8 @@ class mobile_identiities: else: self.driver.find_element(By.XPATH, mobileIdentitiesObjectPage_button_SaveYes_posXpath).click() # self.driver.find_element(By.XPATH, mobileIdentitiesObjectPage_button_warningSaveYes_posXpath).click() - # time.sleep(3) - # self.objects_po.extract_ele() + time.sleep(3) + self.objects_po.extract_ele() # self.ex_details(data) if data["Create"]["model"] == "1": diff --git a/common/ui_common/objects/objects_public_operations.py b/common/ui_common/objects/objects_public_operations.py index 76fbe28f..59ff37fc 100644 --- a/common/ui_common/objects/objects_public_operations.py +++ b/common/ui_common/objects/objects_public_operations.py @@ -2195,52 +2195,46 @@ class ObjectsPublicOperations: def audit_log_view(self, object_type, import_verify=1, export_verify=1): user_name = self.loginout_parse.get("ui_account_1", "username") - self.driver.find_element(By.ID, mainPage_firstLevelMenu_System_posId).click() - self.driver.find_element(By.ID, mainPage_secondLevelMenu_auditLogs_posId).click() + self.driver.find_element(By.XPATH, mainPage_firstLevelMenu_System_posXpath).click() + self.driver.find_element(By.XPATH, mainPage_secondLevelMenu_auditLogs_posXpath).click() time.sleep(3) - self.driver.find_element(By.ID, mainPage_ObjectSearch_selectLabel_posId).click() + self.driver.find_element(By.XPATH, listPage_auditlogSearch_input_posXpath).click() ###校验["Create", "Edit", "Delete", "Import", "Query Verbose"] # 选择Targrt ID if object_type in ["Signature Object", "Application Object", "Customized Attribute Object"]: + self.driver.find_element(By.XPATH, listPage_auditlogSearch_targetid_text_posXpath).send_keys(self.table_dict1["ID"] + Keys.ENTER) self.driver.find_element(By.XPATH, listPage_auditlogSearch_select_TagrgetID_posXpath).click() - self.driver.find_element(By.XPATH, listPage_auditlogSearch_targetid_text_posXpath).send_keys( - self.table_dict1["ID"] + Keys.ENTER) else: + self.driver.find_element(By.XPATH, listPage_auditlogSearch_targetid_text_posXpath).send_keys(self.table_dict["ID"] + Keys.ENTER) self.driver.find_element(By.XPATH, listPage_auditlogSearch_select_TagrgetID_posXpath).click() - self.driver.find_element(By.XPATH, listPage_auditlogSearch_targetid_text_posXpath).send_keys( - self.table_dict["ID"] + Keys.ENTER) # 选择Target Type - self.driver.find_element(By.ID, mainPage_ObjectSearch_selectLabel_posId).click() + self.driver.find_element(By.XPATH, listPage_auditlogSearch_input_posXpath).click() self.driver.find_element(By.XPATH, listPage_auditlogSearch_select_TargetType_posXpath).click() - scrollable_div = self.driver.find_element(By.XPATH, - f"//div[@class='el-select-dropdown el-popper select-popper']//span[text()='{object_type}']") + scrollable_div = self.driver.find_element(By.XPATH,f"//ul[@class='base-Popper-root MuiSelect-listbox Mui-expanded css-1wd16dk']//span[text()='{object_type}']") self.driver.execute_script("arguments[0].scrollIntoView();", scrollable_div) scrollable_div.click() # 选择当前用户 - self.driver.find_element(By.ID, mainPage_ObjectSearch_selectLabel_posId).click() + self.driver.find_element(By.XPATH, listPage_auditlogSearch_input_posXpath).click() self.driver.find_element(By.XPATH, listPage_auditlogSearch_select_UserName_posXpath).click() self.driver.find_element(By.XPATH, listPage_auditlogSearch_username_text_posXpath).send_keys(user_name) time.sleep(2) - element_user_name = self.driver.find_element(By.XPATH, - f"//div[@x-placement='bottom-start']//span[text()='{user_name}']") + element_user_name = self.driver.find_element(By.XPATH,f"//div[@x-placement='bottom-start']//span[text()='{user_name}']") self.driver.execute_script("arguments[0].click()", element_user_name) # 强制点击搜索出来的Name # 搜索 - self.driver.find_element(By.ID, mainPage_ObjectSearch_buttonSearch_posId).click() + self.driver.find_element(By.XPATH, listPage_auditlogSearch_buttonSearch_posXpath).click() # 搜索 - assert len(self.driver.find_elements(By.XPATH,"//div[@class='el-table__body-wrapper is-scrolling-none']//span[text()='Create']")) == 1,"Create日记大于1" - assert len(self.driver.find_elements(By.XPATH,"//div[@class='el-table__body-wrapper is-scrolling-none']//span[text()='Edit']")) == 1,"Edit日志大于1" - assert len(self.driver.find_elements(By.XPATH,"//div[@class='el-table__body-wrapper is-scrolling-none']//span[text()='Delete']")) == 1,"Delete日志大于1" + assert len(self.driver.find_elements(By.XPATH,"//div[@data-field='op_type']//span[text()='Create']")) == 1,"Create日记大于1" + assert len(self.driver.find_elements(By.XPATH,"//div[@data-field='op_type']//span[text()='Edit']")) == 1,"Edit日志大于1" + assert len(self.driver.find_elements(By.XPATH,"//div[@data-field='op_type']//span[text()='Delete']")) == 1,"Delete日志大于1" time.sleep(1) - operation_text_elements = self.driver.find_elements(By.XPATH, - "(//table[@class='el-table__body'])[1]//tbody/tr/td[3]//span") + operation_text_elements = self.driver.find_elements(By.XPATH,"//div[@class='MuiDataGrid-virtualScrollerContent css-0']//div[@data-field='op_type']") if import_verify == 1: operation = ["Create", "Edit", "Delete", "Import", "Query Verbose"] else: operation = ["Create", "Edit", "Delete", "Query Verbose"] operation_text = [] - for i in range(len(operation_text_elements)): - text = self.driver.find_element(By.XPATH, - f"((//table[@class='el-table__body'])[1]//tbody/tr/td[3]//span)[{i + 1}]").text + for i in range(1,len(operation_text_elements)): + text = self.driver.find_element(By.XPATH,f"(//div[@class='MuiDataGrid-virtualScrollerContent css-0']//div[@data-field='op_type'])[{i + 1}]").text operation_text.append(text) self.check_audit_log_detail("0") if set(operation_text) != set(operation): @@ -2248,36 +2242,33 @@ class ObjectsPublicOperations: ###校验["Export","Query List"] # 清除筛选框 - search_clear_btn = self.driver.find_element(By.XPATH, '//*[@id="searchClear"]') + search_clear_btn = self.driver.find_element(By.XPATH,listPage_auditlogSearch_input_posXpath) self.driver.execute_script("arguments[0].scrollIntoView();", search_clear_btn) search_clear_btn.click() object_type = "Object" - self.driver.find_element(By.ID, mainPage_ObjectSearch_selectLabel_posId).click() + self.driver.find_element(By.XPATH, listPage_auditlogSearch_input_posXpath).click() self.driver.find_element(By.XPATH, listPage_auditlogSearch_select_TargetType_posXpath).click() - scrollable_div = self.driver.find_element(By.XPATH, - f"//div[@class='el-select-dropdown el-popper select-popper']//span[text()='{object_type}']") + scrollable_div = self.driver.find_element(By.XPATH,f"//ul[@class='base-Popper-root MuiSelect-listbox Mui-expanded css-1wd16dk']//span[text()='{object_type}']") self.driver.execute_script("arguments[0].scrollIntoView();", scrollable_div) scrollable_div.click() # 选择当前用户 - self.driver.find_element(By.ID, mainPage_ObjectSearch_selectLabel_posId).click() + self.driver.find_element(By.XPATH, listPage_auditlogSearch_input_posXpath).click() self.driver.find_element(By.XPATH, listPage_auditlogSearch_select_UserName_posXpath).click() self.driver.find_element(By.XPATH, listPage_auditlogSearch_username_text_posXpath).send_keys(user_name) time.sleep(2) self.driver.find_element(By.XPATH, f"//div[@x-placement='bottom-start']//span[text()='{user_name}']").click() # 搜索 - self.driver.find_element(By.ID, mainPage_ObjectSearch_buttonSearch_posId).click() + self.driver.find_element(By.XPATH, listPage_auditlogSearch_buttonSearch_posXpath).click() time.sleep(7) - operation_text_elements = self.driver.find_elements(By.XPATH, - "(//table[@class='el-table__body'])[1]//tbody/tr/td[3]//span") + operation_text_elements = self.driver.find_elements(By.XPATH,"//div[@class='MuiDataGrid-virtualScrollerContent css-0']//div[@data-field='op_type']") other_operation_text = [] if export_verify == 1: other_operation = ["Export", "Query List"] else: other_operation = ["Query List"] for i in range(len(operation_text_elements)): - text = self.driver.find_element(By.XPATH, - f"((//table[@class='el-table__body'])[1]//tbody/tr/td[3]//span)[{i + 1}]").text + text = self.driver.find_element(By.XPATH,f"(//div[@class='MuiDataGrid-virtualScrollerContent css-0']//div[@data-field='op_type'])[{i + 1}]").text other_operation_text.append(text) self.check_audit_log_detail("1") print(other_operation_text, set(other_operation_text), len(operation_text_elements)) @@ -2286,37 +2277,25 @@ class ObjectsPublicOperations: def check_audit_log_detail(self, type): if type == "0": # 首次对operation = ["Create", "Edit", "Delete", "Import", "Query Verbose"]的校验 - detaile_elements = self.driver.find_elements(By.XPATH, - "//button[@id='test-compareHistorical-_system_PolicyConfigurationLog_Home_App_anonymousComponent']") - for i in range(len(detaile_elements)): - detaile_text = self.driver.find_element(By.XPATH, - f"(//button[@id='test-compareHistorical-_system_PolicyConfigurationLog_Home_App_anonymousComponent'])[{i + 1}]").text - self.driver.find_element(By.XPATH, - f"(//button[@id='test-compareHistorical-_system_PolicyConfigurationLog_Home_App_anonymousComponent'])[{i + 1}]").click() + detaile_elements = self.driver.find_elements(By.XPATH, "//div[@class='MuiDataGrid-virtualScrollerContent css-0']//div[@data-field='details']") + for i in range(1,len(detaile_elements)): + detaile_text = self.driver.find_element(By.XPATH, f"(//div[@class='MuiDataGrid-virtualScrollerContent css-0']//div[@data-field='details'])[{i + 1}]").text + self.driver.find_element(By.XPATH, f"(//div[@class='MuiDataGrid-virtualScrollerContent css-0']//div[@data-field='details'])[{i + 1}]").click() if detaile_text == "Compare": - compare_verision = self.driver.find_elements(By.XPATH, - "//div[@class='rm-content']//div[@class='el-table__body-wrapper is-scrolling-none']//tr[@class='el-table__row']") + compare_verision = self.driver.find_elements(By.XPATH, "//div[@class='rm-content']//div[@class='el-table__body-wrapper is-scrolling-none']//tr[@class='el-table__row']") assert len(compare_verision) != 0, "Compare存在修改信息" elif detaile_text == "View": - assert self.driver.find_element(By.XPATH, - url_ObjectDetailPage_auditLogsDrawer_compareDrawer_operationText_posXpath).text != "" - assert self.driver.find_element(By.XPATH, - ObjectDetailPage_audit_log_compare_type_posXpath).text != "" + assert self.driver.find_element(By.XPATH, url_ObjectDetailPage_auditLogsDrawer_compareDrawer_operationText_posXpath).text != "" + assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_type_posXpath).text != "" assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_ip_posXpath).text != "" - assert self.driver.find_element(By.XPATH, - ObjectDetailPage_audit_log_compare_time_posXpath).text != "" - assert self.driver.find_element(By.XPATH, - ObjectDetailPage_audit_log_compare_user_posXpath).text != "" - self.driver.find_element(By.ID, - "interceptionadd_allcancelobject10-_AuditLogs_system_PolicyConfigurationLog_Home_App_anonymousComponent").click() + assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_time_posXpath).text != "" + assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_user_posXpath).text != "" + self.driver.find_element(By.ID,"interceptionadd_allcancelobject10-_AuditLogs_system_PolicyConfigurationLog_Home_App_anonymousComponent").click() elif type == "1": # 对 other_operation = ["Export", "Query List"]的校验 - detaile_elements = self.driver.find_elements(By.XPATH, - "//button[@id='test-compareHistorical-_system_PolicyConfigurationLog_Home_App_anonymousComponent']") - detaile_index = random.randint(1, len(detaile_elements) + 1) - self.driver.find_element(By.XPATH, - f"(//button[@id='test-compareHistorical-_system_PolicyConfigurationLog_Home_App_anonymousComponent'])[{detaile_index}]").click() - assert self.driver.find_element(By.XPATH, - url_ObjectDetailPage_auditLogsDrawer_compareDrawer_operationText_posXpath).text != "" + detaile_elements = self.driver.find_elements(By.XPATH,"//div[@class='MuiDataGrid-virtualScrollerContent css-0']//div[@data-field='details']") + detaile_index = random.randint(1, len(detaile_elements)) + self.driver.find_element(By.XPATH,f"(//div[@class='MuiDataGrid-virtualScrollerContent css-0']//div[@data-field='details'])[{detaile_index + 1}]").click() + assert self.driver.find_element(By.XPATH,url_ObjectDetailPage_auditLogsDrawer_compareDrawer_operationText_posXpath).text != "" assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_type_posXpath).text != "" assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_ip_posXpath).text != "" assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_time_posXpath).text != "" @@ -2556,9 +2535,9 @@ class ObjectsPublicOperations: # self.driver.find_element(By.ID, mainPage_ObjectSearch_buttonSearch_posId).click() # else: # # 简单筛选 - # self.clear_name_by_id(mainPage_ObjectSearch_selectLabel_posId) + # self.clear_name_by_id(listPage_auditlogSearch_input_posXpath) # objects_search_input_elem = self.wait.until( - # EC.presence_of_element_located((By.ID, mainPage_ObjectSearch_selectLabel_posId))) + # EC.presence_of_element_located((By.ID, listPage_auditlogSearch_input_posXpath))) # objects_search_input_elem.send_keys("test") # self.wait.until( # EC.presence_of_element_located( diff --git a/common/ui_common/objects/subscriber_ids.py b/common/ui_common/objects/subscriber_ids.py index 25f13a3e..34c5a382 100644 --- a/common/ui_common/objects/subscriber_ids.py +++ b/common/ui_common/objects/subscriber_ids.py @@ -226,7 +226,7 @@ class Base_Subscriber_IDs: # self.driver.find_element(By.XPATH, Subscriber_IDsObjectPage_button_warningSaveYes_posXpath).click() # 提取元素 time.sleep(3) - # self.objects_po.extract_ele() + self.objects_po.extract_ele() elif self.import_status == "1": time.sleep(3) # 导入ok @@ -465,7 +465,7 @@ class Subscriber_IDs(Base_Subscriber_IDs): if search_type == "ID": search_value = self.objects_po.table_dict['ID'] elif search_type == "Name": - search_value = data["Name"] + search_value = self.objects_po.table_dict['Name'] elif search_type == "Description": search_value = self.objects_po.table_dict['Description'] elif search_type == "Details": diff --git a/page_element/objects_element_position.py b/page_element/objects_element_position.py index 9a4dbb2c..4d2b1a41 100644 --- a/page_element/objects_element_position.py +++ b/page_element/objects_element_position.py @@ -104,17 +104,19 @@ mainPage_secondLevelMenu_Intervals_posXpath = "//div[@class='MuiListItem-root Mu # =====================================================================System界面==========System界面======================================================================= -mainPage_firstLevelMenu_System_posId = "System" # 一级菜单System -mainPage_secondLevelMenu_auditLogs_posId = "system_PolicyConfigurationLog" # 二级菜单AuditLog -listPage_auditlogSearch_select_TagrgetID_posXpath = '//li[@id="1-_FilteredSearch_ElRow_system_PolicyConfigurationLog_Home_App_anonymousComponent"]' # TagrgetID -listPage_auditlogSearch_select_Operation_posXpath = '//li[@id="7-_FilteredSearch_ElRow_system_PolicyConfigurationLog_Home_App_anonymousComponent"]' # operation选择 -listPage_auditlogSearch_select_UserName_posXpath = '//li[@id="3-_FilteredSearch_ElRow_system_PolicyConfigurationLog_Home_App_anonymousComponent"]' # username选择 -listPage_auditlogSearch_select_TargetType_posXpath = '//li[@id="30-_FilteredSearch_ElRow_system_PolicyConfigurationLog_Home_App_anonymousComponent"]' # target type选择 +mainPage_firstLevelMenu_System_posXpath = "//li[@class='MuiListItem-root MuiListItem-gutters menu-system css-1cpzmuh']" # 一级菜单System +mainPage_secondLevelMenu_auditLogs_posXpath = "//div[contains(@class,'menu-audit-log')]" # 二级菜单AuditLog +listPage_auditlogSearch_select_TagrgetID_posXpath = "//ul[@class='base-Popper-root MuiAutocomplete-listbox css-18r31z0']//*[normalize-space(text())='Target ID']" # TagrgetID +listPage_auditlogSearch_select_Operation_posXpath = "//ul[@class='base-Popper-root MuiAutocomplete-listbox css-18r31z0']//*[normalize-space(text())='Operation']" # operation选择 +listPage_auditlogSearch_select_UserName_posXpath = "//ul[@class='base-Popper-root MuiAutocomplete-listbox css-18r31z0']//*[normalize-space(text())='User Name']" # username选择 +listPage_auditlogSearch_select_TargetType_posXpath = "//ul[@class='base-Popper-root MuiAutocomplete-listbox css-18r31z0']//*[normalize-space(text())='Target Type']" # target type选择 listPage_auditlogSearch_select_Operation_Create_posXpath = '//li[@id="create-_v-select_ListItem_FilteredSearch_ElRow_system_PolicyConfigurationLog_Home_App_anonymousComponent"]' listPage_auditlogSearch_select_Operation_Edite_posXpath = '//li[@id="edit-_v-select_ListItem_FilteredSearch_ElRow_system_PolicyConfigurationLog_Home_App_anonymousComponent"]' listPage_auditlogSearch_select_Operation_Delete_posXpath = '//li[@id="delete-_v-select_ListItem_FilteredSearch_ElRow_system_PolicyConfigurationLog_Home_App_anonymousComponent"]' listPage_auditlogSearch_targetid_text_posXpath = "//div[@class='rel-input v-input input el-input el-input--mini']/input" listPage_auditlogSearch_username_text_posXpath = "//div[@class='el-input el-input--mini el-input--suffix is-focus']//input" +listPage_auditlogSearch_input_posXpath = "//span[@class='action-search inline-flex mr-[8px] flex-1']//input" +listPage_auditlogSearch_buttonSearch_posXpath = "//i[@class='iconfont icon-sousuo text-[19px]']" # Object 查询栏===================Object 查询栏=====================Object 查询栏=================Object 查询栏=======================Object 查询栏=================Object 查询栏 ##Object模块查询栏 @@ -238,7 +240,7 @@ ObjectDetailPage_audit_log_compare_time_posXpath = "//div[@class='compare-code-b ObjectDetailPage_audit_log_compare_user_posXpath = '//div[contains(text(),"User")]/following-sibling::div' ObjectDetailPage_audit_log_cancel_posXpath = "//div[@class='paper-right-content']//span[normalize-space(text())='Close']" # Group Object详情页通用元素 -groupObjectDetailPage_addSubObjecDrawer_searchInput_posXpath = '//div[@class="css-dob60y"]//input[@class="MuiInput-input css-za5rna"]' # Group 详情页添加sub Object的侧滑页面中的搜索框 +groupObjectDetailPage_addSubObjecDrawer_searchInput_posXpath = '(//div[@class="css-dob60y"]//input)[1]' # Group 详情页添加sub Object的侧滑页面中的搜索框 groupObjectDetailPage_addSubObjecDrawer_totalText_posXpath = '//div[@class="px-[12px] pb-[4px] pt-[2px] text-[--color-text-disabled]"]' # Group 详情页添加sub Object的侧滑页面中的Total文本 groupObjectDetailPage_addSubObjecDrawer_firstSubObject_posXpath = '//ul[@class="MuiList-root MuiList-vertical MuiList-variantPlain MuiList-colorNeutral MuiList-sizeMd css-1cklc3"]/li[1]' # Group 详情页添加sub Object的侧滑页面中第一个sub object @@ -287,8 +289,7 @@ listPage_object_group_include_add_button_posXpath = "//div[@class='ip-object-inc # Object Mobile Identities===================Object Mobile Identities====================Object Mobile Identities=================Object Mobile Identities=======================Object Mobile Identities=================Object Mobile Identities # 导入导出文件设置 -main_ObjectPage_Input_Import_files_button_posXpath = "//button[@class='MuiButtonBase-root MuiButton-root MuiButton-text MuiButton-textPrimary MuiButton-sizeMedium MuiButton-textSizeMedium MuiButton-colorPrimary \ -MuiButton-root MuiButton-text MuiButton-textPrimary MuiButton-sizeMedium MuiButton-textSizeMedium MuiButton-colorPrimary css-epitc3']/i[@class='iconfont icon-export']" # main导出文件按钮 +main_ObjectPage_Input_Import_files_button_posXpath = "//i[@class='iconfont icon-export']" # main导出文件按钮 mobileIdentitiesObjectPage_Button_Import_Mobile_Identity_files_posXpath = "//button[@class='MuiButtonBase-root MuiButton-root MuiButton-text MuiButton-textPrimary MuiButton-sizeSmall MuiButton-textSizeSmall MuiButton-colorPrimary MuiButton-root MuiButton-text MuiButton-textPrimary MuiButton-sizeSmall MuiButton-textSizeSmall MuiButton-colorPrimary css-bc4t0x']" # Create Import Mobile Identity Button mobileIdentitiesObjectPage_Input_path_Import_Mobile_Identity_files_posXpath = main_ObjectPage_Input_path_Import_files_posXpath # Create Import Mobile Identity path main_ObjectPage_Import_Mobile_Identity_files_OK_Button_posXpath = "//div[@class='absolute bottom-0 h-[40px] w-[100%] overflow-hidden text-[16px] truncate bg-[--color-background-secondary] flex justify-center items-center pl-[12px] pr-[38px]']//button[text()='OK']" # 导入文件OK @@ -296,7 +297,7 @@ mobileIdentitiesObjectPage_Import_Mobile_Identity_files_OK_Button_posXpath = mai mobileIdentitiesObjectPage_Import_Mobile_Identity_files_Cancel_Button_posXpath = "//div[5]/div/div[1]/div/div/div[2]/div[2]/button[2]/span" # 导入文件Cancel mobileIdentitiesObjectPage_Import_Mobile_Identity_files_IMSI_Group_Cancel_Button_posXpath = '//div[2]/div/div[1]/div/div/div[2]/div[2]/button[2]/span' main_item_error_format_posXpath = "//div[@class='subscriber-id-object-expression']/div[2]" # 错误格式提示语 -main_Import_files_error_format_posXpath = '//ul/li/div[@class="valid-column import-line"]/span' # 导入文件格式错误提示语 +main_Import_files_error_format_posXpath = "//i[@class='iconfont icon-Dashboarddisablepolicy text-[var(--color-error)] pr-[4px]']//parent::div" # 导入文件格式错误提示语 main_Item_length_error_posXpath = "//div[@class='subscriber-id-object-expression']/div[2]" # item 长度校验错误 mobileIdentitiesObjectPage_Import_Mobile_Identity_files_error_format_posXpath = main_Import_files_error_format_posXpath # mobile identities 导入文件格式错误提示语 main_Import_Mobile_Identity_files_error_type_posXpath = "//div[@class='MuiFormHelperText-root css-koslx8']" # 错误类型提示语 @@ -540,7 +541,7 @@ url_ObjectDetailPage_auditLogsDrawer_compareButton_posXpath = '//div[@class="Loc url_ObjectDetailPage_auditLogsDrawer_compareDrawer_operationText_posXpath = '//div[contains(text(),"Operation")]/following-sibling::div' # Audit Logs 侧滑页点击Compare后的 operation text Xpath url_ObjectDetailPage_itemsTotal_posXpath = "//div[@class='items']//div[@class='flex flex-row justify-between mt-[4px]']/div[2]/span[2]" # 详情页Items Total Xpath url_ObjectDetailPage_importFromFile_posXpath = '//button[contains(text(),"import from file")]' # Import From File 按钮Xpath -url_ObjectDetailPage_importFromFile_button_posXpath = "//button[@class='MuiButtonBase-root MuiButton-root MuiButton-text MuiButton-textPrimary MuiButton-sizeSmall MuiButton-textSizeSmall MuiButton-colorPrimary MuiButton-root MuiButton-text MuiButton-textPrimary MuiButton-sizeSmall MuiButton-textSizeSmall MuiButton-colorPrimary css-bc4t0x']" # Import From File 按钮Xpath +url_ObjectDetailPage_importFromFile_button_posXpath = "//div[@class='flex flex-row justify-between mt-[4px]']//button[text()='import from file']" # Import From File 按钮Xpath # url_ObjectDetailPage_pleaseUpload_posXpath = '//span[contains(text(),"Please Upload")]/../../input' # Please Upload input标签Xpath url_ObjectDetailPage_pleaseUpload_posXpath = "//div[@class='flex flex-col justify-start flex-1 MuiBox-root css-0']//input[@type='file']" # Please Upload input标签Xpath url_ObjectDetailPage_importUrlOk_posXpath = "//div[@class='relative w-[100%] h-[100%] pt-[46px] pb-[56px] flex overflow-hidden']//button[text()='OK']" # Import URL 下的OK按钮Xpath @@ -610,13 +611,14 @@ ip_address_listPage_first_row_checkBox_posXpath = '//div[@data-id="039114ae-34b2 listPage_object_ip_address_viewButton_posXpath = "//button[@id='appEdit-_OperateBtns_ElRow_Objects_ip_Home_App_anonymousComponent']//p[normalize-space(text()) = 'View']" # 查询框输入并选择 -listPage_objectSearch_ip_address_select_Id_posXpath = '//li[@id="1-_FilteredSearch_ElRow_Objects_ip_Home_App_anonymousComponent"]' # 查询ID +listPage_objectSearch_ip_address_select_Id_posXpath = "//ul[@class='base-Popper-root MuiAutocomplete-listbox css-18r31z0']//span[text()='UUID']" # 查询ID listPage_objectSearch_ip_address_select_Name_posXpath = "//ul[@class='base-Popper-root MuiAutocomplete-listbox css-18r31z0']//span[text()='Name']" # 查询Name listPage_objectSearch_ip_address_select_Details_posXpath = "//ul[@class='base-Popper-root MuiAutocomplete-listbox css-18r31z0']//span[text()='Detail']" # 查询Details listPage_objectSearch_ip_address_select_subType_posXpath = "//ul[@class='base-Popper-root MuiAutocomplete-listbox css-18r31z0']//span[text()='Sub Type']" # 查询SubType listPage_objectSearch_ip_address_select_Description_posXpath = "//ul[@class='base-Popper-root MuiAutocomplete-listbox css-18r31z0']//span[text()='Description']" # 查询Description -listPage_objectSearch_ip_address_select_CreateBy_posXpath = '//*[@id="5-_FilteredSearch_ElRow_Objects_ip_Home_App_anonymousComponent"]' # 查询CreateBy +listPage_objectSearch_ip_address_select_CreateBy_posXpath = "//ul[@class='base-Popper-root MuiAutocomplete-listbox css-18r31z0']//span[text()='Create By']" # 查询CreateBy listPage_objectSearch_ip_address_select_IP_posXpath = "//ul[@class='base-Popper-root MuiAutocomplete-listbox css-18r31z0']//span[text()='IP']" +listPage_objectSearch_ip_address_select_Search_posXpath = "//ul[@class='base-Popper-root MuiAutocomplete-listbox css-18r31z0']//li[1]" listPage_objectSearch_geo_select_IP_posXpath = "//li[@id='100-_FilteredSearch_ElRow_Geography_List_Home_App_anonymousComponent']" listPage_objectSearch_geo_select_GeoNameID_posXpath = "//li[@id='56-_FilteredSearch_ElRow_Geography_List_Home_App_anonymousComponent']" listPage_objectSearch_geo_select_CountryAbbreviation_posXpath = "//li[@id='156-_FilteredSearch_ElRow_Geography_List_Home_App_anonymousComponent']" @@ -677,11 +679,11 @@ ip_addressObjectPage_IP_learning_inputItem_posXpath = "//div[@class='ip-object-f ip_addressObjectPage_button_Save_Item_posXpath = '//i[@class="operate-icon iconfont icon-save"]' # 保存item按钮 ip_address_Geography_list_first_ele_posXpath = '//div[@role="group"][@aria-expanded="true"]/div[1]/div/label/span' # Geography所选列表下第一个元素 -ip_addressObjectPage_button_IP_learn_from_protocols_posXpath = "//div[@class='MuiSelect-root MuiSelect-variantOutlined MuiSelect-colorNeutral MuiSelect-sizeMd css-n6bil4']/button[@class='MuiSelect-button css-1qmzz5g']" # Learn From Protocols选择框 +ip_addressObjectPage_button_IP_learn_from_protocols_posXpath = "//div[@class='ip-object-from_protocol']//button[@title='Open']" # Learn From Protocols选择框 ip_addressObjectPage_button_IP_learn_from_protocols_up_posXpath = "//div[@class='MuiSelect-root Mui-expanded MuiSelect-variantOutlined MuiSelect-colorNeutral MuiSelect-sizeMd css-n6bil4']" # Learn From Protocols_up选择框 -ip_addressObjectPage_button_IP_learn_from_protocols_Select_HTTP_posXpath = "//ul[@class='base-Popper-root MuiSelect-listbox Mui-expanded css-icfck1']/li[text()='HTTP']" # Learn From Protocols选择HTTP -ip_addressObjectPage_button_IP_learn_from_protocols_Select_SSL_posXpath = "//ul[@class='base-Popper-root MuiSelect-listbox Mui-expanded css-icfck1']/li[text()='SSL']" # Learn From Protocols选择SSL -ip_addressObjectPage_button_IP_learn_from_protocols_Select_DNS_posXpath ="//ul[@class='base-Popper-root MuiSelect-listbox Mui-expanded css-icfck1']/li[text()='DNS']" +ip_addressObjectPage_button_IP_learn_from_protocols_Select_HTTP_posXpath = "//ul[@class='base-Popper-root MuiAutocomplete-listbox css-19hxmvv']/li[text()='HTTP']" # Learn From Protocols选择HTTP +ip_addressObjectPage_button_IP_learn_from_protocols_Select_SSL_posXpath = "//ul[@class='base-Popper-root MuiAutocomplete-listbox css-19hxmvv']/li[text()='SSL']" # Learn From Protocols选择SSL +ip_addressObjectPage_button_IP_learn_from_protocols_Select_DNS_posXpath ="//ul[@class='base-Popper-root MuiAutocomplete-listbox css-19hxmvv']/li[text()='DNS']" ip_addressObjectPage_button_Input_Aging_Times_posXpath = "//div[@class='ip-object-aging_time']/div/input" # Aging Times输入框 ip_addressObjectPage_button_Input_Vote_Clients_Number_posXpath = "//div[@class='ip-object-vote_client_num']/div/input" # Vote Clients Number输入框 ip_addressObjectPage_button_Input_Learned_IP_Limits_posXpath = "//div[@class='ip-object-goal_upper_limit']/div/input" # Learned IP Limits 输入框 diff --git a/testdata/ui_file/objects/import_file/accounts_single_item导入文件.txt b/testdata/ui_file/objects/import_file/accounts_single_item导入文件.txt index c05df07c..5107096b 100644 --- a/testdata/ui_file/objects/import_file/accounts_single_item导入文件.txt +++ b/testdata/ui_file/objects/import_file/accounts_single_item导入文件.txt @@ -1 +1 @@ -*askdja
\ No newline at end of file +^askdja
\ No newline at end of file |
