更新 app/test/test_bug551_DingZeYu.py
我这边好像没有helper文件所以我直接判断有没有这个账号,如果没有就注册一个来进行测试。这样子可以吗Bug551-DingZeYu
parent
6ee94d1610
commit
23f0dfd8ca
|
@ -1,26 +1,43 @@
|
||||||
import time
|
import time
|
||||||
import pytest
|
import pytest
|
||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
from selenium.webdriver import ActionChains
|
from selenium.webdriver import ActionChains
|
||||||
from selenium.webdriver.common.by import By
|
from selenium.webdriver.common.by import By
|
||||||
|
from selenium.webdriver.common.alert import Alert
|
||||||
|
from selenium.webdriver.support import expected_conditions as EC
|
||||||
def test_bug551():
|
from selenium.webdriver.support.wait import WebDriverWait
|
||||||
driver = webdriver.Edge()
|
|
||||||
driver.maximize_window()
|
|
||||||
driver.get("http://127.0.0.1:5000/")
|
def test_bug551():
|
||||||
|
driver = webdriver.Edge()
|
||||||
driver.find_element(By.CSS_SELECTOR, 'a[href="/login"]').click()
|
driver.maximize_window()
|
||||||
driver.find_element(By.CLASS_NAME, 'username').send_keys('dzy')
|
driver.get("http://127.0.0.1:5000/")
|
||||||
driver.find_element(By.CLASS_NAME, 'password').send_keys('123456')
|
|
||||||
driver.find_element(By.CLASS_NAME, 'btn').click()
|
driver.find_element(By.CSS_SELECTOR, 'a[href="/login"]').click()
|
||||||
|
driver.find_element(By.ID, 'username').send_keys('dzy')
|
||||||
article = driver.find_element(By.ID, 'article')
|
driver.find_element(By.ID, 'password').send_keys('123456')
|
||||||
actions = ActionChains(driver)
|
driver.find_element(By.CLASS_NAME, 'btn').click()
|
||||||
|
|
||||||
actions.move_to_element(article)
|
try:
|
||||||
actions.click_and_hold()
|
alert = WebDriverWait(driver, 10).until(EC.alert_is_present())
|
||||||
actions.move_by_offset(450, 200)
|
alert.accept()
|
||||||
actions.release()
|
driver.find_element(By.CSS_SELECTOR, 'a[href="/signup"]').click()
|
||||||
actions.perform()
|
driver.find_element(By.ID, 'username').send_keys('dzy')
|
||||||
time.sleep(5)
|
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)
|
||||||
|
|
Loading…
Reference in New Issue