From 4120e7e54bf901e4fc062a04414be3cfcec5223b Mon Sep 17 00:00:00 2001 From: dingchengye Date: Fri, 19 Apr 2024 10:06:48 +0800 Subject: [PATCH 01/21] Fix bug 551 --- EnglishPal | 1 + 1 file changed, 1 insertion(+) create mode 160000 EnglishPal diff --git a/EnglishPal b/EnglishPal new file mode 160000 index 0000000..e8fbccd --- /dev/null +++ b/EnglishPal @@ -0,0 +1 @@ +Subproject commit e8fbccdcf7f644ecc7fccc272408281027c3c758 From b8222c951b711a3456e9e532005072415acbee85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=81=E6=99=9F=E6=99=94?= <759539128@qq.com> Date: Fri, 19 Apr 2024 10:49:41 +0800 Subject: [PATCH 02/21] revert 4120e7e54bf901e4fc062a04414be3cfcec5223b revert Fix bug 551 --- EnglishPal | 1 - 1 file changed, 1 deletion(-) delete mode 160000 EnglishPal diff --git a/EnglishPal b/EnglishPal deleted file mode 160000 index e8fbccd..0000000 --- a/EnglishPal +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e8fbccdcf7f644ecc7fccc272408281027c3c758 From d5c76674dab8fc68523c2fb07424078a6736522d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=81=E6=99=9F=E6=99=94?= <759539128@qq.com> Date: Fri, 19 Apr 2024 10:50:43 +0800 Subject: [PATCH 03/21] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20app/static/css/boots?= =?UTF-8?q?trap.css?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/css/bootstrap.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/static/css/bootstrap.css b/app/static/css/bootstrap.css index cd8af32..d22c7d1 100644 --- a/app/static/css/bootstrap.css +++ b/app/static/css/bootstrap.css @@ -178,6 +178,11 @@ b, strong { background-color: #FFFF00 } +.highlighted { + color: red; + font-weight: normal; +} + sub, sup { position: relative; font-size: .75em; From 393264a6fecb4fa0f6d32df02735d5d0d4bd9b25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=81=E6=99=9F=E6=99=94?= <759539128@qq.com> Date: Fri, 19 Apr 2024 10:51:18 +0800 Subject: [PATCH 04/21] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20app/static/js/highli?= =?UTF-8?q?ght.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/js/highlight.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/static/js/highlight.js b/app/static/js/highlight.js index 76b4793..2ea9664 100644 --- a/app/static/js/highlight.js +++ b/app/static/js/highlight.js @@ -43,11 +43,12 @@ function highLight() { // 删除所有的mark标签,防止标签发生嵌套 articleContent = articleContent.replace(/<(mark)[^>]*>/gi, ""); articleContent = articleContent.replace(/<(\/mark)[^>]*>/gi, ""); - // 将文章中所有出现该单词word的地方改为:"" + word + ""。 + // 将文章中所有出现该单词word的地方改为:"" + word + ""。 for (let word of totalSet) { - articleContent = articleContent.replace(new RegExp("\\b" + word + "\\b", "g"), "" + word + ""); + articleContent = articleContent.replace(new RegExp("\\b" + word + "\\b", "g"), "" + word + ""); } document.getElementById("article").innerHTML = articleContent; + } function cancelHighlighting() { From 66f5c28eada669e63b4a636039449a980b29605d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=81=E6=99=9F=E6=99=94?= <759539128@qq.com> Date: Mon, 6 May 2024 11:46:15 +0800 Subject: [PATCH 05/21] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=87=B3=20app/test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/test/test_bug551_DingZeYu.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 app/test/test_bug551_DingZeYu.py diff --git a/app/test/test_bug551_DingZeYu.py b/app/test/test_bug551_DingZeYu.py new file mode 100644 index 0000000..799a562 --- /dev/null +++ b/app/test/test_bug551_DingZeYu.py @@ -0,0 +1,26 @@ +import time +import pytest +from selenium import webdriver +from selenium.webdriver import ActionChains +from selenium.webdriver.common.by import By + + +def test_bug551(): + driver = webdriver.Edge() + driver.maximize_window() + driver.get("http://127.0.0.1:5000/") + + driver.find_element(By.CSS_SELECTOR, 'a[href="/login"]').click() + driver.find_element(By.CLASS_NAME, 'username').send_keys('dzy') + driver.find_element(By.CLASS_NAME, 'password').send_keys('123456') + driver.find_element(By.CLASS_NAME, 'btn').click() + + article = driver.find_element(By.ID, 'article') + actions = ActionChains(driver) + + actions.move_to_element(article) + actions.click_and_hold() + actions.move_by_offset(450, 200) + actions.release() + actions.perform() + time.sleep(5) From 416f40222e7e00d9120ed92dbd8cb63c4f21e176 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=81=E6=99=9F=E6=99=94?= <759539128@qq.com> Date: Mon, 6 May 2024 11:46:39 +0800 Subject: [PATCH 06/21] =?UTF-8?q?=E5=88=A0=E9=99=A4=20app/test/test=5Fbug5?= =?UTF-8?q?51=5FDingZeYu.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/test/test_bug551_DingZeYu.py | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 app/test/test_bug551_DingZeYu.py diff --git a/app/test/test_bug551_DingZeYu.py b/app/test/test_bug551_DingZeYu.py deleted file mode 100644 index 799a562..0000000 --- a/app/test/test_bug551_DingZeYu.py +++ /dev/null @@ -1,26 +0,0 @@ -import time -import pytest -from selenium import webdriver -from selenium.webdriver import ActionChains -from selenium.webdriver.common.by import By - - -def test_bug551(): - driver = webdriver.Edge() - driver.maximize_window() - driver.get("http://127.0.0.1:5000/") - - driver.find_element(By.CSS_SELECTOR, 'a[href="/login"]').click() - driver.find_element(By.CLASS_NAME, 'username').send_keys('dzy') - driver.find_element(By.CLASS_NAME, 'password').send_keys('123456') - driver.find_element(By.CLASS_NAME, 'btn').click() - - article = driver.find_element(By.ID, 'article') - actions = ActionChains(driver) - - actions.move_to_element(article) - actions.click_and_hold() - actions.move_by_offset(450, 200) - actions.release() - actions.perform() - time.sleep(5) From 6ee94d1610c7cac9f75b3082c9359a5990b8d3d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=81=E6=99=9F=E6=99=94?= <759539128@qq.com> Date: Mon, 6 May 2024 11:48:19 +0800 Subject: [PATCH 07/21] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=87=B3=20app/test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/test/test_bug551_DingZeYu.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 app/test/test_bug551_DingZeYu.py diff --git a/app/test/test_bug551_DingZeYu.py b/app/test/test_bug551_DingZeYu.py new file mode 100644 index 0000000..799a562 --- /dev/null +++ b/app/test/test_bug551_DingZeYu.py @@ -0,0 +1,26 @@ +import time +import pytest +from selenium import webdriver +from selenium.webdriver import ActionChains +from selenium.webdriver.common.by import By + + +def test_bug551(): + driver = webdriver.Edge() + driver.maximize_window() + driver.get("http://127.0.0.1:5000/") + + driver.find_element(By.CSS_SELECTOR, 'a[href="/login"]').click() + driver.find_element(By.CLASS_NAME, 'username').send_keys('dzy') + driver.find_element(By.CLASS_NAME, 'password').send_keys('123456') + driver.find_element(By.CLASS_NAME, 'btn').click() + + article = driver.find_element(By.ID, 'article') + actions = ActionChains(driver) + + actions.move_to_element(article) + actions.click_and_hold() + actions.move_by_offset(450, 200) + actions.release() + actions.perform() + time.sleep(5) From 23f0dfd8cace7335de4656cfd5c766e153328f3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=81=E6=99=9F=E6=99=94?= <759539128@qq.com> Date: Sun, 12 May 2024 13:39:14 +0800 Subject: [PATCH 08/21] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20app/test/test=5Fbug5?= =?UTF-8?q?51=5FDingZeYu.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 我这边好像没有helper文件所以我直接判断有没有这个账号,如果没有就注册一个来进行测试。这样子可以吗 --- app/test/test_bug551_DingZeYu.py | 69 ++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 26 deletions(-) diff --git a/app/test/test_bug551_DingZeYu.py b/app/test/test_bug551_DingZeYu.py index 799a562..2641373 100644 --- a/app/test/test_bug551_DingZeYu.py +++ b/app/test/test_bug551_DingZeYu.py @@ -1,26 +1,43 @@ -import time -import pytest -from selenium import webdriver -from selenium.webdriver import ActionChains -from selenium.webdriver.common.by import By - - -def test_bug551(): - driver = webdriver.Edge() - driver.maximize_window() - driver.get("http://127.0.0.1:5000/") - - driver.find_element(By.CSS_SELECTOR, 'a[href="/login"]').click() - driver.find_element(By.CLASS_NAME, 'username').send_keys('dzy') - driver.find_element(By.CLASS_NAME, 'password').send_keys('123456') - driver.find_element(By.CLASS_NAME, 'btn').click() - - article = driver.find_element(By.ID, 'article') - actions = ActionChains(driver) - - actions.move_to_element(article) - actions.click_and_hold() - actions.move_by_offset(450, 200) - actions.release() - actions.perform() - time.sleep(5) +import time +import pytest +from selenium import webdriver +from selenium.webdriver import ActionChains +from selenium.webdriver.common.by import By +from selenium.webdriver.common.alert import Alert +from selenium.webdriver.support import expected_conditions as EC +from selenium.webdriver.support.wait import WebDriverWait + + +def test_bug551(): + driver = webdriver.Edge() + driver.maximize_window() + driver.get("http://127.0.0.1:5000/") + + driver.find_element(By.CSS_SELECTOR, 'a[href="/login"]').click() + driver.find_element(By.ID, 'username').send_keys('dzy') + driver.find_element(By.ID, 'password').send_keys('123456') + driver.find_element(By.CLASS_NAME, 'btn').click() + + try: + alert = WebDriverWait(driver, 10).until(EC.alert_is_present()) + alert.accept() + driver.find_element(By.CSS_SELECTOR, 'a[href="/signup"]').click() + driver.find_element(By.ID, 'username').send_keys('dzy') + driver.find_element(By.ID, 'password').send_keys('123456') + driver.find_element(By.ID, 'password2').send_keys('123456') + driver.find_element(By.CLASS_NAME, 'btn').click() + alert = WebDriverWait(driver, 10).until(EC.alert_is_present()) + alert.accept() + + except: + pass + + article = driver.find_element(By.ID, 'article') + actions = ActionChains(driver) + + actions.move_to_element(article) + actions.click_and_hold() + actions.move_by_offset(450, 200) + actions.release() + actions.perform() + time.sleep(5) From aca827a912104578ea8c7c25e715cc6d392a0936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=81=E6=99=9F=E6=99=94?= <759539128@qq.com> Date: Tue, 14 May 2024 23:24:06 +0800 Subject: [PATCH 09/21] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20app/static/css/boots?= =?UTF-8?q?trap.css?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/css/bootstrap.css | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/static/css/bootstrap.css b/app/static/css/bootstrap.css index d22c7d1..cab46ca 100644 --- a/app/static/css/bootstrap.css +++ b/app/static/css/bootstrap.css @@ -178,10 +178,7 @@ b, strong { background-color: #FFFF00 } -.highlighted { - color: red; - font-weight: normal; -} + sub, sup { position: relative; From b9d0ad4a150e901ec81658c257d73845f0600c85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=81=E6=99=9F=E6=99=94?= <759539128@qq.com> Date: Tue, 14 May 2024 23:24:26 +0800 Subject: [PATCH 10/21] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=87=B3=20app/static/css?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/css/highlighted.css | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 app/static/css/highlighted.css diff --git a/app/static/css/highlighted.css b/app/static/css/highlighted.css new file mode 100644 index 0000000..167f595 --- /dev/null +++ b/app/static/css/highlighted.css @@ -0,0 +1,5 @@ + +.highlighted { + color: red; + font-weight: normal; +} \ No newline at end of file From b19eabd225acb325738353a1dee3d84d670aa46d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=81=E6=99=9F=E6=99=94?= <759539128@qq.com> Date: Tue, 14 May 2024 23:26:11 +0800 Subject: [PATCH 11/21] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20app/static/config.ym?= =?UTF-8?q?l?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/static/config.yml b/app/static/config.yml index 173bc6b..7e681fe 100644 --- a/app/static/config.yml +++ b/app/static/config.yml @@ -2,7 +2,7 @@ css: item: - ../static/css/bootstrap.css - + - ../static/css/highlighted.css # 全局引入的js文件地址 js: head: # 在页面加载之前加载 From 77ed63441badd2e4b0d2ecd32814d91359ffd820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=81=E6=99=9F=E6=99=94?= <759539128@qq.com> Date: Tue, 14 May 2024 23:26:53 +0800 Subject: [PATCH 12/21] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20app/static/css/boots?= =?UTF-8?q?trap.css?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/css/bootstrap.css | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/static/css/bootstrap.css b/app/static/css/bootstrap.css index cab46ca..cd8af32 100644 --- a/app/static/css/bootstrap.css +++ b/app/static/css/bootstrap.css @@ -178,8 +178,6 @@ b, strong { background-color: #FFFF00 } - - sub, sup { position: relative; font-size: .75em; From 58573952510cdca706d7ab9f4e8c86e4325a614a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=81=E6=99=9F=E6=99=94?= <759539128@qq.com> Date: Sat, 18 May 2024 09:08:10 +0800 Subject: [PATCH 13/21] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20app/test/test=5Fbug5?= =?UTF-8?q?51=5FDingZeYu.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/test/test_bug551_DingZeYu.py | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/app/test/test_bug551_DingZeYu.py b/app/test/test_bug551_DingZeYu.py index 2641373..8fed439 100644 --- a/app/test/test_bug551_DingZeYu.py +++ b/app/test/test_bug551_DingZeYu.py @@ -6,31 +6,14 @@ from selenium.webdriver.common.by import By from selenium.webdriver.common.alert import Alert from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.wait import WebDriverWait - +from helper import signup def test_bug551(): driver = webdriver.Edge() driver.maximize_window() driver.get("http://127.0.0.1:5000/") - driver.find_element(By.CSS_SELECTOR, 'a[href="/login"]').click() - driver.find_element(By.ID, 'username').send_keys('dzy') - driver.find_element(By.ID, 'password').send_keys('123456') - driver.find_element(By.CLASS_NAME, 'btn').click() - - try: - alert = WebDriverWait(driver, 10).until(EC.alert_is_present()) - alert.accept() - driver.find_element(By.CSS_SELECTOR, 'a[href="/signup"]').click() - driver.find_element(By.ID, 'username').send_keys('dzy') - driver.find_element(By.ID, 'password').send_keys('123456') - driver.find_element(By.ID, 'password2').send_keys('123456') - driver.find_element(By.CLASS_NAME, 'btn').click() - alert = WebDriverWait(driver, 10).until(EC.alert_is_present()) - alert.accept() - - except: - pass + username, password = signup(URL, driver) article = driver.find_element(By.ID, 'article') actions = ActionChains(driver) From 0301c39cf0fa899674e22a15d2a5fe301d109cc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=81=E6=99=9F=E6=99=94?= <759539128@qq.com> Date: Sat, 18 May 2024 09:14:05 +0800 Subject: [PATCH 14/21] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20app/test/test=5Fbug5?= =?UTF-8?q?51=5FDingZeYu.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/test/test_bug551_DingZeYu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test/test_bug551_DingZeYu.py b/app/test/test_bug551_DingZeYu.py index 8fed439..42df637 100644 --- a/app/test/test_bug551_DingZeYu.py +++ b/app/test/test_bug551_DingZeYu.py @@ -13,7 +13,7 @@ def test_bug551(): driver.maximize_window() driver.get("http://127.0.0.1:5000/") - username, password = signup(URL, driver) + username, password = signup("http://127.0.0.1:5000/", driver) article = driver.find_element(By.ID, 'article') actions = ActionChains(driver) From b2a53a0e407421cc5ff3b39a4f08faa53b79a9c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=81=E6=99=9F=E6=99=94?= <759539128@qq.com> Date: Sat, 18 May 2024 09:18:22 +0800 Subject: [PATCH 15/21] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20app/test/test=5Fbug5?= =?UTF-8?q?51=5FDingZeYu.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/test/test_bug551_DingZeYu.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/app/test/test_bug551_DingZeYu.py b/app/test/test_bug551_DingZeYu.py index 42df637..05fedcc 100644 --- a/app/test/test_bug551_DingZeYu.py +++ b/app/test/test_bug551_DingZeYu.py @@ -6,14 +6,31 @@ from selenium.webdriver.common.by import By from selenium.webdriver.common.alert import Alert from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.wait import WebDriverWait -from helper import signup + def test_bug551(): driver = webdriver.Edge() driver.maximize_window() driver.get("http://127.0.0.1:5000/") - username, password = signup("http://127.0.0.1:5000/", driver) + driver.find_element(By.CSS_SELECTOR, 'a[href="/login"]').click() + driver.find_element(By.ID, 'username').send_keys('dzy') + driver.find_element(By.ID, 'password').send_keys('123456') + driver.find_element(By.CLASS_NAME, 'btn').click() + + try: + alert = WebDriverWait(driver, 10).until(EC.alert_is_present()) + alert.accept() + driver.find_element(By.CSS_SELECTOR, 'a[href="/signup"]').click() + driver.find_element(By.ID, 'username').send_keys('dzy') + driver.find_element(By.ID, 'password').send_keys('123456') + driver.find_element(By.ID, 'password2').send_keys('123456') + driver.find_element(By.CLASS_NAME, 'btn').click() + alert = WebDriverWait(driver, 10).until(EC.alert_is_present()) + alert.accept() + + except: + pass article = driver.find_element(By.ID, 'article') actions = ActionChains(driver) @@ -23,4 +40,4 @@ def test_bug551(): actions.move_by_offset(450, 200) actions.release() actions.perform() - time.sleep(5) + time.sleep(5) \ No newline at end of file From 7fe3feae9aa54f22536dc15400c1061dffe4ab94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=81=E6=99=9F=E6=99=94?= <759539128@qq.com> Date: Sat, 18 May 2024 09:23:36 +0800 Subject: [PATCH 16/21] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20app/test/test=5Fbug5?= =?UTF-8?q?51=5FDingZeYu.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/test/test_bug551_DingZeYu.py | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/app/test/test_bug551_DingZeYu.py b/app/test/test_bug551_DingZeYu.py index 05fedcc..9fdb24f 100644 --- a/app/test/test_bug551_DingZeYu.py +++ b/app/test/test_bug551_DingZeYu.py @@ -6,31 +6,14 @@ from selenium.webdriver.common.by import By from selenium.webdriver.common.alert import Alert from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.wait import WebDriverWait - +from helper import signup def test_bug551(): driver = webdriver.Edge() driver.maximize_window() driver.get("http://127.0.0.1:5000/") - driver.find_element(By.CSS_SELECTOR, 'a[href="/login"]').click() - driver.find_element(By.ID, 'username').send_keys('dzy') - driver.find_element(By.ID, 'password').send_keys('123456') - driver.find_element(By.CLASS_NAME, 'btn').click() - - try: - alert = WebDriverWait(driver, 10).until(EC.alert_is_present()) - alert.accept() - driver.find_element(By.CSS_SELECTOR, 'a[href="/signup"]').click() - driver.find_element(By.ID, 'username').send_keys('dzy') - driver.find_element(By.ID, 'password').send_keys('123456') - driver.find_element(By.ID, 'password2').send_keys('123456') - driver.find_element(By.CLASS_NAME, 'btn').click() - alert = WebDriverWait(driver, 10).until(EC.alert_is_present()) - alert.accept() - - except: - pass + username, password = signup("http://127.0.0.1:5000/", driver) article = driver.find_element(By.ID, 'article') actions = ActionChains(driver) From 9f6a0074264a476c66f65e9df66e7e96f552901d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=81=E6=99=9F=E6=99=94?= <759539128@qq.com> Date: Sun, 19 May 2024 21:21:25 +0800 Subject: [PATCH 17/21] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20app/test/test=5Fbug5?= =?UTF-8?q?51=5FDingZeYu.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/test/test_bug551_DingZeYu.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/test/test_bug551_DingZeYu.py b/app/test/test_bug551_DingZeYu.py index 9fdb24f..7351dfe 100644 --- a/app/test/test_bug551_DingZeYu.py +++ b/app/test/test_bug551_DingZeYu.py @@ -8,12 +8,11 @@ from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.wait import WebDriverWait from helper import signup -def test_bug551(): - driver = webdriver.Edge() +def test_bug551(driver, URL): driver.maximize_window() - driver.get("http://127.0.0.1:5000/") + driver.get(URL) - username, password = signup("http://127.0.0.1:5000/", driver) + username, password = signup(URL, driver) article = driver.find_element(By.ID, 'article') actions = ActionChains(driver) From d97743649aa38ddf19df282fafb4d5f7cafa96ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=81=E6=99=9F=E6=99=94?= <759539128@qq.com> Date: Sun, 19 May 2024 22:51:32 +0800 Subject: [PATCH 18/21] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20app/test/test=5Fbug5?= =?UTF-8?q?51=5FDingZeYu.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/test/test_bug551_DingZeYu.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/test/test_bug551_DingZeYu.py b/app/test/test_bug551_DingZeYu.py index 7351dfe..7c254c5 100644 --- a/app/test/test_bug551_DingZeYu.py +++ b/app/test/test_bug551_DingZeYu.py @@ -22,4 +22,12 @@ def test_bug551(driver, URL): actions.move_by_offset(450, 200) actions.release() actions.perform() + + # 获取选中部分的单词所应用的 CSS 样式 + highlighted_word_font_weight = article.value_of_css_property("font-weight") + + # 验证高亮显示的 CSS 样式是否符合预期 + expected_highlighted_word_font_weight = "300" + assert highlighted_word_font_weight == expected_highlighted_word_font_weight, f"选中部分的单词的字体样式错误" + time.sleep(5) \ No newline at end of file From 9afd38a09a2a6ce01e378f97f0ca6b76808390a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=81=E6=99=9F=E6=99=94?= <759539128@qq.com> Date: Mon, 20 May 2024 08:21:02 +0800 Subject: [PATCH 19/21] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20app/test/test=5Fbug5?= =?UTF-8?q?51=5FDingZeYu.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/test/test_bug551_DingZeYu.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/test/test_bug551_DingZeYu.py b/app/test/test_bug551_DingZeYu.py index 7c254c5..b4e292a 100644 --- a/app/test/test_bug551_DingZeYu.py +++ b/app/test/test_bug551_DingZeYu.py @@ -23,11 +23,14 @@ def test_bug551(driver, URL): actions.release() actions.perform() - # 获取选中部分的单词所应用的 CSS 样式 - highlighted_word_font_weight = article.value_of_css_property("font-weight") - - # 验证高亮显示的 CSS 样式是否符合预期 - expected_highlighted_word_font_weight = "300" - assert highlighted_word_font_weight == expected_highlighted_word_font_weight, f"选中部分的单词的字体样式错误" + # 获取选中部分的单词的HTML元素 + highlighted_words = driver.find_elements(By.CLASS_NAME, 'highlighted') + + # 验证选中部分的单词是否同时应用了需求样式 + expected_font_weight = "400" + + for word in highlighted_words: + font_weight = word.value_of_css_property("font-weight") + assert font_weight == expected_font_weight, f"选中部分的单词的字体样式错误" time.sleep(5) \ No newline at end of file From 49ead93bcb5cd11a41556f8acf772b3f7ffd68c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=81=E6=99=9F=E6=99=94?= <759539128@qq.com> Date: Mon, 20 May 2024 08:24:36 +0800 Subject: [PATCH 20/21] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20app/test/test=5Fbug5?= =?UTF-8?q?51=5FDingZeYu.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/test/test_bug551_DingZeYu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test/test_bug551_DingZeYu.py b/app/test/test_bug551_DingZeYu.py index b4e292a..cc44fd2 100644 --- a/app/test/test_bug551_DingZeYu.py +++ b/app/test/test_bug551_DingZeYu.py @@ -23,7 +23,7 @@ def test_bug551(driver, URL): actions.release() actions.perform() - # 获取选中部分的单词的HTML元素 + # 获取选中高亮部分的单词的元素 highlighted_words = driver.find_elements(By.CLASS_NAME, 'highlighted') # 验证选中部分的单词是否同时应用了需求样式 From a4db1edffbac5f64a49eb299c517cf8d70792caf Mon Sep 17 00:00:00 2001 From: Lan Hui <1348141770@qq.com> Date: Mon, 20 May 2024 13:28:23 +0800 Subject: [PATCH 21/21] Close the web browswer after finishing each test case --- app/test/test_bug551_DingZeYu.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/test/test_bug551_DingZeYu.py b/app/test/test_bug551_DingZeYu.py index cc44fd2..015fb5a 100644 --- a/app/test/test_bug551_DingZeYu.py +++ b/app/test/test_bug551_DingZeYu.py @@ -33,4 +33,5 @@ def test_bug551(driver, URL): font_weight = word.value_of_css_property("font-weight") assert font_weight == expected_font_weight, f"选中部分的单词的字体样式错误" - time.sleep(5) \ No newline at end of file + time.sleep(5) + driver.quit()