summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cases/object/test_accounts.py232
-rw-r--r--cases/object/test_intervals.py149
-rw-r--r--cases/object/test_tunnels.py72
-rw-r--r--common/ui_common/objects/accounts.py346
-rw-r--r--common/ui_common/objects/intervals.py6
-rw-r--r--common/ui_common/objects/objects_public_operations.py77
-rw-r--r--common/ui_common/objects/tunnels.py215
-rw-r--r--page_element/admin_area_element_position.py10
-rw-r--r--page_element/ln_objects_element_position.py19
-rw-r--r--page_element/objects_element_position.py24
-rw-r--r--page_element/policies_element_position.py8
-rw-r--r--testdata/ui_data/objects_data/Accounts/base_accounts.json92
-rw-r--r--testdata/ui_data/objects_data/tunnels.json2
13 files changed, 696 insertions, 556 deletions
diff --git a/cases/object/test_accounts.py b/cases/object/test_accounts.py
index 6a87d5a0..83946a05 100644
--- a/cases/object/test_accounts.py
+++ b/cases/object/test_accounts.py
@@ -99,22 +99,22 @@ class TestAccounts:
acc.delete(data)
#未修改
- @pytest.mark.parametrize("data", [
- {
- "ids": "test_reference_by_object",
- "Model": "create",
- "Type": 0,
- "Search type": "Name",
- "Name": "",
- "Items": [
- "[random]->"
- ],
- "Description": ""
- },
- ])
- def test_reference_by_object(self, demo_fixture, data):
- acc = Accounts(demo_fixture)
- acc._reference_by_object(data)
+ # @pytest.mark.parametrize("data", [
+ # {
+ # "ids": "test_reference_by_object",
+ # "Model": "create",
+ # "Type": 0,
+ # "Search type": "Name",
+ # "Name": "",
+ # "Items": [
+ # "[random]->"
+ # ],
+ # "Description": ""
+ # },
+ # ])
+ # def test_reference_by_object(self, demo_fixture, data):
+ # acc = Accounts(demo_fixture)
+ # acc._reference_by_object(data)
def test_operate_columns(self, demo_fixture):
acc = Accounts(demo_fixture)
acc._operate_columns()
@@ -137,9 +137,86 @@ class TestAccounts:
# ])
# def test_export_objects_and_verify(self, demo_fixture,data):
# acc = Accounts(demo_fixture)
- # acc._export_objects_and_verify(data)
+ acc._export_objects_and_verify(data)
# # driver.quit()
+ @pytest.mark.parametrize("data",
+ [
+ {
+ "ids": "创建accObject并查看验证Total |T017",
+ "Model": "create",
+ "Type": 0,
+ "Name": "",
+ "Search type": "",
+ "Items": [
+ "*example->",
+ "[random]->",
+ "$acbsuduh->"
+ ],
+ "Description": "",
+ "Subordinate Objects": [
+ ],
+ "SubType": "multi_export",
+ "multi_type": "all",
+ },
+ {
+ "ids": "创建accObject并查看验证Total |T017",
+ "Model": "create",
+ "Type": 0,
+ "Name": "",
+ "Search type": "",
+ "Items": [
+ "*example->",
+ "[random]->",
+ "$acbsuduh->"
+ ],
+ "Description": "",
+ "Subordinate Objects": [
+ ],
+ "SubType": "multi_export",
+ "multi_type": "part",
+ },
+ {
+ "ids": "创建accObject并查看验证Total |T017",
+ "Model": "create",
+ "Type": 0,
+ "Name": "",
+ "Search type": "",
+ "Items": [
+ "*example->",
+ "[random]->",
+ "$acbsuduh->"
+ ],
+ "Description": "",
+ "Subordinate Objects": [
+ ],
+ "SubType": "multi_export",
+ "multi_type": " ",
+ },
+ {
+ "ids": "创建interval_Group--test_View_statistics_case",
+ "Model": "create",
+ "Type": 1,
+ "Search type": "Name",
+ "Name": "",
+ "Items": [
+ ],
+ "Description": "",
+ "Subordinate Objects": {
+ "subName": "",
+ "subItems": [
+ "^shdjilluhiasdh->"
+ ],
+ "subDescription": ""
+ },
+ "SubType": "multi_export",
+ "multi_type": " ",
+ },
+ ])
+ def test_export_multi_condition_test(self, demo_fixture, data):
+ acc = Accounts(demo_fixture)
+ acc.export_multi_condition_test(data)
+
@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):
@@ -155,23 +232,23 @@ class TestAccounts:
acc._add_to_watchList()
#未修改
- @pytest.mark.parametrize("data", [
- {
- "ids": "创建urlObject并查看验证审计日志-T016/创建并修改urlObject查看验证审计日志-T041/23.09版本新功能:右侧页面增加Audit Logs功能-T073",
- "Model": "create",
- "Type": 0,
- "Name": "",
- "Search type": "",
- "Items": [
- "[random]->*asruhau"
- ],
- "Description": "",
- }
- ])
- def test_verify_audit_logs(self, demo_fixture, data):
- acc = Accounts(demo_fixture)
- acc._goto_accountsPage()
- acc._verify_audit_logs(data)
+ # @pytest.mark.parametrize("data", [
+ # {
+ # "ids": "创建urlObject并查看验证审计日志-T016/创建并修改urlObject查看验证审计日志-T041/23.09版本新功能:右侧页面增加Audit Logs功能-T073",
+ # "Model": "create",
+ # "Type": 0,
+ # "Name": "",
+ # "Search type": "",
+ # "Items": [
+ # "[random]->*asruhau"
+ # ],
+ # "Description": "",
+ # }
+ # ])
+ # def test_verify_audit_logs(self, demo_fixture, data):
+ # acc = Accounts(demo_fixture)
+ # acc._goto_accountsPage()
+ # acc._verify_audit_logs(data)
@pytest.mark.parametrize("data",
[
@@ -415,22 +492,6 @@ class TestAccounts:
"abcd&efgh->"
],
"Description": ""
- }, {
- "ids": "创建Account Group_View_statistics_case",
- "Model": "create",
- "Type": 1,
- "Search type": "Name",
- "Name": "test_ui-account group 4 statistics",
- "Items": [
- ],
- "Description": "",
- "Subordinate Objects": {
- "subName": "",
- "subItems": [
- "iiiii$->"
- ],
- "subDescription": ""
- }
},
])
def test_view_statistics_case(self, demo_fixture, data):
@@ -483,40 +544,40 @@ class TestAccounts:
acc = Accounts(demo_fixture)
acc._onlyViewPermission()
- @pytest.mark.parametrize("data", [
- {
- "ids": "创建Account,并于列表页筛选Item",
- "Model": "create",
- "Type": 0,
- "Search type": "Name",
- "Name": "",
- "Items": [
- "[random]->",
- "askjdjkj$"
- ],
- "Description": ""
- },
- {
- "ids": "创建Account Group,并于列表页筛选Item",
- "Model": "create",
- "Type": 1,
- "Search type": "Name",
- "Name": "",
- "Items": [
- ],
- "Description": "",
- "Subordinate Objects": {
- "subName": "",
- "subItems": [
- "[random]->"
- ],
- "subDescription": ""
- }
- }
- ])
- def test_list_page_item_search(self, demo_fixture, data):
- acc = Accounts(demo_fixture)
- acc._list_page_item_search(data)
+ # @pytest.mark.parametrize("data", [
+ # {
+ # "ids": "创建Account,并于列表页筛选Item",
+ # "Model": "create",
+ # "Type": 0,
+ # "Search type": "Name",
+ # "Name": "",
+ # "Items": [
+ # "[random]->",
+ # "askjdjkj$"
+ # ],
+ # "Description": ""
+ # },
+ # {
+ # "ids": "创建Account Group,并于列表页筛选Item",
+ # "Model": "create",
+ # "Type": 1,
+ # "Search type": "Name",
+ # "Name": "",
+ # "Items": [
+ # ],
+ # "Description": "",
+ # "Subordinate Objects": {
+ # "subName": "",
+ # "subItems": [
+ # "[random]->"
+ # ],
+ # "subDescription": ""
+ # }
+ # }
+ # ])
+ # def test_list_page_item_search(self, demo_fixture, data):
+ # acc = Accounts(demo_fixture)
+ # acc._list_page_item_search(data)
@pytest.mark.parametrize("data", [
{
@@ -549,7 +610,6 @@ class TestAccounts:
"Search type": "Name",
"Name": "",
"Items": [
- "[random]->",
"^skjdjkj$"
],
"Description": ""
@@ -584,7 +644,7 @@ class TestAccounts:
"Model": "create",
"Type": 0,
"Name": "",
- "Search type": "Name&Description&Details",
+ "Search type": "Name&Description",
"Items": [
"[random]->"
],
diff --git a/cases/object/test_intervals.py b/cases/object/test_intervals.py
index 8a2aac51..d8a109e6 100644
--- a/cases/object/test_intervals.py
+++ b/cases/object/test_intervals.py
@@ -200,48 +200,48 @@ class TestIntervals:
@pytest.mark.parametrize("data",
[
- # {
- # "ids": "创建accObject并查看验证Total |T017",
- # "Model": "create",
- # "Type": 0,
- # "Name": "",
- # "Search type": "",
- # "Items": [
- # "[4,54]->",
- # ],
- # "Description": "",
- # "Subordinate Objects": [],
- # "SubType": "cancel_export",
- # "multi_type": " ",
- # },
- # {
- # "ids": "创建accObject并查看验证Total |T017",
- # "Model": "create",
- # "Type": 0,
- # "Name": "",
- # "Search type": "",
- # "Items": [
- # "[4,54]->",
- # ],
- # "Description": "",
- # "Subordinate Objects": [],
- # "SubType": "multi_export",
- # "multi_type": "all",
- # },
- # {
- # "ids": "创建accObject并查看验证Total |T017",
- # "Model": "create",
- # "Type": 0,
- # "Name": "",
- # "Search type": "",
- # "Items": [
- # "[4,54]->",
- # ],
- # "Description": "",
- # "Subordinate Objects": [],
- # "SubType": "multi_export",
- # "multi_type": "part",
- # },
+ {
+ "ids": "创建accObject并查看验证Total |T017",
+ "Model": "create",
+ "Type": 0,
+ "Name": "",
+ "Search type": "",
+ "Items": [
+ "[4,54]->",
+ ],
+ "Description": "",
+ "Subordinate Objects": [],
+ "SubType": "cancel_export",
+ "multi_type": " ",
+ },
+ {
+ "ids": "创建accObject并查看验证Total |T017",
+ "Model": "create",
+ "Type": 0,
+ "Name": "",
+ "Search type": "",
+ "Items": [
+ "[4,54]->",
+ ],
+ "Description": "",
+ "Subordinate Objects": [],
+ "SubType": "multi_export",
+ "multi_type": "all",
+ },
+ {
+ "ids": "创建accObject并查看验证Total |T017",
+ "Model": "create",
+ "Type": 0,
+ "Name": "",
+ "Search type": "",
+ "Items": [
+ "[4,54]->",
+ ],
+ "Description": "",
+ "Subordinate Objects": [],
+ "SubType": "multi_export",
+ "multi_type": "part",
+ },
{
"ids": "创建interval_Group--test_View_statistics_case",
"Model": "create",
@@ -354,48 +354,29 @@ class TestIntervals:
# inter = Intervals(demo_fixture)
# inter._clear_counter(data)
- # @pytest.mark.parametrize("data", [
- # {
- # "ids": "创建interval_Objec--test_View_statistics_case",
- # "Model": "create",
- # "Type": 0,
- # "Search type": "",
- # "Name": "",
- # "Object Statistics": "Elaborate",
- # "Items": [
- # "[1,1]->",
- # "[11,21]->",
- # "[random]->"
- # ],
- # "Description": "",
- # "Subordinate Objects": {
- # "subName": "",
- # "subItems": [
- # ],
- # "subDescription": ""
- # }
- # },
- # {
- # "ids": "创建interval_Group--test_View_statistics_case",
- # "Model": "create",
- # "Type": 1,
- # "Search type": "Name",
- # "Name": "test-account group",
- # "Items": [
- # ],
- # "Description": "",
- # "Subordinate Objects": {
- # "subName": "",
- # "subItems": [
- # "[1,999]->"
- # ],
- # "subDescription": ""
- # }
- # },
- # ])
- # def test_view_statistics_case(self, demo_fixture, data):
- # inter = Intervals(demo_fixture)
- # inter._view_statistics_case(data)
+ @pytest.mark.parametrize("data", [
+ {
+ "ids": "创建interval_Objec--test_View_statistics_case",
+ "Model": "create",
+ "Type": 0,
+ "Search type": "",
+ "Name": "",
+ "Object Statistics": "Elaborate",
+ "Items": [
+ "[1,1]->",
+ ],
+ "Description": "",
+ "Subordinate Objects": {
+ "subName": "",
+ "subItems": [
+ ],
+ "subDescription": ""
+ }
+ },
+ ])
+ def test_view_statistics_case(self, demo_fixture, data):
+ inter = Intervals(demo_fixture)
+ inter._view_statistics_case(data)
@pytest.mark.parametrize("data", [
{
diff --git a/cases/object/test_tunnels.py b/cases/object/test_tunnels.py
index d29676c0..99dd1360 100644
--- a/cases/object/test_tunnels.py
+++ b/cases/object/test_tunnels.py
@@ -12,25 +12,6 @@ data = ReadData()
class TestTunnels:
- # 24.1.3pass
- # 测试点:未选中数据时,点击导出按钮可以导出所有数据
- # 改变export定位,24.1.22 pass
- # @pytest.mark.parametrize(
- # "data",
- # [
- # {
- # "ids": "Tunnel无法导出,注释",
- # "CreatType": "Tunnel",
- # "SubType": "ID",
- # "Search_type": "Name"
- # }
- # ]
- # )
- # def test_tunnels_verify_checkbox(self, data):
- # driver = download_files()
- # tunnels = Tunnels(driver)
- # tunnels._verify_not_checkbox_export(data)
- # driver.quit()
# 测试点:增删改查、选择颜色、新建修改后数据是否相同、name最大长度
# 24.1.3 pass
@@ -73,19 +54,19 @@ class TestTunnels:
# 24.1.22pass
# 测试点:Audit Logs审计日志(创建)
# Todo 增删
- @pytest.mark.parametrize(
- "data",
- [
- {
- "ids": "Tunnel的Audit Logs:增加和编辑",
- "Search_type": "Name",
- "type": " "
- }
- ]
- )
- def test_tunnels_audit_case(self, demo_fixture, data):
- tunnels = Tunnels(demo_fixture)
- tunnels._verify_audit_logs(data)
+ # @pytest.mark.parametrize(
+ # "data",
+ # [
+ # {
+ # "ids": "Tunnel的Audit Logs:增加和编辑",
+ # "Search_type": "Name",
+ # "type": " "
+ # }
+ # ]
+ # )
+ # def test_tunnels_audit_case(self, demo_fixture, data):
+ # tunnels = Tunnels(demo_fixture)
+ # tunnels._verify_audit_logs(data)
# 24.1.3pass
# 测试点:删除引用数据
@@ -107,9 +88,9 @@ class TestTunnels:
tunnels = Tunnels(demo_fixture)
tunnels._delete_quoted_object(data)
- def test_list_check(self, demo_fixture):
- tunnels = Tunnels(demo_fixture)
- tunnels._list_check()
+ # def test_list_check(self, demo_fixture):
+ # tunnels = Tunnels(demo_fixture)
+ # tunnels._list_check()
@pytest.mark.parametrize(
"data",
@@ -144,32 +125,25 @@ class TestTunnels:
@pytest.mark.parametrize(
"data",
[
- # Tunnel中新建ip和ip group,之后删除
- {
- "ids": "Tunnel中Name模糊查询",
- "Search_type": "fuzzy->Name",
- "type": "All",
- "isDeleteGroup": "True"
- },
{
"ids": "Tunnel中组合查询",
- "Search_type": "ID&Name&IP",
+ "Search_type": "UUID",
"type": "All",
"isDeleteGroup": "True"
},
{
"ids": "Tunnel中根据IP查询",
- "Search_type": "IP",
+ "Search_type": "Name",
"type": "IP",
"isDeleteGroup": "True"
-
},
{
- "ids": "Tunnel中全局查询",
+ "ids": "Tunnel中根据IP查询",
"Search_type": "IP",
- "type": "All",
+ "type": "IP",
"isDeleteGroup": "True"
- }
+ },
+
]
)
def test_tunnel_query_case(self, demo_fixture, data):
@@ -253,8 +227,6 @@ class TestTunnels:
"ids": "modify tunnel时修改tunnel,删除endpoint b",
"Search_type": "Name",
"type": "IP",
- "isDeleteGroup": "True"
-
}
]
)
diff --git a/common/ui_common/objects/accounts.py b/common/ui_common/objects/accounts.py
index fd09d4f2..17942673 100644
--- a/common/ui_common/objects/accounts.py
+++ b/common/ui_common/objects/accounts.py
@@ -1,5 +1,6 @@
# -*- coding: UTF-8 -*-
import configparser
+import re
import time
import pytest
@@ -76,6 +77,7 @@ class Accounts:
self.driver.find_element(By.XPATH, mainPage_firstLevelMenu_Objects_posXpath).click()
self.driver.implicitly_wait(2)
self.driver.find_element(By.XPATH, mainPage_secondLevelMenu_Account_posXpath).click()
+ time.sleep(3)
@screenshot_on_failure
def _just_goto_accountsPage(self):
@@ -101,6 +103,7 @@ class Accounts:
is_first_exist = self.driver.element_isExist(By.XPATH, list_first_row_first_column_posXpath)
assert is_first_exist or total_value == 0, "校验失败!!列表页为空!!"
self.my_count += 1
+ time.sleep(3)
@screenshot_on_failure
def _create(self, data):
@@ -343,7 +346,7 @@ class Accounts:
if data_acc == "[random]":
data_acc = self.random_account
self._items_acc_add(data_acc)
- self._items_acc_search(search_pos="single", search_value=data_acc)
+ # self._items_acc_search(search_pos="single", search_value=data_acc)
elif data_acc[-16:] == "[ImportFromFile]": # abc.txt[ImportFromFile]->表示文件导入方式添加Item
data_file_name = data_acc[:-16]
self._items_acc_add_from_file(data_file_name)
@@ -354,7 +357,7 @@ class Accounts:
item_datas = f.readlines() # 读取文件所有行内容
item_data = item_datas[random.randint(1, len(item_datas)) - 1].replace("\\n",
"").strip() # 任选一行的数据
- self._items_acc_search(search_pos="single", search_value=item_data)
+ # self._items_acc_search(search_pos="single", search_value=item_data)
elif "&" in data_values[i].split("->")[0].strip(): # 一条Item中加多个数据:
# print("#一条Item中加多个数据")
item_value_list = []
@@ -423,8 +426,9 @@ class Accounts:
data_acc = self.my_random.random_account()
self._operate_sub_items_modify(data, old_data, data_acc)
if search_sub_obj:
- self._items_acc_search(search_pos="sub",
- search_value=self._operate_sub_name(data, data_acc))
+ pass
+ # self._items_acc_search(search_pos="sub",
+ # search_value=self._operate_sub_name(data, data_acc))
else: # 新增数据 asdnkj->
if data_acc == "[random]": # random->表示新增对象value值为随机
data_acc = self.random_account
@@ -436,8 +440,9 @@ class Accounts:
else:
self._sub_objects_acc_add(data, data_acc)
if search_sub_obj:
- self._items_acc_search(search_pos="sub",
- search_value=self._operate_sub_name(data, data_acc))
+ pass
+ # self._items_acc_search(search_pos="sub",
+ # search_value=self._operate_sub_name(data, data_acc))
@screenshot_on_failure
def _items_acc_del(self, item_value):
@@ -544,7 +549,7 @@ class Accounts:
# # print("加载完毕")
# break
self.first_row_checkBox_element = self.driver.find_element(By.XPATH,listPage_select_first_object_posXpath).click() # 勾选第一行元素
- self.driver.find_element(By.XPATH, acc_listPage_editButton_posXpath).click() # 点击edit按钮
+ self.driver.find_element(By.XPATH, listpage_edit_button_posXpath).click() # 点击edit按钮
# return item_data
@screenshot_on_failure
@@ -609,9 +614,8 @@ class Accounts:
# self.driver.isElementExist('//div[@class="EditDraw"]//div[@class="el-loading-mask"]')
# if not self.driver.Exist:
# break
- self.driver.find_element(By.XPATH, '//div[@data-desc="exclude subObject"]/label').click()
# 判断 Exclude Objects 按钮是否处于开启状态
- if self.driver.element_isExist(By.XPATH, urlGroup_ObjectDetailPage_excludeObjectsSwitch_enableStatus_posXpath):
+ if self.driver.element_isExist(By.XPATH, accGroup_ObjectDetailPage_excludeObjectsSwitch_enableStatus_posXpath):
print("有数据新建")
# 点击Exclude Objects 下的"+"按钮
self.driver.find_element(By.XPATH,
@@ -643,10 +647,10 @@ class Accounts:
# 点击侧滑子Create Account页面中Items下的"+"按钮
self.driver.find_element(By.XPATH,
acc_ObjectGroupDetailPage_subObjects_subCreateAccountDrawer_itemsAddButton_posXpath).click()
+ for i in item_value:
# 于侧滑子Create Account页面中Items下的item value输入框键入 item_value
- self.driver.find_element(By.XPATH,
- acc_ObjectGroupDetailPage_subObjects_subCreateAccountDrawer_itemsValueInput_posXpath).send_keys(
- item_value)
+ self.driver.find_element(By.XPATH,
+ acc_ObjectGroupDetailPage_subObjects_subCreateAccountDrawer_itemsValueInput_posXpath).send_keys(i)
# 点击侧滑子Create Account页面中Items下的保存按钮
self.driver.find_element(By.XPATH,
acc_ObjectGroupDetailPage_subObjects_subCreateAccountDrawer_itemsValueSaveButton_posXpath).click()
@@ -663,7 +667,8 @@ class Accounts:
acc_item_input_xpath = "//input[@value='{}']".format(old_value)
self.driver.find_element(By.XPATH, acc_item_input_xpath).clear()
# 清空后键入新数据
- self.driver.find_element(By.XPATH, acc_item_input_xpath).send_keys(new_value)
+ for i in new_value:
+ self.driver.find_element(By.XPATH, acc_item_input_xpath).send_keys(i)
# 保存
acc_item_save_btn_xpath = acc_ObjectDetailPage_itemSaveButton_poXpath
self.driver.find_element(By.XPATH, acc_item_save_btn_xpath).click()
@@ -675,8 +680,8 @@ class Accounts:
self.driver.find_element(By.XPATH,
acc_ObjectGroupDetailPage_subObjects_subCreateAccountDrawer_okButton_posXpath).click()
# 点击确认弹窗的YES
- self.driver.find_element(By.XPATH,
- acc_ObjectGroupDetailPage_subObjects_subCreateAccountDrawer_okButton_yes_posXpath).click()
+ # self.driver.find_element(By.XPATH,
+ # acc_ObjectGroupDetailPage_subObjects_subCreateAccountDrawer_okButton_yes_posXpath).click()
def _operate_exclude_items_modify(self, data, old_value, new_value):
self._exclude_items_acc_modify(data, old_value, new_value)
@@ -692,23 +697,23 @@ class Accounts:
my_sub_item_name = self._operate_sub_name(data, old_value)
time.sleep(0.5)
# 点击要修改数据的编辑按钮操作
- sub_acc_object_edit_btn_xpath = "(//*[normalize-space(text())='{}']/ancestor::li[contains(@class,'item margindouble')]//i[contains(@class,'icon-Edit')])[1]".format(
+ sub_acc_object_edit_btn_xpath = "(//*[normalize-space(text())='{}']/ancestor::li[contains(@class,'list-none truncate relative')]//i[contains(@class,'icon-Edit')])[1]".format(
my_sub_item_name)
print("my_sub_item_name:{}".format(my_sub_item_name))
self.driver.find_element(By.XPATH, sub_acc_object_edit_btn_xpath).click()
print("clicked sub_acc_object_edit_btn")
# 进入Edit Interval侧滑页面
# 点击要修改数据的编辑按钮操作
- sub_acc_item_edit_btn_xpath = "(//*[normalize-space(text())='{}']/ancestor::*[@class='view-row']//i[contains(@class, 'iconfont icon-Edit')])[1]".format(
- old_value)
+ sub_acc_item_edit_btn_xpath = '//div[@class="items"]//i[@class="iconfont icon-Edit"]'
print("old_value:{}".format(old_value))
self.driver.implicitly_wait(6)
self.driver.find_element(By.XPATH, sub_acc_item_edit_btn_xpath).click()
# 清空要编辑修改数据的输入框内容
- sub_acc_item_input_xpath = '//div[@exprlistdata="{}"]//input'.format(old_value)
+ sub_acc_item_input_xpath = '//input[@class="MuiInput-input css-1u0jcuo"]'
self.driver.find_element(By.XPATH, sub_acc_item_input_xpath).clear()
# 清空后键入新数据
- self.driver.find_element(By.XPATH, sub_acc_item_input_xpath).send_keys(new_value)
+ for i in new_value:
+ self.driver.find_element(By.XPATH, sub_acc_item_input_xpath).send_keys(i)
# 保存
sub_acc_item_save_btn_xpath = acc_ObjectGroupDetailPage_subObjects_subCreateAccountDrawer_itemsValueSaveButton_posXpath
self.driver.find_element(By.XPATH, sub_acc_item_save_btn_xpath).click()
@@ -718,7 +723,7 @@ class Accounts:
my_exclude_item_name = self._operate_exclude_name(data, old_value)
time.sleep(0.5)
# 点击要修改数据的编辑按钮操作
- exclude_acc_object_edit_btn_xpath = "(//div[@data-desc='exclude subObject']//*[normalize-space(text())='{}']/ancestor::li[contains(@class,'item margindouble')]//i[contains(@class,'icon-Edit')])[1]".format(
+ exclude_acc_object_edit_btn_xpath = "(//*[normalize-space(text())='{}']/ancestor::li[contains(@class,'list-none truncate relative')]//i[contains(@class,'icon-Edit')])[1]".format(
my_exclude_item_name)
# print("my_sub_item_name:{}".format(my_exclude_item_name))
self.driver.find_element(By.XPATH, exclude_acc_object_edit_btn_xpath).click()
@@ -731,10 +736,11 @@ class Accounts:
self.driver.implicitly_wait(6)
self.driver.find_element(By.XPATH, exclude_acc_item_edit_btn_xpath).click()
# 清空要编辑修改数据的输入框内容
- exclude_acc_item_input_xpath = '//div[@exprlistdata="{}"]//input'.format(old_value)
+ exclude_acc_item_input_xpath = '//input[@class="MuiInput-input css-1u0jcuo"]'
self.driver.find_element(By.XPATH, exclude_acc_item_input_xpath).clear()
# 清空后键入新数据
- self.driver.find_element(By.XPATH, exclude_acc_item_input_xpath).send_keys(new_value)
+ for i in new_value:
+ self.driver.find_element(By.XPATH, exclude_acc_item_input_xpath).send_keys(i)
# 保存
exclude_acc_item_save_btn_xpath = acc_ObjectGroupDetailPage_subObjects_subCreateAccountDrawer_itemsValueSaveButton_posXpath
self.driver.find_element(By.XPATH, exclude_acc_item_save_btn_xpath).click()
@@ -880,6 +886,7 @@ class Accounts:
# 点击侧滑子Create Account页面中OK按钮
self.driver.find_element(By.XPATH,
acc_ObjectGroupDetailPage_subObjects_subCreateAccountDrawer_okButton_posXpath).click() # 点击“OK”按钮
+ self.driver.find_element(By.XPATH, '//i[@class="iconfont icon-Clear_aNormal close-icon"]').click()
# 点击侧滑子Create Account页面确认弹窗的“Yes”按钮
# subCreateAccountDrawer_okButton_yes = self.driver.find_element(By.XPATH,
# acc_ObjectGroupDetailPage_subObjects_subCreateAccountDrawer_okButton_yes_posXpath)
@@ -929,8 +936,9 @@ class Accounts:
data_acc = self.my_random.random_account()
self._operate_exclude_items_modify(data, old_data, data_acc)
if search_exclude_obj:
- self._items_acc_search(search_pos="exclude",
- search_value=self._operate_sub_name(data, data_acc))
+ pass
+ # self._items_acc_search(search_pos="exclude",
+ # search_value=self._operate_sub_name(data, data_acc))
else: # 新增数据 asdnkj->
if data_acc == "[random]": # random->表示新增对象value值为随机
# if data_values[i].split("->")[0].strip() == "[random]":
@@ -944,8 +952,9 @@ class Accounts:
else:
self._exclude_sub_objects_acc_add(data, data_acc)
if search_exclude_obj:
- self._items_acc_search(search_pos="exclude",
- search_value=self._operate_sub_name(data, data_acc))
+ pass
+ # self._items_acc_search(search_pos="exclude",
+ # search_value=self._operate_sub_name(data, data_acc))
@screenshot_on_failure
def _query(self, data, search_type="Name", search_value=None, **kwargs):
@@ -1076,6 +1085,7 @@ class Accounts:
self.objects_po.clear_name_by_id(acc_objects_search_input_posXpath)
if fuzzy_search: # 随机方式全局模糊搜索
acc_objects_search_input_elem.send_keys(search_value) # 键入搜索值
+ self.driver.find_element(By.XPATH, listpage_globalSearch_posXpath).click()
random_enter = random.randint(0, 1)
# random_enter = 1
if random_enter == 0: # 使用ENTER 确认搜索值
@@ -1084,14 +1094,14 @@ class Accounts:
acc_objects_search_input_elem.send_keys(Keys.ENTER) # 确认输入框内容
else: # 鼠标点击确认搜索值
print("随机全局模糊搜索-Mouse Click")
- self.driver.find_element(By.XPATH, acc_listPage_object_fuzzySearch_posXpath).click() # 点击搜索按钮
+ self.driver.find_element(By.XPATH, listpage_search_button_posXpath).click() # 点击搜索按钮
else: # 精确属性的搜索
acc_objects_search_input_elem.send_keys(search_value)
time.sleep(1)
if search_type == "Name" or search_type == "":
self.driver.find_element(By.XPATH, acc_listPage_object_searchName_posId).click()
- elif search_type == "ID":
- self.driver.find_element(By.XPATH, acc_listPage_object_searchId_posId).click()
+ elif search_type == "UUID":
+ self.driver.find_element(By.XPATH, listPage_objectSearch_select_UUID_posXpath).click()
elif search_type == "Details":
self.driver.find_element(By.XPATH, acc_listPage_object_searchDetails_posId).click()
elif search_type == "Description":
@@ -1137,8 +1147,8 @@ class Accounts:
else:
# 勾选第一行元素
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按钮
+ listPage_select_first_object_posXpath).click()
+ self.driver.find_element(By.XPATH, listpage_edit_button_posXpath).click() # 点击edit按钮
# 解析修改数据
self._operate_page(data, operation_type="edit", no_modify=False)
# 进入Object详情页
@@ -1177,6 +1187,7 @@ class Accounts:
acc_listPage_object_urls_delete_noButton_posXpath)
# 删除object group对象后,再删除子object对象
while del_count > 0:
+ self.go_to_page()
print("del 循环")
try:
if del_flag:
@@ -1294,13 +1305,14 @@ class Accounts:
self._create(data) # 新建
self._query(data) # 创建后查询
# 勾选被引用的对象
- first_quoted_object_elem_posXpath = "(//div[@data-field='reference_count']/button[number(text())=1]/../..//input[@class='MuiCheckbox-input css-1jj0cvj'])[1]" # 引用数大于0的第一个对象对应的勾选框元素Xpath
- first_quoted_object_elem = self.driver.find_element(By.XPATH,first_quoted_object_elem_posXpath) # 引用数大于0的第一个对象对应的勾选框元素
+ first_quoted_object_elem_posXpath = listpage_select_second_object_posXpath # 引用数大于0的第一个对象对应的勾选框元素Xpath
+ first_quoted_object_elem = self.driver.find_element(By.XPATH,
+ first_quoted_object_elem_posXpath) # 引用数大于0的第一个对象对应的勾选框元素
first_quoted_object_elem.click() # 点击勾选框
# 定位删除按钮元素,并判断是否可点击
- del_button_elem_clickable = self.objects_po.is_element_clickable(acc_listPage_deleteButton_posXpath, "XPATH")
+ del_button_elem_clickable = self.objects_po.is_element_clickable(listpage_delete_button_posXpath, "XPATH")
print("当前元素是否可点击:{}".format(del_button_elem_clickable))
- assert del_button_elem_clickable == False, "校验失败!此时删除按钮可点击!"
+ assert del_button_elem_clickable == False, "校验删除按钮不可点击"
@screenshot_on_failure
def _reference_count(self):
@@ -1462,6 +1474,76 @@ class Accounts:
self.objects_po.Column_ele_ex(Column_text=self.objects_po.Column_text)
assert self.objects_po.result
+ def export_multi_condition_test(self,data):
+ self.create(data) # 新建,新建后就是查询到该条数据的状态
+ if data["SubType"] == "cancel_export":
+ #1、单个Object导出取消选中目标数据
+ self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click()
+ self.pop_cancel_export_num()
+ self.create(data)
+ # 2、多个Object导出取消选中目标数据(2个)
+ self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click()
+ self.driver.find_element(By.XPATH, listpage_select_second_object_posXpath).click()
+ self.pop_cancel_export_num()
+ self._del(data)
+ elif data["SubType"] == "multi_export":
+ if data["multi_type"] == "all":#4、多选导出所有数据,校验行数
+ self.create(data)
+ self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click()
+ self.driver.find_element(By.XPATH, listpage_select_second_object_posXpath).click()
+ self._export_objects1()
+ assert self.export_number == 2,"断言多选全部导出是否符合预期"
+ self._del(data)
+ elif data["multi_type"] == "part":#3、多选导出第一个数据
+ self.create(data)
+ self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click()
+ self.driver.find_element(By.XPATH, listpage_select_second_object_posXpath).click()
+ self.pop_export_part()
+ assert self.export_number == 1,"断言单选导出数据是否符合预期"
+ time.sleep(2)
+ self.driver.refresh()
+ self._del(data)
+ else: #多选数据中有group时无法导出
+ self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click()
+ self.driver.find_element(By.XPATH, listpage_select_second_object_posXpath).click()
+ #self.driver.find_element(By.XPATH,listPage_object_apns_exportButton_posXpath).click()
+ status = self.driver.isElementExist(Element='//span[@class="action-export inline-flex mr-[8px] "]//button[contains(@class, "disabled")]')
+ assert status == True
+ # export_tip = self.driver.find_element(By.XPATH,'//div[@class="el-message el-message--error"]/p').text
+ # assert export_tip.strip() == "Object group is not exportable"
+ self._del(data)
+
+
+ def pop_export_part(self):
+ self.driver.find_element(By.XPATH, listpage_export_button_posXpath).click()
+ self.driver.find_element(By.XPATH, '//div[@role="dialog"]//div[@data-rowindex="0"]//input').click() # 选择第一个
+ self.export_total_str = self.driver.find_element(By.XPATH,'//div[@class="text-center color-[--color-text] mt-[12px] MuiBox-root css-0"]').text # 定位到导出个数的按钮
+ self.export_total = re.search(r'\d+', self.export_total_str) # 正则表达式返回匹配的数字对象
+ if self.export_total:
+ self.export_number = int(self.export_total.group()) # group()方法返回正则表达式匹配的字符串
+ print(self.export_number)
+
+ def pop_cancel_export_num(self):
+ self.driver.find_element(By.XPATH, listpage_export_button_posXpath).click()
+ self.driver.isElementExist(Element=port_listPage_object_exportPopYes_posXpath)
+ assert self.driver.Exist, "断言导出按钮是否置灰不展示"
+ self.driver.find_element(By.XPATH, listpage_export_no_button_posXpath).click()
+ self.driver.refresh()
+
+ def _export_objects1(self):
+ self.driver.find_element(By.XPATH, listpage_export_button_posXpath).click()
+ time.sleep(3)
+ self.export_total_str = self.driver.find_element(By.XPATH,'//div[@class="text-center color-[--color-text] mt-[12px] MuiBox-root css-0"]').text
+ self.driver.find_element(By.XPATH, listPage_object_urls_exportPopYes_posXpath).click()
+ print(11111)
+ self.export_total =re.search(r'\d+',self.export_total_str) #正则表达式返回匹配的数字对象
+ print(self.export_total_str)
+ print(2222)
+ print(self.export_total)
+ if self.export_total:
+ self.export_number = int(self.export_total.group())#group()方法返回正则表达式匹配的字符串
+ print(self.export_number)
+
@screenshot_on_failure
def _export_objects_and_verify(self, data):
self._create(data) # 新建
@@ -1493,7 +1575,7 @@ class Accounts:
:return:
"""
self.driver.implicitly_wait(5)
- self.driver.find_element(By.XPATH, acc_listPage_first_row_checkBox_posXpath).click()
+ self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click()
self.driver.find_element(By.XPATH,
acc_listPage_object_exportButton_posXpath).click()
self.driver.find_element(By.XPATH, acc_listPage_object_exportPopYes_posXpath).click()
@@ -1528,8 +1610,8 @@ class Accounts:
self._create(data) # 新建
self._query(data, need_verify_details=0) # 创建后查询
# 选中并进入编辑页面
- 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按钮
+ self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click() # 勾选第一行元素
+ self.driver.find_element(By.XPATH, listpage_edit_button_posXpath).click() # 点击edit按钮
# 点击Audit Logs
self.driver.find_element(By.XPATH, acc_ObjectDetailPage_auditLogs_posXpath).click()
self.driver.find_element(By.XPATH,
@@ -1550,8 +1632,8 @@ class Accounts:
# 修改
self._query(data, need_verify_details=0) # 查询
- 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按钮
+ self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click() # 勾选第一行元素
+ self.driver.find_element(By.XPATH, listpage_edit_button_posXpath).click() # 点击edit按钮
# 解析修改数据
self._operate_page(data, operation_type="edit")
# 点击ok
@@ -1561,8 +1643,8 @@ class Accounts:
# self.driver.find_element(By.XPATH, acc_ObjectDetailPage_okButton_yes_posXpath).click() # 点击确认弹窗的“Yes”按钮
# print("保存")
# 重新进入对象详情页查看audit logs
- 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按钮
+ self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click() # 勾选第一行元素
+ self.driver.find_element(By.XPATH, listpage_edit_button_posXpath).click() # 点击edit按钮
self.driver.find_element(By.XPATH, acc_ObjectDetailPage_auditLogs_posXpath).click() # 点击Audit Logs
self.driver.find_element(By.XPATH,
acc_ObjectDetailPage_auditLogsDrawer_firstRowLog_checkBox_posXpath).click() # 勾选第一行log CheckBox
@@ -1594,14 +1676,14 @@ class Accounts:
try:
self._query(data, need_verify_details=0) # 创建后查询
# 选中并进入编辑页面
- 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按钮
+ self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click() # 勾选第一行元素
+ self.driver.find_element(By.XPATH, listpage_edit_button_posXpath).click() # 点击edit按钮
# 校验Audit Logs
self.objects_po.audit_log_check("Account Object", "Create")
# 修改
self._query(data, need_verify_details=0) # 查询
- 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按钮
+ self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click() # 勾选第一行元素
+ self.driver.find_element(By.XPATH, listpage_edit_button_posXpath).click() # 点击edit按钮
# 解析修改数据
self._operate_page(data, operation_type="edit")
# 点击ok
@@ -1609,8 +1691,8 @@ class Accounts:
# self.driver.find_element(By.XPATH, acc_ObjectDetailPage_okButton_yes_posXpath).click() # 点击确认弹窗的“Yes”按钮
# print("保存")
# 重新进入对象详情页查看audit logs
- 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按钮
+ self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click() # 勾选第一行元素
+ self.driver.find_element(By.XPATH, listpage_edit_button_posXpath).click() # 点击edit按钮
# 校验Audit Logs
self.objects_po.audit_log_check("Account Object", "Edit")
except Exception as e:
@@ -1623,8 +1705,8 @@ class Accounts:
def _verify_items_total(self, data):
self._create(data) # 新建
self._query(data) # 创建后查询
- 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按钮
+ self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click() # 勾选第一行元素
+ self.driver.find_element(By.XPATH, listpage_edit_button_posXpath).click() # 点击edit按钮
# 进入编辑页面
items_total = self.driver.find_element(By.XPATH, acc_ObjectDetailPage_itemsTotal_posXpath).text # Total 值
@@ -2036,13 +2118,13 @@ 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.driver.find_element(By.XPATH, acc_listPage_editButton_posXpath).click() # 点击edit按钮
+ self.first_row_checkBox_element = self.driver.find_element(By.XPATH,listPage_select_first_object_posXpath).click() # 勾选第一行元素
+ self.driver.find_element(By.XPATH, listpage_edit_button_posXpath).click() # 点击edit按钮
item_data = data["Items"][0]
if item_data == "[random]":
item_data = self.random_account
- acc_item_edit_btn_xpath = "(//*[normalize-space(text())='{acc}']/ancestor::*[@class='view-row']//i[contains(@class, 'iconfont icon-Edit')])[1]".format(acc=item_data)
+ acc_item_edit_btn_xpath = "(//*[normalize-space(text())='{acc}']/ancestor::*[@class='css-103las5']//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:
@@ -2188,7 +2270,7 @@ class Accounts:
try:
assert exclude_objects_switch_elem.get_attribute(
- "class") == "el-switch is-checked", "Exclude Objects Switch未被开启!!"
+ "class") == "MuiButtonBase-root MuiSwitch-switchBase MuiSwitch-colorPrimary Mui-checked PrivateSwitchBase-root MuiSwitch-switchBase MuiSwitch-colorPrimary Mui-checked Mui-checked css-y2jqxi", "Exclude Objects Switch未被开启!!"
print("Exclude Objects Switch成功开启")
self.driver.isElementExist(accGroup_ObjectDetailPage_excludeObjects_itemsArea_posXpath)
assert self.driver.Exist, "Exclude Objects未开启!!"
@@ -2200,7 +2282,7 @@ class Accounts:
exclude_objects_switch_elem.click() # 从开启到关闭
try:
assert exclude_objects_switch_elem.get_attribute(
- "class") == "el-switch", "Exclude Objects Switch未被关闭!!"
+ "class") == "MuiButtonBase-root MuiSwitch-switchBase MuiSwitch-colorPrimary PrivateSwitchBase-root MuiSwitch-switchBase MuiSwitch-colorPrimary css-y2jqxi", "Exclude Objects Switch未被关闭!!"
print("Exclude Objects Switch成功关闭")
self.driver.isElementExist(accGroup_ObjectDetailPage_excludeObjects_itemsArea_posXpath)
assert not self.driver.Exist, "Exclude Objects未关闭!!"
@@ -2217,10 +2299,10 @@ class Accounts:
###捕获error messages并校验
try:
# self.driver.find_element(By.XPATH,acc_ObjectDetailPage_mainOkButton_posXpath).click() # 再次点击OK
- error_message = self.driver.find_element(By.XPATH, '//*[@role="alert"]//p').text
+ error_message = self.driver.find_element(By.XPATH, '//div[@class="account-object-included_sub_object_uuids"]/div[2]').text
print(error_message)
# assert error_message == "Subordinate objects of an object cannot contain only excluded objects", "error_message 校验失败"
- assert error_message in "Subordinate objects of an object cannot be null", "error_message 校验失败"
+ assert error_message in "Subordinate Objects cannot be empty", "error_message 校验失败"
except Exception as e:
print(e)
raise
@@ -2257,13 +2339,14 @@ class Accounts:
try:
time.sleep(3)
self.driver.find_element(By.XPATH,acc_ObjectDetailPage_mainOkButton_posXpath).click() # 再次点击OK
- error_message = self.driver.find_element(By.XPATH, '//*[@role="alert"]//p').text
+ error_message = self.driver.find_element(By.XPATH, '//div[@class="account-object-included_sub_object_uuids"]/div[2]').text
print(error_message)
# assert error_message == "Subordinate objects of an object cannot contain only excluded objects", "error_message 校验失败"
- assert error_message in "Subordinate objects of an object cannot contain only excluded objects", "error_message 校验失败"
+ assert error_message in "Subordinate Objects cannot be empty", "error_message 校验失败"
except Exception as e:
print(e)
raise
+ self._del(data)
@screenshot_on_failure
def _choose_single_object_method(self):
@@ -2420,11 +2503,11 @@ class Accounts:
if detail_type == 0: # Object详情页
# 选中第一个Object并进入其详情页
self.driver.find_element(By.XPATH, acc_listPage_object_tableCheckbox_firstSingleObject_posXpath).click()
- self.driver.find_element(By.XPATH, acc_listPage_editButton_posXpath).click() # 点击edit按钮
+ self.driver.find_element(By.XPATH, listpage_edit_button_posXpath).click() # 点击edit按钮
elif detail_type == 1: # Object Group详情页
# 选中第一个Object Group并进入其详情页
self.driver.find_element(By.XPATH, acc_listPage_object_tableCheckbox_firstObjectGroup_posXpath).click()
- self.driver.find_element(By.XPATH, acc_listPage_editButton_posXpath).click() # 点击edit按钮
+ self.driver.find_element(By.XPATH, listpage_edit_button_posXpath).click() # 点击edit按钮
else: # etail_type=2--非本Vsys的Object详情页
# 判断当前页有无非本Vsys的对象
@@ -2483,7 +2566,7 @@ class Accounts:
# 选中第一个非本Vsys的Object Group或Object并进入其详情页
self.driver.find_element(By.XPATH,
acc_listPage_object_tableCheckbox_firstNotLocalVsys_objectOrGroup_posXpath).click()
- self.driver.find_element(By.XPATH, acc_listPage_editButton_posXpath).click() # 点击edit按钮
+ self.driver.find_element(By.XPATH, listpage_edit_button_posXpath).click() # 点击edit按钮
@screenshot_on_failure
def _pure_operate_checkbox(self, selected_object_type, selected_objects_number):
@@ -2790,7 +2873,7 @@ class Accounts:
self._just_goto_accountsPage()
self._create(data)
self._simple_query(data, data["Name"])
- self.objects_po.View_statistics(edit_element=acc_listPage_editButton_posXpath)
+ self.objects_po.View_statistics(edit_element=listpage_edit_button_posXpath)
except Exception as e:
raise e
finally:
@@ -2924,13 +3007,13 @@ class Accounts:
self._just_goto_accountsPage()
# 查询object
self.driver.find_element(By.XPATH,listpage_search_box_posXpath).send_keys(Sou_ID_list[0])
- self.driver.find_element(By.ID, acc_listPage_object_searchId_posId).click()
+ self.driver.find_element(By.ID, listPage_objectSearch_select_UUID_posXpath).click()
self.driver.find_element(By.XPATH,listpage_search_button_posXpath).click()
time.sleep(2)
# 修改数据
if data["Type"] == 0:
self.driver.find_element(By.XPATH, listPage_first_row_checkBox_posXpath).click() # 第一行数据前的复选框
- self.driver.find_element(By.XPATH, acc_listPage_editButton_posXpath).click() # edit按钮
+ self.driver.find_element(By.XPATH, listpage_edit_button_posXpath).click() # edit按钮
self.objects_po.clear_Name(path=ObjectDetailPage_input_Name_posXpath) # 清除name
self.driver.find_element(By.XPATH, ObjectDetailPage_input_Name_posXpath).send_keys(
data["modify_sou_name"]) # 重新输入name
@@ -2943,7 +3026,7 @@ class Accounts:
self.driver.find_element(By.XPATH, ObjectDetailPage_okButton_yes_posXpath).click()
else:
self.driver.find_element(By.XPATH, listPage_first_row_checkBox_posXpath).click() # 第一行数据前的复选框
- self.driver.find_element(By.XPATH, acc_listPage_editButton_posXpath).click() # edit按钮
+ self.driver.find_element(By.XPATH, listpage_edit_button_posXpath).click() # edit按钮
self.objects_po.clear_Name(path=ObjectDetailPage_input_Name_posXpath) # 清除name
self.driver.find_element(By.XPATH, ObjectDetailPage_input_Name_posXpath).send_keys(
data["modify_sou_name"]) # 重新输入name
@@ -2962,7 +3045,7 @@ class Accounts:
self._just_goto_accountsPage()
# 查询object
self.driver.find_element(By.XPATH,listpage_search_box_posXpath).send_keys(Sou_ID_list[0])
- self.driver.find_element(By.ID, acc_listPage_object_searchId_posId).click()
+ self.driver.find_element(By.ID, listPage_objectSearch_select_UUID_posXpath).click()
self.driver.find_element(By.XPATH,listpage_search_button_posXpath).click()
time.sleep(2)
# 获取修改后的数据
@@ -3021,7 +3104,7 @@ class Accounts:
self._just_goto_accountsPage()
# 搜索目的vsys数据
self.driver.find_element(By.XPATH,listpage_search_box_posXpath).send_keys(Des_ID_list[0])
- self.driver.find_element(By.ID, acc_listPage_object_searchId_posId).click()
+ self.driver.find_element(By.ID, listPage_objectSearch_select_UUID_posXpath).click()
self.driver.find_element(By.XPATH,listpage_search_button_posXpath).click()
time.sleep(2)
# 获取sync后的值
@@ -3034,7 +3117,7 @@ class Accounts:
# 在目的vsys中修改
if data["Type"] == 0:
self.driver.find_element(By.XPATH, listPage_first_row_checkBox_posXpath).click() # 第一行数据前的复选框
- self.driver.find_element(By.XPATH, acc_listPage_editButton_posXpath).click() # edit按钮
+ self.driver.find_element(By.XPATH, listpage_edit_button_posXpath).click() # edit按钮
self.objects_po.clear_Name(path=ObjectDetailPage_input_Name_posXpath) # 清除name
self.driver.find_element(By.XPATH, ObjectDetailPage_input_Name_posXpath).send_keys(
data["modify_des_name"]) # 重新输入name
@@ -3047,7 +3130,7 @@ class Accounts:
self.driver.find_element(By.XPATH, ObjectDetailPage_okButton_yes_posXpath).click()
else:
self.driver.find_element(By.XPATH, listPage_first_row_checkBox_posXpath).click() # 第一行数据前的复选框
- self.driver.find_element(By.XPATH, acc_listPage_editButton_posXpath).click() # edit按钮
+ self.driver.find_element(By.XPATH, listpage_edit_button_posXpath).click() # edit按钮
self.objects_po.clear_Name(path=ObjectDetailPage_input_Name_posXpath) # 清除name
self.driver.find_element(By.XPATH, ObjectDetailPage_input_Name_posXpath).send_keys(
data["modify_des_name"]) # 重新输入name
@@ -3077,7 +3160,7 @@ class Accounts:
self._just_goto_accountsPage()
# 搜索目的vsys数据
self.driver.find_element(By.XPATH,listpage_search_box_posXpath).send_keys(Des_ID_list[0])
- self.driver.find_element(By.ID, acc_listPage_object_searchId_posId).click()
+ self.driver.find_element(By.ID, listPage_objectSearch_select_UUID_posXpath).click()
self.driver.find_element(By.XPATH,listpage_search_button_posXpath).click()
time.sleep(2)
# 再次获取sync后的值
@@ -3093,7 +3176,7 @@ class Accounts:
def _delete_des(self, Des_ID_list, data):
if data["Type"] == 0:
self.driver.find_element(By.XPATH,listpage_search_box_posXpath).send_keys(Des_ID_list[0])
- self.driver.find_element(By.ID, acc_listPage_object_searchId_posId).click()
+ self.driver.find_element(By.ID, listPage_objectSearch_select_UUID_posXpath).click()
self.driver.find_element(By.XPATH,listpage_search_button_posXpath).click()
time.sleep(1)
self.driver.find_element(By.XPATH, listPage_first_row_checkBox_posXpath).click() # 选择第一个对象
@@ -3103,7 +3186,7 @@ class Accounts:
else:
for id in Des_ID_list:
self.driver.find_element(By.XPATH,listpage_search_box_posXpath).send_keys(id)
- self.driver.find_element(By.ID, acc_listPage_object_searchId_posId).click()
+ self.driver.find_element(By.ID, listPage_objectSearch_select_UUID_posXpath).click()
self.driver.find_element(By.XPATH,listpage_search_button_posXpath).click()
time.sleep(1)
self.driver.find_element(By.XPATH, listPage_first_row_checkBox_posXpath).click() # 选择第一个对象
@@ -3127,7 +3210,7 @@ class Accounts:
def _delete_source(self, Sou_ID_list, data):
if data["Type"] == 0:
self.driver.find_element(By.XPATH,listpage_search_box_posXpath).send_keys(Sou_ID_list[0])
- self.driver.find_element(By.ID, acc_listPage_object_searchId_posId).click()
+ self.driver.find_element(By.ID, listPage_objectSearch_select_UUID_posXpath).click()
self.driver.find_element(By.XPATH,listpage_search_button_posXpath).click()
time.sleep(1)
self.driver.find_element(By.XPATH, listPage_first_row_checkBox_posXpath).click() # 选择第一个对象
@@ -3137,7 +3220,7 @@ class Accounts:
else:
for id in Sou_ID_list:
self.driver.find_element(By.XPATH,listpage_search_box_posXpath).send_keys(id)
- self.driver.find_element(By.ID, acc_listPage_object_searchId_posId).click()
+ self.driver.find_element(By.ID, listPage_objectSearch_select_UUID_posXpath).click()
self.driver.find_element(By.XPATH,listpage_search_button_posXpath).click()
time.sleep(1)
self.driver.find_element(By.XPATH, listPage_first_row_checkBox_posXpath).click() # 选择第一个对象
@@ -3215,7 +3298,7 @@ class Accounts:
self._just_goto_accountsPage()
for id in Des_ID_list:
self.driver.find_element(By.XPATH,listpage_search_box_posXpath).send_keys(id)
- self.driver.find_element(By.ID, acc_listPage_object_searchId_posId).click()
+ self.driver.find_element(By.ID, listPage_objectSearch_select_UUID_posXpath).click()
self.driver.find_element(By.XPATH,listpage_search_button_posXpath).click()
self.driver.find_element(By.XPATH, listPage_first_row_checkBox_posXpath).click() # 选择第一个对象
# 确认删除
@@ -3228,7 +3311,7 @@ class Accounts:
self._just_goto_accountsPage()
for id in Sou_ID_list:
self.driver.find_element(By.XPATH,listpage_search_box_posXpath).send_keys(id)
- self.driver.find_element(By.ID, acc_listPage_object_searchId_posId).click()
+ self.driver.find_element(By.ID, listPage_objectSearch_select_UUID_posXpath).click()
self.driver.find_element(By.XPATH,listpage_search_button_posXpath).click()
time.sleep(1)
self.driver.find_element(By.XPATH, listPage_first_row_checkBox_posXpath).click() # 选择第一个对象
@@ -3276,7 +3359,7 @@ class Accounts:
search_value = self.my_sub_item_name
# 进入drawer_search页面
##勾选
- self.driver.find_element(By.XPATH, acc_listPage_first_row_checkBox_posXpath).click()
+ self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click()
##点击编辑按钮
self.driver.find_element(By.XPATH, listpage_edit_button_posXpath).click()
##点击 add button展开drawer_search
@@ -3287,7 +3370,7 @@ class Accounts:
self.driver.find_element(By.XPATH, groupObjectDetailPage_addSubObjecDrawer_searchInput_posXpath).send_keys(self.my_random.random_number() + Keys.ENTER)
assert self.driver.find_element(By.XPATH,groupObjectDetailPage_addSubObjecDrawer_totalText_posXpath).get_attribute("innerHTML") == "Total:0"
# 正确校验
- self.driver.find_element(By.XPATH, groupObjectDetailPage_addSubObjecDrawer_searchInput_posXpath).clear()
+ self.driver.find_element(By.XPATH, '//i[@class="iconfont icon-Delete_X text-[16px] mt-[-1px] cursor-pointer"]').click()
self.driver.find_element(By.XPATH, groupObjectDetailPage_addSubObjecDrawer_searchInput_posXpath).send_keys(search_value + Keys.ENTER)
# resulte_text = self.driver.find_element(By.XPATH,"//div[@class='IpItems list-box']//ul[@class='row-container tableList']/li[1]/div").text
# 等待查询结果加载
@@ -3295,7 +3378,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,acc_ObjectDetailPage_cancel_posXpath).click()
+ self.driver.find_element(By.XPATH, '//i[@class="iconfont icon-Clear_aNormal close-icon"]').click()
except Exception as e:
raise e
finally:
@@ -3303,7 +3386,63 @@ class Accounts:
self._del(data, search_value=self.my_item_name, del_flag=1)
def _different_vsys_check(self, data):
- self.objects_po.different_vsys_check("accounts", data)
+ self._create(data)
+ self.query(data)
+ # 获取UIAutoTestVsys的Object信息
+ self.uiAutoTestVsys_object = dict(self.objects_po.table_dict)
+ print(self.uiAutoTestVsys_object)
+ # 切换Vsys至Vsys0
+ self.profile_pub.change_vsys(vsys_name="vsys0")
+ self._create(data)
+ self.query(data)
+ self.vsys0_object = dict(self.objects_po.table_dict)
+ self._query(data)
+ time.sleep(2)
+ self.view_check("vsys0")
+ self.profile_pub.change_vsys(vsys_name="PerformanceTestVsys")
+ self._query(data)
+ time.sleep(2)
+ self.view_check("PerformanceTestVsys")
+ self.profile_pub.change_vsys(vsys_name="UIAutoTestVsys")
+ self._query(data)
+ time.sleep(2)
+ self.view_check("UIAutoTestVsys")
+ self.profile_pub.change_vsys(vsys_name="vsys0")
+ self._del(data)
+
+ def view_check(self, vsys_name):
+ time.sleep(1)
+ total = self.driver.find_element(By.XPATH, "//span[contains(text(),'Total')]").text
+ count = total.split("Total:")
+ if vsys_name == "PerformanceTestVsys":
+ assert int(count[1]) == 1
+ assert self.driver.find_element(By.XPATH, listPage_First_object_ID_posXpath).text == self.vsys0_object["UUID"]
+ elif vsys_name == "vsys0":
+ assert int(count[1]) == 1
+ assert self.driver.find_element(By.XPATH, listPage_First_object_ID_posXpath).text == self.vsys0_object["UUID"]
+ # assert self.driver.find_element(By.XPATH, listPage_Second_object_ID_posXpath).text == self.uiAutoTestVsys_object["ID"]
+ # self.driver.find_element(By.XPATH,"//*[@id='ly-table1-listcontent']//tbody/tr[2]//span[@class='el-checkbox__inner']").click()
+ # self.driver.find_element(By.XPATH,"//button[@id='appEdit-_OperateBtns_ElRow_Objects_port_Home_App_anonymousComponent']//p[normalize-space(text()) = 'View']").click()
+ # assert len(self.driver.find_elements(By.XPATH, '//div[@class="IconBtn disabled-btn"]')) == 3
+ # self.driver.isElementExist(port_ObjectDetailPage_mainOkButton_posXpath)
+ # assert self.driver.Exist == False
+ # self.driver.find_element(By.XPATH,port_ObjectPage_button_cancel_posXpath).click()
+ elif vsys_name == "UIAutoTestVsys":
+ assert int(count[1]) == 2
+ assert self.driver.find_element(By.XPATH, listPage_First_object_ID_posXpath).text == self.vsys0_object["UUID"]
+ assert self.driver.find_element(By.XPATH, listPage_Second_object_ID_posXpath).text == self.uiAutoTestVsys_object["UUID"]
+ self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click()
+ self.driver.find_element(By.XPATH, listPage_view_button_posXpath).click()
+ # add_item_disable = self.driver.element_isExist(by=By.XPATH,value="//div[@class='object-item-add']/div[@class='IconBtn disabled-btn']")
+ # edit_item_disable = self.driver.element_isExist(by=By.XPATH,value="//div[@class='list-container']//div[@class='IconBtn disabled-btn'][1]")
+ # del_item_disable = self.driver.element_isExist(by=By.XPATH,value="//div[@class='list-container']//div[@class='IconBtn disabled-btn'][2]")
+ # assert add_item_disable == edit_item_disable == del_item_disable == True
+ self.driver.isElementExist(port_ObjectDetailPage_mainOkButton_posXpath)
+ assert self.driver.Exist == False
+ self.driver.find_element(By.XPATH, port_ObjectPage_button_cancel_posXpath).click()
+ self.driver.find_element(By.XPATH, listpage_select_second_object_posXpath).click()
+ self.driver.find_element(By.XPATH, listpage_delete_button_posXpath).click()
+ self.driver.find_element(By.XPATH, port_listPage_deleteYes_posXpath).click()
def _audit_log_all_operation(self, data):
self._create(data)
@@ -3328,14 +3467,12 @@ class Accounts:
# 获取页面元素
self._just_goto_accountsPage()
my_table_dict = self.objects_po.extract_ele()
- details_first_value = self.driver.find_element(By.XPATH,
- '(//div[@class="itemDetails cursor"][1]/span)[1]').text
for search_type in search_type_list:
- if search_type == "ID":
+ if search_type == "UUID":
self.driver.find_element(By.XPATH,listpage_search_box_posXpath).click()
self.driver.find_element(By.XPATH,listpage_search_box_posXpath).send_keys(
- my_table_dict['ID'])
- self.driver.find_element(By.ID, acc_listPage_object_searchId_posId).click()
+ my_table_dict['UUID'])
+ self.driver.find_element(By.XPATH, listPage_objectSearch_select_UUID_posXpath).click()
elif search_type == "Name":
self.driver.find_element(By.XPATH,listpage_search_box_posXpath).click()
input_value = self.operate_input_value_4_multiple_search(my_table_dict['Name'])
@@ -3346,16 +3483,14 @@ class Accounts:
input_value = self.operate_input_value_4_multiple_search(my_table_dict['Description'])
self.driver.find_element(By.XPATH,listpage_search_box_posXpath).send_keys(input_value)
self.driver.find_element(By.ID, acc_listPage_object_searchDescription_posId).click()
- elif search_type == "Details":
- self.driver.find_element(By.XPATH,listpage_search_box_posXpath).click()
- input_value = self.operate_input_value_4_multiple_search(details_first_value)
- self.driver.find_element(By.XPATH,listpage_search_box_posXpath).send_keys(input_value)
- self.driver.find_element(By.ID, acc_listPage_object_searchDetails_posId).click()
+ # elif search_type == "Details":
+ # self.driver.find_element(By.XPATH,listpage_search_box_posXpath).click()
+ # input_value = self.operate_input_value_4_multiple_search(details_first_value)
+ # self.driver.find_element(By.XPATH,listpage_search_box_posXpath).send_keys(input_value)
+ # self.driver.find_element(By.ID, acc_listPage_object_searchDetails_posId).click()
search_button = self.driver.find_element(By.XPATH,listpage_search_button_posXpath)
self.driver.execute_script("arguments[0].scrollIntoView();", search_button)
search_button.click()
-
- self._query_verify(search_type="Details", search_value=details_first_value, need_verify_vsysID=0)
except Exception as e:
raise e
finally:
@@ -3392,28 +3527,27 @@ if __name__ == '__main__':
acc = Accounts(demo_fixture=driver)
driver.implicitly_wait(5)
- driver.get("http://192.168.45.158")
+ driver.get("http://192.168.44.72")
# driver.get("http://192.168.42.49")
driver.maximize_window()
- driver.find_element(By.XPATH, '//*[@id="root"]/div/div[2]/div/div[1]/input').send_keys("admin")
- driver.find_element(By.XPATH, '//*[@id="root"]/div/div[2]/div/div[2]/input').send_keys("admin")
- driver.find_element(By.XPATH, '//*[@id=":r0:"]').click()
+ driver.find_element(By.XPATH, '//input[@placeholder="User name"]').send_keys("guouitest")
+ driver.find_element(By.XPATH, '//input[@placeholder="Password"]').send_keys("jMIfnvhc1U")
+ driver.find_element(By.XPATH, '//button[@class="MuiButtonBase-root MuiButton-root MuiLoadingButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeLarge MuiButton-containedSizeLarge MuiButton-colorPrimary MuiButton-root MuiLoadingButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeLarge MuiButton-containedSizeLarge MuiButton-colorPrimary !bg-[#4487d4] css-zeizzp"]').click()
# 切换Vsys
# profile_pub = ProfilesPublicOperations(driver)
# profile_pub.change_vsys(vsys_name='UIAutoTestVsys')
- acc.acc_case(data=
+ acc._different_vsys_check(data=
{
- "ids": "Created By作为搜索条件进行模糊查询-T074-4",
+ "ids": "test_different_vsys_check",
"Model": "create",
"Type": 0,
- "Name": "test_ui_test_ui323",
- "Search type": "Created By",
+ "Search type": "Name",
+ "Name": "",
"Items": [
- "[random]->"
+ "^skkj$"
],
- "Description": "",
- "Subordinate Objects": ""
- },
+ "Description": ""
+ }
)
time.sleep(3)
driver.quit()
diff --git a/common/ui_common/objects/intervals.py b/common/ui_common/objects/intervals.py
index cb7f0838..3cd77751 100644
--- a/common/ui_common/objects/intervals.py
+++ b/common/ui_common/objects/intervals.py
@@ -113,7 +113,7 @@ class Intervals:
# no_modify = False
if self.object_type == 0: # single Object
self._operate_name(data, no_modify=no_modify)
- # self._operate_object_statistics(data, no_modify=no_modify)
+ self._operate_object_statistics(data, no_modify=no_modify)
self._operate_items(data, data_index=data_index, no_modify=no_modify)
self._operate_description(data, no_modify=no_modify)
else: # Object group
@@ -139,9 +139,9 @@ class Intervals:
def _select_object_statistics(self, my_object_statistics):
# 展开下拉框
self.driver.find_element(By.XPATH, acc_ObjectDetailPage_objectStatistics_dropDown_posXpath).click()
- if my_object_statistics == "Elaborate":
+ if my_object_statistics == "Brief":
self.driver.find_element(By.XPATH, object_page_ln_select_statistics_elaborate_posXpath).click()
- elif my_object_statistics == "Brief":
+ elif my_object_statistics == "Elaborate":
self.driver.find_element(By.XPATH, object_page_ln_select_statistics_brief_posXpath).click()
else:
pass # 默认为None
diff --git a/common/ui_common/objects/objects_public_operations.py b/common/ui_common/objects/objects_public_operations.py
index 1875f4f3..b3348034 100644
--- a/common/ui_common/objects/objects_public_operations.py
+++ b/common/ui_common/objects/objects_public_operations.py
@@ -289,9 +289,9 @@ class ObjectsPublicOperations:
# self.key_id = self.driver.find_element(By.XPATH, list_headers_id_posXpath).text
# self.value_id = self.driver.find_element(By.XPATH, list_firstRow_values_id_posXpath).text
- if need_exclude == 1:
- self.uuid_name = self.driver.find_element(By.XPATH, '//div[text()="UUID"]').text
- self.uuid_value = self.driver.find_element(By.XPATH,'//div[@aria-rowindex="2"]//div[@data-field="uuid"]').text
+
+ self.uuid_name = self.driver.find_element(By.XPATH, '//div[text()="UUID"]').text
+ self.uuid_value = self.driver.find_element(By.XPATH,'//div[@aria-rowindex="2"]//div[@data-field="uuid"]').text
self.key_vsys_id = self.driver.find_element(By.XPATH, '//div[text()="Vsys ID"]').text
self.value_vsys_id = self.driver.find_element(By.XPATH, '//div[@aria-rowindex="2"]//div[@data-field="vsys"]').text
@@ -315,7 +315,7 @@ class ObjectsPublicOperations:
self.key_des: self.value_des,"Details": "null"}
else:
- self.table_dict = {self.key_vsys_id: self.value_vsys_id,self.key_name: self.value_name, self.key_des: self.value_des,
+ self.table_dict = {self.uuid_name:self.uuid_value,self.key_vsys_id: self.value_vsys_id,self.key_name: self.value_name, self.key_des: self.value_des,
"Details": "null"}
# print("extract_ele TEST:{}".format(self.table_dict))
return self.table_dict
@@ -572,15 +572,19 @@ class ObjectsPublicOperations:
def View_statistics(self, edit_element):
# 主界面View验证
self.driver.find_element(By.XPATH, main_listPage_object_statistics_view_postXpath).click()
- self.driver.isElementExist(Element="(//div[@class='ObjectStatisticSlider'])[1]")
+ self.driver.isElementExist(Element='//i[@class="iconfont icon-Clear_aNormal close-icon"]')
assert self.driver.Exist, "Statistics界面打开"
- self.driver.find_element(By.XPATH, "(//div[@class='ObjectStatisticSlider']//span[text()='Cancel'])[2]").click()
+ self.driver.find_element(By.XPATH, '//i[@class="iconfont icon-Clear_aNormal close-icon"]').click()
+ time.sleep(2)
# 详情界面Statistics验证
- self.driver.find_element(By.XPATH, listPage_object_ip_address_select_First_object_posXpath).click()
- self.driver.find_element(By.ID, edit_element).click()
- self.driver.find_element(By.XPATH, "//div[@class='paper-grid-right']//span[text()='Statistics']").click()
- self.driver.isElementExist(Element="(//div[@class='ObjectStatisticSlider'])[1]")
+ # self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click()
+ self.driver.find_element(By.XPATH, edit_element).click()
+ self.driver.find_element(By.XPATH, '(//button[text()="Statistics"])[1]').click()
+ self.driver.isElementExist(Element='(//i[@class="iconfont icon-Clear_aNormal close-icon"])[2]')
assert self.driver.Exist, "Statistics界面打开"
+ time.sleep(2)
+ self.driver.find_element(By.XPATH, '(//i[@class="iconfont icon-Clear_aNormal close-icon"])[2]').click()
+ time.sleep(2)
def Duplicate_check(self, data):
self.driver.isElementExist(Element=listPage_object_reprtition_check_postXpath)
@@ -2236,7 +2240,7 @@ class ObjectsPublicOperations:
self.driver.find_element(By.XPATH, listPage_auditlogSearch_buttonSearch_posXpath).click()
# 搜索
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']")) > 2,"Edit日志大于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,"//div[@class='MuiDataGrid-virtualScrollerContent css-0']//div[@data-field='op_type']")
@@ -2245,8 +2249,8 @@ class ObjectsPublicOperations:
else:
operation = ["Create", "Edit", "Delete", "Query Verbose"]
operation_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']/span)[{i + 1}]").text
+ for i in range(1,len(operation_text_elements)+1):
+ text = self.driver.find_element(By.XPATH,f"(//div[@class='MuiDataGrid-virtualScrollerContent css-0']//div[@data-field='op_type']/span)[{i}]").text
operation_text.append(text)
self.check_audit_log_detail("0")
if set(operation_text) != set(operation):
@@ -2254,21 +2258,21 @@ class ObjectsPublicOperations:
###校验["Export","Query List"]
# 清除筛选框
- 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"
+ # 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()
+ self.driver.find_element(By.XPATH, '//span[text()="Audit Logs"]').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"//ul[@class='base-Popper-root MuiSelect-listbox Mui-expanded css-1wd16dk']//li[text()='{object_type}']")
self.driver.execute_script("arguments[0].scrollIntoView();", scrollable_div)
scrollable_div.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.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.XPATH, listPage_auditlogSearch_buttonSearch_posXpath).click()
@@ -2276,16 +2280,15 @@ class ObjectsPublicOperations:
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","Create", "Edit", "Delete", "Import", "Query Verbose"]
+ other_operation = ["Export", "Query List"]
else:
- other_operation = ["Query List","Create", "Edit", "Delete", "Query Verbose"]
+ other_operation = ["Query List"]
for i in range(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
other_operation_text.append(text)
self.check_audit_log_detail("1")
print(other_operation_text, set(other_operation_text), len(operation_text_elements))
- if set(other_operation_text) != set(other_operation):
- raise Exception("存在未记录日志")
+ assert other_operation in set(other_operation_text)
def check_audit_log_detail(self, type):
if type == "0": # 首次对operation = ["Create", "Edit", "Delete", "Import", "Query Verbose"]的校验
@@ -2297,21 +2300,21 @@ class ObjectsPublicOperations:
compare_verision = self.driver.find_elements(By.XPATH, "//div[@class='overflow-hidden']//tbody//tr")
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, 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, url_ObjectDetailPage_auditLogsDrawer_compareDrawer_operationText_posXpath1).text != ""
+ assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_type_posXpath1).text != ""
+ assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_ip_posXpath1).text != ""
+ assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_time_posXpath1).text != ""
+ assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_user_posXpath1).text != ""
+ self.driver.find_element(By.XPATH, '//i[@class="iconfont icon-Clear_aNormal close-icon"]').click()
elif type == "1": # 对 other_operation = ["Export", "Query List"]的校验
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 != ""
- assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_user_posXpath).text != ""
+ assert self.driver.find_element(By.XPATH,url_ObjectDetailPage_auditLogsDrawer_compareDrawer_operationText_posXpath1).text != ""
+ assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_type_posXpath1).text != ""
+ assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_ip_posXpath1).text != ""
+ assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_time_posXpath1).text != ""
+ assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_user_posXpath1).text != ""
# self.driver.find_element(By.XPATH,"(//button[@id='test-compareHistorical-_system_PolicyConfigurationLog_Home_App_anonymousComponent']//span[normalize-space(text())='Compare'])[1]").click()
# 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存在修改信息"
diff --git a/common/ui_common/objects/tunnels.py b/common/ui_common/objects/tunnels.py
index 05ac03d5..519d9d0d 100644
--- a/common/ui_common/objects/tunnels.py
+++ b/common/ui_common/objects/tunnels.py
@@ -102,12 +102,12 @@ class Tunnels:
self.driver.find_element(By.XPATH,mainPage_firstLevelMenu_Objects_posXpath).click()
self.driver.find_element(By.XPATH,mainPage_secondLevelMenu_Tunnel_posXpath).click()
# 增加首次进入时验证Total和首行是否存在
- if self.my_count == 0:
- total_text = self.driver.find_element(By.XPATH, main_listPage_object_bottomTotal_postXpath).text
- total_value = int(total_text.split(":")[-1].strip())
- is_first_exist = self.driver.element_isExist(By.XPATH, list_first_row_first_column_posXpath)
- assert is_first_exist or total_value == 0, "校验失败!!列表页为空!!"
- self.my_count += 1
+ # if self.my_count == 0:
+ # total_text = self.driver.find_element(By.XPATH, main_listPage_object_bottomTotal_postXpath).text
+ # total_value = int(total_text.split(":")[-1].strip())
+ # is_first_exist = self.driver.element_isExist(By.XPATH, list_first_row_first_column_posXpath)
+ # assert is_first_exist or total_value == 0, "校验失败!!列表页为空!!"
+ # self.my_count += 1
def pop_export_part(self):
self.driver.find_element(By.XPATH, listPage_object_Tunnels_exportButton_posXPATH).click()
@@ -147,7 +147,7 @@ class Tunnels:
def _export_objects_and_verify(self, data):
self._create(data) # 新建,新建后就是查询到该条数据的状态
- self.driver.find_element(By.XPATH, listPage_object_Tunnels_select_First_object_posXpath).click() # 选中第一行
+ self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click() # 选中第一行
self._export_objects() # 选中并导出文件
time.sleep(3)
self.file_name = get_txt_filenames(path=self.my_files._obj_files_dowload_path())
@@ -169,17 +169,17 @@ class Tunnels:
self.create_tunnel(data) # 新建,新建后就是查询到该条数据的状态
if data["SubType"] == "cancel_export":
# 1、单个Object导出取消选中目标数据
- self.driver.find_element(By.XPATH, listPage_object_Tunnels_select_First_object_posXpath).click()
+ self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click()
self.pop_cancel_export_num()
self.create_tunnel(data)
# 2、多个Object导出取消选中目标数据(2个)
- self.driver.find_element(By.XPATH, listPage_object_Tunnels_select_First_object_posXpath).click()
+ self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click()
self.driver.find_element(By.XPATH, listPage_object_Tunnels_select_second_object_posXpath).click()
self.pop_cancel_export_num()
self._delete(data)
elif data["SubType"] == "multi_export":
self.create_tunnel(data)
- self.driver.find_element(By.XPATH, listPage_object_Tunnels_select_First_object_posXpath).click()
+ self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click()
self.driver.find_element(By.XPATH, listPage_object_Tunnels_select_second_object_posXpath).click()
if data["multi_type"] == "all": # 4、多选导出所有数据,校验行数
self._export_objects()
@@ -262,7 +262,7 @@ class Tunnels:
# self._goto_subObjectPage()
# self._search(data)
# 查询后编辑
- self.driver.find_element(By.XPATH, listPage_object_Tunnels_select_First_object_posXpath).click()
+ self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click()
self.driver.find_element(By.XPATH, listPage_object_Tunnels_editButton_posXPATH).click() # edit按钮
def _verify_not_checkbox_export(self, data: {}):
@@ -315,7 +315,7 @@ class Tunnels:
# 调用消除右上提示弹窗
self._goto_subObjectPage()
# first_quoted_tunnel_elem_posXpath = '(//*[@class="obj-charts-btn pro-port cursorPointer textCenter" and text() != 0])[1]/parent::div/parent::div/parent::td'
- self.driver.find_element(By.XPATH, listPage_object_Tunnels_select_First_object_posXpath).click()
+ self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click()
del_button_elem = listPage_object_Tunnels_delButton_posXpath
del_button_elem_clickable = self.objects_po.is_element_clickable(del_button_elem, "XPATH")
print("当前元素是否可点击:{}".format(del_button_elem_clickable))
@@ -393,10 +393,10 @@ class Tunnels:
search_types = data["Search_type"].split('&')
for search_type in search_types:
if not fuzzy_search:
- if search_type == "ID":
+ if search_type == "UUID":
self.driver.find_element(By.XPATH, listpage_search_box_posXpath).click()
- self.driver.find_element(By.XPATH, listpage_search_box_posXpath).send_keys(self.table_dict['ID'])
- self.driver.find_element(By.XPATH, listPage_objectSearch_Tunnels_select_Id_posId).click()
+ self.driver.find_element(By.XPATH, listpage_search_box_posXpath).send_keys(self.table_dict['UUID'])
+ self.driver.find_element(By.XPATH, listPage_objectSearch_select_UUID_posXpath).click()
elif search_type == "Name":
self.driver.find_element(By.XPATH, listpage_search_box_posXpath).click()
input_value = self.operate_input_value_4_multiple_search(self.table_dict['Name'])
@@ -405,7 +405,7 @@ class Tunnels:
self.driver.find_element(By.XPATH, listPage_objectSearch_Tunnels_select_Name_posId).click()
elif search_type == "IP":
self.driver.find_element(By.XPATH, listpage_search_box_posXpath).click()
- input_value = self.operate_input_value_4_multiple_search(self.table_dict['Details'])
+ input_value = self.operate_input_value_4_multiple_search("2.2.2.3")
self.driver.find_element(By.XPATH, listpage_search_box_posXpath).send_keys(
input_value)
self.driver.find_element(By.XPATH, listPage_objectSearch_Tunnels_select_IP_posId).click()
@@ -416,7 +416,7 @@ class Tunnels:
input_value)
self.driver.find_element(By.XPATH, listPage_objectSearch_Tunnels_select_Name_posId).click()
else: # 全局查询
- if search_type == "ID":
+ if search_type == "UUID":
self.driver.find_element(By.XPATH, listpage_search_box_posXpath).click()
self.driver.find_element(By.XPATH, listpage_search_box_posXpath).send_keys(self.table_dict['ID'])
elif search_type == "Name":
@@ -505,6 +505,7 @@ class Tunnels:
# 通过Name查询,查看内容是否和新建时一致
# self.extract_ele_tunnel() ## 提取ID、Name、Description、Detail
self.table_dict = self.objects_po.extract_ele(need_exclude=2)
+ print(self.table_dict)
# first_detail_elem = self.driver.find_element(By.XPATH,'(//div[@class="itemDetails cursor"]//div[@class="three-row list-popover-click"])[1]')
# ActionChains(self.driver).move_to_element(first_detail_elem).perform()
# first_detail_ip_elem = self.driver.find_element(By.XPATH,'((//div[contains(@x-placement,"right-start")]//td)[last()]//div)[last()]')
@@ -558,17 +559,17 @@ class Tunnels:
self.driver.find_element(By.XPATH, tunnel_ip_list_close).click()
##endpoint B中新建ip object group
- self.driver.find_element(By.XPATH, tunnel_add_endpoint_b).click()
- self.driver.find_element(By.XPATH, tunnel_add_item_2).click()
- self.driver.find_element(By.XPATH, tunnel_ip_list_add_button).click()
- self.driver.find_element(By.XPATH, tunnel_ip_list_select_ip_group).click()
- self.driver.find_element(By.XPATH, tunnel_slide_ip_name).send_keys("test_ui_4_tunnle")
- self.driver.find_element(By.XPATH, tunnel_ip_group_add_subobject).click()
- self.driver.find_element(By.XPATH, tunnel_ip_group_first_row).click()
- self.driver.find_element(By.XPATH, tunnel_ip_list_close2).click()
- self.driver.find_element(By.XPATH, tunnel_slide_ip_ok).click()
- # self.driver.find_element(By.XPATH, tunnel_slide_ip_confirm_ok).click()
- self.driver.find_element(By.XPATH, tunnel_ip_list_close).click()
+ # self.driver.find_element(By.XPATH, tunnel_add_endpoint_b).click()
+ # self.driver.find_element(By.XPATH, tunnel_add_item_2).click()
+ # self.driver.find_element(By.XPATH, tunnel_ip_list_add_button).click()
+ # self.driver.find_element(By.XPATH, tunnel_ip_list_select_ip_group).click()
+ # self.driver.find_element(By.XPATH, tunnel_slide_ip_name).send_keys("test_ui_4_tunnle")
+ # self.driver.find_element(By.XPATH, tunnel_ip_group_add_subobject).click()
+ # self.driver.find_element(By.XPATH, tunnel_ip_group_first_row).click()
+ # self.driver.find_element(By.XPATH, tunnel_ip_list_close2).click()
+ # self.driver.find_element(By.XPATH, tunnel_slide_ip_ok).click()
+ # # self.driver.find_element(By.XPATH, tunnel_slide_ip_confirm_ok).click()
+ # self.driver.find_element(By.XPATH, tunnel_ip_list_close).click()
# 确认保存
self.driver.find_element(By.XPATH,TunnelsObjectPage_button_SaveYes_posXpath).click()
@@ -576,6 +577,7 @@ class Tunnels:
# self.extract_ele_tunnel() ## 提取ID、Name、Description、Detail
self.table_dict = self.objects_po.extract_ele(need_exclude=2)
+ print(self.table_dict)
# first_detail_elem = self.driver.find_element(By.XPATH,'(//div[@class="itemDetails cursor"]//div[@class="three-row list-popover-click"])[1]')
# time.sleep(1)
# ActionChains(self.driver).move_to_element(first_detail_elem).perform()
@@ -592,7 +594,7 @@ class Tunnels:
if "isDeleteGroup" in data and data["isDeleteGroup"] == "True":
# self.driver.find_element(By.XPATH, mainPage_secondLevelMenu_ipAddress_posXpath).send_keys(
# "test_ui_4_tunnle")
- # self.driver.find_element(By.XPATH, listPage_objectSearch_ip_address_select_Name_posXpath).click()
+ # self.driver.find_element(By.XPATH, listPage_objectSearch_select_Name_posXpath).click()
# self.driver.find_element(By.XPATH, listpage_search_button_posXpath).click()
# # 尝试定位第一个对象,如果找到则执行删除操作
# try:
@@ -606,9 +608,9 @@ class Tunnels:
# # 如果没有找到元素,打印消息并跳过删除操作
# print("未找到第一个对象,跳过删除操作")
# 筛选目标数据
- self.driver.find_element(By.XPATH, mainPage_secondLevelMenu_ipAddress_posXpath).send_keys(
+ self.driver.find_element(By.XPATH, listpage_search_input_posXpath).send_keys(
"test_ui_4_tunnle")
- self.driver.find_element(By.XPATH, listPage_objectSearch_ip_address_select_Name_posXpath).click()
+ self.driver.find_element(By.XPATH, listPage_objectSearch_select_Name_posXpath).click()
self.driver.find_element(By.XPATH, listpage_search_button_posXpath).click()
is_target_exist = self.driver.element_isExist(By.XPATH,
listPage_object_tableCheckbox_localVsysAndReferenceEqualO_objectOrGroup_posXpaths)
@@ -625,13 +627,14 @@ class Tunnels:
self.driver.find_element(By.XPATH,listPage_object_ip_address_delButton_posXpath).click()
self.driver.find_element(By.XPATH, listPage_object_ip_address_del_yes_Button_posXpath).click()
time.sleep(2)
+ self.driver.refresh()
# 筛选目标数据
- self.driver.find_element(By.XPATH, mainPage_secondLevelMenu_ipAddress_posXpath).send_keys(
+ self.driver.find_element(By.XPATH, listpage_search_input_posXpath).send_keys(
"test_ui_4_tunnle")
- # element = self.driver.find_element(By.XPATH, listPage_objectSearch_ip_address_select_Name_posXpath)
+ # element = self.driver.find_element(By.XPATH, listPage_objectSearch_select_Name_posXpath)
# self.driver.execute_script("arguments[0].scrollIntoView();", element)
# element.click()
- self.wait.until(EC.presence_of_element_located((By.XPATH,listPage_objectSearch_ip_address_select_Name_posXpath))).click()
+ self.wait.until(EC.presence_of_element_located((By.XPATH,listPage_objectSearch_select_Name_posXpath))).click()
self.driver.find_element(By.XPATH, listpage_search_button_posXpath).click()
time.sleep(2)
is_target_exist = self.driver.element_isExist(By.XPATH,
@@ -693,7 +696,7 @@ class Tunnels:
self.random_name = self.my_random.random_name() # 重新生成一个random_name
self.random_item = self.my_random.random_tunnel() # 重新生成的endpoint
# 查询后EditName
- self.driver.find_element(By.XPATH, listPage_object_Tunnels_select_First_object_posXpath).click() # 第一行数据前的复选框
+ self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click() # 第一行数据前的复选框
self.driver.find_element(By.XPATH, listPage_object_Tunnels_editButton_posXPATH).click() # edit按钮
self.objects_po.clear_Name(path=Tunnel_ObjectPage_InputName_posXpath) # 清除name
self.driver.find_element(By.XPATH, Tunnel_ObjectPage_InputName_posXpath).send_keys(self.random_name) # 重新输入name
@@ -710,7 +713,7 @@ class Tunnels:
def _delete(self, data):
# self._goto_subObjectPage()
self._search(data)
- self.driver.find_element(By.XPATH, listPage_object_Tunnels_select_First_object_posXpath).click() # 选择第一个对象
+ self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click() # 选择第一个对象
# 确认删除
self.driver.find_element(By.XPATH,listPage_object_Tunnels_delButton_posXpath).click()
self.driver.find_element(By.XPATH, listPage_object_Tunnels_del_yes_Button_posXpath).click()
@@ -761,8 +764,8 @@ class Tunnels:
# self.key12 = self.driver.find_element(By.XPATH, list_first_row_second_column_posXpath).text
# self.value22 = self.driver.find_element(By.XPATH, list_second_row_second_column_posXpath).text
# Name
- self.key13 = self.driver.find_element(By.XPATH, list_first_row_third_column_posXpath).text
- self.value23 = self.driver.find_element(By.XPATH, "//div[@class='MuiDataGrid-virtualScrollerRenderZone css-1inm7gi']/div[1]//div[@data-field='name']//span[@class='truncate']").text
+ self.key13 = self.driver.find_element(By.XPATH, '//div[text()="Name"]').text
+ self.value23 = self.driver.find_element(By.XPATH, '//div[@aria-rowindex="2"]//span[@class="truncate"]').text
# 字典
# self.edit_table_dict = {self.key11: self.value12, self.key12: self.value22, self.key13: self.value23}
self.edit_table_dict = {self.key13: self.value23}
@@ -770,14 +773,15 @@ class Tunnels:
def new_security_policy_tunnel(self, data: {}):
# 跳转到安全策略创建页面
- self.driver.find_element(By.ID, mainPage_firstLevelMenu_Policy_posId).click()
- self.driver.find_element(By.ID, mainPage_secondLevelMenu_Security_posId).click()
+ self.driver.find_element(By.XPATH, mainPage_firstLevelMenu_Policy_posXpath).click()
+ self.driver.find_element(By.XPATH, mainPage_secondLevelMenu_Security_posXpath).click()
# 添加tunnel
self.driver.find_element(By.XPATH, listpage_create_button_posXpath).click()
self.driver.find_element(By.XPATH, security_create_Name_input_frame_PosXpath).send_keys(data["Name"])
self.driver.find_element(By.XPATH, security_policy_add_condition_button_by_xpath).click() # 选择Condition按钮
self.driver.find_element(By.XPATH, security_create_add_tunnel_button_click_PosXpath).click() # 选择tunnel
+ self.driver.find_element(By.XPATH, '//i[@class="iconfont icon-Clear_aNormal close-icon"]').click()
time.sleep(2)
self.driver.find_element(By.XPATH, security_add_tunnel_button).click() # 添加tunnel
# self.driver.find_element(By.XPATH, security_search_tunnel_frame_click_PosXpath).send_keys(
@@ -790,8 +794,9 @@ class Tunnels:
print('正常找到Object,正常进行引用创建')
self.driver.find_element(By.XPATH, security_first_tunnel_inlist_click_PosXpath).click()
+ self.driver.find_element(By.XPATH, '//i[@class="iconfont icon-Clear_aNormal close-icon"]').click()
self.driver.find_element(By.XPATH, security_create_ok_click_posXpath).click()
- self.driver.find_element(By.XPATH, security_create_Warn_ok_click_posXpath).click()
+ # self.driver.find_element(By.XPATH, security_create_Warn_ok_click_posXpath).click()
else: # 不存在就跳过
assert self.driver.Exist == False # 未找到元素
print('未找到Object,无法进行引用创建')
@@ -1361,7 +1366,7 @@ class Tunnels:
self._goto_subObjectPage()
self._search(data)
# 修改数据
- self.driver.find_element(By.XPATH, listPage_object_Tunnels_select_First_object_posXpath).click() # 第一行数据前的复选框
+ self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click() # 第一行数据前的复选框
self.driver.find_element(By.XPATH, listPage_object_Tunnels_editButton_posXPATH).click() # edit按钮
self.objects_po.clear_Name(path=Tunnel_ObjectPage_InputName_posXpath) # 清除name
self.driver.find_element(By.XPATH, Tunnel_ObjectPage_InputName_posXpath).send_keys(
@@ -1435,7 +1440,7 @@ class Tunnels:
compare_list_detail.append(des_value_detail)
# 在目的vsys中修改
self.driver.find_element(By.XPATH,
- listPage_object_Tunnels_select_First_object_posXpath).click() # 第一行数据前的复选框
+ listPage_select_first_object_posXpath).click() # 第一行数据前的复选框
self.driver.find_element(By.XPATH, listPage_object_Tunnels_editButton_posXPATH).click() # edit按钮
self.objects_po.clear_Name(path=Tunnel_ObjectPage_InputName_posXpath) # 清除name
self.driver.find_element(By.XPATH, Tunnel_ObjectPage_InputName_posXpath).send_keys(
@@ -1483,7 +1488,7 @@ class Tunnels:
self.driver.find_element(By.XPATH, listpage_search_box_posXpath).send_keys(Des_ID_list[0])
self.driver.find_element(By.ID, listPage_objectSearch_Tunnels_select_Id_posId).click()
self.driver.find_element(By.XPATH,listpage_search_button_posXpath).click()
- self.driver.find_element(By.XPATH, listPage_object_Tunnels_select_First_object_posXpath).click() # 选择第一个对象
+ self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click() # 选择第一个对象
# 确认删除
self.driver.find_element(By.XPATH,listPage_object_Tunnels_delButton_posXpath).click()
self.driver.find_element(By.XPATH, listPage_object_Tunnels_del_yes_Button_posXpath).click()
@@ -1500,21 +1505,23 @@ class Tunnels:
def View_statistics(self, edit_element):
# 主界面View验证
- self.driver.find_element(By.XPATH,
-
- '(//span[@id="tunnelStatistics-_Objects_tunnel_Home_App_anonymousComponent" and text()="View"])[1]').click()
- self.driver.isElementExist(Element="(//div[@class='ObjectStatisticSlider'])[1]")
+ self.driver.find_element(By.XPATH, main_listPage_object_statistics_view_postXpath).click()
+ self.driver.isElementExist(Element='//i[@class="iconfont icon-Clear_aNormal close-icon"]')
assert self.driver.Exist, "Statistics界面打开"
- self.driver.find_element(By.XPATH, "(//div[@class='ObjectStatisticSlider']//span[text()='Cancel'])[2]").click()
+ self.driver.find_element(By.XPATH, '//i[@class="iconfont icon-Clear_aNormal close-icon"]').click()
+ time.sleep(2)
# 详情界面Statistics验证
- self.driver.find_element(By.XPATH, listPage_object_ip_address_select_First_object_posXpath).click()
+ # self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click()
self.driver.find_element(By.XPATH, edit_element).click()
- self.driver.find_element(By.XPATH, "//div[@class='paper-grid-right']//span[text()='Statistics']").click()
- self.driver.isElementExist(Element="(//div[@class='ObjectStatisticSlider'])[1]")
+ self.driver.find_element(By.XPATH, '(//button[text()="Statistics"])[1]').click()
+ self.driver.isElementExist(Element='//div[text()="Object Statistics"]')
assert self.driver.Exist, "Statistics界面打开"
+ time.sleep(2)
+ self.driver.find_element(By.XPATH, '(//i[@class="iconfont icon-Clear_aNormal close-icon"])').click()
+ time.sleep(2)
def modify_tunnel(self, data):
- self.create_tunnel(data)
+ self._create(data)
self._modify2(data)
self._delete(data)
# self.delete_created_ip_bymself(data)
@@ -1525,9 +1532,8 @@ class Tunnels:
self.select_first_row_data_and_edit(data)
# 选择该按钮删除endpoint B
self.driver.find_element(By.XPATH,
- '//*[@id="endpointDelItem-_EndpointBList_ElFormItem_ElForm_VPanel_VEditPanel_tunnelAdd_Home_App_anonymousComponent"]/i')
- self.driver.find_element(By.XPATH,
- '//*[@id="endpointDelItem-_EndpointBList_ElFormItem_ElForm_VPanel_VEditPanel_tunnelAdd_Home_App_anonymousComponent"]/i').click()
+ '//div[@class="tunnel-object-endpointB"]//i[contains(@class,"icon-Delete")]').click()
+ self.driver.find_element(By.XPATH, '//div[@class="tunnel-object-endpointB"]//I[@class="iconfont icon-retract cursor block text-[22px]"]').click()
self.driver.find_element(By.XPATH,TunnelsObjectPage_button_SaveYes_posXpath).click()
# self.driver.find_element(By.CSS_SELECTOR, TunnelsObjectPage_button_warningSaveYes_posSelector).click()
# 断言修改name是否生效
@@ -1535,7 +1541,7 @@ class Tunnels:
time.sleep(3)
self._search(data)
self.select_first_row_data_and_edit(data)
- self.driver.isElementExist(Element=tunnel_add_item_2)
+ self.driver.isElementExist(Element=tunnel_end_point_b_frame)
assert not self.driver.Exist, "endpoint已关闭"
@screenshot_on_failure
@@ -1629,7 +1635,74 @@ class Tunnels:
self.driver.find_element(By.XPATH, listPage_object_Keywords_del_yes_Button_posXpath).click()
def _different_vsys_check(self, data):
- self.objects_po.different_vsys_check("tunnels", data)
+ self.create_tunnel(data)
+ # 获取UIAutoTestVsys的Object信息
+ self.uiAutoTestVsys_object = dict(self.objects_po.table_dict)
+ # 切换Vsys至Vsys0
+ self.profile_pub.change_vsys(vsys_name="vsys0")
+ self.create_tunnel(data)
+ self.vsys0_object = dict(self.objects_po.table_dict)
+ self._search(data)
+ column_setting_btn = self.driver.find_element(By.XPATH,
+ mainPage_ObjectSearch_Column_settings_posXpath) # 列设置按钮
+ self.driver.execute_script("arguments[0].scrollIntoView();", column_setting_btn)
+ column_setting_btn.click() # 点击列设置
+ self.driver.find_element(By.XPATH, '//span[text()="Vsys ID"]').click()
+ self.driver.find_element(By.XPATH, '//span[text()="UUID" and contains(@class,"MuiTypography-body1")]').click()
+ # self.driver.find_element(By.XPATH, "//input[@name='Show/Hide All']").click()
+ # self.driver.find_element(By.XPATH, "//input[@name='Show/Hide All']").click()
+ self.driver.find_element(By.XPATH, '//div[text()="Name"]').click()
+ self.view_check("vsys0")
+ self.profile_pub.change_vsys(vsys_name="PerformanceTestVsys")
+ self._search(data)
+ self.view_check("PerformanceTestVsys")
+ self.profile_pub.change_vsys(vsys_name="UIAutoTestVsys")
+ self._search(data)
+ column_setting_btn = self.driver.find_element(By.XPATH,
+ mainPage_ObjectSearch_Column_settings_posXpath) # 列设置按钮
+ self.driver.execute_script("arguments[0].scrollIntoView();", column_setting_btn)
+ column_setting_btn.click() # 点击列设置
+ self.driver.find_element(By.XPATH, '//span[text()="Vsys ID"]').click()
+ self.driver.find_element(By.XPATH, '//span[text()="UUID" and contains(@class,"MuiTypography-body1")]').click()
+ # self.driver.find_element(By.XPATH, "//input[@name='Show/Hide All']").click()
+ # self.driver.find_element(By.XPATH, "//input[@name='Show/Hide All']").click()
+ self.driver.find_element(By.XPATH, '//div[text()="Name"]').click()
+ self.view_check("UIAutoTestVsys")
+ self.profile_pub.change_vsys(vsys_name="vsys0")
+ self._delete(data)
+
+ def view_check(self,vsys_name):
+ time.sleep(1)
+ total = self.driver.find_element(By.XPATH,"//span[contains(text(),'Total')]").text
+ count = total.split("Total:")
+ if vsys_name == "PerformanceTestVsys":
+ assert int(count[1]) == 1
+ elif vsys_name =="vsys0":
+ assert int(count[1]) == 1
+ assert self.driver.find_element(By.XPATH, listPage_First_object_ID_posXpath).text == self.vsys0_object["UUID"]
+ # assert self.driver.find_element(By.XPATH, listPage_Second_object_ID_posXpath).text == self.uiAutoTestVsys_object["ID"]
+ # self.driver.find_element(By.XPATH,"//*[@id='ly-table1-listcontent']//tbody/tr[2]//span[@class='el-checkbox__inner']").click()
+ # self.driver.find_element(By.XPATH,"//button[@id='appEdit-_OperateBtns_ElRow_Objects_apn_Home_App_anonymousComponent']//p[normalize-space(text()) = 'View']").click()
+ # assert len(self.driver.find_elements(By.XPATH, '//div[@class="IconBtn disabled-btn"]')) == 3
+ # self.driver.isElementExist(APNsObjectPage_button_SaveYes_posXpath)
+ # assert self.driver.Exist == False
+ # self.driver.find_element(By.XPATH,apn_ObjectPage_button_cancel_posXpath).click()
+ elif vsys_name == "UIAutoTestVsys":
+ assert int(count[1]) == 2
+ assert self.driver.find_element(By.XPATH, listPage_First_object_ID_posXpath).text == self.vsys0_object["UUID"]
+ assert self.driver.find_element(By.XPATH, listPage_Second_object_ID_posXpath).text == self.uiAutoTestVsys_object["UUID"]
+ self.driver.find_element(By.XPATH,listPage_select_first_object_posXpath).click()
+ self.driver.find_element(By.XPATH,'//span[text()="View"]').click()
+ # add_item_disable = self.driver.element_isExist(by=By.XPATH,value="//div[@class='object-item-add']/div[@class='IconBtn disabled-btn']")
+ # edit_item_disable = self.driver.element_isExist(by=By.XPATH,value="//div[@class='list-container']//div[@class='IconBtn disabled-btn'][1]")
+ # del_item_disable = self.driver.element_isExist(by=By.XPATH,value="//div[@class='list-container']//div[@class='IconBtn disabled-btn'][2]")
+ # assert add_item_disable == edit_item_disable == del_item_disable == True
+ self.driver.isElementExist(APNsObjectPage_button_SaveYes_posXpath)
+ assert self.driver.Exist == False
+ self.driver.find_element(By.XPATH, port_ObjectPage_button_cancel_posXpath).click()
+ self.driver.find_element(By.XPATH, listpage_select_second_object_posXpath).click()
+ self.driver.find_element(By.XPATH, listPage_object_apns_delButton_posXpath).click()
+ self.driver.find_element(By.XPATH, listPage_object_apns_deleteYes_posXpath).click()
def _audit_log_all_operation(self, data):
try:
@@ -1664,27 +1737,33 @@ if __name__ == '__main__':
tun = Tunnels(demo_fixture=driver)
driver.implicitly_wait(5)
- driver.get("http://192.168.45.158")
+ driver.get("http://192.168.44.72")
# driver.get("http://192.168.42.49")
driver.maximize_window()
# driver.find_element(By.NAME, 'username').send_keys("Gary")
# driver.find_element(By.NAME, 'password').send_keys("4garyautoui")
- driver.find_element(By.XPATH, '//input[@placeholder="User name"]').send_keys("admin")
- driver.find_element(By.XPATH, '//input[@placeholder="Password"]').send_keys("admin")
+ driver.find_element(By.XPATH, '//input[@placeholder="User name"]').send_keys("guouitest")
+ driver.find_element(By.XPATH, '//input[@placeholder="Password"]').send_keys("jMIfnvhc1U")
# driver.find_element(By.NAME, 'username').send_keys("User4Link")
# driver.find_element(By.NAME, 'password').send_keys("User4Link")
driver.find_element(By.XPATH, '//button[@class="MuiButtonBase-root MuiButton-root MuiLoadingButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeLarge MuiButton-containedSizeLarge MuiButton-colorPrimary MuiButton-root MuiLoadingButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeLarge MuiButton-containedSizeLarge MuiButton-colorPrimary !bg-[#4487d4] css-zeizzp"]').click()
# 切换Vsys
# profile_pub = ProfilesPublicOperations(driver)
# profile_pub.change_vsys(vsys_name='UIAutoTestVsys')
- tun.tunnels_case(data=
+ tun.create_tunnel(data=
{
- "ids": "Tunnel的增删改查:IP",
- "CreatType": "Tunnel",
- "SubType": "",
- "Search_type": "Name",
- "type": "IP"
- }
+ "ids": "Tunnel中根据IP查询",
+ "Search_type": "IP",
+ "type": "IP",
+ "isDeleteGroup": "True"
+ },
)
+ tun._delete(data=
+ {
+ "ids": "Tunnel中根据IP查询",
+ "Search_type": "IP",
+ "type": "IP",
+ "isDeleteGroup": "True"
+ },)
time.sleep(3)
driver.quit()
diff --git a/page_element/admin_area_element_position.py b/page_element/admin_area_element_position.py
index 0a515bc9..2b8a1248 100644
--- a/page_element/admin_area_element_position.py
+++ b/page_element/admin_area_element_position.py
@@ -683,11 +683,11 @@ object_ip_address_search_result_first = '(//*[@class="table-status-box"])[1]'
admin_logs_target_ids_column = '//span[@class="bfId"]' #该列元素集合
object_ip_address_delete_button = '//*[@id="appDel-_OperateBtns_ElRow_Objects_ip_Home_App_anonymousComponent"]'
object_ip_address_delete_confirm = '(//*[@class="dialog-footer"])[2]/button[1]'
-url_ObjectDetailPage_auditLogsDrawer_compareDrawer_operationText_posXpath = '//div[contains(text(),"Operation")]/following-sibling::div' # Audit Logs 侧滑页点击Compare后的 operation text Xpath
-ObjectDetailPage_audit_log_compare_type_posXpath = '//div[@class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-2.5 css-n8utul"]/div[3]'
-ObjectDetailPage_audit_log_compare_ip_posXpath = '//div[@class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-2.5 css-n8utul"]/div[4]'
-ObjectDetailPage_audit_log_compare_time_posXpath = '//div[@class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-2.5 css-n8utul"]/div[5]'
-ObjectDetailPage_audit_log_compare_user_posXpath = '//div[@class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-2.5 css-n8utul"]/div[6]'
+url_ObjectDetailPage_auditLogsDrawer_compareDrawer_operationText_posXpath1 = '//div[@class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-2.5 css-n8utul"]/div[3]' # Audit Logs 侧滑页点击Compare后的 operation text Xpath
+ObjectDetailPage_audit_log_compare_type_posXpath1 = '//div[@class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-2.5 css-n8utul"]/div[4]'
+ObjectDetailPage_audit_log_compare_ip_posXpath1 = '//div[@class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-2.5 css-n8utul"]/div[5]'
+ObjectDetailPage_audit_log_compare_time_posXpath1 = '//div[@class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-2.5 css-n8utul"]/div[6]'
+ObjectDetailPage_audit_log_compare_user_posXpath1 = '//div[@class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-2.5 css-n8utul"]/div[7]'
ObjectDetailPage_audit_log_cancel_posXpath = '//button[text()="Cancel"]'
# My Account模块
menu_first_user_posXpath = "//*[@id='user_avator']" # 右上角当前登录账号
diff --git a/page_element/ln_objects_element_position.py b/page_element/ln_objects_element_position.py
index 951e2a76..b884b81d 100644
--- a/page_element/ln_objects_element_position.py
+++ b/page_element/ln_objects_element_position.py
@@ -106,7 +106,7 @@ listPage_objectSearch_Tunnels_buttonClear_posId = "searchClear" #清空查�
listPage_objectSearch_Tunnels_AllButton_posxpath = listPage_objectSearch_APNs_All_Button_posxpath #列表的All按钮
listPage_objectSearch_Tunnels_Total_posxpath = "(//div[@class='flex-1']//span[@class='text-textColor'])[1]" #列表的总条数total
-listPage_object_tunnel_type_Button_posXpath="//div[@class='MuiDataGrid-columnsManagement css-1v3xuhs']//span[text()='Type']" #Colum-Type Button
+listPage_object_tunnel_type_Button_posXpath="//span[text()='Type']" #Colum-Type Button
listPage_object_Tunnels_select_First_object_posXpath = listPage_object_APNs_select_First_object_posXpath #列表中第一行数据前的复选框
listPage_object_Tunnels_select_second_object_posXpath=listPage_object_APNs_select_Second_object_posXpath #列表中第二行数据前的复选框
@@ -129,7 +129,8 @@ Tunnel_add_item_button="//div[@class='tunnel-object-endpointA']//i[@class='iconf
tunnel_ip_list_first = "//div[@class='pt-[2px] overflow-hidden flex-1']//ul/li[1]//div[@class='flex h-[22px] leading-[22px] MuiBox-root css-14di81r']"
tunnel_add_endpoint_b= "//div[@class='tunnel-object-endpointB']"
tunnel_add_item_2="//div[@class='tunnel-object-endpointB']//i[@class='iconfont icon-Create1 font-[700]']"
-tunnel_ip_list_fourth="//div[@class='pt-[2px] overflow-hidden flex-1']//ul/li[9]//div[@class='flex h-[22px] leading-[22px] MuiBox-root css-14di81r']"
+tunnel_end_point_b_frame = 'v[@class="tunnel-object-endpointB"]//div[@class="MuiBox-root css-kh10be"]'
+tunnel_ip_list_fourth="//div[@class='pt-[2px] overflow-hidden flex-1']//ul/li[2]//div[@class='flex h-[22px] leading-[22px] MuiBox-root css-14di81r']"
tunnel_page_description="//div[@class='tunnel-object-description']//textarea[1]"
tunnel_ip_list_close="//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-zcc2bs']"
tunnel_ip_list_close2 = "(//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-zcc2bs'])[2]"
@@ -137,14 +138,14 @@ tunnel_ip_list_add_button='//i[@class="iconfont icon-Create1"]'
tunnel_ip_list_select_ip='//li[normalize-space(text())="Address"]'
tunnel_ip_list_select_ip_group='//li[normalize-space(text())="Address Group"]'
tunnel_ip_group_add_subobject="//div[@class='ip-object-included_sub_object_uuids']"
-tunnel_slide_ip_name="//div[@class='MuiBox-root css-1krxo6z']//div[@class='ip-object-name']//input"
-tunnel_slide_ip_item_add="//div[@class='MuiBox-root css-1krxo6z']//i[@class='iconfont icon-Create1 font-[700]']"
-tunnel_slide_ip_item_input="//div[@class='MuiBox-root css-1krxo6z']//input[@class='MuiAutocomplete-input css-1lv7pyi']"
-tunnel_slide_ip_item_save="//div[@class='MuiBox-root css-1krxo6z']//i[@class='operate-icon iconfont icon-save']"
-tunnel_slide_ip_ok="//div[@class='MuiBox-root css-1krxo6z']//button[@class='MuiButtonBase-root MuiButton-root MuiLoadingButton-root MuiButton-text MuiButton-textPrimary MuiButton-sizeSmall MuiButton-textSizeSmall MuiButton-colorPrimary MuiButton-root MuiLoadingButton-root MuiButton-text MuiButton-textPrimary MuiButton-sizeSmall MuiButton-textSizeSmall MuiButton-colorPrimary form-action-submit css-1djnbgz']"
+tunnel_slide_ip_name="(//input[@class='MuiInput-input css-fqt4w4'])[2]"
+tunnel_slide_ip_item_add="(//i[@class='iconfont icon-Create1 font-[700]'])[3]"
+tunnel_slide_ip_item_input="(//input[@class='MuiAutocomplete-input css-1lv7pyi'])"
+tunnel_slide_ip_item_save="//i[@class='operate-icon iconfont icon-save']"
+tunnel_slide_ip_ok="(//button[@class='MuiButtonBase-root MuiButton-root MuiLoadingButton-root MuiButton-text MuiButton-textPrimary MuiButton-sizeSmall MuiButton-textSizeSmall MuiButton-colorPrimary MuiButton-root MuiLoadingButton-root MuiButton-text MuiButton-textPrimary MuiButton-sizeSmall MuiButton-textSizeSmall MuiButton-colorPrimary form-action-submit css-1djnbgz'])[2]"
tunnel_slide_ip_confirm_ok='//*[@class="el-button el-button--default el-button--small el-button--primary operation-confirm"]'
tunnel_item_search_frame = "//div[@class='tunnel-object-endpointA']//input[@placeholder='Search For']"
-tunnel_first_row_item="//div[@class='flex flex-col items-center px-[4px] select-picker']//ul/li[1]//span"
+tunnel_first_row_item = '//div[@class="flex h-[22px] leading-[22px] MuiBox-root css-j0s0fv"]//span'
tunnel_ip_group_first_row="(//div[@class='pt-[2px] overflow-hidden flex-1'])[2]//ul//li[1]"
tunnel_edit_endpointa_posXpath = '//*[@id="tunnelOperateItem-_EndpointAList_ElFormItem_ElForm_VPanel_VEditPanel_tunnelAdd_Home_App_anonymousComponent"]/i'
tunnel_edit_endpointa_item_posXpath ='//*[@id="router-view-container"]//div[@class="IconBtn"]/i[@class="operate-icon iconfont icon-Edit"]'
@@ -160,7 +161,7 @@ TunnelsObjectPage_button_warningSaveYes_posSelector = 'body > div.el-message-box
listPage_objectSearch_Tunnels_select_all_xpath= "//ul[@class='base-Popper-root MuiAutocomplete-listbox css-18r31z0']//li[1]"
listPage_objectSearch_Tunnels_select_Id_posId = "1-_FilteredSearch_ElRow_Objects_tunnel_Home_App_anonymousComponent" #查询ID
listPage_objectSearch_Tunnels_select_Name_posId ="//ul[@class='base-Popper-root MuiAutocomplete-listbox css-18r31z0']//span[text()='Name']" #查询Name
-listPage_objectSearch_Tunnels_select_IP_posId = "//ul[@class='base-Popper-root MuiAutocomplete-listbox css-18r31z0']//span[text()='ip']" #查询IP
+listPage_objectSearch_Tunnels_select_IP_posId = "//ul[@class='base-Popper-root MuiAutocomplete-listbox css-18r31z0']//span[text()='IP']" #查询IP
#Object Attributes===================Attributes====================Attributes=================Attributes=======================Attributes=================Attributes================
diff --git a/page_element/objects_element_position.py b/page_element/objects_element_position.py
index 012baa50..aca5a47e 100644
--- a/page_element/objects_element_position.py
+++ b/page_element/objects_element_position.py
@@ -137,7 +137,7 @@ main_Group_sub_Object_input_frame_posXpath = "//input[@class='MuiInput-input css
main_Group_sub_Object_input_frame_select_one_posXpath = "//ul[@class='MuiList-root MuiList-vertical MuiList-variantPlain MuiList-colorNeutral MuiList-sizeMd css-1cklc3']/li[1]//div[@class='flex h-[22px] leading-[22px] MuiBox-root css-14di81r']" # 搜索框第一个元素
# 列表页
main_listPage_object_reference_count_posXpath = "//div[@class='MuiDataGrid-virtualScrollerContent css-0']/div/div[2]//div[@data-field='reference_count']/button" # 提取reference的数量《断言》
-main_listPage_object_statistics_view_postXpath = "(//div[@class='MuiDataGrid-virtualScrollerContent css-0']//div[@data-field='statistics'])[2]"
+main_listPage_object_statistics_view_postXpath = '(//button[text()="View"])[1]'
main_listPage_object_bottomTotal_postXpath = "//div[@class='flex-1 flex items-center justify-center undefined']/span[1]" # 列表页底部Total元素
# object导入文件Xpath路径
main_ObjectPage_Input_path_Import_files_posXpath = "//div[@class='flex flex-col justify-start flex-1 MuiBox-root css-0']//input[@type='file']"
@@ -1248,7 +1248,7 @@ acc_ObjectDetailPage_auditLogsDrawer_compareButton_posXpath = url_ObjectDetailPa
acc_ObjectDetailPage_auditLogsDrawer_compareDrawer_operationText_posXpath = url_ObjectDetailPage_auditLogsDrawer_compareDrawer_operationText_posXpath # Audit Logs 侧滑页点击Compare后的 operation text Xpath
acc_ObjectDetailPage_itemsTotal_posXpath = url_ObjectDetailPage_itemsTotal_posXpath # Items Total Xpath
acc_ObjectDetailPage_clearCounter_posXpath = url_ObjectDetailPage_clearCounter_posXpath # Clear Counter 按钮
-acc_ObjectDetailPage_objectStatistics_dropDown_posXpath = "//div[@class='MuiSelect-root MuiSelect-variantOutlined MuiSelect-colorNeutral MuiSelect-sizeMd css-1lceg5i']" # Statistics type下拉框
+acc_ObjectDetailPage_objectStatistics_dropDown_posXpath = "//div[@class='MuiSelect-root MuiSelect-variantOutlined MuiSelect-colorNeutral MuiSelect-sizeMd css-1lceg5i']//button" # Statistics type下拉框
acc_ObjectDetailPage_objectStatistics_elaborate_posXpath = "//ul[@class='base-Popper-root MuiSelect-listbox Mui-expanded css-1ufo3gk']//*[text()='Elaborate']" # object_statistics下的Elaborate选项
acc_ObjectDetailPage_objectStatistics_brief_posXpath = "//ul[@class='base-Popper-root MuiSelect-listbox Mui-expanded css-1ufo3gk']//*[text()='Brief']" # object_statistics下的 Brief 选项
acc_ObjectDetailPage_objectStatistics_none_posXpath = "//ul[@class='base-Popper-root MuiSelect-listbox Mui-expanded css-1ufo3gk']//*[text()=’None‘]" # object_statistics下的 None 选项
@@ -1271,28 +1271,28 @@ ObjectDetailPage_importDrawer_importTipsValue_Total_posXpath = "//div[@class='Mu
ObjectDetailPage_importDrawer_importTable_Failed_items_posXpath = '//i[@class="iconfont icon-Dashboarddisablepolicy text-[var(--color-error)] pr-[4px]"]'
ObjectDetailPage_importDrawer_importTable_Total_posXpath ="(//div[@class='flex-1 mt-[20px]']//div[@class='flex-1 flex items-center justify-center undefined']//span[@class='text-textColor'])[1]"
# 对象组详情页
+accGroup_ObjectDetailPage_excludeObjectsSwitch_enableStatus_posXpath = "//div[@class='account-object-']//span[@class='MuiButtonBase-root MuiSwitch-switchBase MuiSwitch-colorPrimary Mui-checked PrivateSwitchBase-root MuiSwitch-switchBase MuiSwitch-colorPrimary Mui-checked Mui-checked css-y2jqxi']" # Exclude Objects Switch Xpath开启状态
acc_ObjectGroupDetailPage_subObjects_addButton_normalAdd_posXpath = "//div[@class='account-object-included_sub_object_uuids']// i[@class='iconfont icon-Create1 text-[18px] font-[700] text-[--color-primary] cursor-pointer']" # Subordinate Objects 下有数据新增时"+"按钮Xpath
-acc_ObjectGroupDetailPage_excludeObjects_addButton_normalAdd_posXpath = "//div[@class='account-object-excluded_sub_object_uuids']//i[@class='iconfont icon-Create1 text-[18px] text-weight-700] text-[--color-primary] cursor-pointer']" # Exclude Objects 下有数据新增时"+"按钮Xpath
-acc_ObjectGroupDetailPage_subObjects_addButton_newAdd_posXpath = "//div[@class='account-object-included_sub_object_uuids']" # Subordinate Objects 下无数据新增时"+"按钮Xpath
-acc_ObjectGroupDetailPage_excludeObjects_addButton_newAdd_posXpath = "//div[@class='account-object-excluded_sub_object_uuids']" # Exclude Objects 下无数据新增时"+"按钮Xpath
+acc_ObjectGroupDetailPage_excludeObjects_addButton_normalAdd_posXpath = "//div[@class='account-object-excluded_sub_object_uuids']//i[@class='iconfont icon-Create1 text-[18px] font-[700] text-[--color-primary] cursor-pointer']" # Exclude Objects 下有数据新增时"+"按钮Xpath
+acc_ObjectGroupDetailPage_subObjects_addButton_newAdd_posXpath = "//div[@class='account-object-included_sub_object_uuids']//i" # Subordinate Objects 下无数据新增时"+"按钮Xpath
+acc_ObjectGroupDetailPage_excludeObjects_addButton_newAdd_posXpath = "//div[@class='account-object-excluded_sub_object_uuids']//i" # Exclude Objects 下无数据新增时"+"按钮Xpath
acc_ObjectDetailPage_firstAccObject = url_ObjectDetailPage_firstUrlObject ## 侧滑Objects列表中第一个acc object Xpath
acc_ObjectGroupDetailPage_subObjects_search_posId = url_ObjectDetailPage_object_ip_search_posId # Subordinate Objects 下搜索框id
acc_ObjectGroupDetailPage_subObjects_toggleDraw_addButton_posXpath = "//button[@class='MuiIconButton-root MuiIconButton-variantPlain MuiIconButton-colorNeutral MuiIconButton-sizeMd MuiMenuButton-root MuiMenuButton-variantOutlined MuiMenuButton-colorNeutral MuiMenuButton-sizeMd css-83p2rh']" # Accounts侧滑窗口的"+"按钮
acc_ObjectGroupDetailPage_subObjects_toggleDraw_closeButton_posXpath = url_ObjectGroupDetailPage_subObjects_toggleDraw_closeButton_posXpath # Accounts侧滑窗口的Close按钮
acc_ObjectGroupDetailPage_subObjects_toggleDraw_addButton_account_posXpath = objectPage_group_sub_object_add_new_select_button_posXpath # Accounts侧滑窗口的"+"按钮下的Account
-acc_ObjectGroupDetailPage_subObjects_subCreateAccountDrawer_nameInput_posXpath = "//div[@class='MuiBox-root css-1krxo6z']//input[@class='MuiInput-input css-fqt4w4']" # 侧滑子Create Account页面Name input Xpath
+acc_ObjectGroupDetailPage_subObjects_subCreateAccountDrawer_nameInput_posXpath = "(//input[@class='MuiInput-input css-fqt4w4'])[2]" # 侧滑子Create Account页面Name input Xpath
acc_ObjectGroupDetailPage_subObjects_subCreateAccountDrawer_itemsAddButton_posXpath = "//div[@class='items']//i[@class='iconfont icon-Create1 font-[700]']" # 侧滑子Create Account页面中Items下的"+"按钮 Xpath
-acc_ObjectGroupDetailPage_subObjects_subCreateAccountDrawer_itemsValueInput_posXpath = "//div[@class='MuiBox-root css-1krxo6z']//input[@class='MuiInput-input css-1u0jcuo']" # 侧滑子Create Account页面中Items下的item value输入框 Xpath
+acc_ObjectGroupDetailPage_subObjects_subCreateAccountDrawer_itemsValueInput_posXpath = '//div[@class="account-object-expression"]//input' # 侧滑子Create Account页面中Items下的item value输入框 Xpath
acc_ObjectGroupDetailPage_subObjects_subCreateAccountDrawer_itemsValueSaveButton_posXpath = "//i[@class='operate-icon iconfont icon-save']" # 侧滑子Create Account页面中Items下的保存按钮 Xpath
acc_ObjectGroupDetailPage_subObjects_subCreateAccountDrawer_descriptionTextarea_posXpath = '(//textarea[@placeholder="Please enter the content"])[2]' # 侧滑子Create Account页面中的Description textarea Xpath
-acc_ObjectGroupDetailPage_subObjects_subCreateAccountDrawer_okButton_posXpath = "//div[@class='MuiBox-root css-1krxo6z']//button[@class='MuiButtonBase-root MuiButton-root MuiLoadingButton-root MuiButton-text MuiButton-textPrimary MuiButton-sizeSmall MuiButton-textSizeSmall MuiButton-colorPrimary MuiButton-root MuiLoadingButton-root MuiButton-text MuiButton-textPrimary MuiButton-sizeSmall MuiButton-textSizeSmall MuiButton-colorPrimary form-action-submit css-1djnbgz']" # 侧滑子Create Account页面中OK按钮
+acc_ObjectGroupDetailPage_subObjects_subCreateAccountDrawer_okButton_posXpath = "(//button[@class='MuiButtonBase-root MuiButton-root MuiLoadingButton-root MuiButton-text MuiButton-textPrimary MuiButton-sizeSmall MuiButton-textSizeSmall MuiButton-colorPrimary MuiButton-root MuiLoadingButton-root MuiButton-text MuiButton-textPrimary MuiButton-sizeSmall MuiButton-textSizeSmall MuiButton-colorPrimary form-action-submit css-1djnbgz'])[2]" # 侧滑子Create Account页面中OK按钮
acc_ObjectGroupDetailPage_subObjects_subCreateAccountDrawer_okButton_yes_posXpath = url_ObjectDetailPage_okButton_yes_posXpath # 侧滑子Create Account页面确认弹窗的“Yes”按钮
acc_ObjectGroupDetailPage_subObjects_subCreateAccountDrawer_okButton_cancel_posXpath = url_ObjectDetailPage_okButton_cancel_posXpath # 侧滑子Create Account页面确认弹窗的“Cancel”按钮
-accGroup_ObjectDetailPage_excludeObjectsSwitch_posXpath = urlGroup_ObjectDetailPage_excludeObjectsSwitch_posXpath # Exclude Objects Switch Xpath
-accGroup_ObjectDetailPage_excludeObjectsSwitch_enableStatus_posXpath = urlGroup_ObjectDetailPage_excludeObjectsSwitch_enableStatus_posXpath # Exclude Objects Switch Xpath开启状态下
-accGroup_ObjectDetailPage_excludeObjectsSwitch_newAdd_posXpath = urlGroup_ObjectDetailPage_excludeObjectsSwitch_newAdd_posXpath # Exclude Objects无数据时新增按钮Xpath
+accGroup_ObjectDetailPage_excludeObjectsSwitch_posXpath = "//div[@class='account-object-']//span[@class='MuiButtonBase-root MuiSwitch-switchBase MuiSwitch-colorPrimary PrivateSwitchBase-root MuiSwitch-switchBase MuiSwitch-colorPrimary css-y2jqxi']" # Exclude Objects Switch Xpath
+accGroup_ObjectDetailPage_excludeObjectsSwitch_newAdd_posXpath = "//div[@class='account-object-excluded_sub_object_uuids']//i[@class='iconfont icon-Create1 font-[700]']" # Exclude Objects无数据时新增按钮Xpath
accGroup_ObjectDetailPage_excludeObjectsSwitch_normalAdd_posXpath = urlGroup_ObjectDetailPage_excludeObjectsSwitch_normalAdd_posXpath # Exclude Objects有数据时新增按钮Xpath
-accGroup_ObjectDetailPage_excludeObjects_itemsArea_posXpath = urlGroup_ObjectDetailPage_excludeObjects_itemsArea_posXpath # Exclude Objects下的item区域div Xpath
+accGroup_ObjectDetailPage_excludeObjects_itemsArea_posXpath = "//div[@class='account-object-excluded_sub_object_uuids']" # Exclude Objects下的item区域div Xpath
acc_ObjectDetailPage_firstObject = url_ObjectDetailPage_firstUrlObject # 侧滑acc Object中第一个url Xpath
acc_ObjectDetailPage_secondObject = url_ObjectDetailPage_secondUrlObject # 侧滑acc Object中第二个url Xpath
acc_ObjectDetailPage_editgroup_posXpath = "//i[@class='row-edit iconfont icon-Edit cursor fontsize18']"
diff --git a/page_element/policies_element_position.py b/page_element/policies_element_position.py
index 4520c16c..4a2e57a1 100644
--- a/page_element/policies_element_position.py
+++ b/page_element/policies_element_position.py
@@ -42,7 +42,7 @@ listPage_policiesSearch_buttonClear_posId = "searchClear" # 清空查询按钮i
# profiles模块列设置
listPage_policiesColumn_columnSetting_posId = "eventfixed" # 列设置按钮
listPage_firstRow_checkBox_posXpath = '(//div[contains(@class,"el-table__body-wrapper")]//tr[contains(@class," table_")]//td//span[@class="el-checkbox__input"])[1]' # 列表页第一行数据的CheckBox
-list_first_row_first_column_posXpath = '//div[@id="ly-table1-listcontent"]//span[text()="ID"]' # 第一行、第一列--ID
+list_first_row_first_column_posXpath = '//div[@aria-rowindex="2"]' # 第一行、第一列--ID
# Policies 底部页码栏===================Policies 底部页码栏=====================Policies 底部页码栏=================Policies 底部页码栏=======================Policies 底部页码栏=================Policies 底部页码栏
listPage_bottomTotal_postXpath = '//div[@class="page-box-containcheck"]//*[@class="el-pagination__total"]' # 列表页底部Total元素
@@ -106,10 +106,10 @@ security_policy_add_button_by_xpath = '//label[(normalize-space(text())="Device"
security_create_Button_posXpath = '//button[@id="app_create-_OperateBtns_ElRow_Objects_ProxyInterception_Home_App_anonymousComponent"]/span' # 安全创建按钮
security_create_Name_input_frame_PosXpath = '//input[@class="MuiInput-input css-fqt4w4"]' # 创建输入Name框
security_create_add_source_button_click_PosXpath = '//div/div/div/div[1]/div[2]/form/div[4]/div/div/div/i' # 创建添加source按钮
-security_create_add_tunnel_button_click_PosXpath = '(//div[(normalize-space(text())="Tunnel")])[2]' # 选择tunnel按钮
-security_add_tunnel_button = '(//*[@class="iconfont icon-Create1 cursor"])[1]'
+security_create_add_tunnel_button_click_PosXpath = '(//div[(normalize-space(text())="Tunnel")])' # 选择tunnel按钮
+security_add_tunnel_button = '//label[text()="Tunnel"]/ancestor::div[@class="flex flex-row group"]//button'
security_search_tunnel_frame_click_PosXpath = '(//*[@id="object_ip_search"])[2]' # tunnel搜索框
-security_first_tunnel_inlist_click_PosXpath = '(//*[@class="ellipsis list-popover-click"])[1]' # tunnel列表页的第一个元素
+security_first_tunnel_inlist_click_PosXpath = '//ul[@class="MuiList-root MuiList-vertical MuiList-variantPlain MuiList-colorNeutral MuiList-sizeMd css-1cklc3"]/li[1]' # tunnel列表页的第一个元素
security_first_add_App_Group_right_top_click_PosXpath = '//*[@id="tab-group"]' # "+"App,列表页选择App Group
security_first_app_group_inlist_click_PosXpath = '//div/div/div/div[3]/div[1]/div/div[2]/ul/li[1]/div[2]/span/div[2]/div/span' # App Group列表页的第一个元素
security_create_add_source_button_right_click_PosXpath = '//div[2]/div/div[1]/div/div/div/div[2]/div/div/div[1]/div/span[2]/i' # 右划选择框
diff --git a/testdata/ui_data/objects_data/Accounts/base_accounts.json b/testdata/ui_data/objects_data/Accounts/base_accounts.json
index f78f24bb..bcaa5ee6 100644
--- a/testdata/ui_data/objects_data/Accounts/base_accounts.json
+++ b/testdata/ui_data/objects_data/Accounts/base_accounts.json
@@ -51,11 +51,7 @@
"Search type": "",
"Name": "",
"Items": [
- "abcd$->^aaaa$",
- "^abcd.cc->^bbbb.cxc",
- "[random]->[删除]",
- "^asdas.zz->[random]",
- "[random]->[random]"
+ "abcd$->^aaaa$"
],
"Description": ""
},
@@ -204,19 +200,6 @@
"Subordinate Objects": ""
},
{
- "ids": "ID作为搜索条件进行模糊查询-T074-1",
- "Model": "create",
- "Type": 0,
- "Name": "",
- "Search type": "Name",
- "fuzzy_search": "True",
- "Items": [
- "[random]->"
- ],
- "Description": "",
- "Subordinate Objects": ""
- },
- {
"ids": "Name作为搜索条件进行查询-T074-2",
"Model": "create",
"Type": 0,
@@ -267,55 +250,6 @@
"Subordinate Objects": ""
},
{
- "ids": "Created By作为搜索条件进行模糊查询-T074-4",
- "Model": "create",
- "Type": 0,
- "Name": "test_ui_test_ui323",
- "Search type": "Created By",
- "Items": [
- "[random]->"
- ],
- "Description": "",
- "Subordinate Objects": ""
- },
- {
- "ids": "Details作为搜索条件进行查询-T074-5",
- "Model": "create",
- "Type": 0,
- "Name": "test_ui_test_ui323",
- "Search type": "Details",
- "Items": [
- "aaacccsee->"
- ],
- "Description": "",
- "Subordinate Objects": ""
- },
- {
- "ids": "Details作为搜索条件进行模糊查询-T074-5",
- "Model": "create",
- "Type": 0,
- "Name": "test_ui_test_ui323",
- "Search type": "Details",
- "fuzzy_search": "True",
- "Items": [
- "aaacccsee->"
- ],
- "Description": "",
- "Subordinate Objects": ""
- },
- {
- "ids": "ID作为搜索条件进行查询-T075-1",
- "Model": "create",
- "Type": 0,
- "Name": "",
- "Search type": "Name",
- "Items": [
- "accounts_item导入文件.txt[ImportFromFile]->"
- ],
- "Description": "",
- "Subordinate Objects": ""
- },
- {
"ids": "Name作为搜索条件进行模糊查询-T075-2",
"Model": "create",
"Type": 0,
@@ -338,30 +272,6 @@
],
"Description": "",
"Subordinate Objects": ""
- },
- {
- "ids": "Created By作为搜索条件进行模糊查询-T075-4",
- "Model": "create",
- "Type": 0,
- "Name": "test_ui_test_ui323",
- "Search type": "Created By",
- "Items": [
- "accounts_item导入文件.txt[ImportFromFile]->"
- ],
- "Description": "",
- "Subordinate Objects": ""
- },
- {
- "ids": "Details作为搜索条件进行模糊查询-T075-5",
- "Model": "create",
- "Type": 0,
- "Name": "test_ui_test_ui323",
- "Search type": "Details",
- "Items": [
- "accounts_item导入文件.txt[ImportFromFile]->"
- ],
- "Description": "",
- "Subordinate Objects": ""
}
]
}
diff --git a/testdata/ui_data/objects_data/tunnels.json b/testdata/ui_data/objects_data/tunnels.json
index 0e201d62..20e5837b 100644
--- a/testdata/ui_data/objects_data/tunnels.json
+++ b/testdata/ui_data/objects_data/tunnels.json
@@ -13,7 +13,7 @@
"CreatType":"Tunnel",
"SubType":"",
"Search_type":"Name",
- "type": "GRE"
+ "type": "GRE"
},
{
"ids":"Tunnel的增删改查:GTP",