From fd95f6914acdb5836fc04b265b60c889068f27f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E5=B0=9A=E6=B5=B7?= <1337633392@qq.com> Date: Tue, 28 May 2024 18:11:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20app/test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/test/test_bug551_XieShangHai.py | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 app/test/test_bug551_XieShangHai.py diff --git a/app/test/test_bug551_XieShangHai.py b/app/test/test_bug551_XieShangHai.py new file mode 100644 index 0000000..b23b312 --- /dev/null +++ b/app/test/test_bug551_XieShangHai.py @@ -0,0 +1,30 @@ +from selenium.webdriver.common.action_chains import ActionChains +import time +from helper import signup + +def test_highlight(driver, URL): + try: + # 打开网页 + driver.maximize_window() + driver.get(URL) + + # 注册 + time.sleep(1) + signup(URL, driver) + time.sleep(2) + + # 选中单词(移动鼠标到起点位置、按下鼠标左键、拖动鼠标到结束位置、释放鼠标左键、执行操作链) + article = driver.find_element_by_id("article") + actions = ActionChains(driver) + actions.move_to_element(article).click_and_hold().move_by_offset(450,60).release().perform() + time.sleep(1) + + # 判断所有高亮单词是否有间隔 + highlighteds = driver.find_elements_by_class_name("highlighted") + for highlighted in highlighteds: + assert highlighted.value_of_css_property("padding") == '0px' + time.sleep(5) + finally: + # 测试结束后关闭浏览器 + driver.quit() + \ No newline at end of file