修改app\test\test_login.py添加若干代码,测试bug是否修复
parent
ae6c44e942
commit
3aaaa90c6a
|
@ -59,5 +59,19 @@ def test_login():
|
||||||
|
|
||||||
driver.save_screenshot('./app/test/test_login_pic4.png')
|
driver.save_screenshot('./app/test/test_login_pic4.png')
|
||||||
assert 'EnglishPal Study Room for ' + uname in driver.title
|
assert 'EnglishPal Study Room for ' + uname in driver.title
|
||||||
|
|
||||||
|
# 测试bug是否修复
|
||||||
|
driver.get(HOME_PAGE)
|
||||||
|
elem = driver.find_element_by_link_text('登录')
|
||||||
|
elem.click()
|
||||||
|
uname = 'lanhui'
|
||||||
|
elem = driver.find_element_by_name('username')
|
||||||
|
elem.send_keys(uname)
|
||||||
|
elem = driver.find_element_by_name('password')
|
||||||
|
elem.send_keys("' or 'a'='a'or'a'='a")
|
||||||
|
elem = driver.find_element_by_xpath('//form[1]/p[3]/input[1]') # 找到登录按钮
|
||||||
|
elem.click()
|
||||||
|
driver.save_screenshot('./app/test/test_login_pic5.png')
|
||||||
|
assert '无法通过验证。' in driver.page_source
|
||||||
finally:
|
finally:
|
||||||
driver.quit()
|
driver.quit()
|
||||||
|
|
Loading…
Reference in New Issue