# Time    : 2024/8/22 09:13
# Author  : lxl
# File    : Test_StaticText.py
# Description : 水平菜单组件测试类
# -*- coding: utf-8 -*-

import os
import time

import allure
import pytest
from BasePage.BasePage import BasePage
from Pages.PageManagementPage.StaticTextPage import StaticTextPage


@allure.epic("CMS2.0UI自动化测试")
@allure.feature("静态文本组件")
class Test_StaticText:
	@allure.story("静态文本-创建静态文本组件")
	@pytest.mark.parametrize("filename,actual_img_name,expect_img_name",[("StaticText","静态文本_创建静态文本_实际图", "静态文本_创建静态文本_预期图")])
	def test_StaticText(self, page, create_and_destroy_page, filename, actual_img_name, expect_img_name):
		bp = BasePage(page)
		bp._goto_url("画面")
		stp = StaticTextPage(page)
		stp.create_static_text()
		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",[("StaticText","静态文本_修改xywh属性_实际图", "静态文本_修改xywh属性_预期图")])
	def test_StaticText_set_xywh_axis(self, page, create_and_destroy_page, filename, actual_img_name, expect_img_name):
		bp = BasePage(page)
		bp._goto_url("画面")
		stp = StaticTextPage(page)
		stp.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",[("StaticText","静态文本_修改旋转角度_实际图", "静态文本_修改旋转角度_预期图")])
	def test_StaticText_set_rotation_angle(self, page, create_and_destroy_page, filename, actual_img_name, expect_img_name):
		bp = BasePage(page)
		bp._goto_url("画面")
		stp = StaticTextPage(page)
		stp.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",[("StaticText","静态文本_设置锁定_实际图", "静态文本_设置锁定_预期图")])
	def test_StaticText_set_lock(self, page, create_and_destroy_page, filename, actual_img_name, expect_img_name):
		bp = BasePage(page)
		bp._goto_url("画面")
		stp = StaticTextPage(page)
		stp.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",[("StaticText","静态文本_设置纯色背景_实际图", "静态文本_设置纯色背景_预期图")])
	def test_StaticText_set_solid_color_background(self, page, create_and_destroy_page, filename, actual_img_name, expect_img_name):
		bp = BasePage(page)
		bp._goto_url("画面")
		stp = StaticTextPage(page)
		stp.set_solid_color_background()
		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", [("StaticText","静态文本_设置渐变色背景_实际图", "静态文本_设置渐变色背景_预期图")])
	def test_StaticText_set_gradient_color_background(self, page, create_and_destroy_page, filename, actual_img_name, expect_img_name):
		bp = BasePage(page)
		bp._goto_url("画面")
		stp = StaticTextPage(page)
		stp.set_gradient_color_background()
		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",[("StaticText", "静态文本_设置图片背景_拉伸类型_实际图", "静态文本_设置图片背景_拉伸类型_预期图")])
	def test_StaticText_set_stretch_type_image_background(self, page, create_and_destroy_page, filename, actual_img_name, expect_img_name):
		bp = BasePage(page)
		bp._goto_url("画面")
		stp = StaticTextPage(page)
		stp.set_stretch_type_image_background()
		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",
							 [("StaticText", "静态文本_设置图片背景_自适应类型_实际图", "静态文本_设置图片背景_自适应类型_预期图")])
	def test_StaticText_set_adapt_type_image_background(self, page, create_and_destroy_page, filename, actual_img_name, expect_img_name):
		bp = BasePage(page)
		bp._goto_url("画面")
		stp = StaticTextPage(page)
		stp.set_adapt_type_image_background()
		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",[("StaticText", "静态文本_设置图片背景_覆盖类型_实际图", "静态文本_设置图片背景_覆盖类型_预期图")])
	def test_StaticText_set_cover_type_image_background(self, page, create_and_destroy_page, filename, actual_img_name, expect_img_name):
		bp = BasePage(page)
		bp._goto_url("画面")
		stp = StaticTextPage(page)
		stp.set_cover_type_image_background()
		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",[("StaticText", "静态文本_设置图片背景_实际大小类型_实际图", "静态文本_设置图片背景_实际大小类型_预期图")])
	def test_StaticText_set_actual_type_image_background(self, page, create_and_destroy_page, filename, actual_img_name, expect_img_name):
		bp = BasePage(page)
		bp._goto_url("画面")
		stp = StaticTextPage(page)
		stp.set_actual_type_image_background()
		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", [("StaticText", "静态文本_设置直线边框_实际图", "静态文本_设置直线边框_预期图")])
	def test_StaticText_set_straight_line_frame(self, page, create_and_destroy_page, filename, actual_img_name, expect_img_name):
		bp = BasePage(page)
		bp._goto_url("画面")
		stp = StaticTextPage(page)
		stp.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",[("StaticText","静态文本_设置虚线边框_实际图", "静态文本_设置虚线边框_预期图")])
	def test_StaticText_set_dashed_line_frame(self, page, create_and_destroy_page, filename, actual_img_name, expect_img_name):
		bp = BasePage(page)
		bp._goto_url("画面")
		stp = StaticTextPage(page)
		stp.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",[("StaticText","静态文本_设置圆点边框_实际图", "静态文本_设置圆点边框_预期图")])
	def test_StaticText_set_scircular_dots_frame(self, page, create_and_destroy_page, filename, actual_img_name, expect_img_name):
		bp = BasePage(page)
		bp._goto_url("画面")
		stp = StaticTextPage(page)
		stp.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",[("StaticText","静态文本_设置无边框_实际图", "静态文本_设置无边框_预期图")])
	def test_StaticText_set_no_frame(self, page, create_and_destroy_page, filename, actual_img_name, expect_img_name):
		bp = BasePage(page)
		bp._goto_url("画面")
		stp = StaticTextPage(page)
		stp.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",[("StaticText","静态文本_设置内外阴影_实际图", "静态文本_设置内外阴影_预期图")])
	def test_StaticText_set_shadow(self, page, create_and_destroy_page, filename, actual_img_name, expect_img_name):
		bp = BasePage(page)
		bp._goto_url("画面")
		stp = StaticTextPage(page)
		stp.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",[("StaticText","静态文本_设置圆角_实际图", "静态文本_设置圆角_预期图")])
	def test_StaticText_set_rounded_corners(self, page, create_and_destroy_page, filename, actual_img_name, expect_img_name):
		bp = BasePage(page)
		bp._goto_url("画面")
		stp = StaticTextPage(page)
		stp.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",[("StaticText","静态文本_设置不透明度_实际图", "静态文本_设置不透明度_预期图")])
	def test_StaticText_set_opacity(self, page, create_and_destroy_page, filename, actual_img_name, expect_img_name):
		bp = BasePage(page)
		bp._goto_url("画面")
		stp = StaticTextPage(page)
		stp.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",[("StaticText","静态文本_设置不透明度_实际图", "静态文本_设置不透明度_预期图")])
	def test_StaticText_set_opacity(self, page, create_and_destroy_page, filename, actual_img_name, expect_img_name):
		bp = BasePage(page)
		bp._goto_url("画面")
		stp = StaticTextPage(page)
		stp.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",[("StaticText","静态文本_设置左对齐_实际图", "静态文本_设置左对齐_预期图")])
	def test_StaticText_set_left_aligned(self, page, create_and_destroy_page, filename, actual_img_name, expect_img_name):
		bp = BasePage(page)
		bp._goto_url("画面")
		stp = StaticTextPage(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",[("StaticText","静态文本_设置居中对齐_实际图", "静态文本_设置居中对齐_预期图")])
	def test_StaticText_set_center_aligned(self, page, create_and_destroy_page, filename, actual_img_name, expect_img_name):
		bp = BasePage(page)
		bp._goto_url("画面")
		stp = StaticTextPage(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",[("StaticText","静态文本_设置右对齐_实际图", "静态文本_设置右对齐_预期图")])
	def test_StaticText_set_right_aligned(self, page, create_and_destroy_page, filename, actual_img_name, expect_img_name):
		bp = BasePage(page)
		bp._goto_url("画面")
		stp = StaticTextPage(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",[("StaticText","静态文本_设置字号颜色加粗斜体下划线_实际图", "静态文本_设置字号颜色加粗斜体下划线_预期图")])
	def test_StaticText_set_font_style(self, page, create_and_destroy_page, filename, actual_img_name, expect_img_name):
		bp = BasePage(page)
		bp._goto_url("画面")
		stp = StaticTextPage(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",[("StaticText","静态文本_设置字体类型_实际图", "静态文本_设置字体类型_预期图")])
	def test_StaticText_set_font_type(self, page, create_and_destroy_page, filename, actual_img_name, expect_img_name):
		bp = BasePage(page)
		bp._goto_url("画面")
		stp = StaticTextPage(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",[("StaticText","静态文本_设置字距行高_实际图", "静态文本_设置字距行高_预期图")])
	def test_StaticText_set_font_distance(self, page, create_and_destroy_page, filename, actual_img_name, expect_img_name):
		bp = BasePage(page)
		bp._goto_url("画面")
		stp = StaticTextPage(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"页面截图与预期截图不一致"







