From a8faa5076643107d4fa8ab408c251a43874a245b Mon Sep 17 00:00:00 2001
From: Hui Lan <lanhui@zjnu.edu.cn>
Date: Mon, 8 Feb 2021 21:37:45 +0800
Subject: app/test/test_add_word.py: select a word that does not have
 punctuation.

---
 app/test/test_add_word.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/app/test/test_add_word.py b/app/test/test_add_word.py
index 0d5356a..4ff5a75 100644
--- a/app/test/test_add_word.py
+++ b/app/test/test_add_word.py
@@ -5,13 +5,16 @@ from selenium import webdriver
 from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
 
 import random, time
+import string
 
 driver = webdriver.Remote('http://localhost:4444/wd/hub', DesiredCapabilities.CHROME)
 
 HOME_PAGE = 'http://121.4.94.30:91/'
 
 
-
+def has_punctuation(s):
+    return [c for c in s if c in string.punctuation] != []
+    
 def test_add_word():
     driver.get(HOME_PAGE)
     assert 'English Pal -' in driver.page_source
@@ -41,7 +44,7 @@ def test_add_word():
     # click Next
     elem = driver.find_element_by_id('selected-words')
     word = random.choice(essay_content.split())
-    while 'font>' in word or 'br>' in word or 'p>' in word or len(word) < 5:
+    while 'font>' in word or 'br>' in word or 'p>' in word or len(word) < 5 or has_punctuation(word):
         word = random.choice(essay_content.split())        
     elem.send_keys(word)
     driver.save_screenshot('./app/test/test_add_word_pic1.png')        
-- 
cgit v1.2.1