Commit ea5a1ae4 authored by 王超's avatar 王超

更新开关按钮

parent 9c3c198d
......@@ -12,222 +12,222 @@ from Pages.PageManagementPage.SwitchButtonPage import SwitchButtonPage
@allure.epic("CMS2.0UI自动化测试")
@allure.feature("开关组件")
class Test_SwitchButton:
# @allure.story("开关按钮-创建开关按钮组件")
# @pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_创建开关按钮_实际图", "开关按钮_创建开关按钮_预期图")])
# def test_create_SwitchButton(self, page, create_page, filename, actual_img_name, expect_img_name):
# bp = BasePage(page)
# bp._goto_url("画面")
# sbp =SwitchButtonPage(page)
# sbp.create_switch_button()
# time.sleep(1)
# result = bp.compare_images(filename, actual_img_name, expect_img_name)
# bp.allure_reports(filename, actual_img_name, expect_img_name)
# assert result, f"页面截图与预期截图不一致"
#
# @allure.story("开关按钮-位置-修改x、y、w、h属性")
# @pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_修改xywh属性_实际图", "开关按钮_修改xywh属性_预期图")])
# def test_SwitchButton_set_xywh_axis(self, page, create_page, filename, actual_img_name,expect_img_name):
# bp = BasePage(page)
# bp._goto_url("画面")
# sbp =SwitchButtonPage(page)
# sbp.set_xywh()
# time.sleep(1)
# result = bp.compare_images(filename, actual_img_name, expect_img_name)
# bp.allure_reports(filename, actual_img_name, expect_img_name)
# assert result, f"页面截图与预期截图不一致"
#
# @allure.story("开关按钮-位置-修改旋转角度")
# @pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_修改旋转角度_实际图", "开关按钮_修改旋转角度_预期图")])
# def test_SwitchButton_set_rotation_angle(self, page, create_page, filename, actual_img_name,expect_img_name):
# bp = BasePage(page)
# bp._goto_url("画面")
# sbp =SwitchButtonPage(page)
# sbp.set_rotation_angle()
# time.sleep(1)
# result = bp.compare_images(filename, actual_img_name, expect_img_name)
# bp.allure_reports(filename, actual_img_name, expect_img_name)
# assert result, f"页面截图与预期截图不一致"
#
# @allure.story("开关按钮-位置-设置锁定")
# @pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_设置锁定_实际图", "开关按钮_设置锁定_预期图")])
# def test_SwitchButton_set_lock(self, page, create_page, filename, actual_img_name, expect_img_name):
# bp = BasePage(page)
# bp._goto_url("画面")
# sbp =SwitchButtonPage(page)
# sbp.set_lock()
# time.sleep(1)
# result = bp.compare_images(filename, actual_img_name, expect_img_name)
# bp.allure_reports(filename, actual_img_name, expect_img_name)
# assert result, f"页面截图与预期截图不一致"
#
# @allure.story("开关按钮-外观-设置直线边框")
# @pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_设置直线边框_实际图", "开关按钮_设置直线边框_预期图")])
# def test_SwitchButton_set_straight_line_frame(self, page, create_page, filename, actual_img_name,expect_img_name):
# bp = BasePage(page)
# bp._goto_url("画面")
# sbp =SwitchButtonPage(page)
# sbp.set_straight_line_frame() # 直线
# time.sleep(1)
# result = bp.compare_images(filename, actual_img_name, expect_img_name)
# bp.allure_reports(filename, actual_img_name, expect_img_name)
# assert result, f"页面截图与预期截图不一致"
#
# @allure.story("开关按钮-外观-设置虚线边框")
# @pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_设置虚线边框_实际图", "开关按钮_设置虚线边框_预期图")])
# def test_SwitchButton_set_dashed_line_frame(self, page, create_page, filename, actual_img_name,expect_img_name):
# bp = BasePage(page)
# bp._goto_url("画面")
# sbp =SwitchButtonPage(page)
# sbp.set_dashed_line_frame() # 虚线
# time.sleep(1)
# result = bp.compare_images(filename, actual_img_name, expect_img_name)
# bp.allure_reports(filename, actual_img_name, expect_img_name)
# assert result, f"页面截图与预期截图不一致"
#
# @allure.story("开关按钮-外观-设置圆点边框")
# @pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_设置圆点边框_实际图", "开关按钮_设置圆点边框_预期图")])
# def test_SwitchButton_set_scircular_dots_frame(self, page, create_page, filename, actual_img_name,expect_img_name):
# bp = BasePage(page)
# bp._goto_url("画面")
# sbp =SwitchButtonPage(page)
# sbp.set_scircular_dots_frame() # 圆点
# time.sleep(1)
# result = bp.compare_images(filename, actual_img_name, expect_img_name)
# bp.allure_reports(filename, actual_img_name, expect_img_name)
# assert result, f"页面截图与预期截图不一致"
#
# @allure.story("开关按钮-外观-设置无边框")
# @pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_设置无边框_实际图", "开关按钮_设置无边框_预期图")])
# def test_SwitchButton_set_no_frame(self, page, create_page, filename, actual_img_name,expect_img_name):
# bp = BasePage(page)
# bp._goto_url("画面")
# sbp =SwitchButtonPage(page)
# sbp.set_no_frame() # 无边框
# time.sleep(1)
# result = bp.compare_images(filename, actual_img_name, expect_img_name)
# bp.allure_reports(filename, actual_img_name, expect_img_name)
# assert result, f"页面截图与预期截图不一致"
#
# @allure.story("开关按钮-外观-设置内外阴影")
# @pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_设置内外阴影_实际图", "开关按钮_设置内外阴影_预期图")])
# def test_SwitchButton_set_shadow(self, page, create_page, filename, actual_img_name, expect_img_name):
# bp = BasePage(page)
# bp._goto_url("画面")
# sbp =SwitchButtonPage(page)
# sbp.set_shadow() # 设置内外阴影
# time.sleep(1)
# result = bp.compare_images(filename, actual_img_name, expect_img_name)
# bp.allure_reports(filename, actual_img_name, expect_img_name)
# assert result, f"页面截图与预期截图不一致"
#
# @allure.story("开关按钮-外观-设置圆角")
# @pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_设置圆角_实际图", "开关按钮_设置圆角_预期图")])
# def test_SwitchButton_set_rounded_corners(self, page, create_page, filename, actual_img_name,expect_img_name):
# bp = BasePage(page)
# bp._goto_url("画面")
# sbp =SwitchButtonPage(page)
# sbp.set_rounded_corners()
# time.sleep(1)
# result = bp.compare_images(filename, actual_img_name, expect_img_name)
# bp.allure_reports(filename, actual_img_name, expect_img_name)
# assert result, f"页面截图与预期截图不一致"
#
# @allure.story("开关按钮-外观-设置不透明度")
# @pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_设置不透明度_实际图", "开关按钮_设置不透明度_预期图")])
# def test_SwitchButton_set_opacity(self, page, create_page, filename, actual_img_name, expect_img_name):
# bp = BasePage(page)
# bp._goto_url("画面")
# sbp =SwitchButtonPage(page)
# sbp.set_opacity()
# time.sleep(1)
# result = bp.compare_images(filename, actual_img_name, expect_img_name)
# bp.allure_reports(filename, actual_img_name, expect_img_name)
# assert result, f"页面截图与预期截图不一致"
#
# @allure.story("开关按钮-文本-设置左对齐")
# @pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_设置左对齐_实际图", "开关按钮_设置左对齐_预期图")])
# def test_SwitchButton_set_left_aligned(self, page, create_page, filename, actual_img_name,expect_img_name):
# bp = BasePage(page)
# bp._goto_url("画面")
# stp = SwitchButtonPage(page)
# stp.set_left_aligned()
# time.sleep(1)
# result = bp.compare_images(filename, actual_img_name, expect_img_name)
# bp.allure_reports(filename, actual_img_name, expect_img_name)
# assert result, f"页面截图与预期截图不一致"
#
# @allure.story("开关按钮-文本-设置居中对齐")
# @pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_设置居中对齐_实际图", "开关按钮_设置居中对齐_预期图")])
# def test_SwitchButton_set_center_aligned(self, page, create_page, filename, actual_img_name,expect_img_name):
# bp = BasePage(page)
# bp._goto_url("画面")
# stp = SwitchButtonPage(page)
# stp.set_center_aligned()
# time.sleep(1)
# result = bp.compare_images(filename, actual_img_name, expect_img_name)
# bp.allure_reports(filename, actual_img_name, expect_img_name)
# assert result, f"页面截图与预期截图不一致"
#
# @allure.story("开关按钮-文本-设置右对齐")
# @pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_设置右对齐_实际图", "开关按钮_设置右对齐_预期图")])
# def test_SwitchButton_set_right_aligned(self, page, create_page, filename, actual_img_name,expect_img_name):
# bp = BasePage(page)
# bp._goto_url("画面")
# stp = SwitchButtonPage(page)
# stp.set_right_aligned()
# time.sleep(1)
# result = bp.compare_images(filename, actual_img_name, expect_img_name)
# bp.allure_reports(filename, actual_img_name, expect_img_name)
# assert result, f"页面截图与预期截图不一致"
#
# @allure.story("开关按钮-文本-设置字号颜色加粗斜体下划线")
# @pytest.mark.parametrize("filename,actual_img_name,expect_img_name", [("SwitchButton", "开关按钮_设置字号颜色加粗斜体下划线_实际图", "开关按钮_设置字号颜色加粗斜体下划线_预期图")])
# def test_SwitchButton_set_font_style(self, page, create_page, filename, actual_img_name,expect_img_name):
# bp = BasePage(page)
# bp._goto_url("画面")
# stp = SwitchButtonPage(page)
# stp.set_font_style()
# time.sleep(1)
# result = bp.compare_images(filename, actual_img_name, expect_img_name)
# bp.allure_reports(filename, actual_img_name, expect_img_name)
# assert result, f"页面截图与预期截图不一致"
#
# @allure.story("开关按钮-文本-设置字体类型")
# @pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_设置字体类型_实际图", "开关按钮_设置字体类型_预期图")])
# def test_SwitchButton_set_font_type(self, page, create_page, filename, actual_img_name,expect_img_name):
# bp = BasePage(page)
# bp._goto_url("画面")
# stp = SwitchButtonPage(page)
# stp.set_font_type()
# time.sleep(1)
# result = bp.compare_images(filename, actual_img_name, expect_img_name)
# bp.allure_reports(filename, actual_img_name, expect_img_name)
# assert result, f"页面截图与预期截图不一致"
#
# @allure.story("开关按钮-文本-设置字距行高")
# @pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_设置字距行高_实际图", "开关按钮_设置字距行高_预期图")])
# def test_SwitchButton_set_font_distance(self, page, create_page, filename, actual_img_name,expect_img_name):
# bp = BasePage(page)
# bp._goto_url("画面")
# stp = SwitchButtonPage(page)
# stp.set_font_distance()
# time.sleep(1)
# result = bp.compare_images(filename, actual_img_name, expect_img_name)
# bp.allure_reports(filename, actual_img_name, expect_img_name)
# assert result, f"页面截图与预期截图不一致"
#
# @allure.story("开关按钮-切换按钮")
# @pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_切换按钮_实际图", "开关按钮_切换按钮_预期图")])
# def test_SwitchButton_switch_btn(self, page, create_page, filename, actual_img_name,expect_img_name):
# bp = BasePage(page)
# bp._goto_url("画面")
# stp = SwitchButtonPage(page)
# stp.test_switch_btn()
# time.sleep(1)
# result = bp.compare_images(filename, actual_img_name, expect_img_name)
# bp.allure_reports(filename, actual_img_name, expect_img_name)
# assert result, f"页面截图与预期截图不一致"
#
@allure.story("开关按钮-创建开关按钮组件")
@pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_创建开关按钮_实际图", "开关按钮_创建开关按钮_预期图")])
def test_create_SwitchButton(self, page, create_page, filename, actual_img_name, expect_img_name):
bp = BasePage(page)
bp._goto_url("画面")
sbp =SwitchButtonPage(page)
sbp.create_switch_button()
time.sleep(1)
result = bp.compare_images(filename, actual_img_name, expect_img_name)
bp.allure_reports(filename, actual_img_name, expect_img_name)
assert result, f"页面截图与预期截图不一致"
@allure.story("开关按钮-位置-修改x、y、w、h属性")
@pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_修改xywh属性_实际图", "开关按钮_修改xywh属性_预期图")])
def test_SwitchButton_set_xywh_axis(self, page, create_page, filename, actual_img_name,expect_img_name):
bp = BasePage(page)
bp._goto_url("画面")
sbp =SwitchButtonPage(page)
sbp.set_xywh()
time.sleep(1)
result = bp.compare_images(filename, actual_img_name, expect_img_name)
bp.allure_reports(filename, actual_img_name, expect_img_name)
assert result, f"页面截图与预期截图不一致"
@allure.story("开关按钮-位置-修改旋转角度")
@pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_修改旋转角度_实际图", "开关按钮_修改旋转角度_预期图")])
def test_SwitchButton_set_rotation_angle(self, page, create_page, filename, actual_img_name,expect_img_name):
bp = BasePage(page)
bp._goto_url("画面")
sbp =SwitchButtonPage(page)
sbp.set_rotation_angle()
time.sleep(1)
result = bp.compare_images(filename, actual_img_name, expect_img_name)
bp.allure_reports(filename, actual_img_name, expect_img_name)
assert result, f"页面截图与预期截图不一致"
@allure.story("开关按钮-位置-设置锁定")
@pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_设置锁定_实际图", "开关按钮_设置锁定_预期图")])
def test_SwitchButton_set_lock(self, page, create_page, filename, actual_img_name, expect_img_name):
bp = BasePage(page)
bp._goto_url("画面")
sbp =SwitchButtonPage(page)
sbp.set_lock()
time.sleep(1)
result = bp.compare_images(filename, actual_img_name, expect_img_name)
bp.allure_reports(filename, actual_img_name, expect_img_name)
assert result, f"页面截图与预期截图不一致"
@allure.story("开关按钮-外观-设置直线边框")
@pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_设置直线边框_实际图", "开关按钮_设置直线边框_预期图")])
def test_SwitchButton_set_straight_line_frame(self, page, create_page, filename, actual_img_name,expect_img_name):
bp = BasePage(page)
bp._goto_url("画面")
sbp =SwitchButtonPage(page)
sbp.set_straight_line_frame() # 直线
time.sleep(1)
result = bp.compare_images(filename, actual_img_name, expect_img_name)
bp.allure_reports(filename, actual_img_name, expect_img_name)
assert result, f"页面截图与预期截图不一致"
@allure.story("开关按钮-外观-设置虚线边框")
@pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_设置虚线边框_实际图", "开关按钮_设置虚线边框_预期图")])
def test_SwitchButton_set_dashed_line_frame(self, page, create_page, filename, actual_img_name,expect_img_name):
bp = BasePage(page)
bp._goto_url("画面")
sbp =SwitchButtonPage(page)
sbp.set_dashed_line_frame() # 虚线
time.sleep(1)
result = bp.compare_images(filename, actual_img_name, expect_img_name)
bp.allure_reports(filename, actual_img_name, expect_img_name)
assert result, f"页面截图与预期截图不一致"
@allure.story("开关按钮-外观-设置圆点边框")
@pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_设置圆点边框_实际图", "开关按钮_设置圆点边框_预期图")])
def test_SwitchButton_set_scircular_dots_frame(self, page, create_page, filename, actual_img_name,expect_img_name):
bp = BasePage(page)
bp._goto_url("画面")
sbp =SwitchButtonPage(page)
sbp.set_scircular_dots_frame() # 圆点
time.sleep(1)
result = bp.compare_images(filename, actual_img_name, expect_img_name)
bp.allure_reports(filename, actual_img_name, expect_img_name)
assert result, f"页面截图与预期截图不一致"
@allure.story("开关按钮-外观-设置无边框")
@pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_设置无边框_实际图", "开关按钮_设置无边框_预期图")])
def test_SwitchButton_set_no_frame(self, page, create_page, filename, actual_img_name,expect_img_name):
bp = BasePage(page)
bp._goto_url("画面")
sbp =SwitchButtonPage(page)
sbp.set_no_frame() # 无边框
time.sleep(1)
result = bp.compare_images(filename, actual_img_name, expect_img_name)
bp.allure_reports(filename, actual_img_name, expect_img_name)
assert result, f"页面截图与预期截图不一致"
@allure.story("开关按钮-外观-设置内外阴影")
@pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_设置内外阴影_实际图", "开关按钮_设置内外阴影_预期图")])
def test_SwitchButton_set_shadow(self, page, create_page, filename, actual_img_name, expect_img_name):
bp = BasePage(page)
bp._goto_url("画面")
sbp =SwitchButtonPage(page)
sbp.set_shadow() # 设置内外阴影
time.sleep(1)
result = bp.compare_images(filename, actual_img_name, expect_img_name)
bp.allure_reports(filename, actual_img_name, expect_img_name)
assert result, f"页面截图与预期截图不一致"
@allure.story("开关按钮-外观-设置圆角")
@pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_设置圆角_实际图", "开关按钮_设置圆角_预期图")])
def test_SwitchButton_set_rounded_corners(self, page, create_page, filename, actual_img_name,expect_img_name):
bp = BasePage(page)
bp._goto_url("画面")
sbp =SwitchButtonPage(page)
sbp.set_rounded_corners()
time.sleep(1)
result = bp.compare_images(filename, actual_img_name, expect_img_name)
bp.allure_reports(filename, actual_img_name, expect_img_name)
assert result, f"页面截图与预期截图不一致"
@allure.story("开关按钮-外观-设置不透明度")
@pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_设置不透明度_实际图", "开关按钮_设置不透明度_预期图")])
def test_SwitchButton_set_opacity(self, page, create_page, filename, actual_img_name, expect_img_name):
bp = BasePage(page)
bp._goto_url("画面")
sbp =SwitchButtonPage(page)
sbp.set_opacity()
time.sleep(1)
result = bp.compare_images(filename, actual_img_name, expect_img_name)
bp.allure_reports(filename, actual_img_name, expect_img_name)
assert result, f"页面截图与预期截图不一致"
@allure.story("开关按钮-文本-设置左对齐")
@pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_设置左对齐_实际图", "开关按钮_设置左对齐_预期图")])
def test_SwitchButton_set_left_aligned(self, page, create_page, filename, actual_img_name,expect_img_name):
bp = BasePage(page)
bp._goto_url("画面")
stp = SwitchButtonPage(page)
stp.set_left_aligned()
time.sleep(1)
result = bp.compare_images(filename, actual_img_name, expect_img_name)
bp.allure_reports(filename, actual_img_name, expect_img_name)
assert result, f"页面截图与预期截图不一致"
@allure.story("开关按钮-文本-设置居中对齐")
@pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_设置居中对齐_实际图", "开关按钮_设置居中对齐_预期图")])
def test_SwitchButton_set_center_aligned(self, page, create_page, filename, actual_img_name,expect_img_name):
bp = BasePage(page)
bp._goto_url("画面")
stp = SwitchButtonPage(page)
stp.set_center_aligned()
time.sleep(1)
result = bp.compare_images(filename, actual_img_name, expect_img_name)
bp.allure_reports(filename, actual_img_name, expect_img_name)
assert result, f"页面截图与预期截图不一致"
@allure.story("开关按钮-文本-设置右对齐")
@pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_设置右对齐_实际图", "开关按钮_设置右对齐_预期图")])
def test_SwitchButton_set_right_aligned(self, page, create_page, filename, actual_img_name,expect_img_name):
bp = BasePage(page)
bp._goto_url("画面")
stp = SwitchButtonPage(page)
stp.set_right_aligned()
time.sleep(1)
result = bp.compare_images(filename, actual_img_name, expect_img_name)
bp.allure_reports(filename, actual_img_name, expect_img_name)
assert result, f"页面截图与预期截图不一致"
@allure.story("开关按钮-文本-设置字号颜色加粗斜体下划线")
@pytest.mark.parametrize("filename,actual_img_name,expect_img_name", [("SwitchButton", "开关按钮_设置字号颜色加粗斜体下划线_实际图", "开关按钮_设置字号颜色加粗斜体下划线_预期图")])
def test_SwitchButton_set_font_style(self, page, create_page, filename, actual_img_name,expect_img_name):
bp = BasePage(page)
bp._goto_url("画面")
stp = SwitchButtonPage(page)
stp.set_font_style()
time.sleep(1)
result = bp.compare_images(filename, actual_img_name, expect_img_name)
bp.allure_reports(filename, actual_img_name, expect_img_name)
assert result, f"页面截图与预期截图不一致"
@allure.story("开关按钮-文本-设置字体类型")
@pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_设置字体类型_实际图", "开关按钮_设置字体类型_预期图")])
def test_SwitchButton_set_font_type(self, page, create_page, filename, actual_img_name,expect_img_name):
bp = BasePage(page)
bp._goto_url("画面")
stp = SwitchButtonPage(page)
stp.set_font_type()
time.sleep(1)
result = bp.compare_images(filename, actual_img_name, expect_img_name)
bp.allure_reports(filename, actual_img_name, expect_img_name)
assert result, f"页面截图与预期截图不一致"
@allure.story("开关按钮-文本-设置字距行高")
@pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_设置字距行高_实际图", "开关按钮_设置字距行高_预期图")])
def test_SwitchButton_set_font_distance(self, page, create_page, filename, actual_img_name,expect_img_name):
bp = BasePage(page)
bp._goto_url("画面")
stp = SwitchButtonPage(page)
stp.set_font_distance()
time.sleep(1)
result = bp.compare_images(filename, actual_img_name, expect_img_name)
bp.allure_reports(filename, actual_img_name, expect_img_name)
assert result, f"页面截图与预期截图不一致"
@allure.story("开关按钮-切换按钮")
@pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_切换按钮_实际图", "开关按钮_切换按钮_预期图")])
def test_SwitchButton_switch_btn(self, page, create_page, filename, actual_img_name,expect_img_name):
bp = BasePage(page)
bp._goto_url("画面")
stp = SwitchButtonPage(page)
stp.test_switch_btn()
time.sleep(1)
result = bp.compare_images(filename, actual_img_name, expect_img_name)
bp.allure_reports(filename, actual_img_name, expect_img_name)
assert result, f"页面截图与预期截图不一致"
@allure.story("开关按钮-切换关状态")
@pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_切换关状态_实际图", "开关按钮_切换关状态_预期图")])
def test_SwitchButton_switch_state(self, page, create_page,write_var,filename, actual_img_name,expect_img_name):
......@@ -240,15 +240,26 @@ class Test_SwitchButton:
bp.allure_reports(filename, actual_img_name, expect_img_name)
assert result, f"页面截图与预期截图不一致"
# @allure.story("开关按钮-变量分离-切换写状态")
# @pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_变量分离-切换写状态_实际图", "开关按钮_变量分离-切换写状态_预期图")])
# def test_SwitchButton_switch_write_state(self, page, create_page, write_var,filename, actual_img_name,expect_img_name):
# bp = BasePage(page)
# bp._goto_url("画面")
# page.pause()
# stp = SwitchButtonPage(page)
# stp.test_var_split_switch_write_state()
# time.sleep(1)
# result = bp.compare_images(filename, actual_img_name, expect_img_name)
# bp.allure_reports(filename, actual_img_name, expect_img_name)
# assert result, f"页面截图与预期截图不一致"
@allure.story("开关按钮-变量分离-写入变量")
@pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_变量分离-写入变量_实际图", "开关按钮_变量分离-写入变量_预期图")])
def test_SwitchButton_switch_write_state(self, page, create_page, write_var,filename, actual_img_name,expect_img_name):
bp = BasePage(page)
bp._goto_url("画面")
stp = SwitchButtonPage(page)
stp.test_var_split_switch_write_state()
time.sleep(1)
result = bp.compare_images(filename, actual_img_name, expect_img_name)
bp.allure_reports(filename, actual_img_name, expect_img_name)
assert result, f"页面截图与预期截图不一致"
@allure.story("开关按钮-变量分离-读取变量")
@pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("SwitchButton", "开关按钮_变量分离-读取变量_实际图", "开关按钮_变量分离-读取变量_预期图")])
def test_SwitchButton_switch_read_state(self, page, create_page, write_var,filename, actual_img_name,expect_img_name):
bp = BasePage(page)
bp._goto_url("画面")
stp = SwitchButtonPage(page)
stp.test_var_split_switch_read_state()
time.sleep(1)
result = bp.compare_images(filename, actual_img_name, expect_img_name)
bp.allure_reports(filename, actual_img_name, expect_img_name)
assert result, f"页面截图与预期截图不一致"
......@@ -12,7 +12,7 @@ log_cli_date_format = %Y-%m-%d %H:%M:%S
# 配置测试搜索的路径,当前目录下的TestCases文件夹,可自定义
testpaths = ./TestCases
# 配置测试搜索的文件名,当前目录下的Testcase文件夹下,以Test_开头,以.py结尾的所有文件,可自定义
python_files = mode*.py
python_files = Test*.py
# 配置测试搜索的测试类名,当前目录下的Testcase文件夹下,以Test_开头,以.py结尾的所有文件中,以Test开头的类,可自定义
python_classes = Test*
# 配置测试搜索的测试函数名,当前目录下的Testcase文件夹下,以Test开头,以.py结尾的所有文件中,以Test_开头的类内,以test_开头的方法,可自定义
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment